esoftplay-event 0.0.2-s → 0.0.2-u

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,6 @@
2
2
  import { EventButton } from 'esoftplay/cache/event/button/import';
3
3
  import { EventHeader } from 'esoftplay/cache/event/header/import';
4
4
  import { EventOrder_itemProperty } from 'esoftplay/cache/event/order_item/import';
5
- import { EventReviewProperty } from 'esoftplay/cache/event/review/import';
6
5
  import { EventReview_addProperty } from 'esoftplay/cache/event/review_add/import';
7
6
  import { LibCarrousel_snap } from 'esoftplay/cache/lib/carrousel_snap/import';
8
7
  import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
@@ -16,7 +15,6 @@ import { LibStyle } from 'esoftplay/cache/lib/style/import';
16
15
  import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
17
16
  import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
18
17
  import { LibUtils } from 'esoftplay/cache/lib/utils/import';
19
- import { UserClass } from 'esoftplay/cache/user/class/import';
20
18
 
21
19
  import { applyStyle } from 'esoftplay';
22
20
  import { EventAlert } from 'esoftplay/cache/event/alert/import';
@@ -24,14 +22,16 @@ import { EventButton_order_detail } from 'esoftplay/cache/event/button_order_det
24
22
  import { EventConfigProperty } from 'esoftplay/cache/event/config/import';
25
23
  import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
26
24
  import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
27
- import { EventMessage } from 'esoftplay/cache/event/message/import';
28
- import { EventPopup } from 'esoftplay/cache/event/popup/import';
25
+ import { EventOrder_detail_addons } from 'esoftplay/cache/event/order_detail_addons/import';
26
+ import { EventOrder_detail_addons_booked } from 'esoftplay/cache/event/order_detail_addons_booked/import';
27
+ import { EventOrder_detail_coupon } from 'esoftplay/cache/event/order_detail_coupon/import';
28
+ import { EventOrder_detail_instruction } from 'esoftplay/cache/event/order_detail_instruction/import';
29
+ import { EventOrder_detail_reschedule } from 'esoftplay/cache/event/order_detail_reschedule/import';
30
+ import { EventOrder_detail_review } from 'esoftplay/cache/event/order_detail_review/import';
31
+ import { EventOrder_detail_tnc } from 'esoftplay/cache/event/order_detail_tnc/import';
29
32
  import { EventQr_bg } from 'esoftplay/cache/event/qr_bg/import';
30
- import { EventRating } from 'esoftplay/cache/event/rating/import';
31
33
  import { EventSecure_page } from 'esoftplay/cache/event/secure_page/import';
32
- import { EventStep } from 'esoftplay/cache/event/step/import';
33
34
  import { LibCollaps } from 'esoftplay/cache/lib/collaps/import';
34
- import { LibCurl_view } from 'esoftplay/cache/lib/curl_view/import';
35
35
  import { LibObject } from 'esoftplay/cache/lib/object/import';
36
36
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
37
37
  import { UseCondition } from 'esoftplay/cache/use/condition/import';
@@ -40,7 +40,7 @@ import moment from 'esoftplay/moment';
40
40
  import useSafeState from 'esoftplay/state';
41
41
  import useGlobalSubscriber, { useGlobalSubscriberReturn } from 'esoftplay/subscribe';
42
42
  import React, { useEffect, useRef } from 'react';
43
- import { Linking, Pressable, Text, TouchableOpacity, View } from 'react-native';
43
+ import { Text, TouchableOpacity, View } from 'react-native';
44
44
  import { ScrollView } from 'react-native-gesture-handler';
45
45
  import QRCode from 'react-native-qrcode-svg';
46
46
 
@@ -49,71 +49,23 @@ export interface EventOrder_detailProps {
49
49
  navigation: any
50
50
  }
51
51
 
52
-
53
- function renderTermItem(item: any, i: number) {
54
- return (
55
- <View key={i} style={{ marginTop: 10 }}>
56
- <EventStep text={item} />
57
- </View>
58
- )
59
- }
60
-
61
-
62
- let urlsInstruction: any[] = []
63
-
64
52
  const subs = useGlobalSubscriber()
65
53
  export function subscribe(): useGlobalSubscriberReturn {
66
54
  return subs
67
55
  }
68
56
 
