esoftplay-event 0.0.2 → 0.0.3

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.
Files changed (100) hide show
  1. package/event/additional.tsx +1 -1
  2. package/event/additional_input.tsx +15 -0
  3. package/event/additional_new.tsx +565 -0
  4. package/event/artist.tsx +14 -34
  5. package/event/artist_detail.tsx +336 -239
  6. package/event/artist_detail_multi.tsx +266 -157
  7. package/event/artist_detailv2.tsx +129 -69
  8. package/event/artistv2.tsx +5 -13
  9. package/event/button.tsx +2 -2
  10. package/event/button_order_detail.tsx +20 -8
  11. package/event/capture.tsx +2 -0
  12. package/event/checkout.ts +135 -0
  13. package/event/countdown.tsx +13 -9
  14. package/event/countdown_base.tsx +88 -48
  15. package/event/countdown_event.tsx +3 -0
  16. package/event/countdown_timestamp.tsx +106 -0
  17. package/event/coupon.tsx +1 -1
  18. package/event/coupon_generate.tsx +35 -22
  19. package/event/detail.tsx +9 -15
  20. package/event/detail2.tsx +63 -61
  21. package/event/dialog_custom.tsx +67 -0
  22. package/event/exchange_ticket_list.tsx +23 -14
  23. package/event/exchange_ticket_result.tsx +1 -1
  24. package/event/firebase_socket.ts +14 -12
  25. package/event/htmltext.tsx +40 -28
  26. package/event/index.tsx +8 -2
  27. package/event/label_input.tsx +2 -2
  28. package/event/layout.tsx +312 -0
  29. package/event/loading_page.tsx +62 -82
  30. package/event/message.tsx +2 -2
  31. package/event/order_detail.tsx +408 -477
  32. package/event/order_detail_addons.tsx +60 -0
  33. package/event/order_detail_addons_booked.tsx +61 -0
  34. package/event/order_detail_coupon.tsx +66 -0
  35. package/event/order_detail_instruction.tsx +96 -0
  36. package/event/order_detail_payment.tsx +1 -1
  37. package/event/order_detail_reschedule.tsx +109 -0
  38. package/event/order_detail_return.tsx +231 -0
  39. package/event/order_detail_review.tsx +174 -0
  40. package/event/order_detail_share.tsx +304 -0
  41. package/event/order_detail_tnc.tsx +76 -0
  42. package/event/order_detail_upgrade.tsx +140 -90
  43. package/event/order_detail_upgrade_payment.tsx +120 -38
  44. package/event/order_detail_visitor.tsx +21 -10
  45. package/event/order_detail_waiting.tsx +3 -3
  46. package/event/order_history.tsx +1 -1
  47. package/event/order_item.tsx +1 -1
  48. package/event/order_lottery.tsx +1 -1
  49. package/event/order_reschedule.tsx +29 -16
  50. package/event/order_share_to.tsx +14 -0
  51. package/event/order_waiting.tsx +1 -1
  52. package/event/payment_subscribe.tsx +18 -0
  53. package/event/point_events.tsx +35 -0
  54. package/event/point_redemption.tsx +101 -0
  55. package/event/point_redemption_exchange.tsx +60 -0
  56. package/event/point_redemption_input.tsx +56 -0
  57. package/event/point_redemption_success.tsx +50 -0
  58. package/event/point_summary.tsx +48 -0
  59. package/event/popup.tsx +4 -4
  60. package/event/queue.tsx +111 -0
  61. package/event/queue_pricing.tsx +17 -6
  62. package/event/review_add.tsx +2 -2
  63. package/event/scan_item.tsx +1 -1
  64. package/event/schedule.tsx +33 -30
  65. package/event/schedule2.tsx +86 -0
  66. package/event/seat.tsx +135 -374
  67. package/event/seat_map.tsx +8 -8
  68. package/event/seat_map_new.tsx +211 -38
  69. package/event/step.tsx +1 -1
  70. package/event/test.tsx +8 -8
  71. package/event/ticket.tsx +326 -0
  72. package/event/ticket_list.tsx +316 -258
  73. package/event/ticket_list2.tsx +349 -224
  74. package/event/ticket_list_item.tsx +61 -0
  75. package/event/ticket_list_new.tsx +710 -0
  76. package/event/tms_add_result.tsx +10 -5
  77. package/event/tms_check_ticket_result.tsx +16 -7
  78. package/event/tms_dashboard.tsx +87 -12
  79. package/event/tms_gate.tsx +32 -15
  80. package/event/tms_home.tsx +178 -92
  81. package/event/tms_idcard.tsx +43 -26
  82. package/event/tms_in.tsx +2 -3
  83. package/event/tms_in_failed.tsx +1 -1
  84. package/event/tms_in_hall.tsx +4 -1
  85. package/event/tms_in_hall_failed.tsx +36 -16
  86. package/event/tms_in_log.tsx +9 -11
  87. package/event/tms_in_success.tsx +13 -8
  88. package/event/tms_log.tsx +16 -17
  89. package/event/tms_out_hall_failed.tsx +1 -1
  90. package/event/tms_out_temporary.tsx +3 -4
  91. package/event/token_order.tsx +103 -0
  92. package/event/token_payment.tsx +79 -0
  93. package/event/visitor_index.tsx +60 -49
  94. package/event/visitor_input.tsx +336 -54
  95. package/event/visitor_inputv2.tsx +173 -88
  96. package/event/voucher.tsx +1 -1
  97. package/id.json +76 -4
  98. package/package.json +1 -1
  99. package/event/secure_page.debug.tsx +0 -34
  100. package/event/secure_page.live.tsx +0 -35
