esoftplay-event 0.0.2-h → 0.0.2-j

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.
@@ -24,11 +24,14 @@ import { EventButton_order_detail } from 'esoftplay/cache/event/button_order_det
24
24
  import { EventConfigProperty } from 'esoftplay/cache/event/config/import';
25
25
  import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
26
26
  import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
27
+ import { EventMessage } from 'esoftplay/cache/event/message/import';
27
28
  import { EventPopup } from 'esoftplay/cache/event/popup/import';
28
29
  import { EventQr_bg } from 'esoftplay/cache/event/qr_bg/import';
29
30
  import { EventRating } from 'esoftplay/cache/event/rating/import';
30
31
  import { EventSecure_page } from 'esoftplay/cache/event/secure_page/import';
31
32
  import { EventStep } from 'esoftplay/cache/event/step/import';
33
+ import { LibCollaps } from 'esoftplay/cache/lib/collaps/import';
34
+ import { LibCurl_view } from 'esoftplay/cache/lib/curl_view/import';
32
35
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
33
36
  import { UseCondition } from 'esoftplay/cache/use/condition/import';
34
37
  import esp from 'esoftplay/esp';
@@ -48,7 +51,7 @@ export interface EventOrder_detailProps {
48
51
 
49
52
  function renderTermItem(item: any, i: number) {
50
53
  return (
51
- <View key={i}>
54
+ <View key={i} style={{ marginTop: 10 }}>
52
55
  <EventStep text={item} />
53
56
  </View>
54
57
  )
@@ -105,30 +108,15 @@ export default function m(props: EventOrder_detailProps): any {
105
108
  const dialogSendBack = useRef<LibSlidingup>(null)
106
109
  const url = LibNavigation.getArgs(props, 'url')
107
110
  const [result, setResult] = useSafeState<any>(EventIndexProperty?.stateTicketCache()?.get()?.filter?.((x: any) => x.url?.replace?.('?id=', '/') == url?.replace?.('?id=', '/'))?.[0]?.detail)
108
- const [tickets, setTickets] = useSafeState(result?.detail_ticket?.tickets ?? [])
109
- const [dataAddons, setDataAddons] = useSafeState()
110
111
  const useIndividualQr = result?.config?.use_individual_qr_ticket
111
112
 
112
- const dataTickets = tickets?.filter?.((x: ItemTiket) => x?.email == user?.email && x?.ticket_code != '')
113
-
114
- const [coupons, setCoupons] = useSafeState<any>()
115
113
  const [qty, setQty] = useSafeState<number>(1)
116
114
  const [, setGroupAddon, getGroupAddon] = useSafeState()
117
115
 
118
116
  const dataOfflineReview = EventReview_addProperty.state().get()
119
117
  let availableOfflineReview = dataOfflineReview?.filter((z: any) => z?.booking_id == result?.id)
120
-
121
118
  const [dataReview, setDataReview] = useSafeState<any>(availableOfflineReview?.length == 1 ? availableOfflineReview[0] : result?.detail_review)
122
119
 
123
- urlsInstruction = []
124
- result?.instructions?.map?.((item: any) => {
125
- let matches = item.match(/(https?:\/\/[^\s]+)/g);
126
- if (matches) {
127
- urlsInstruction.push(...matches)
128
- }
129
- })
130
-
131
-
132
120
  moment().locale?.('id')
133
121
 
134
122
  const imgWidth = LibStyle.width - 30
@@ -138,11 +126,6 @@ export default function m(props: EventOrder_detailProps): any {
138
126
  function loadData(): void {
139
127
  new LibCurl(url + ((url.includes("?") ? "&" : "?") + 't=' + new Date().getTime()), null, (res: any) => {
140
128
  setResult(res)
141
- new LibCurl(res?.url_coupon, null, (ress: any) => {
142
- setCoupons(ress)
143
- }, (error: any) => {
144
- // setEmptyCoupons(error)
145
- })
146
129
 
147
130
  if (res?.review_status != 0) {
148
131
  loadDetailReview(res?.url_review)
@@ -153,30 +136,6 @@ export default function m(props: EventOrder_detailProps): any {
153
136
  sendReview(availableOfflineReview[0])
154
137
  }
155
138
 
156
- // // load data untuk upgrade tiket
157
- // if (res?.is_upgradable == 1) {
158
- // loadDataUpgradeTicket(res?.url_upgrade)
159
- // }
160
-
161
- new LibCurl(res?.url_ticket, null,
162
- (res: any, msg: string) => {
163
- setTickets(res.tickets)
164
- }, (err: any) => {
165
- LibToastProperty.show(err.message)
166
- }
167
- )
168
-
169
- // addons list
170
- if (res?.hasOwnProperty('url_addons') && res?.url_addons != "") {
171
- new LibCurl(res?.url_addons, null,
172
- (resss: any, msg: string) => {
173
- setDataAddons(resss)
174
- }, (err: any) => {
175
- esp.log(err, "res url_addons");
176
- }
177
- )
178
- }
179
-
180
139
  }, (error: any) => {
181
140
  const transformedUrl = url?.includes("?id=") ? url?.replace(/\?id=/, '/') : url
182
141
  const urlArr = transformedUrl?.split("/")
@@ -189,6 +148,14 @@ export default function m(props: EventOrder_detailProps): any {
189
148
  })
190
149
  }
191
150
 
151
+ function loadDetailReview(url: any) {
152
+ new LibCurl(url, null, (ress: any) => {
153
+ setDataReview(ress)
154
+ }, (error: any) => {
155
+ // setEmptyCoupons(error)
156
+ })
157
+ }
158
+
192
159
  useEffect(() => {
193
160
  EventConfigProperty.curlConfig('v2/config_order_type')
194
161
  loadData()
@@ -206,17 +173,8 @@ export default function m(props: EventOrder_detailProps): any {
206
173
  }, 1)
207
174
  }
208
175
 
209
- function loadDetailReview(url: any) {
210
- new LibCurl(url, null, (ress: any) => {
211
- setDataReview(ress)
212
- }, (error: any) => {
213
- // setEmptyCoupons(error)
214
- })
215
- }
216
-
217
176
  subs.useSubscribe(() => {
218
177
  loadData()
219
- setDataReview(subs.getValue())
220
178
  })
221
179
 
222
180
  function addReturn(): void {
@@ -251,7 +209,6 @@ export default function m(props: EventOrder_detailProps): any {
251
209
  function loadDataAddons(id: any, url: string) {
252
210
  LibProgress.show(esp.lang("event/order_detail", "wait"))
253
211
  new LibCurl(url, null, (res: any, msg: any) => {
254
- esp.log({ res });
255
212
  LibProgress.hide()
256
213
  let dataBookingEvent = {
257
214
  event_id: res?.event_id,
@@ -283,22 +240,8 @@ export default function m(props: EventOrder_detailProps): any {
283
240
  let addons_id = id
284
241
  let booking_id_ref = result?.id
285
242
 
286
- if (res?.hasOwnProperty('alert') && res?.alert != "") {
287
- LibDialog.warningConfirm("Informasi", res?.alert, "Lanjutkan", () => {
288
- LibNavigation.navigate('payment/ticket', {
289
- order_type: order_type,
290
- tax: tax,
291
- fee_platform: fee_platform,
292
- dataBookingEvent: dataBookingEvent,
293
- show_fee_percentage,
294
- addons_id,
295
- booking_id_ref
296
- })
297
- }, "Kembali", () => {
298
-
299
- })
300
- } else {
301
- LibNavigation.navigate('payment/ticket', {
243
+ function goToPayment() {
244
+ let args: any = {
302
245
  order_type: order_type,
303
246
  tax: tax,
304
247
  fee_platform: fee_platform,
@@ -306,18 +249,48 @@ export default function m(props: EventOrder_detailProps): any {
306
249
  show_fee_percentage,
307
250
  addons_id,
308
251
  booking_id_ref
252
+ }
253
+ curlPriceConfig(res?.url_price_config, res?.price_id, (conf) => {
254
+ args['tax'] = conf?.tax
255
+ args['fee_platform'] = Boolean(conf?.fee_platform_amount) ? {
256
+ fee_platform_amount: conf?.fee_platform_amount || 0,
257
+ fee_platform_type: conf?.fee_platform_type || "NONE"
258
+ } : fee_platform
259
+ LibNavigation.navigate('payment/ticket', args)
309
260
  })
310
261
  }
311
262
 
263
+ if (res?.hasOwnProperty('alert') && res?.alert != "") {
264
+ LibDialog.warningConfirm("Informasi", res?.alert, "Lanjutkan", () => {
265
+ goToPayment()
266
+ }, esp.lang("event/order_detail", "back"), () => {
267
+
268
+ })
269
+ } else {
270
+ goToPayment()
271
+ }
272
+
312
273
 
313
274
  }, (err: any) => {
314
275
  LibProgress.hide()
315
276
  LibDialog.warning("Oops", err?.message)
316
- esp.log({ err });
317
277
  }, 1)
318
278
  }
319
279
 
320
- if (result == undefined && !coupons) {
280
+ function curlPriceConfig(url_price_config: string, price_id: string, onDone: (data: any) => void) {
281
+ LibProgress.show("Mohon tunggu..")
282
+ if (url_price_config) {
283
+ new LibCurl(url_price_config, null, (res, msg) => {
284
+ onDone(res?.[price_id])
285
+ LibProgress.hide()
286
+ }, (err) => {
287
+ LibProgress.hide()
288
+ LibToastProperty.show(err?.message)
289
+ })
290
+ }
291
+ }
292
+
293
+ if (result == undefined) {
321
294
  return (
322
295
  <View style={{ flex: 1, backgroundColor: '#f6f6f6' }}>
323
296
  <EventHeader title={esp.lang("event/order_detail", "order_detail")} />
@@ -415,9 +388,6 @@ export default function m(props: EventOrder_detailProps): any {
415
388
  let startEvent = result?.start_date + " " + result?.start_time
416
389
  let dateNow = LibUtils.moment().localeFormat("YYYY-MM-DD HH:mm")
417
390
 
418
- const termData = result?.term ? Object.values(result?.term) : []
419
-
420
- // esp.log(result);
421
391
 
422
392
  return (
423
393
  <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
@@ -510,9 +480,9 @@ export default function m(props: EventOrder_detailProps): any {
510
480
  <View style={{ marginTop: 15, marginRight: 10 }}>
511
481
  <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, marginBottom: 5, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail", "seat_number")}</Text>
512
482
  <View style={{ flexDirection: 'row', flexWrap: 'wrap' }}>
513
- {tickets?.map((item: any, i: number) => {
514
- const [front, end] = item?.seat_name?.split("#") || ["", ""];
515
- if (item?.seat_name?.includes("#")) {
483
+ {result?.seat_names?.map((item: any, i: number) => {
484
+ const [front, end] = item?.split("#") || ["", ""];
485
+ if (item?.includes("#")) {
516
486
  return (
517
487
  <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
518
488
  <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16, color: "#000" }}> {front} </Text>
@@ -522,7 +492,7 @@ export default function m(props: EventOrder_detailProps): any {
522
492
  } else {
523
493
  return (
524
494
  <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
525
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: "#000" }}>{item?.seat_name}</Text>
495
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: "#000" }}>{item}</Text>
526
496
  </View>
527
497
  )
528
498
  }
@@ -538,24 +508,24 @@ export default function m(props: EventOrder_detailProps): any {
538
508
 
539
509
  }
540
510
  {
541
- useIndividualQr > 0 && dataTickets.length > 0 ?
511
+ useIndividualQr > 0 && result?.ticket_codes.length > 0 ?
542
512
  <LibCarrousel_snap
543
- data={dataTickets}
513
+ data={result?.ticket_codes}
544
514
  style={{ marginVertical: 10, marginBottom: 0, }}
545
515
  itemMarginHorizontal={3}
546
516
  itemWidth={LibStyle.width - 46}
547
517
  maxWidth={LibStyle.width}
548
518
  align={"center"}
549
- renderItem={(item: ItemTiket, id: any) => {
519
+ renderItem={(item: any, id: any) => {
550
520
  return (
551
521
  <View pointerEvents='none' style={{ width: LibStyle.width - 52, flexDirection: 'row', padding: 10, backgroundColor: 'white', borderWidth: 2, borderColor: LibStyle.colorPrimary, borderRadius: 5, overflow: 'hidden', alignItems: 'center' }} >
552
522
  <LibTextstyle textStyle='m_h2' style={{ textAlignVertical: 'center', marginHorizontal: 10 }} text={(id + 1).toString()} />
553
523
  <View style={{ marginLeft: 10, marginVertical: 10, flex: 1, justifyContent: 'flex-start' }} >
554
- <LibTextstyle textStyle='headline' numberOfLines={1} text={item.name} ellipsizeMode='tail' />
555
- <LibTextstyle textStyle='caption1' text={item.email} ellipsizeMode='tail' />
524
+ <LibTextstyle textStyle='headline' numberOfLines={1} text={result?.params?.buyer?.buyer_name} ellipsizeMode='tail' />
525
+ <LibTextstyle textStyle='caption1' text={result?.params?.buyer?.buyer_email} ellipsizeMode='tail' />
556
526
  </View>
557
527
  <EventQr_bg>
558
- <QRCode value={item.ticket_code} size={70} />
528
+ <QRCode value={item} size={70} />
559
529
  </EventQr_bg>
560
530
  </View>
561
531
  )
@@ -606,68 +576,99 @@ export default function m(props: EventOrder_detailProps): any {
606
576
  />
607
577
  </UseCondition>
608
578
 
609
-
610
-
611
579
  {/* tombol add on */}
612
580
  {
613
- dataAddons?.length > 0 && dataAddons?.map((item: any, i: number) => {
614
- if (item?.hasOwnProperty("group_id")) {
615
- return (
616
- <EventButton_order_detail
617
- disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
618
- status_message={item?.status_message}
619
- key={i}
620
- color={result?.color}
621
- onPress={() => {
622
- setGroupAddon(item)
623
- LibUtils.debounce(() => {
624
- dialogAddonList?.current?.show()
625
- }, 100)
626
- // loadDataAddons(item?.addons_id, item?.url)
627
- }}
628
- icon={'chevron-down'}
629
- title={item.group_title}
630
- info={item.info}
631
- />
632
- )
633
- } else if (item?.hasOwnProperty('list')) {
581
+ result?.hasOwnProperty('url_addons') && result?.url_addons != "" &&
582
+ <LibCollaps
583
+ header={(show) => {
634
584
  return (
635
- <EventButton_order_detail
636
- disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
637
- status_message={item?.status_message}
638
- key={i}
639
- color={result?.color}
640
- onPress={() => {
641
- setGroupAddon(item)
642
- LibUtils.debounce(() => {
643
- dialogAddonList?.current?.show()
644
- }, 100)
645
- // loadDataAddons(item?.addons_id, item?.url)
646
- }}
647
- icon={'chevron-down'}
648
- title={item.title}
649
- info={item.info}
650
- />
651
- )
652
- } else {
653
- return (
654
- <EventButton_order_detail
655
- disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
656
- status_message={item?.status_message}
657
- key={i}
658
- color={result?.color}
659
- onPress={() => {
660
- if (item?.hasOwnProperty('status') && item?.status == 1) {
661
- loadDataAddons(item?.addons_id, item?.url)
662
- }
663
- }}
664
- icon={'plus-circle-outline'}
665
- title={item.title}
666
- info={item.info}
667
- />
585
+ <View style={{ margin: 15, alignContent: 'center', alignItems: 'center', paddingHorizontal: 15, marginBottom: 0, borderRadius: 7, backgroundColor: '#fff', paddingBottom: 10, paddingTop: 10, flexDirection: 'row' }}>
586
+ <View style={{ flex: 1 }}>
587
+ <Text style={{ fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{esp.lang("event/order_detail", "addons")}</Text>
588
+ </View>
589
+ <LibIcon name={!show ? "chevron-down" : "chevron-up"} />
590
+ </View>
668
591
  )
669
- }
670
- })
592
+ }} >
593
+ <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, paddingBottom: 10, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
594
+ <LibCurl_view
595
+ url={result?.url_addons}
596
+ onSuccess={(res, msg): any => {
597
+ return (
598
+ <View>
599
+ {
600
+ res?.length > 0 && res?.map((item: any, i: number) => {
601
+ if (item?.hasOwnProperty("group_id")) {
602
+ return (
603
+ <EventButton_order_detail
604
+ disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
605
+ status_message={item?.status_message}
606
+ key={i}
607
+ color={result?.color}
608
+ onPress={() => {
609
+ setGroupAddon(item)
610
+ LibUtils.debounce(() => {
611
+ dialogAddonList?.current?.show()
612
+ }, 100)
613
+ // loadDataAddons(item?.addons_id, item?.url)
614
+ }}
615
+ icon={'chevron-down'}
616
+ title={item.group_title}
617
+ info={item.info}
618
+ />
619
+ )
620
+ } else if (item?.hasOwnProperty('list')) {
621
+ return (
622
+ <EventButton_order_detail
623
+ disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
624
+ status_message={item?.status_message}
625
+ key={i}
626
+ color={result?.color}
627
+ onPress={() => {
628
+ setGroupAddon(item)
629
+ LibUtils.debounce(() => {
630
+ dialogAddonList?.current?.show()
631
+ }, 100)
632
+ // loadDataAddons(item?.addons_id, item?.url)
633
+ }}
634
+ icon={'chevron-down'}
635
+ title={item.title}
636
+ info={item.info}
637
+ />
638
+ )
639
+ } else {
640
+ return (
641
+ <EventButton_order_detail
642
+ disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
643
+ status_message={item?.status_message}
644
+ key={i}
645
+ color={result?.color}
646
+ onPress={() => {
647
+ if (item?.hasOwnProperty('status') && item?.status == 1) {
648
+ loadDataAddons(item?.addons_id, item?.url)
649
+ }
650
+ }}
651
+ icon={'plus-circle-outline'}
652
+ title={item.title}
653
+ info={item.info}
654
+ />
655
+ )
656
+ }
657
+ })
658
+ }
659
+ </View>
660
+ )
661
+ }}
662
+ onError={(err) => {
663
+ return (
664
+ <EventMessage
665
+ message={err?.message}
666
+ />
667
+ )
668
+ }}
669
+ />
670
+ </View>
671
+ </LibCollaps>
671
672
  }
672
673
 
673
674
  {
@@ -755,40 +756,182 @@ export default function m(props: EventOrder_detailProps): any {
755
756
 
756
757
  {/* view for coupon */}
757
758
  {
758
- result?.status != "2" && coupons &&
759
- <View style={{ margin: 15, marginBottom: 0, borderRadius: 7, backgroundColor: '#fff', paddingBottom: 10, paddingTop: 10 }}>
760
- <View style={{ marginHorizontal: 20 }}>
761
- <Text style={{ fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{coupons.title || ''}</Text>
759
+ result?.url_coupon != "" &&
760
+ <LibCollaps
761
+ header={(show) =>
762
+ <View style={{ margin: 15, alignContent: 'center', alignItems: 'center', paddingHorizontal: 15, marginBottom: 0, borderRadius: 7, backgroundColor: '#fff', paddingBottom: 10, paddingTop: 10, flexDirection: 'row' }}>
763
+ <View style={{ flex: 1 }}>
764
+ <Text style={{ fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{esp.lang("event/order_detail", "voucher_or_coupon")}</Text>
765
+ </View>
766
+ <LibIcon name={!show ? "chevron-down" : "chevron-up"} />
767
+ </View>
768
+ }
769
+ >
770
+ <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
771
+ <LibCurl_view
772
+ url={result?.url_coupon}
773
+ onSuccess={(res, msg): any => {
774
+ return (
775
+ <View>
776
+ <Text style={{ margin: 15, marginBottom: 0, fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{res?.title}</Text>
777
+
778
+ {
779
+ res?.list?.map((item: any, i: number) => {
780
+ return (
781
+ <TouchableOpacity key={i} onPress={() => {
782
+ esp.modProp("event/coupon").getCouponDetail(item?.url_detail_coupon)
783
+ }} style={[{ marginBottom: 10, margin: 15, borderRadius: 15, backgroundColor: '#fff' }, LibStyle.elevation(2)]}>
784
+ <LibPicture source={{ uri: item.image }} resizeMode="cover" style={{ height: (LibStyle.width - 60) * 0.43, width: LibStyle.width - 60, borderRadius: 5 }} />
785
+ </TouchableOpacity>
786
+ )
787
+ })
788
+ }
789
+ {
790
+ res?.pages > 1 &&
791
+ <TouchableOpacity onPress={() => {
792
+ LibNavigation.navigate("event/coupon")
793
+ }}>
794
+ <View style={{ marginTop: 10, alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 50 }}>
795
+ <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>
796
+ </View>
797
+ </TouchableOpacity>
798
+ }
799
+ </View>
800
+ )
801
+ }}
802
+ onError={(err) => {
803
+ return (
804
+ <EventMessage
805
+ message={err?.message}
806
+ />
807
+ )
808
+ }}
809
+ />
762
810
  </View>
811
+ </LibCollaps>
812
+ }
813
+
814
+ {/* how to use ticket */}
815
+ {
816
+ result?.status == 1 && result?.url_instructions != "" &&
817
+ <LibCollaps
818
+ header={(show) => {
819
+ return (
820
+ <View style={{ margin: 15, alignContent: 'center', alignItems: 'center', paddingHorizontal: 15, marginBottom: 0, borderRadius: 7, backgroundColor: '#fff', paddingBottom: 10, paddingTop: 10, flexDirection: 'row' }}>
821
+ <View style={{ flex: 1 }}>
822
+ <Text style={{ fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{esp.lang("event/order_detail", "how_to_use")}</Text>
823
+ </View>
824
+ <LibIcon name={!show ? "chevron-down" : "chevron-up"} />
825
+ </View>
826
+ )
827
+ }}>
828
+ <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
829
+ <LibCurl_view
830
+ url={result?.url_instructions}
831
+ onSuccess={(res, msg): any => {
832
+ urlsInstruction = []
833
+ res?.map?.((item: any) => {
834
+ let matches = item.match(/(https?:\/\/[^\s]+)/g);
835
+ if (matches) {
836
+ urlsInstruction.push(...matches)
837
+ }
838
+ })
839
+ return (
840
+ <View style={{ margin: 15 }}>
841
+ {
842
+ res?.map((item: any, i: number) => {
843
+ const urls = item.match(/(https?:\/\/[^\s]+)/g)
844
+ const text = item.replace(urls?.[0], '~:::~')
845
+ const texts = text.split('~:::~')
846
+ return (
847
+ <TouchableOpacity key={i + 1} onPress={() => {
848
+ if (item.match(/(https?:\/\/[^\s]+)/g)) {
849
+ Linking.openURL(urls[0])
850
+ }
851
+ }}>
852
+ <Text allowFontScaling={false} style={{ flexWrap: 'wrap', marginBottom: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", lineHeight: 18, color: "#4a4a4a", marginTop: 4 }}>
853
+ {texts?.[0]}
854
+ {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>}
855
+ {texts?.[1]}
856
+ </Text>
857
+ </TouchableOpacity>
858
+ )
859
+ })
860
+ }
861
+
862
+ {
863
+ urlsInstruction?.length > 0 && urlsInstruction?.map((item: any, i: number) => {
864
+ return (
865
+ <View key={i + 1} style={{ padding: 10, marginTop: 10, flexDirection: 'row-reverse' }}>
866
+ <TouchableOpacity onPress={() => {
867
+ LibUtils.share(item)
868
+ }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
869
+ <LibIcon color="#fff" name="share" />
870
+ </TouchableOpacity>
871
+ <TouchableOpacity onPress={() => {
872
+ LibUtils.copyToClipboard(item)
873
+ LibToastProperty.show(esp.lang("event/order_detail", "copied"))
874
+ }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
875
+ <LibIcon color="#fff" name="content-copy" />
876
+ </TouchableOpacity>
877
+ <TouchableOpacity onPress={() => {
878
+ Linking.openURL(item)
879
+ }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
880
+ <LibIcon.MaterialIcons color="#fff" name="open-in-browser" />
881
+ </TouchableOpacity>
882
+ </View>
883
+ )
884
+ })
885
+ }
763
886
 
764
- {
765
- coupons?.list?.map((item: any, i: number) => {
766
- return (
767
- <TouchableOpacity key={i} onPress={() => {
768
- esp.modProp("event/coupon").getCouponDetail(item?.url_detail_coupon)
769
- }} style={[{ marginBottom: 4, margin: 15, borderRadius: 15, backgroundColor: '#fff' }, LibStyle.elevation(2)]}>
770
- <LibPicture source={{ uri: item.image }} resizeMode="cover" style={{ height: (LibStyle.width - 60) * 0.43, width: LibStyle.width - 60, borderRadius: 5 }} />
771
- <View style={{ position: 'absolute', top: (((LibStyle.width - 60) * 0.43) / 2) - 10, marginBottom: 15, flexDirection: 'row', justifyContent: 'space-between' }} >
772
- <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginLeft: -9.5 }} />
773
- <View style={{ flex: 1 }} />
774
- <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginRight: -9.5 }} />
775
887
  </View>
776
- </TouchableOpacity>
777
- )
778
- })
779
- }
888
+ )
889
+ }}
890
+ onError={(err) => {
891
+ return (
892
+ <EventMessage
893
+ message={err?.message}
894
+ />
895
+ )
896
+ }}
897
+ />
898
+ </View>
899
+ </LibCollaps>
900
+ }
780
901
 
781
- {
782
- coupons?.pages > 1 &&
783
- <TouchableOpacity onPress={() => {
784
- LibNavigation.navigate("event/coupon")
785
- }}>
786
- <View style={{ marginTop: 10, alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 50 }}>
787
- <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>
902
+ {/* term n condition */}
903
+ {
904
+ result?.url_term != "" &&
905
+ <LibCollaps
906
+ header={(show) =>
907
+ <View style={{ margin: 15, alignContent: 'center', alignItems: 'center', paddingHorizontal: 15, marginBottom: 0, borderRadius: 7, backgroundColor: '#fff', paddingBottom: 10, paddingTop: 10, flexDirection: 'row' }}>
908
+ <View style={{ flex: 1 }}>
909
+ <Text style={{ fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{esp.lang("event/order_detail", "tos")}</Text>
788
910
  </View>
789
- </TouchableOpacity>
911
+ <LibIcon name={!show ? "chevron-down" : "chevron-up"} />
912
+ </View>
790
913
  }
791
- </View>
914
+ >
915
+ <View style={{ backgroundColor: '#fff', marginTop: 1, borderRadius: 7, overflow: 'hidden', marginHorizontal: 15, marginBottom: 0 }}>
916
+ <LibCurl_view
917
+ url={result?.url_term}
918
+ onSuccess={(res, msg): any => {
919
+ return (
920
+ <View>
921
+ {res?.map(renderTermItem)}
922
+ </View>
923
+ )
924
+ }}
925
+ onError={(err) => {
926
+ return (
927
+ <EventMessage
928
+ message={err?.message}
929
+ />
930
+ )
931
+ }}
932
+ />
933
+ </View>
934
+ </LibCollaps>
792
935
  }
793
936
 
794
937
  <View style={{ margin: 15, marginBottom: 0, padding: 16, borderRadius: 5, backgroundColor: '#fff' }}>
@@ -807,80 +950,26 @@ export default function m(props: EventOrder_detailProps): any {
807
950
  <Text allowFontScaling={false} style={{ alignContent: 'center', alignItems: 'center', fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "right", color: "#9b9b9b" }}>{result?.payment_title}</Text>
808
951
  </View>
809
952
  }
810
- </View>
811
-
812
- {
813
- result?.status == 1 && result?.instructions?.length > 0 &&
814
- <View style={{ margin: 15, marginBottom: 5, padding: 16, borderRadius: 5, backgroundColor: '#fff' }}>
815
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail", "how_to_use")}</Text>
816
- {
817
- result?.instructions.map((item: any, i: number) => {
818
- const urls = item.match(/(https?:\/\/[^\s]+)/g)
819
- const text = item.replace(urls?.[0], '~:::~')
820
- const texts = text.split('~:::~')
821
- return (
822
- <TouchableOpacity key={i + 1} onPress={() => {
823
- if (item.match(/(https?:\/\/[^\s]+)/g)) {
824
- Linking.openURL(urls[0])
825
- }
826
- }}>
827
- <Text allowFontScaling={false} style={{ flexWrap: 'wrap', marginBottom: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", lineHeight: 18, color: "#4a4a4a", marginTop: 4 }}>
828
- {texts?.[0]}
829
- {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>}
830
- {texts?.[1]}
831
- </Text>
832
- </TouchableOpacity>
833
- )
834
- })
835
- }
836
953
 
837
- {
838
- urlsInstruction.length > 0 && urlsInstruction.map((item: any, i: number) => {
839
- return (
840
- <View key={i + 1} style={{ padding: 10, marginTop: 10, flexDirection: 'row-reverse' }}>
841
- <TouchableOpacity onPress={() => {
842
- LibUtils.share(item)
843
- }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
844
- <LibIcon color="#fff" name="share" />
845
- </TouchableOpacity>
846
- <TouchableOpacity onPress={() => {
847
- LibUtils.copyToClipboard(item)
848
- LibToastProperty.show(esp.lang("event/order_detail", "copied"))
849
- }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
850
- <LibIcon color="#fff" name="content-copy" />
851
- </TouchableOpacity>
852
- <TouchableOpacity onPress={() => {
853
- Linking.openURL(item)
854
- }} style={{ ...LibStyle.elevation(5), alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, height: 40, width: 40, borderRadius: 20, marginHorizontal: 10 }}>
855
- <LibIcon.MaterialIcons color="#fff" name="open-in-browser" />
856
- </TouchableOpacity>
857
- </View>
858
- )
859
- })
860
- }
954
+ {
955
+ result?.url_ticket != "" &&
956
+ <TouchableOpacity
957
+ onPress={() => {
958
+ LibNavigation.navigate('event/order_detail_visitor', { url: result?.url_ticket, url_addition: result?.url_addition })
959
+ }}
960
+ style={{ ...LibStyle.elevation(2), marginTop: 15, alignContent: 'center', alignItems: 'center', borderWidth: 1, borderColor: LibStyle.colorBgGrey, padding: 10, backgroundColor: '#fff', borderRadius: 5, flexDirection: 'row' }}>
961
+ <View style={{ flex: 1 }}>
962
+ <Text style={{ fontWeight: 'bold', fontSize: 14, color: "#495057" }}>{esp.lang("event/order_detail", "buyer_detail")}</Text>
963
+ </View>
964
+ <LibIcon name={"chevron-right"} />
965
+ </TouchableOpacity>
966
+ }
967
+ </View>
861
968
 
862
- </View>
863
- }
864
- {
865
- termData?.length > 0 &&
866
- <View style={{ margin: 16, borderRadius: 5, padding: 10, backgroundColor: 'white' }} >
867
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail", "tos")}</Text>
868
- {termData?.map(renderTermItem)}
869
- </View>
870
- }
871
- {
872
- result?.url_ticket != "" &&
873
- <TouchableOpacity onPress={() => {
874
- LibNavigation.navigate('event/order_detail_visitor', { url: result?.url_ticket, url_addition: result?.url_addition })
875
- }} style={{ ...LibStyle.elevation(3), margin: 15, padding: 16, borderRadius: 5, backgroundColor: '#fff', flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' }}>
876
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail", "buyer_detail")}</Text>
877
- <LibIcon name='chevron-right-circle-outline' size={30} color={LibStyle.colorBlue} />
878
- </TouchableOpacity>
879
- }
880
969
 
881
970
  {
882
971
  esp.isDebug("") &&
883
- <View style={{ padding: 5 }}>
972
+ <View style={{ padding: 5, marginTop: 15 }}>
884
973
  <EventButton label={esp.lang("event/order_detail", "send_to_email")} onPress={() => {
885
974
  LibToastProperty.show("Coming Soon")
886
975
  }} backgroundColor={"#FFF"} borderColor={LibStyle.colorGreen} fontColor={LibStyle.colorGreen} />