69
- function getStringReview(data: any) {
70
- const groupedData = data.reduce((acc: any[], obj: any) => {
71
- const { survey_id, survey_question, survey_option, content } = obj;
72
-
73
- if (!acc[survey_id]) {
74
- acc[survey_id] = {
75
- survey_id,
76
- survey_question,
77
- values: []
78
- };
79
- }
80
-
81
- if (survey_option) {
82
- acc[survey_id].values.push(survey_option);
83
- }
84
- if (content) {
85
- acc[survey_id].values.push(content);
86
- }
87
-
88
- return acc;
89
- }, {});
90
-
91
- const finalResult = Object.values(groupedData).map((group: any) => {
92
- const { survey_question, values } = group;
93
- const valuesString = values.join(", ");
94
- return `\nQ: ${survey_question}\nA: ${valuesString}`;
95
- })
96
- return finalResult
97
- }
98
-
99
-
100
-
101
57
  export default function m(props: EventOrder_detailProps): any {
102
58
  const LibCurl = esp.mod("lib/curl")
103
59
 
104
60
  EventSecure_page()
105
- const [user] = UserClass.state().useState()
106
61
 
107
62
  let showQR = useRef<LibSlidingup>(null)
108
63
  let dialogAddonList = useRef<LibSlidingup>(null)
109
64
  let dialogQtyAddons = useRef<LibSlidingup>(null)
110
- const dialogSendBack = useRef<LibSlidingup>(null)
111
65
  const url = LibNavigation.getArgs(props, 'url')
112
66
  const [result, setResult] = useSafeState<any>(EventIndexProperty?.stateTicketCache()?.get()?.filter?.((x: any) => x.url?.replace?.('?id=', '/') == url?.replace?.('?id=', '/'))?.[0]?.detail)
113
67
  const useIndividualQr = result?.config?.use_individual_qr_ticket
114
68
 
115
- const [qty, setQty] = useSafeState<number>(1)
116
-
117
69
  const [, setGroupAddon, getGroupAddon] = useSafeState()
118
70
  const [, setSelectedAddon, getSelectedAddon] = useSafeState()
119
71
  const [addonsBooked, setAddOnsBooked] = useSafeState()
@@ -195,7 +147,6 @@ export default function m(props: EventOrder_detailProps): any {
195
147
  checked: 0,
196
148
  })
197
149
  })
198
- esp.log({ data });
199
150
  setDataTicket(data)
200
151
  LibUtils.debounce(() => { dialogQtyAddons?.current?.show() }, 100)
201
152
  }, (error: any) => {
@@ -235,35 +186,6 @@ export default function m(props: EventOrder_detailProps): any {
235
186
  loadData()
236
187
  })
237
188
 