@@ -6,18 +6,19 @@ import { useEffect } from 'react';
6
6
 
7
7
  import { applyStyle } from 'esoftplay';
8
8
  import { EventButton } from 'esoftplay/cache/event/button/import';
9
+ import { EventCheckout } from 'esoftplay/cache/event/checkout/import';
9
10
  import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
10
11
  import { EventMessage } from 'esoftplay/cache/event/message/import';
11
12
  import { LibCurl } from 'esoftplay/cache/lib/curl/import';
12
- import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
13
13
  import { LibList } from 'esoftplay/cache/lib/list/import';
14
14
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
15
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
15
16
  import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
16
17
  import { LibUtils } from 'esoftplay/cache/lib/utils/import';
17
18
  import esp from 'esoftplay/esp';
18
19
  import useSafeState from 'esoftplay/state';
19
20
  import React from 'react';
20
- import { Pressable, Text, View } from 'react-native';
21
+ import { ActivityIndicator, Pressable, Text, View } from 'react-native';
21
22
 
22
23
 
23
24
  export interface EventOrder_detail_upgradeArgs {
@@ -28,9 +29,10 @@ export interface EventOrder_detail_upgradeProps {
28
29
  }
29
30
  export default function m(props: EventOrder_detail_upgradeProps): any {
30
31
  const { dataTicket, url }: any = esp.mod("lib/navigation").getArgsAll(props)
31
- const [selectedTicket, setSelectedTicket] = useSafeState()
32
- const [result, setResult] = useSafeState()
32
+ const [selectedTicket, setSelectedTicket, getSelectedTicket] = useSafeState()
33
+ const [result, setResult, getResult] = useSafeState()
33
34
  const [error, setError] = useSafeState()
35
+ const [loading, setLoading] = useSafeState(false)
34
36
  // const [resultEvent, setResultEvent] = useSafeState()
35
37
 
36
38
  function loadDataUpgradeTicket() {
@@ -56,6 +58,70 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
56
58
  // loadDataEvent()
57
59
  }, [])
58
60
 
61
+ function renderItem(item: any, i: number) {
62
+ let textOpacity = item?.status == 1 ? 1 : 0.3
63
+ let ticketWithDate = item.price_date == 1 && item.use_code == 0
64
+ let selTic = selectedTicket?.selected_ticket?.id == item.id
65
+ return (
66
+ <Pressable onPress={() => {
67
+ if (item.status == 1) {
68
+ let a = {
69
+ event_id: dataTicket?.event_id,
70
+ selected_ticket: {
71
+ ...item,
72
+ price_to: item?.is_remainer == 0 ? (Number(item?.amount_difference) / Number(dataTicket?.qty_upgrade)) : item?.price_to, //kondisi jika upgrade fixprice
73
+ price_id: item.price_id_to,
74
+ list: {
75
+ ondate: item.ondate
76
+ },
77
+ },
78
+ qty: dataTicket?.qty_upgrade,
79
+ // tax_event: item.tax
80
+ }
81
+ setSelectedTicket(a)
82
+ }
83
+ }} key={i} style={{
84
+
85
+ margin: 15, marginTop: 0, borderRadius: 5, overflow: 'hidden', borderWidth: 1.5, borderColor: selTic ? LibStyle.colorBlue : LibStyle.colorBgGrey
86
+ }}>
87
+ <View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius: 5, borderTopRightRadius: 5 }}>
88
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
89
+ <View style={{ flex: 3 }}>
90
+ <EventHtmltext allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold', color: item.status != 1 ? "#c9c9c9" : selTic ? LibStyle.colorBlue : "#000" }}>{item.price_name_to} </EventHtmltext>
91
+ </View>
92
+ {
93
+ item?.status != 1 &&
94
+ <View style={applyStyle({ alignSelf: 'center', flexDirection: 'row' })}>
95
+ <View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', borderWidth: 1, backgroundColor: (item.status == 0 || item?.status == 3) ? LibStyle.colorRed : "#4cd964", borderColor: (item.status == 0 || item?.status == 3) ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 })}>
96
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: "#fff", fontWeight: 'bold' })}>{item?.status_text}</Text>
97
+ </View>
98
+ </View>
99
+ }
100
+ </View>
101
+ {
102
+ item.info != "" && ticketWithDate &&
103
+ <View style={{ marginTop: 3, alignContent: 'center', alignItems: 'center', flexDirection: 'row', marginRight: 5 }}>
104
+ <Text allowFontScaling={false} style={{ fontSize: 12, color: LibStyle.colorBlue }}>{item.info}</Text>
105
+ </View>
106
+ }
107
+ </View>
108
+ <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', padding: 10, alignItems: 'center' }}>
109
+ <View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
110
+ <LibPicture source={esp.assets('icons/ic_special2.png')} style={{ height: 42, width: 42 }} />
111
+ <View style={{ marginLeft: 14, flex: 1 }} >
112
+ {
113
+ item.info != "" &&
114
+ <EventHtmltext allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: "Arial", fontSize: 11, fontStyle: "normal", letterSpacing: 0, color: '#999' }}>{item.info}</EventHtmltext>
115
+ }
116
+ </View>
117
+ <Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold', marginTop: 5, color: item.status != 1 ? "#c9c9c9" : selTic ? LibStyle.colorBlue : "#000" }}>{"+ "}{item?.is_remainer == "0" ? LibUtils.money(item?.price_difference, item?.currency) : LibUtils.money(item?.amount_difference, item?.currency)}</Text>
118
+
119
+ </View>
120
+ </View>
121
+ </Pressable>
122
+ )
123
+ }
124
+
59
125
  if (!result && !error) {
60
126
  const LibLoading = esp.mod("lib/loading")
61
127
  return <LibLoading />
@@ -78,6 +144,15 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
78
144
  )
79
145
  }
80
146
 
147
+ const sorted = result?.list?.sort((a: any, b: any) => {
148
+ // jika a.status = 1 dan b bukan 1 → a di atas
149
+ if (a.status == 1 && b.status != 1) return -1;
150
+ // jika b.status = 1 dan a bukan 1 → b di atas
151
+ if (b.status == 1 && a.status != 1) return 1;
152
+ // jika dua-duanya sama statusnya → urutan tidak berubah
153
+ return 0;
154
+ });
155
+
81
156
  return (
82
157
  <View style={{ flex: 1 }} >
83
158
  <EventHeader title={esp.lang("event/order_detail_upgrade", "header_title")} subtitle={dataTicket?.event_name} />
@@ -85,8 +160,8 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
85
160
  <LibTextstyle textStyle='m_overline' text={esp.lang("event/order_detail_upgrade", "current_ticket")} style={{ fontSize: 12, margin: 15, marginBottom: 0 }} />
86
161
 
87
162
  <View style={{ ...LibStyle.elevation(2), margin: 15, width: LibStyle.width - 30, borderRadius: 10, backgroundColor: LibStyle.colorBgGrey, padding: 10, height: 100, alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
88
- <EventHtmltext allowFontScaling={false} style={{ marginHorizontal: 5, fontSize: 20, color: "#000", textAlign: 'center', fontWeight: 'bold' }} numberOfLines={2} ellipsizeMode={'tail'}>{dataTicket?.price_name}</EventHtmltext>
89
- <Text allowFontScaling={false} style={{ color: "#000", marginTop: 10 }}>{LibUtils.money(dataTicket.total, dataTicket?.currency)}</Text>
163
+ <EventHtmltext allowFontScaling={false} style={{ marginHorizontal: 5, fontSize: 20, color: "#000", textAlign: 'center', fontWeight: 'bold' }} numberOfLines={2} ellipsizeMode={'tail'}>{result?.price_name_from || dataTicket?.price_name}</EventHtmltext>
164
+ <Text allowFontScaling={false} style={{ color: "#000", marginTop: 10 }}>{LibUtils.money(result?.total_from, result?.currency || dataTicket?.currency)}</Text>
90
165
 
91
166
  <View style={applyStyle({ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 })}>
92
167
  <View style={applyStyle({ width: 25, height: 25, borderRadius: 12.5, backgroundColor: "#fff", marginLeft: -12.5 })} />
@@ -98,106 +173,81 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
98
173
  <LibTextstyle textStyle='m_overline' text={esp.lang("event/order_detail_upgrade", "upgrade_to")} style={{ fontSize: 12, margin: 15, marginBottom: 10 }} />
99
174
 
100
175
  <LibList
101
- data={result?.list}
176
+ data={sorted}
102
177
  extraData={selectedTicket}
103
- renderItem={(item: any, i: number) => {
104
- return (
105
- <Pressable onPress={() => {
106
- if (item.status == 1) {
107
- let a = {
108
- event_id: dataTicket?.event_id,
109
- selected_ticket: {
110
- ...item,
111
- price_id: item.price_id_to,
112
- list: {
113
- ondate: item.ondate
114
- },
115
- },
116
- qty: dataTicket?.qty_upgrade,
117
- tax_event: item.tax
118
- }
119
- setSelectedTicket(a)
120
- } else {
121
- LibDialog.warning(esp.lang("event/order_detail_upgrade", "oops"), item.message_error)
122
- }
123
- }} key={i} style={{
124
- ...LibStyle.elevation(2), marginHorizontal: 15, marginTop: 2.5, marginBottom: 10, borderRadius: 10,
125
- backgroundColor: item.status == 0 ? LibStyle.colorBgGrey : selectedTicket?.selected_ticket?.id == item.id ? LibStyle.colorGreen : "#fff", padding: 10, alignContent: 'center', alignItems: 'center', justifyContent: 'center'
126
- }}>
127
- <EventHtmltext allowFontScaling={false} style={{ marginHorizontal: 5, fontSize: 16, color: item.status == 0 ? "#c9c9c9" : selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#000", textAlign: 'center', fontWeight: 'bold' }} numberOfLines={2} ellipsizeMode={'tail'}>{item?.price_name_to}</EventHtmltext>
128
- <Text allowFontScaling={false} style={{ fontSize: 14, fontWeight: 'bold', marginTop: 5, color: item.status == 0 ? "#c9c9c9" : selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#000" }}>{"+ " + LibUtils.money(Number(dataTicket?.qty_upgrade) * Number(item?.amount), item?.currency)}</Text>
129
-
130
- {
131
- item.info &&
132
- <Text allowFontScaling={false} style={{ marginTop: 10, fontSize: 12, color: selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#c9c9c9" }}>{item.info}</Text>
133
- }
134
-
135
- </Pressable>
136
- )
137
- }}
178
+ renderItem={renderItem}
138
179
  />
139
180
 
140
181
  </View>
141
182
  <View style={{ padding: 10 }}>
142
- <EventButton label={esp.lang("event/order_detail_upgrade", "btn_next")} onPress={() => {
143
- if (selectedTicket) {
144
- if (selectedTicket?.selected_ticket?.use_seat == 1 && selectedTicket?.selected_ticket?.seat_autopick == 0) {
145
- LibNavigation.navigateForResult('event/seat_map_new', {
146
- url: 'event_seat',
147
- dataTicket: selectedTicket
148
- }).then((value) => {
149
- let seatData: any = {}
150
- seatData.seat_label = value?.seat_label
151
- LibNavigation.navigate('event/order_detail_upgrade_payment', {
152
- dataTicket: {
153
- url_payment: result?.url_payment,
154
- price_name: dataTicket?.price_name,
155
- booking_id: dataTicket?.id,
156
- qty_upgrade: dataTicket?.qty_upgrade,
157
- tax_event: selectedTicket?.tax_event,
158
- ondate: dataTicket?.ondate,
159
- event_title: dataTicket?.event_name,
160
- event_id: dataTicket?.event_id,
161
- // ...dataTicket
162
- },
163
- selectedTicket: {
164
- ...selectedTicket,
165
- ...seatData
166
- },
167
- fee_platform: {
168
- fee_platform_amount: selectedTicket?.selected_ticket?.fee_platform_amount,
169
- fee_platform_type: selectedTicket?.selected_ticket?.fee_platform_type,
183
+ {
184
+ loading ?
185
+ <View style={{ minWidth: '100%', alignSelf: 'center' }} >
186
+ <View style={{ borderWidth: 1, borderColor: 'rgba(0, 0, 0, 0)', height: 40, borderRadius: 16, backgroundColor: "#e6e6e6", alignItems: 'center', justifyContent: 'center', paddingHorizontal: 9 }} >
187
+ <ActivityIndicator size={"small"} color={LibStyle.colorPrimary} />
188
+ </View>
189
+ </View> :
190
+ <EventButton label={esp.lang("event/order_detail_upgrade", "btn_next")} onPress={async () => {
191
+ const selectedTicket = getSelectedTicket()
192
+
193
+ if (!selectedTicket) {
194
+ LibToastProperty.show(esp.lang("event/order_detail_upgrade", "select_ticket"))
195
+ return
196
+ }
197
+
198
+ let seatData: any = {}
199
+ if (selectedTicket?.selected_ticket?.use_seat == 1) {
200
+ if (selectedTicket?.selected_ticket?.seat_autopick != 1) {
201
+ const seat = await LibNavigation.navigateForResult('event/seat_map_new', {
202
+ url: 'event_seat',
203
+ dataTicket: selectedTicket
204
+ })
205
+ seatData = {
206
+ ...seatData,
207
+ seat_label: seat?.seat_label
170
208
  }
171
- })
172
- })
173
- } else {
174
- LibNavigation.navigate('event/order_detail_upgrade_payment', {
209
+ }
210
+ }
211
+
212
+ setLoading(true)
213
+ const config = await EventCheckout().curlPriceConfig(getResult()?.url_price_config, selectedTicket?.selected_ticket?.price_id_to)
214
+ setLoading(false)
215
+
216
+ const args = {
175
217
  dataTicket: {
176
218
  url_payment: result?.url_payment,
177
- price_name: dataTicket?.price_name,
219
+ url_upgrade: result?.url_upgrade,
220
+ price_name: result?.price_name_from || dataTicket?.price_name,
221
+ previous_total: selectedTicket?.selected_ticket?.is_remainer == 0 ? 0 : Number(result?.total_from),//kondisi jika upgrade fixprice
178
222
  booking_id: dataTicket?.id,
179
223
  qty_upgrade: dataTicket?.qty_upgrade,
180
- tax_event: selectedTicket?.tax_event,
224
+ tax_event: config?.tax,
181
225
  ondate: dataTicket?.ondate,
182
226
  event_title: dataTicket?.event_name,
183
227
  event_id: dataTicket?.event_id,
184
- // ...dataTicket
185
228
  },
186
- selectedTicket: selectedTicket,
229
+ selectedTicket: {
230
+ ...selectedTicket,
231
+ ...seatData
232
+ },
187
233
  fee_platform: {
188
- fee_platform_amount: selectedTicket?.selected_ticket?.fee_platform_amount,
189
- fee_platform_type: selectedTicket?.selected_ticket?.fee_platform_type,
234
+ fee_platform_amount: config?.fee_platform_amount,
235
+ fee_platform_type: config?.fee_platform_type,
236
+ },
237
+ fee_custom: {
238
+ fee_custom_label: config?.fee_custom_label,
239
+ fee_custom_amount: config?.fee_custom_amount,
240
+ fee_custom_type: config?.fee_custom_type,
190
241
  }
191
- })
192
- }
193
- } else {
194
- LibToastProperty.show(esp.lang("event/order_detail_upgrade", "select_ticket"))
195
- return
196
- }
197
- }}
198
- backgroundColor={selectedTicket ? LibStyle.colorGreen : LibStyle.colorGrey}
199
- fontColor='#fff'
200
- />
242
+ }
243
+
244
+ LibNavigation.navigate('event/order_detail_upgrade_payment', args)
245
+
246
+ }}
247
+ backgroundColor={selectedTicket ? LibStyle.colorGreen : LibStyle.colorGrey}
248
+ fontColor='#fff'
249
+ />
250
+ }
201
251
  </View>
202
252
  </View>
203
253
  )
@@ -1,21 +1,24 @@
1
1
  // withHooks
2
- import { useRef } from 'react';
2
+ import { useMemo, useRef } from 'react';
3
3
 
4
- import { BigbangPayment_detail, BigbangPayment_detailProperty } from 'esoftplay/cache/bigbang/payment_detail/import';
5
- import { BigbangPayment_list } from "esoftplay/cache/bigbang/payment_list/import";
4
+ import { BigbangPayment_detail_ticket, BigbangPayment_detail_ticketProperty } from 'esoftplay/cache/bigbang/payment_detail_ticket/import';
5
+ import { BigbangPayment_list, BigbangPayment_listProperty } from "esoftplay/cache/bigbang/payment_list/import";
6
6
  import { EventButton } from "esoftplay/cache/event/button/import";
7
7
  import { EventHeader } from "esoftplay/cache/event/header/import";
8
8
  import { EventTransaction } from 'esoftplay/cache/event/transaction/import';
9
9
  import { LibCurl } from "esoftplay/cache/lib/curl/import";
10
10
  import { LibDialog } from "esoftplay/cache/lib/dialog/import";
11
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
11
12
  import { LibNavigation } from "esoftplay/cache/lib/navigation/import";
12
13
  import { LibProgress } from "esoftplay/cache/lib/progress/import";
13
14
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
14
15
  import { LibStyle } from "esoftplay/cache/lib/style/import";
15
16
  import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
17
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
18
+ import { PaymentFee_calculate } from 'esoftplay/cache/payment/fee_calculate/import';
16
19
  import esp from "esoftplay/esp";
17
20
  import useSafeState from "esoftplay/state";
18
- import { Linking, ScrollView, Text, View } from "react-native";
21
+ import { Linking, Pressable, ScrollView, Text, View } from "react-native";
19
22
 
20
23
 
21
24
 
@@ -25,10 +28,10 @@ export interface EventOrder_detail_upgrade_paymentArgs {
25
28
  export interface EventOrder_detail_upgrade_paymentProps {
26
29
 
27
30
  }
31
+
28
32
  export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
29
- const { dataTicket, selectedTicket, fee_platform }: any = LibNavigation.getArgsAll(props)
30
- const [selectedPayment, setSelectedPayment] = useSafeState<any>()
31
- const [platformFee, setPlatformFee] = useSafeState<any>(fee_platform)
33
+ const { dataTicket, selectedTicket, fee_platform, fee_custom }: any = LibNavigation.getArgsAll(props)
34
+ const [selectedPayment, setSelectedPayment] = BigbangPayment_listProperty.paymentState.useState()
32
35
  const [charge, setCharge] = useSafeState<any>(0)
33
36
  const [chargePercent, setChargePercent] = useSafeState<any>()
34
37
 
@@ -37,7 +40,6 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
37
40
  const scrollYRef = useRef(0)
38
41
  const dialogSeat = useRef<LibSlidingup>(null)
39
42
 
40
- esp.log({ dataTicket, selectedTicket });
41
43
 
42
44
  function doUpgrade(pin?: any) {
43
45
  const LibToastProperty = esp.modProp("lib/toast")
@@ -56,7 +58,7 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
56
58
  }
57
59
 
58
60
  if (selectedTicket?.selected_ticket?.use_seat == 1) {
59
- post.seat_label = selectedTicket?.seat_label.join('|')
61
+ post.seat_label = selectedTicket?.seat_label?.join('|')
60
62
  }
61
63
 
62
64
  if (selectedTicket?.selected_ticket?.seat_autopick == 1) {
@@ -67,7 +69,7 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
67
69
  post.pin = pin
68
70
  }
69
71
  LibProgress.show(esp.lang("event/order_detail_upgrade_payment", "confirm_wait"))
70
- new LibCurl('event_order_detail_upgrade_checkout', post, (res, msg) => {
72
+ new LibCurl(dataTicket?.url_upgrade || 'event_order_detail_upgrade_checkout', post, (res, msg) => {
71
73
  LibProgress.hide()
72
74
  LibNavigation.reset()
73
75
  if (res?.hasOwnProperty('url_mobile') && res?.url_mobile != null) {
@@ -110,14 +112,24 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
110
112
  return (percent * amount) / 100
111
113
  }
112
114
 
113
- let amount = Number(selectedTicket?.selected_ticket?.amount_difference) * Number(dataTicket?.qty_upgrade)
114
- let _tax = percentageCalculator(amount, dataTicket?.tax_event)
115
- let subtotalWithTax = amount + _tax
115
+ const price = Number(selectedTicket?.selected_ticket?.price_to || selectedTicket?.selected_ticket?.amount_difference)
116
+ const qty = Number(dataTicket?.qty_upgrade)
117
+
118
+ const calculate = PaymentFee_calculate(price, qty,
119
+ {
120
+ fee_platform_type: fee_platform?.fee_platform_type || "NONE",
121
+ fee_platform_amount: fee_platform?.fee_platform_amount || 0,
122
+ fee_custom_type: fee_custom?.fee_custom_type || "NONE",
123
+ fee_custom_amount: fee_custom?.fee_custom_amount || 0,
124
+ discount_type: "NONE",
125
+ discount_amount: 0,
126
+ tax: dataTicket?.tax_event || 0
127
+ }
128
+ )
116
129
 
117
- let _fee_platform_type = platformFee?.fee_platform_type
118
- let _fee_platform = _fee_platform_type == "NOMINAL" ? Number(platformFee?.fee_platform_amount || 0) : _fee_platform_type == "PERCENTAGE" ? percentageCalculator(amount, Number(platformFee?.fee_platform_amount || 0)) : 0
119
130
 
120
- let subtotalWithTaxWithFeePlatform = subtotalWithTax + _fee_platform
131
+ let amount = Number(selectedTicket?.selected_ticket?.price_to || selectedTicket?.selected_ticket?.amount_difference) * Number(dataTicket?.qty_upgrade)
132
+ let subtotalWithTaxWithFeePlatform = calculate.subtotal
121
133
 
122
134
  let _charge = amount == 0 ? 0 : Number(charge)
123
135
  let _charge_percent = chargePercent == 0 ? 0 : percentageCalculator(subtotalWithTaxWithFeePlatform, chargePercent)
@@ -126,13 +138,96 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
126
138
  let _amountTotal = Number(subtotalWithTaxWithFeePlatform) + Number(_charge_total)
127
139
 
128
140
  function renderSeatItem(item: any, i: number) {
141
+ const seat = item.includes("#") ? item.split("#")[1] : item
129
142
  return (
130
143
  <View key={i} style={{ margin: 10, marginBottom: 0, marginRight: 5, marginLeft: 5, height: 32, width: 32, backgroundColor: LibStyle.colorBlue, borderWidth: 1, borderColor: LibStyle.colorBlue, borderRadius: 4, justifyContent: 'center', alignContent: 'center', alignItems: 'center' }}>
131
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{item}</Text>
144
+ <Text allowFontScaling={false} adjustsFontSizeToFit style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff", textAlign: "center", textAlignVertical: "center" }}>{seat}</Text>
132
145
  </View>
133
146
  )
134
147
  }
135
148
 
149
+ const currency = selectedTicket?.selected_ticket?.currency || "IDR"
150
+
151
+ const itemData = useMemo(() => {
152
+ const items: BigbangPayment_detail_ticketProperty.BigbangPayment_detail_ticketItem[] = []
153
+
154
+ items.push({
155
+ label: esp.lang("event/order_detail_upgrade_payment", "upgrade_to", dataTicket?.price_name, selectedTicket?.selected_ticket?.price_name_to),
156
+ caption: dataTicket?.ondate != "0000-00-00" ? LibUtils.moment(dataTicket?.ondate).localeFormat("DD MMMM YYYY") : "",
157
+ value: LibUtils.money(price, currency),
158
+ qty: LibUtils.number(qty)
159
+ })
160
+
161
+ //seat
162
+ const name_seat = selectedTicket?.seat_name
163
+ if (name_seat && name_seat.length > 0) {
164
+ const firstSeat = name_seat?.[0]
165
+ const seat = firstSeat.includes("#") ? firstSeat.split("#")[1] : firstSeat
166
+ items.push({
167
+ label: esp.lang("bigbang/payment_detail", "text_seat"),
168
+ value:
169
+ <Pressable onPress={() => dialogSeat.current?.show()} style={{ flexDirection: 'row', justifyContent: 'center', alignContent: 'center', alignItems: 'center' }} >
170
+ <View style={{ marginRight: 5, marginLeft: 5, height: 28, width: 28, backgroundColor: LibStyle.colorBlue, borderWidth: 1, borderColor: LibStyle.colorBlue, borderRadius: 4, justifyContent: 'center', alignContent: 'center', alignItems: 'center' }}>
171
+ <Text allowFontScaling={false} adjustsFontSizeToFit style={{ fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff", textAlign: "center", textAlignVertical: "center" }}>{seat}</Text>
172
+ </View>
173
+ {
174
+ name_seat && name_seat?.length > 1 &&
175
+ <LibIcon.MaterialIcons name="more" style={{ transform: [{ rotate: '180deg' }] }} size={37} color={LibStyle.colorBlue} />
176
+ }
177
+ </Pressable>
178
+ })
179
+ }
180
+
181
+ // Gov tax
182
+ if (dataTicket?.tax_event) {
183
+ if (Number(dataTicket?.tax_event) !== 0) {
184
+ items.push({
185
+ label: esp.lang("bigbang/payment_detail", "tax", String(Number(dataTicket?.tax_event))),
186
+ value: LibUtils.money(calculate.tax, currency)
187
+ })
188
+ } else
189
+ //@ts-ignore
190
+ items.push({
191
+ caption: esp.lang("bigbang/payment_detail", "tax_include")
192
+ })
193
+ }
194
+
195
+ // Platform fee
196
+ if (calculate.platform !== 0) {
197
+ items.push({
198
+ label: esp.lang("bigbang/payment_detail", "fee_apps"),
199
+ value: LibUtils.money(calculate.platform, currency),
200
+ sublabel: (fee_platform?.fee_platform_type !== "NOMINAL") ? "(" + fee_platform?.fee_platform_amount + "%)" : ""
201
+ });
202
+ }
203
+
204
+ // Custom fee
205
+ if (calculate.custom !== 0) {
206
+ items.push({
207
+ label: fee_custom?.fee_custom_label || "Custom Fee",
208
+ value: LibUtils.money(calculate.custom, currency),
209
+ sublabel: (fee_custom?.fee_custom_type !== "NOMINAL") ? "(" + fee_custom?.fee_custom_amount + "%)" : ""
210
+ });
211
+ }
212
+
213
+ //potongan sebelumnya
214
+ if (dataTicket?.previous_total && dataTicket?.previous_total > 0) {
215
+ items.push({
216
+ label: esp.lang("bigbang/payment_detail_ticket", "previous_total"),
217
+ value: "-" + LibUtils.money(dataTicket?.previous_total, currency),
218
+ })
219
+ }
220
+
221
+ // Admin bank
222
+ items.push({
223
+ label: esp.lang("bigbang/payment_detail", "admin_fee"),
224
+ sublabel: esp.modProp("bigbang/payment_detail_ticket").processAdminBank(chargePercent, charge, currency),
225
+ caption: esp.lang("bigbang/payment_detail", "info"),
226
+ value: LibUtils.money(_charge_total, currency),
227
+ })
228
+
229
+ return items
230
+ }, [charge, chargePercent, _charge_total, dataTicket, calculate, price, qty])
136
231
 
137
232
  return (
138
233
  <View style={{ flex: 1, backgroundColor: '#fff' }}>
@@ -144,38 +239,26 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
144
239
  if (currentYPosition >= (LibStyle.height * 0.3)) {
145
240
  if (oldPosition == 0) {
146
241
  scrollYRef.current = nativeEvent.contentOffset.y
147
- BigbangPayment_detailProperty.stateShow.set(false)
242
+ BigbangPayment_detail_ticketProperty.stateShow.set(false)
148
243
  }
149
244
  }
150
245
  }}>
151
246
 
152
247
  {/* detail */}
153
248
  <View style={{ backgroundColor: 'white' }}>
154
- <BigbangPayment_detail
155
- ondate={dataTicket?.ondate}
156
- // onlyBboPay={bboPay}
157
- order_type={14}
158
- priceTotal={amount}
159
- charge={charge}
160
- fee_platform_type={platformFee?.fee_platform_type}
161
- fee_platform_amount={platformFee?.fee_platform_amount}
162
- charge_percent={chargePercent}
163
- // typeTicket={dataBookingEvent?.selected_ticket?.type}
164
- currency={selectedTicket?.selected_ticket?.currency}
165
- qty={dataTicket?.qty_upgrade}
166
- tax={dataTicket?.tax_event}
167
- name_seat={selectedTicket?.seat_name}
168
- onPressSeat={() => {
169
- dialogSeat.current?.show()
170
- }}
171
- title={esp.lang("event/order_detail_upgrade_payment", "upgrade_to", dataTicket?.price_name, selectedTicket?.selected_ticket?.price_name_to)}
172
- event_name={dataTicket?.event_title} />
249
+ <BigbangPayment_detail_ticket
250
+ product_title={esp.lang("event/order_detail_upgrade_payment", "upgrade_to", dataTicket?.price_name, selectedTicket?.selected_ticket?.price_name_to)}
251
+ product_subtitle={dataTicket?.event_title}
252
+ product_price={LibUtils.money(_amountTotal - (dataTicket?.previous_total || 0), currency)}
253
+ itemData={itemData}
254
+ />
173
255
  </View>
174
256
 
175
257
 
176
258
  <BigbangPayment_list
177
259
  eventId={dataTicket?.event_id}
178
260
  url_payment={dataTicket?.url_payment}
261
+ previous_total={dataTicket?.previous_total || 0}
179
262
  onToggleCC={() => { scrollRef.current?.scrollToEnd({ animated: true }) }}
180
263
  order_type={14} // upgrade ticekt
181
264
  currency={selectedTicket?.selected_ticket?.currency}
@@ -186,7 +269,6 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
186
269
  payment_type: Number(item.type),
187
270
  }
188
271
  setSelectedPayment(payment)
189
- setPlatformFee({ fee_platform_type: item?.fee_platform_type || 'NONE', fee_platform_amount: item?.fee_platform_amount || 0 })
190
272
  setCharge(item.charge)
191
273
  setChargePercent(item.charge_percent)
192
274
  }}
@@ -106,6 +106,8 @@ export default function m(props: EventOrder_detail_visitorProps): any {
106
106
  return finalResult
107
107
  }
108
108
 
109
+ esp.log(result);
110
+
109
111
  return (
110
112
  <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
111
113
  <EventHeader title={esp.lang("event/order_detail_visitor", "header")} />
@@ -119,6 +121,7 @@ export default function m(props: EventOrder_detail_visitorProps): any {
119
121
  <View style={{ margin: 15, borderRadius: 10, backgroundColor: '#fff', padding: 10 }}>
120
122
  {
121
123
  result?.tickets?.map((item: any, i: number) => {
124
+ const [front, end] = item?.seat_name?.split("#") || ["", ""];
122
125
  return (
123
126
  <View key={i} style={{ marginLeft: 14, marginBottom: 15, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
124
127
  <View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
@@ -134,11 +137,11 @@ export default function m(props: EventOrder_detail_visitorProps): any {
134
137
  item?.redemption?.length > 0 &&
135
138
  <View style={{ marginTop: 3 }}>
136
139
  <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3", marginTop: 7 }}>{"Item Redemption"}</Text>
137
- <View style={{ flexDirection: 'row', flex: 1, flexWrap: 'wrap', justifyContent: 'space-around' }}>
140
+ <View style={{ marginTop: 5, flexDirection: 'row', flex: 1, flexWrap: 'wrap' }}>
138
141
  {
139
142
  item?.redemption?.map((x: any, ii: number) => {
140
143
  return (
141
- <View key={ii} style={{ borderRadius: 3, marginRight: 6, backgroundColor: LibStyle.colorPrimary, padding: 5 }}>
144
+ <View key={ii} style={{ marginBottom: 6, borderRadius: 3, marginRight: 6, backgroundColor: LibStyle.colorPrimary, padding: 5 }}>
142
145
  <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{x}</Text>
143
146
  </View>
144
147
  )
@@ -149,14 +152,22 @@ export default function m(props: EventOrder_detail_visitorProps): any {
149
152
  }
150
153
  </View>
151
154
  </View>
152
- <View style={{ alignContent: 'center', alignItems: 'center' }}>
153
- {
154
- item.hasOwnProperty('seat_name') && item?.seat_name != "" &&
155
- <View style={{ paddingVertical: 5, paddingHorizontal: 7, borderWidth: 1, borderColor: '#000', backgroundColor: '#fff', borderRadius: 5, marginRight: 7 }}>
156
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: '#000' }}>{item.seat_name}</Text>
157
- </View>
158
- }
159
- </View>
155
+ {
156
+ item.hasOwnProperty('seat_name') && item?.seat_name != "" &&
157
+ <View style={{ alignContent: 'center', alignItems: 'center' }}>
158
+ {
159
+ item?.seat_name?.includes('#') ?
160
+ <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
161
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16, color: "#000" }}> {front} </Text>
162
+ <Text allowFontScaling={false} style={{ marginLeft: 3, fontWeight: 'bold', fontSize: 16, color: '#000', }}> {end} </Text>
163
+ </View>
164
+ :
165
+ <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
166
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: "#000" }}>{item?.seat_name}</Text>
167
+ </View>
168
+ }
169
+ </View>
170
+ }
160
171
  </View>
161
172
  )
162
173
  })
@@ -313,7 +313,7 @@ export default function m(props: EventOrder_waitingProps): any {
313
313
  result?.status == 0 &&
314
314
  <View style={{ alignItems: 'center', justifyContent: 'space-between', flexDirection: 'row', marginTop: 5 }}>
315
315
  <Text allowFontScaling={false} style={{ fontWeight: 'bold', flex: 1, flexWrap: 'wrap', fontSize: 14, fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail_waiting", "expired_payment")}</Text>
316
- <EventCountdown_base expired={moment(result?.exp_payment).serverFormat("YYYY-MM-DD HH:mm:ss", result?.timezone)} style={{ flex: 1, marginLeft: 15, fontSize: 14, color: LibStyle.colorRed, fontFamily: "ArialBold" }} />
316
+ <EventCountdown_base expired={moment(result?.exp_payment).serverFormat("YYYY-MM-DD HH:mm:ss", result?.timezone)} timezone={result?.timezone} style={{ flex: 1, marginLeft: 15, fontSize: 14, color: LibStyle.colorRed, fontFamily: "ArialBold" }} />
317
317
  </View>
318
318
  }
319
319
 
@@ -397,7 +397,7 @@ export default function m(props: EventOrder_waitingProps): any {
397
397
  }
398
398
 
399
399
  {
400
- result?.status == 0 && result?.payment?.payment_type != 3 && result?.payment?.payment_type != 4 && result?.payment?.payment_type != 11 && result?.payment?.payment_type != 13 && result?.payment?.payment_type != 14 &&
400
+ result?.status == 0 && result?.payment?.payment_type != 3 && result?.payment?.payment_type != 4 && result?.payment?.payment_type != 11 && result?.payment?.payment_type != 12 && result?.payment?.payment_type != 13 && result?.payment?.payment_type != 14 &&
401
401
  <>
402
402
  <View style={{ height: 3, backgroundColor: "#f6f6f6" }} />
403
403
 
@@ -487,7 +487,7 @@ export default function m(props: EventOrder_waitingProps): any {
487
487
  result?.status == 0 && LibUtils.moment(result?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss', result?.timezone) >= dateNow &&
488
488
  <View style={{ padding: 15, paddingTop: 10, paddingBottom: 10 }}>
489
489
  {
490
- (result?.payment?.payment_type == 3 || result?.payment?.payment_type == 14) && //khusus cc & FPX
490
+ (result?.payment?.payment_type == 3 || result?.payment?.payment_type == 12 || result?.payment?.payment_type == 14) && //khusus cc & FPX
491
491
  <TouchableOpacity onPress={() => {
492
492
  if (result?.hasOwnProperty("has_addition") && result?.has_addition == 1) {
493
493
  LibNavigation.navigateForResult('event/additional', {