238
- function add(max: number): void {
239
- if (qty < max) {
240
- setQty(qty + 1)
241
- }
242
- }
243
-
244
- function min(): void {
245
- setQty(qty == 1 ? 1 : qty - 1)
246
- }
247
-
248
- function sendBack(p: any) {
249
- LibDialog.confirm(esp.lang("event/order_detail", "warning"), esp.lang("event/order_detail", "return_this_ticket"), esp.lang("event/order_detail", "btn_yes"), () => {
250
- LibProgress.show(esp.lang("event/order_detail", "please_wait"))
251
- let post = {
252
- pin: p
253
- }
254
- new LibCurl('event_booking_shared_return?booking_id=' + result?.id + '&qty_shared=' + qty, post, (res: any, msg: any) => {
255
- // LibNotify(res)
256
- LibProgress.hide()
257
- LibDialog.info(esp.lang("event/order_detail", "information"), msg)
258
- LibNavigation.back()
259
- }, (error: any) => {
260
- LibProgress.hide()
261
- LibDialog.warning(esp.lang("event/order_detail", "back_err"), error?.message);
262
- LibNavigation.back()
263
- }, 1)
264
- }, esp.lang("event/order_detail", "btn_cancel"), () => { })
265
- }
266
-
267
189
  function loadDataAddons(id: any, url: string) {
268
190
  LibProgress.show(esp.lang("event/order_detail", "wait"))
269
191
  new LibCurl(url, null, (res: any, msg: any) => {
@@ -377,83 +299,12 @@ export default function m(props: EventOrder_detailProps): any {
377
299
  let isInvitationDate = result?.ondate == "0000-00-00" && result?.kind_detail?.use_code == 1
378
300
  let isOnlineWithoutDate = result?.ondate == "0000-00-00" && result?.kind_detail?.everyday_pass == 0
379
301
 
380
- if ((result?.status == 1 || (result?.qty == 0 && result?.qty_shared > 0)) && result?.is_reschedule == 1) {
381
- return (
382
- <View style={{ flex: 1, backgroundColor: '#f6f6f6' }}>
383
- <EventHeader title={esp.lang("event/order_detail", "order_detail")} />
384
- <View style={[{ margin: 18, borderTopLeftRadius: 7, borderTopRightRadius: 7, backgroundColor: '#fff', paddingBottom: 10 }, LibStyle.elevation(3)]}>
385
-
386
- <TouchableOpacity onPress={() => {
387
- LibNavigation.navigate('lib/gallery', { image: result?.image })
388
- }}>
389
- <LibPicture source={{ uri: result?.image }} style={{ borderTopLeftRadius: 7, borderTopRightRadius: 7, height: imgHeight, width: imgWidth }} resizeMode="cover" />
390
- </TouchableOpacity>
391
- <View style={{ flexDirection: 'row', margin: 14, marginTop: 4, justifyContent: 'space-between' }}>
392
- <View style={{ marginTop: 14 }}>
393
- <EventHtmltext allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{esp.lang("event/order_detail", "ticket")}{result?.price_name}</EventHtmltext>
394
- <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
395
- <LibIcon name="ticket-outline" size={20} />
396
- <Text allowFontScaling={false} style={{ marginLeft: 6, fontFamily: "Arial", fontSize: 30, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{result?.qty}</Text>
397
- <Text allowFontScaling={false} style={{ marginLeft: 4, fontFamily: "Arial", fontSize: 16, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{esp.lang("event/order_detail", "ticket")}</Text>
398
- </View>
399
- <UseCondition if={result?.show_ticket_status == 1 && result?.status == 1 || result?.status == 3 || result?.status == 6}>
400
- <Text allowFontScaling={false} style={{ fontSize: 12, fontWeight: "normal", fontStyle: "normal", flexWrap: 'wrap', letterSpacing: 0, marginBottom: 12, color: "#484848" }}>
401
- {
402
- result?.qty_used == 0 ? esp.lang("event/order", "have_not_been_used")
403
- :
404
- result.kind_detail?.everyday_pass == 1 ?
405
- "(" + result?.qty_used_today + " " + esp.lang("event/order_detail", "used_today") + ")"
406
- :
407
- "(" + result?.qty_used + " " + esp.lang("event/order_detail", "used") + ")"
408
- }
409
- </Text>
410
- </UseCondition>
411
- <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
412
- <LibIcon name="calendar-blank-outline" size={20} />
413
- <Text allowFontScaling={false} style={{ marginLeft: 6, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{result?.ondate != "0000-00-00" ? moment(result?.ondate).localeFormat("DD MMMM YYYY") : ((isInvitationDate || isOnlineWithoutDate) ? esp.lang("event/order_item", "used_once") : dateRange)}</Text>
414
- </View>
415
- </View>
416
- {
417
- result?.status == "1" &&
418
- <View style={{ marginTop: 14, justifyContent: 'center', alignContent: 'center', alignItems: 'center' }}>
419
- {
420
- result?.qr != "" &&
421
- <TouchableOpacity onPress={() => {
422
- result?.status == "1" && showQR?.current?.show()
423
- }}>
424
- <EventQr_bg>
425
- <QRCode ecl="H" size={80} value={result?.qr} />
426
- </EventQr_bg>
427
- </TouchableOpacity>
428
- }
429
- </View>
430
- }
431
- </View>
432
-
433
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }} >
434
- <View style={{ width: 19, height: 19, borderRadius: 9.5, backgroundColor: "#f6f6f6", marginLeft: -9.5 }} />
435
- {/* <Text style={{ marginTop: 5, alignSelf: 'center', fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "center", color: "#f39c12" }} ></Text> */}
436
- <View style={{ width: 19, height: 19, borderRadius: 9.5, backgroundColor: "#f6f6f6", marginRight: -9.5 }} />
437
- </View>
438
302
 
439
- <View style={{ margin: 14, flexDirection: 'row' }}>
440
- <Text style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorRed }} >{result?.reschedule_notes}</Text>
441
- </View>
442
- {
443
- result?.par_id > 0 ?
444
- null
445
- :
446
- <EventButton onPress={() => {
447
- LibNavigation.navigate('event/order_reschedule', { url: result?.url_reschedule })
448
- }} label={result?.is_refundable == 1 ? esp.lang("event/order_detail", "refund_rescedule") : esp.lang("event/order_detail", "rescedule")} backgroundColor={LibStyle.colorGreen} style={{ marginLeft: 20, marginRight: 20, marginBottom: 10 }} />
449
- }
450
- </View>
451
- </View>
452
- )
303
+ if ((result?.status == 1 || (result?.qty == 0 && result?.qty_shared > 0)) && result?.is_reschedule == 1) {
304
+ return <EventOrder_detail_reschedule dataTicket={result} onPressQr={() => { showQR?.current?.show() }} />
453
305
  }
454
306
 
455
- let startEvent = result?.start_date + " " + result?.start_time
456
- let dateNow = LibUtils.moment().localeFormat("YYYY-MM-DD HH:mm")
307
+ let valid = dataTicket?.some((item: any) => item.status == 1 && item.checked == 1);
457
308
 
458
309
  return (
459
310
  <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
@@ -578,44 +429,7 @@ export default function m(props: EventOrder_detailProps): any {
578
429
  </View>
579
430
  {
580
431
  result?.hasOwnProperty('url_addons_booked') && result?.url_addons_booked != "" &&
581
- <View style={{ padding: 10, paddingLeft: 15, paddingBottom: 0 }}>
582
- {
583
- addonsBooked?.length > 0 && addonsBooked?.map((x: any, i: number) => {
584
- return (
585
- <View key={i} style={{ flexDirection: 'row', marginBottom: 10 }}>
586
- <LibIcon name='check-decagram' size={20} color={LibStyle.colorGreen} />
587
- <View style={{ marginLeft: 10 }}>
588
- <Text allowFontScaling={false} style={{ color: '#484848', fontSize: 14, fontWeight: 'bold', fontFamily: "Arial" }}>
589
- {x.price_name}
590
- {x?.list?.length == 1 ? " (" + Number(x?.list?.[0]?.qty) + " Tiket)" : ""}
591
- </Text>
592
- {
593
- x?.list?.length > 0 && x?.list?.map((z: any, i: number) => {
594
- if (z?.ondate != "0000-00-00") {
595
- return (
596
- <Text key={i} allowFontScaling={false}>{LibUtils.moment(z.ondate).localeFormat('DD MMM YYYY') + " (" + Number(z.qty) + " Tiket)"}</Text>
597
- )
598
- } else {
599
- return null
600
- }
601
- })
602
- }
603
- </View>
604
- </View>
605
- )
606
- })
607
- }
608
- {
609
- errorAddonsBooked &&
610
- <EventMessage
611
- message={errorAddonsBooked?.message}
612
- children={<EventButton label='Segarkan' onPress={() => {
613
- esp.log("dipencet");
614
- loadData()
615
- }} />}
616
- />
617
- }
618
- </View>
432
+ <EventOrder_detail_addons_booked addonsBooked={addonsBooked} errorAddonsBooked={errorAddonsBooked} onPress={loadData} />
619
433
  }
620
434
  </View>
621
435
 
@@ -703,161 +517,37 @@ export default function m(props: EventOrder_detailProps): any {
703
517
  </View>
704
518
  )
705
519
  }} >
706
- <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, paddingBottom: 10, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
707
- <LibCurl_view
708
- url={result?.url_addons}
709
- onSuccess={(res, msg): any => {
710
- esp.log(res);
711
- return (
712
- <View>
713
- {
714
- res?.length > 0 && res?.map((item: any, i: number) => {
715
- if (item?.list?.length > 1) {
716
- return (
717
- <EventButton_order_detail
718
- disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
719
- status_message={item?.status_message}
720
- key={i}
721
- color={result?.color}
722
- onPress={() => {
723
- setGroupAddon(item)
724
- LibUtils.debounce(() => {
725
- // setQty(1)
726
- dialogAddonList?.current?.show()
727
- }, 100)
728
- // loadDataAddons(item?.addons_id, item?.url)
729
- }}
730
- icon={'chevron-down'}
731
- title={item.title}
732
- info={item.info}
733
- />
734
- )
735
- } else {
736
- return (
737
- <EventButton_order_detail
738
- disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
739
- status_message={item?.status_message}
740
- key={i}
741
- color={result?.color}
742
- onPress={() => {
743
- if (item?.hasOwnProperty('status') && item?.status == 1) {
744
- // setQty(1)
745
- setSelectedAddon(item)
746
- loadDataTicket(result?.id, item?.[0]?.price_id, item?.[0]?.ondate)
747
-
748
- // loadDataAddons(item?.addons_id, item?.url)
749
- }
750
- }}
751
- icon={'plus-circle-outline'}
752
- title={item.title}
753
- info={item.info}
754
- />
755
- )
756
- }
757
- })
758
- }
759
- </View>
760
- )
761
- }}
762
- onError={(err) => {
763
- return (
764
- <EventMessage
765
- message={err?.message}
766
- />
767
- )
768
- }}
769
- />
770
- </View>
520
+ <EventOrder_detail_addons
521
+ dataTicket={result}
522
+ onPress={(item: any) => {
523
+ const isMultiple = item?.list?.length > 1
524
+ if (isMultiple) {
525
+ setGroupAddon(item)
526
+ LibUtils.debounce(() => {
527
+ dialogAddonList?.current?.show()
528
+ }, 100)
529
+ } else {
530
+ if (item?.status == 1) {
531
+ const addon = item?.list?.[0]
532
+ setGroupAddon(item)
533
+ setSelectedAddon(addon)
534
+ loadDataTicket(result?.id, addon?.price_id, addon?.ondate)
535
+ }
536
+ }
537
+
538
+ }}
539
+ />
771
540
  </LibCollaps>
772
541
  }
773
542
 
774
- {
775
- // jika mau edit view dibawah ini, tekan ctrl + f terus paste prefik dibawah ini
776
- // view_reviewed
777
- dataReview?.status == 1 ?
778
- <View style={{ margin: 15, marginBottom: 0, borderRadius: 7, backgroundColor: 'white', padding: 10 }}>
779
- <View style={{ flexDirection: 'row', alignItems: 'flex-start', marginTop: 10 }}>
780
- <LibPicture source={{ uri: user?.image }} style={{ height: 50, width: 50, borderRadius: 25 }} />
781
- <View style={{ marginLeft: 10, flex: 1 }}>
782
- <Text allowFontScaling={false} numberOfLines={1} ellipsizeMode='tail' style={{ fontSize: 16, fontWeight: 'bold' }}>{user?.name}</Text>
783
- <Text allowFontScaling={false} style={{ fontSize: 12, color: '#c9c9c9' }}>{LibUtils.moment(dataReview?.review?.created).localeFormat("D MMM YYYY")}</Text>
784
- <View style={{ marginTop: 5 }}>
785
- <EventRating disabled onChangeRating={() => { }} defaultValue={dataReview?.review?.rating} size={18} containerStyle={{ padding: 0, justifyContent: 'flex-start' }} />
786
- {
787
- dataReview?.review?.content != "" &&
788
- <Text allowFontScaling={false} style={{ marginTop: 10, fontSize: 12, color: '#000' }}>{dataReview?.review?.content.replace(/\\n/g, '\n')}</Text>
789
- }
790
- {
791
- dataReview?.surveys?.length > 0 &&
792
- getStringReview(dataReview?.surveys).map((sur) => (
793
- <Text allowFontScaling={false} style={{ fontSize: 12, color: '#000' }}>{sur}</Text>
794
- ))
795
- }
796
- </View>
797
- </View>
798
- </View>
799
- {
800
- dataReview?.status == 2 &&
801
- <View style={applyStyle({ borderColor: '#FC9722', backgroundColor: '#FDF1DE', borderWidth: 1, borderStyle: 'dashed', borderRadius: 5, padding: 5, marginTop: 15, marginBottom: 0 })} >
802
- <Text allowFontScaling={false} style={applyStyle({ fontFamily: "Arial", fontSize: 12, fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" })}>{esp.lang("event/order_detail", "thanks")}</Text>
803
- </View>
804
- }
805
-
806
- </View>
807
- :
808
- dateNow > startEvent ?
809
- <View style={{ margin: 15, marginBottom: 0, borderRadius: 7, backgroundColor: '#000', padding: 10 }}>
810
- {
811
- dataReview?.review == null ?
812
- <Pressable>
813
- <EventRating onChangeRating={(rate) => {
814
- let type = EventReviewProperty.calculateProb(result?.config?.review)
815
- let urlForm = "event_order_detail_review_form?id=" + result?.id + "&type=" + type?.type
816
- let args = {
817
- url_form: urlForm,
818
- type: type?.type,
819
- booking_id: result?.id,
820
- rate: rate
821
- }
822
- if (result?.review_status != 1) {
823
- LibNavigation.navigate('event/review_add', args)
824
- }
825
- }} defaultValue={5} size={50} containerStyle={{ padding: 0, backgroundColor: 'transparent' }} />
826
- <Text allowFontScaling={false} style={{ alignSelf: 'center', marginTop: 15, fontSize: 18, fontWeight: 'bold', color: '#fff' }}>{esp.lang("event/order_detail", "leave_review")}</Text>
827
- <Text allowFontScaling={false} style={{ alignSelf: 'center', marginTop: 7, fontSize: 14, color: '#fff' }}>{esp.lang("event/order_detail", "review_info")}</Text>
828
-
829
- </Pressable>
830
- :
831
- // view_reviewed
832
- <View style={{ margin: -10, backgroundColor: '#fff', padding: 10, borderRadius: 7 }}>
833
- <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
834
- <LibPicture source={{ uri: user?.image }} style={{ height: 50, width: 50, borderRadius: 25 }} />
835
- <View style={{ marginLeft: 10 }}>
836
- <Text allowFontScaling={false} numberOfLines={1} ellipsizeMode='tail' style={{ fontSize: 16, fontWeight: 'bold' }}>{user?.name}</Text>
837
- <Text allowFontScaling={false} style={{ fontSize: 12, color: '#c9c9c9' }}>{LibUtils.moment(dataReview?.review?.created).localeFormat("D MMM YYYY")}</Text>
838
- <View style={{ marginTop: 5 }}>
839
- <EventRating disabled onChangeRating={() => { }} defaultValue={dataReview?.review?.rating} size={18} containerStyle={{ padding: 0, backgroundColor: 'transparent' }} />
840
- </View>
841
- </View>
842
- </View>
843
-
844
- <Text allowFontScaling={false} numberOfLines={5} ellipsizeMode='tail' style={{ marginTop: 10, fontSize: 12, color: '#000' }}>{dataReview?.review?.content}</Text>
845
- {
846
- dataReview?.status == 2 &&
847
- <View style={applyStyle({ borderColor: '#FC9722', backgroundColor: '#FDF1DE', borderWidth: 1, borderStyle: 'dashed', borderRadius: 5, padding: 5, marginTop: 15, marginBottom: 0 })} >
848
- <Text allowFontScaling={false} style={applyStyle({ fontFamily: "Arial", fontSize: 12, fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" })}>{esp.lang("event/order_detail", "thanks")}</Text>
849
- </View>
850
- }
851
- </View>
852
- }
853
- </View>
854
- : null
855
- }
543
+ {/* review */}
544
+ <EventOrder_detail_review dataReview={dataReview} dataTicket={result} />
856
545
 
857
546
  {/* view for coupon */}
858
547
  {
859
548
  result?.url_coupon != "" &&
860
549
  <LibCollaps
550
+ show={Number(result?.show_voucher) == 0 ? false : true}
861
551
  header={(show) =>
862
552
  <View style={{ margin: 15, alignContent: 'center', alignItems: 'center', paddingHorizontal: 15, marginBottom: 0, borderRadius: 7, backgroundColor: '#fff', paddingBottom: 10, paddingTop: 10, flexDirection: 'row' }}>
863
553
  <View style={{ flex: 1 }}>
@@ -867,49 +557,7 @@ export default function m(props: EventOrder_detailProps): any {
867
557
  </View>
868
558
  }
869
559
  >
870
- <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
871
- <LibCurl_view
872
- url={result?.url_coupon}
873
- onSuccess={(res, msg): any => {
874
- return (
875
- <View>
876
- <Text style={{ margin: 15, marginBottom: 0, fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{res?.title}</Text>
877
-
878
- {
879
- res?.list?.map((item: any, i: number) => {
880
- return (
881
- <TouchableOpacity key={i} onPress={() => {
882
- if (item?.show_qr != 0) {
883
- esp.modProp("event/coupon").getCouponDetail(item?.url_detail_coupon)
884
- }
885
- }} style={[{ marginBottom: 10, margin: 15, borderRadius: 15, backgroundColor: '#fff' }, LibStyle.elevation(2)]}>
886
- <LibPicture source={{ uri: item.image }} resizeMode="cover" style={{ height: (LibStyle.width - 60) * 0.43, width: LibStyle.width - 60, borderRadius: 5 }} />
887
- </TouchableOpacity>
888
- )
889
- })
890
- }
891
- {
892
- res?.pages > 1 &&
893
- <TouchableOpacity onPress={() => {
894
- LibNavigation.navigate("event/coupon")
895
- }}>
896
- <View style={{ marginTop: 10, alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 50 }}>
897
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontWeight: "bold", textAlign: 'center', fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{esp.lang("event/order_detail", "see_all_coupon")}</Text>
898
- </View>
899
- </TouchableOpacity>
900
- }
901
- </View>
902
- )
903
- }}
904
- onError={(err) => {
905
- return (
906
- <EventMessage
907
- message={err?.message}
908
- />
909
- )
910
- }}
911
- />
912
- </View>
560
+ <EventOrder_detail_coupon dataTicket={result} />
913
561
  </LibCollaps>
914
562
  }
915
563
 
@@ -927,77 +575,7 @@ export default function m(props: EventOrder_detailProps): any {
927
575
  </View>
928
576
  )
929
577
  }}>
930
- <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
931
- <LibCurl_view
932
- url={result?.url_instructions}
933
- onSuccess={(res, msg): any => {
934
- urlsInstruction = []
935
- res?.map?.((item: any) => {
936
- let matches = item.match(/(https?:\/\/[^\s]+)/g);
937
- if (matches) {
938
- urlsInstruction.push(...matches)
939
- }
940
- })
941
- return (
942
- <View style={{ margin: 15 }}>
943
- {
944
- res?.map((item: any, i: number) => {
945
- const urls = item.match(/(https?:\/\/[^\s]+)/g)
946
- const text = item.replace(urls?.[0], '~:::~')
947
- const texts = text.split('~:::~')
948
- return (
949
- <TouchableOpacity key={i + 1} onPress={() => {
950
- if (item.match(/(https?:\/\/[^\s]+)/g)) {
951
- Linking.openURL(urls[0])
952
- }
953
- }}>
954
- <Text allowFontScaling={false} style={{ flexWrap: 'wrap', marginBottom: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", lineHeight: 18, color: "#4a4a4a", marginTop: 4 }}>
955
- {texts?.[0]}
956
- {urls && <Text allowFontScaling={false} style={{ flexWrap: 'wrap', marginBottom: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", lineHeight: 18, color: LibStyle.colorBlue, marginTop: 4 }}>{urls[0]}</Text>}
957
- {texts?.[1]}
958
- </Text>
959
- </TouchableOpacity>
960
- )
961
- })
962
- }
963
-
964
- {
965
- urlsInstruction?.length > 0 && urlsInstruction?.map((item: any, i: number) => {
966
- return (
967
- <View key={i + 1} style={{ padding: 10, marginTop: 10, flexDirection: 'row-reverse' }}>
968
- <TouchableOpacity onPress={() => {
969
- LibUtils.share(item)
970
- }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
971
- <LibIcon color="#fff" name="share" />
972
- </TouchableOpacity>
973
- <TouchableOpacity onPress={() => {
974
- LibUtils.copyToClipboard(item)
975
- LibToastProperty.show(esp.lang("event/order_detail", "copied"))
976
- }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
977
- <LibIcon color="#fff" name="content-copy" />
978
- </TouchableOpacity>
979
- <TouchableOpacity onPress={() => {
980
- Linking.openURL(item)
981
- }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
982
- <LibIcon.MaterialIcons color="#fff" name="open-in-browser" />
983
- </TouchableOpacity>
984
- </View>
985
- )
986
- })
987
- }
988
-
989
- </View>
990
- )
991
- }}
992
- onError={(err) => {
993
- return (
994
- <EventMessage
995
- message={err?.message}
996
- />
997
- )
998
- }}
999
- />
1000
- </View>
578
+ <EventOrder_detail_instruction dataTicket={result} />
1001
579
  </LibCollaps>
1002
580
  }
1003
581
 
@@ -1014,51 +592,7 @@ export default function m(props: EventOrder_detailProps): any {
1014
592
  </View>
1015
593
  }
1016
594
  >
1017
- <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
1018
- <LibCurl_view
1019
- url={result?.url_term}
1020
- onSuccess={(res, msg): any => {
1021
- esp.log(res);
1022
- if (Array.isArray(res)) {
1023
- return (
1024
- <View>
1025
- {res?.map(renderTermItem)}
1026
- </View>
1027
- )
1028
- } else {
1029
- return (
1030
- <View>
1031
- {
1032
- Object.entries(res).map(([title, items]: any) => {
1033
- return (
1034
- <View key={title}>
1035
- <LibCollaps header={(show) =>
1036
- <View style={{ padding: 15, paddingRight: 25, paddingLeft: 20, paddingBottom: 10, borderBottomWidth: 1, borderColor: LibStyle.colorBgGrey, alignContent: 'center', alignItems: 'center', borderRadius: 7, backgroundColor: '#f9f9f9', flexDirection: 'row' }}>
1037
- <View style={{ flex: 1 }}>
1038
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: "#495057" }}>{title}</Text>
1039
- </View>
1040
- <LibIcon name={!show ? "chevron-down" : "chevron-up"} color='#495057' />
1041
- </View>
1042
- }>
1043
- {items.map(renderTermItem)}
1044
- </LibCollaps>
1045
- </View>
1046
- )
1047
- })
1048
- }
1049
- </View>
1050
- )
1051
- }
1052
- }}
1053
- onError={(err) => {
1054
- return (
1055
- <EventMessage
1056
- message={err?.message}
1057
- />
1058
- )
1059
- }}
1060
- />
1061
- </View>
595
+ <EventOrder_detail_tnc dataTicket={result} />
1062
596
  </LibCollaps>
1063
597
  }
1064
598
 
@@ -1220,9 +754,13 @@ export default function m(props: EventOrder_detailProps): any {
1220
754
  </ScrollView>
1221
755
 
1222
756
  <EventButton label={esp.lang("event/order_detail", "next")} onPress={() => {
1223
- dialogQtyAddons?.current?.hide()
1224
- loadDataAddons(getSelectedAddon()?.addons_id, getSelectedAddon()?.url)
1225
- }} backgroundColor={"#FFF"} borderColor={LibStyle.colorGreen} fontColor={LibStyle.colorGreen} />
757
+ if (valid) {
758
+ dialogQtyAddons?.current?.hide()
759
+ loadDataAddons(getSelectedAddon()?.addons_id, getSelectedAddon()?.url)
760
+ }
761
+ }}
762
+ backgroundColor={!valid ? LibStyle.colorGrey : LibStyle.colorGreen}
763
+ />
1226
764
  </View>
1227
765
  </LibSlidingup>
1228
766
 
@@ -1265,54 +803,6 @@ export default function m(props: EventOrder_detailProps): any {
1265
803
  </View>
1266
804
  </LibSlidingup>
1267
805
 
1268
- <LibSlidingup ref={dialogSendBack} >
1269
- <View style={{ backgroundColor: 'white', borderTopLeftRadius: 20, borderTopRightRadius: 20, padding: 20 }} >
1270
- <EventPopup email={result?.sharer_email?.trim?.()} redirect={() => {
1271
- if (result?.use_seat == 1) {
1272
- let data = {
1273
- qty: qty
1274
- }
1275
- LibNavigation.navigate('event/seat', {
1276
- url: result?.url_ticket,
1277
- dataTicket: data,
1278
- returnTicket: true,
1279
- })
1280
- } else {
1281
- LibNavigation.navigateForResult("bigbang/payment_pin", undefined, 1132).then((p) => {
1282
- if (p) {
1283
- sendBack(p)
1284
- }
1285
- })
1286
- }
1287
- dialogSendBack.current!.hide()
1288
- }} cancel={() => {
1289
- dialogSendBack.current!.hide()
1290
- }}
1291
- view={
1292
- <View style={{ flexDirection: 'row', alignItems: 'center', marginVertical: 20 }} >
1293
- <TouchableOpacity
1294
- onPress={() => {
1295
- min()
1296
- }}
1297
- style={{ height: 70, width: 70, borderRadius: 10, backgroundColor: '#f1f1f1', alignItems: 'center', justifyContent: 'center' }} >
1298
- <LibIcon name='minus' color={LibStyle.colorRed} size={50} />
1299
- </TouchableOpacity>
1300
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }} >
1301
- <Text style={{ fontSize: 50 }} >{qty}</Text>
1302
- </View>
1303
- <TouchableOpacity
1304
- onPress={() => {
1305
- add(Number(result.qty_returnable))
1306
- }}
1307
- style={{ height: 70, width: 70, borderRadius: 10, backgroundColor: '#f1f1f1', alignItems: 'center', justifyContent: 'center' }} >
1308
- <LibIcon name='plus' color={LibStyle.colorGreen} size={50} />
1309
- </TouchableOpacity>
1310
- </View>
1311
- }
1312
- />
1313
- </View>
1314
- </LibSlidingup>
1315
-
1316
806
  </View >
1317
807
  )
1318
808
  }