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.
@@ -9,15 +9,15 @@ import { EventButton } from 'esoftplay/cache/event/button/import';
9
9
  import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
10
10
  import { EventMessage } from 'esoftplay/cache/event/message/import';
11
11
  import { LibCurl } from 'esoftplay/cache/lib/curl/import';
12
- import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
13
12
  import { LibList } from 'esoftplay/cache/lib/list/import';
14
13
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
14
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
15
15
  import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
16
16
  import { LibUtils } from 'esoftplay/cache/lib/utils/import';
17
17
  import esp from 'esoftplay/esp';
18
18
  import useSafeState from 'esoftplay/state';
19
19
  import React from 'react';
20
- import { Pressable, Text, View } from 'react-native';
20
+ import { ActivityIndicator, Pressable, Text, View } from 'react-native';
21
21
 
22
22
 
23
23
  export interface EventOrder_detail_upgradeArgs {
@@ -28,9 +28,10 @@ export interface EventOrder_detail_upgradeProps {
28
28
  }
29
29
  export default function m(props: EventOrder_detail_upgradeProps): any {
30
30
  const { dataTicket, url }: any = esp.mod("lib/navigation").getArgsAll(props)
31
- const [selectedTicket, setSelectedTicket] = useSafeState()
32
- const [result, setResult] = useSafeState()
31
+ const [selectedTicket, setSelectedTicket, getSelectedTicket] = useSafeState()
32
+ const [result, setResult, getResult] = useSafeState()
33
33
  const [error, setError] = useSafeState()
34
+ const [loading, setLoading] = useSafeState(false)
34
35
  // const [resultEvent, setResultEvent] = useSafeState()
35
36
 
36
37
  function loadDataUpgradeTicket() {
@@ -42,6 +43,19 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
42
43
  })
43
44
  }
44
45
 
46
+ function curlPriceConfig(price_id: string, onDone: (data: any) => void) {
47
+ setLoading(true)
48
+ if (getResult()?.url_price_config) {
49
+ new LibCurl(getResult()?.url_price_config, null, (res, msg) => {
50
+ setLoading(false)
51
+ onDone(res?.[price_id])
52
+ }, (err) => {
53
+ setLoading(false)
54
+ LibToastProperty.show(err?.message)
55
+ })
56
+ }
57
+ }
58
+
45
59
  // function loadDataEvent() {
46
60
  // new LibCurl("event_detail/" + dataTicket?.event_id, null, (res: any, msg: string) => {
47
61
  // setResultEvent(res)
@@ -56,6 +70,69 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
56
70
  // loadDataEvent()
57
71
  }, [])
58
72
 
73
+ function renderItem(item: any, i: number) {
74
+ let textOpacity = item?.status == 1 ? 1 : 0.3
75
+ let ticketWithDate = item.price_date == 1 && item.use_code == 0
76
+ let selTic = selectedTicket?.selected_ticket?.id == item.id
77
+ return (
78
+ <Pressable onPress={() => {
79
+ if (item.status == 1) {
80
+ let a = {
81
+ event_id: dataTicket?.event_id,
82
+ selected_ticket: {
83
+ ...item,
84
+ price_id: item.price_id_to,
85
+ list: {
86
+ ondate: item.ondate
87
+ },
88
+ },
89
+ qty: dataTicket?.qty_upgrade,
90
+ // tax_event: item.tax
91
+ }
92
+ setSelectedTicket(a)
93
+ }
94
+ }} key={i} style={{
95
+
96
+ margin: 15, marginTop: 0, borderRadius: 5, overflow: 'hidden', borderWidth: 1.5, borderColor: selTic ? LibStyle.colorBlue : LibStyle.colorBgGrey
97
+ }}>
98
+ <View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius: 5, borderTopRightRadius: 5 }}>
99
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
100
+ <View style={{ flex: 3 }}>
101
+ <EventHtmltext allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold', color: item.status != 1 ? "#c9c9c9" : selTic ? LibStyle.colorBlue : "#000" }}>{item.price_name_to} </EventHtmltext>
102
+ </View>
103
+ {
104
+ item?.status != 1 &&
105
+ <View style={applyStyle({ alignSelf: 'center', flexDirection: 'row' })}>
106
+ <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 })}>
107
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: "#fff", fontWeight: 'bold' })}>{item?.status_text}</Text>
108
+ </View>
109
+ </View>
110
+ }
111
+ </View>
112
+ {
113
+ item.info != "" && ticketWithDate &&
114
+ <View style={{ marginTop: 3, alignContent: 'center', alignItems: 'center', flexDirection: 'row', marginRight: 5 }}>
115
+ <Text allowFontScaling={false} style={{ fontSize: 12, color: LibStyle.colorBlue }}>{item.info}</Text>
116
+ </View>
117
+ }
118
+ </View>
119
+ <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', padding: 10, alignItems: 'center' }}>
120
+ <View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
121
+ <LibPicture source={esp.assets('icons/ic_special2.png')} style={{ height: 42, width: 42 }} />
122
+ <View style={{ marginLeft: 14, flex: 1 }} >
123
+ {
124
+ item.info != "" &&
125
+ <EventHtmltext allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: "Arial", fontSize: 11, fontStyle: "normal", letterSpacing: 0, color: '#999' }}>{item.info}</EventHtmltext>
126
+ }
127
+ </View>
128
+ <Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold', marginTop: 5, color: item.status != 1 ? "#c9c9c9" : selTic ? LibStyle.colorBlue : "#000" }}>{"+ " + LibUtils.money(item?.amount_difference, item?.currency)}</Text>
129
+
130
+ </View>
131
+ </View>
132
+ </Pressable>
133
+ )
134
+ }
135
+
59
136
  if (!result && !error) {
60
137
  const LibLoading = esp.mod("lib/loading")
61
138
  return <LibLoading />
@@ -78,7 +155,14 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
78
155
  )
79
156
  }
80
157
 
81
- esp.log(result);
158
+ const sorted = result?.list?.sort((a: any, b: any) => {
159
+ // jika a.status = 1 dan b bukan 1 → a di atas
160
+ if (a.status == 1 && b.status != 1) return -1;
161
+ // jika b.status = 1 dan a bukan 1 → b di atas
162
+ if (b.status == 1 && a.status != 1) return 1;
163
+ // jika dua-duanya sama statusnya → urutan tidak berubah
164
+ return 0;
165
+ });
82
166
 
83
167
  return (
84
168
  <View style={{ flex: 1 }} >
@@ -88,7 +172,7 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
88
172
 
89
173
  <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' }}>
90
174
  <EventHtmltext allowFontScaling={false} style={{ marginHorizontal: 5, fontSize: 20, color: "#000", textAlign: 'center', fontWeight: 'bold' }} numberOfLines={2} ellipsizeMode={'tail'}>{dataTicket?.price_name}</EventHtmltext>
91
- <Text allowFontScaling={false} style={{ color: "#000", marginTop: 10 }}>{LibUtils.money(dataTicket.total, dataTicket?.currency)}</Text>
175
+ <Text allowFontScaling={false} style={{ color: "#000", marginTop: 10 }}>{LibUtils.money(result?.total_from, dataTicket?.currency)}</Text>
92
176
 
93
177
  <View style={applyStyle({ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 })}>
94
178
  <View style={applyStyle({ width: 25, height: 25, borderRadius: 12.5, backgroundColor: "#fff", marginLeft: -12.5 })} />
@@ -100,114 +184,92 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
100
184
  <LibTextstyle textStyle='m_overline' text={esp.lang("event/order_detail_upgrade", "upgrade_to")} style={{ fontSize: 12, margin: 15, marginBottom: 10 }} />
101
185
 
102
186
  <LibList
103
- data={result?.list}
187
+ data={sorted}
104
188
  extraData={selectedTicket}
105
- renderItem={(item: any, i: number) => {
106
- return (
107
- <Pressable onPress={() => {
108
- if (item.status == 1) {
109
- let a = {
110
- event_id: dataTicket?.event_id,
111
- selected_ticket: {
112
- ...item,
113
- price_id: item.price_id_to,
114
- list: {
115
- ondate: item.ondate
116
- },
117
- },
118
- qty: dataTicket?.qty_upgrade,
119
- tax_event: item.tax
120
- }
121
- setSelectedTicket(a)
122
- } else {
123
- LibDialog.warning(esp.lang("event/order_detail_upgrade", "oops"), item.message_error)
124
- }
125
- }} key={i} style={{
126
- ...LibStyle.elevation(2), marginHorizontal: 15, marginTop: 2.5, marginBottom: 10, borderRadius: 10,
127
- backgroundColor: item.status != 1 ? LibStyle.colorBgGrey : selectedTicket?.selected_ticket?.id == item.id ? LibStyle.colorGreen : "#fff", padding: 10, /* alignContent: 'center', alignItems: 'center', justifyContent: 'center' */
128
- }}>
129
- {
130
- item?.status != 1 &&
131
- <View style={applyStyle({ flexDirection: 'row' })}>
132
- <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 })}>
133
- <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: "#fff", fontWeight: 'bold' })}>{item?.status_text}</Text>
134
- </View>
135
- </View>
136
- }
137
- <EventHtmltext allowFontScaling={false} style={{ marginHorizontal: 5, fontSize: 16, color: item.status != 1 ? "#c9c9c9" : selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#000", textAlign: 'center', fontWeight: 'bold' }} numberOfLines={2} ellipsizeMode={'tail'}>{item?.price_name_to}</EventHtmltext>
138
- <Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold', marginTop: 5, color: item.status != 1 ? "#c9c9c9" : selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#000" }}>{"+ " + LibUtils.money(Number(dataTicket?.qty_upgrade) * Number(item?.amount), item?.currency)}</Text>
139
-
140
- {
141
- item.info &&
142
- <Text allowFontScaling={false} style={{ textAlign: 'center', marginTop: 10, fontSize: 12, color: selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#c9c9c9" }}>{item.info}</Text>
143
- }
144
-
145
- </Pressable>
146
- )
147
- }}
189
+ renderItem={renderItem}
148
190
  />
149
191
 
150
192
  </View>
151
193
  <View style={{ padding: 10 }}>
152
- <EventButton label={esp.lang("event/order_detail_upgrade", "btn_next")} onPress={() => {
153
- if (selectedTicket) {
154
- if (selectedTicket?.selected_ticket?.use_seat == 1 && selectedTicket?.selected_ticket?.seat_autopick == 0) {
155
- LibNavigation.navigateForResult('event/seat_map_new', {
156
- url: 'event_seat',
157
- dataTicket: selectedTicket
158
- }).then((value) => {
159
- let seatData: any = {}
160
- seatData.seat_label = value?.seat_label
161
- LibNavigation.navigate('event/order_detail_upgrade_payment', {
162
- dataTicket: {
163
- url_payment: result?.url_payment,
164
- price_name: dataTicket?.price_name,
165
- booking_id: dataTicket?.id,
166
- qty_upgrade: dataTicket?.qty_upgrade,
167
- tax_event: selectedTicket?.tax_event,
168
- ondate: dataTicket?.ondate,
169
- event_title: dataTicket?.event_name,
170
- event_id: dataTicket?.event_id,
171
- // ...dataTicket
172
- },
173
- selectedTicket: {
174
- ...selectedTicket,
175
- ...seatData
176
- },
177
- fee_platform: {
178
- fee_platform_amount: selectedTicket?.selected_ticket?.fee_platform_amount,
179
- fee_platform_type: selectedTicket?.selected_ticket?.fee_platform_type,
180
- }
181
- })
182
- })
183
- } else {
184
- LibNavigation.navigate('event/order_detail_upgrade_payment', {
185
- dataTicket: {
186
- url_payment: result?.url_payment,
187
- price_name: dataTicket?.price_name,
188
- booking_id: dataTicket?.id,
189
- qty_upgrade: dataTicket?.qty_upgrade,
190
- tax_event: selectedTicket?.tax_event,
191
- ondate: dataTicket?.ondate,
192
- event_title: dataTicket?.event_name,
193
- event_id: dataTicket?.event_id,
194
- // ...dataTicket
195
- },
196
- selectedTicket: selectedTicket,
197
- fee_platform: {
198
- fee_platform_amount: selectedTicket?.selected_ticket?.fee_platform_amount,
199
- fee_platform_type: selectedTicket?.selected_ticket?.fee_platform_type,
194
+ {
195
+ loading ?
196
+ <View style={{ minWidth: '100%', alignSelf: 'center' }} >
197
+ <View style={{ borderWidth: 1, borderColor: 'rgba(0, 0, 0, 0)', height: 40, borderRadius: 16, backgroundColor: "#e6e6e6", alignItems: 'center', justifyContent: 'center', paddingHorizontal: 9 }} >
198
+ <ActivityIndicator size={"small"} color={LibStyle.colorPrimary} />
199
+ </View>
200
+ </View> :
201
+ <EventButton label={esp.lang("event/order_detail_upgrade", "btn_next")} onPress={() => {
202
+ const selectedTicket = getSelectedTicket()
203
+ if (selectedTicket) {
204
+ if (selectedTicket?.selected_ticket?.use_seat == 1 && selectedTicket?.selected_ticket?.seat_autopick == 0) {
205
+ LibNavigation.navigateForResult('event/seat_map_new', {
206
+ url: 'event_seat',
207
+ dataTicket: selectedTicket
208
+ }).then((value) => {
209
+ let seatData: any = {}
210
+ seatData.seat_label = value?.seat_label
211
+
212
+ curlPriceConfig(selectedTicket.selected_ticket?.price_id_to, (config) => {
213
+ LibNavigation.navigate('event/order_detail_upgrade_payment', {
214
+ dataTicket: {
215
+ url_payment: result?.url_payment,
216
+ url_upgrade: result?.url_upgrade,
217
+ price_name: dataTicket?.price_name,
218
+ previous_total: Number(result?.total_from),
219
+ booking_id: dataTicket?.id,
220
+ qty_upgrade: dataTicket?.qty_upgrade,
221
+ tax_event: config?.tax,
222
+ ondate: dataTicket?.ondate,
223
+ event_title: dataTicket?.event_name,
224
+ event_id: dataTicket?.event_id,
225
+ // ...dataTicket
226
+ },
227
+ selectedTicket: {
228
+ ...selectedTicket,
229
+ ...seatData
230
+ },
231
+ fee_platform: {
232
+ fee_platform_amount: config?.fee_platform_amount,
233
+ fee_platform_type: config?.fee_platform_type,
234
+ },
235
+ })
236
+ })
237
+
238
+ })
239
+ } else {
240
+ curlPriceConfig(selectedTicket.selected_ticket?.price_id_to, (config) => {
241
+ LibNavigation.navigate('event/order_detail_upgrade_payment', {
242
+ dataTicket: {
243
+ url_payment: result?.url_payment,
244
+ url_upgrade: result?.url_upgrade,
245
+ price_name: dataTicket?.price_name,
246
+ booking_id: dataTicket?.id,
247
+ previous_total: Number(result?.total_from),
248
+ qty_upgrade: dataTicket?.qty_upgrade,
249
+ tax_event: config?.tax,
250
+ ondate: dataTicket?.ondate,
251
+ event_title: dataTicket?.event_name,
252
+ event_id: dataTicket?.event_id,
253
+ // ...dataTicket
254
+ },
255
+ selectedTicket: selectedTicket,
256
+ fee_platform: {
257
+ fee_platform_amount: config?.fee_platform_amount,
258
+ fee_platform_type: config?.fee_platform_type,
259
+ }
260
+ })
261
+ })
262
+
200
263
  }
201
- })
202
- }
203
- } else {
204
- LibToastProperty.show(esp.lang("event/order_detail_upgrade", "select_ticket"))
205
- return
206
- }
207
- }}
208
- backgroundColor={selectedTicket ? LibStyle.colorGreen : LibStyle.colorGrey}
209
- fontColor='#fff'
210
- />
264
+ } else {
265
+ LibToastProperty.show(esp.lang("event/order_detail_upgrade", "select_ticket"))
266
+ return
267
+ }
268
+ }}
269
+ backgroundColor={selectedTicket ? LibStyle.colorGreen : LibStyle.colorGrey}
270
+ fontColor='#fff'
271
+ />
272
+ }
211
273
  </View>
212
274
  </View>
213
275
  )
@@ -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';
4
+ import { BigbangPayment_detail_ticket, BigbangPayment_detail_ticketProperty } from 'esoftplay/cache/bigbang/payment_detail_ticket/import';
5
5
  import { BigbangPayment_list } 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
 
@@ -28,7 +31,6 @@ export interface EventOrder_detail_upgrade_paymentProps {
28
31
  export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
29
32
  const { dataTicket, selectedTicket, fee_platform }: any = LibNavigation.getArgsAll(props)
30
33
  const [selectedPayment, setSelectedPayment] = useSafeState<any>()
31
- const [platformFee, setPlatformFee] = useSafeState<any>(fee_platform)
32
34
  const [charge, setCharge] = useSafeState<any>(0)
33
35
  const [chargePercent, setChargePercent] = useSafeState<any>()
34
36
 
@@ -37,7 +39,6 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
37
39
  const scrollYRef = useRef(0)
38
40
  const dialogSeat = useRef<LibSlidingup>(null)
39
41
 
40
- esp.log({ dataTicket, selectedTicket });
41
42
 
42
43
  function doUpgrade(pin?: any) {
43
44
  const LibToastProperty = esp.modProp("lib/toast")
@@ -67,7 +68,7 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
67
68
  post.pin = pin
68
69
  }
69
70
  LibProgress.show(esp.lang("event/order_detail_upgrade_payment", "confirm_wait"))
70
- new LibCurl('event_order_detail_upgrade_checkout', post, (res, msg) => {
71
+ new LibCurl(dataTicket?.url_upgrade || 'event_order_detail_upgrade_checkout', post, (res, msg) => {
71
72
  LibProgress.hide()
72
73
  LibNavigation.reset()
73
74
  if (res?.hasOwnProperty('url_mobile') && res?.url_mobile != null) {
@@ -110,14 +111,22 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
110
111
  return (percent * amount) / 100
111
112
  }
112
113
 
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
114
+ const price = Number(selectedTicket?.selected_ticket?.price_to)
115
+ const qty = Number(dataTicket?.qty_upgrade)
116
+
117
+ const calculate = PaymentFee_calculate(price, qty,
118
+ {
119
+ fee_platform_type: fee_platform?.fee_platform_type || "NONE",
120
+ fee_platform_amount: fee_platform?.fee_platform_amount || 0,
121
+ discount_type: "NONE",
122
+ discount_amount: 0,
123
+ tax: dataTicket?.tax_event || 0
124
+ }
125
+ )
116
126
 
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
127
 
120
- let subtotalWithTaxWithFeePlatform = subtotalWithTax + _fee_platform
128
+ let amount = Number(selectedTicket?.selected_ticket?.price_to || selectedTicket?.selected_ticket?.amount_difference) * Number(dataTicket?.qty_upgrade)
129
+ let subtotalWithTaxWithFeePlatform = calculate.subtotal
121
130
 
122
131
  let _charge = amount == 0 ? 0 : Number(charge)
123
132
  let _charge_percent = chargePercent == 0 ? 0 : percentageCalculator(subtotalWithTaxWithFeePlatform, chargePercent)
@@ -133,6 +142,77 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
133
142
  )
134
143
  }
135
144
 
145
+ const currency = selectedTicket?.selected_ticket?.currency || "IDR"
146
+
147
+ const itemData = useMemo(() => {
148
+ const items: BigbangPayment_detail_ticketProperty.BigbangPayment_detail_ticketItem[] = []
149
+
150
+ items.push({
151
+ label: esp.lang("event/order_detail_upgrade_payment", "upgrade_to", dataTicket?.price_name, selectedTicket?.selected_ticket?.price_name_to),
152
+ caption: dataTicket?.ondate != "0000-00-00" ? LibUtils.moment(dataTicket?.ondate).localeFormat("DD MMMM YYYY") : "",
153
+ value: LibUtils.money(price, currency),
154
+ qty: LibUtils.number(qty)
155
+ })
156
+
157
+ //seat
158
+ const name_seat = selectedTicket?.seat_name
159
+ if (name_seat && name_seat.length > 0) {
160
+ items.push({
161
+ label: esp.lang("bigbang/payment_detail", "text_seat"),
162
+ value:
163
+ <Pressable onPress={() => dialogSeat.current?.show()} style={{ flexDirection: 'row', justifyContent: 'center', alignContent: 'center', alignItems: 'center' }} >
164
+ <View style={{ marginRight: 5, marginLeft: 5, height: 25, width: 25, backgroundColor: LibStyle.colorBlue, borderWidth: 1, borderColor: LibStyle.colorBlue, borderRadius: 4, justifyContent: 'center', alignContent: 'center', alignItems: 'center' }}>
165
+ <Text allowFontScaling={false} style={{ fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{name_seat?.[0]}</Text>
166
+ </View>
167
+ {
168
+ name_seat && name_seat?.length > 1 &&
169
+ <LibIcon.MaterialIcons name="more" style={{ transform: [{ rotate: '180deg' }] }} size={32} color={LibStyle.colorBlue} />
170
+ }
171
+ </Pressable>
172
+ })
173
+ }
174
+
175
+ // Gov tax
176
+ if (dataTicket?.tax_event) {
177
+ if (Number(dataTicket?.tax_event) !== 0) {
178
+ items.push({
179
+ label: esp.lang("bigbang/payment_detail", "tax", String(Number(dataTicket?.tax_event))),
180
+ value: LibUtils.money(calculate.tax, currency)
181
+ })
182
+ } else
183
+ //@ts-ignore
184
+ items.push({
185
+ caption: esp.lang("bigbang/payment_detail", "tax_include")
186
+ })
187
+ }
188
+
189
+ // Platform fee
190
+ if (calculate.platform !== 0) {
191
+ items.push({
192
+ label: esp.lang("bigbang/payment_detail", "fee_apps"),
193
+ value: LibUtils.money(calculate.platform, currency),
194
+ sublabel: (fee_platform?.fee_platform_type !== "NOMINAL") ? "(" + fee_platform?.fee_platform_amount + "%)" : ""
195
+ });
196
+ }
197
+
198
+ //potongan sebelumnya
199
+ if (dataTicket?.previous_total && dataTicket?.previous_total > 0) {
200
+ items.push({
201
+ label: esp.lang("bigbang/payment_detail_ticket", "previous_total"),
202
+ value: "-" + LibUtils.money(dataTicket?.previous_total, currency),
203
+ })
204
+ }
205
+
206
+ // Admin bank
207
+ items.push({
208
+ label: esp.lang("bigbang/payment_detail", "admin_fee"),
209
+ sublabel: esp.modProp("bigbang/payment_detail_ticket").processAdminBank(chargePercent, charge, currency),
210
+ caption: esp.lang("bigbang/payment_detail", "info"),
211
+ value: LibUtils.money(_charge_total, currency),
212
+ })
213
+
214
+ return items
215
+ }, [charge, chargePercent, _charge_total, dataTicket, calculate, price, qty])
136
216
 
137
217
  return (
138
218
  <View style={{ flex: 1, backgroundColor: '#fff' }}>
@@ -144,32 +224,20 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
144
224
  if (currentYPosition >= (LibStyle.height * 0.3)) {
145
225
  if (oldPosition == 0) {
146
226
  scrollYRef.current = nativeEvent.contentOffset.y
147
- BigbangPayment_detailProperty.stateShow.set(false)
227
+ BigbangPayment_detail_ticketProperty.stateShow.set(false)
148
228
  }
149
229
  }
150
230
  }}>
151
231
 
152
232
  {/* detail */}
153
233
  <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} />
234
+ <BigbangPayment_detail_ticket
235
+ product_title={esp.lang("event/order_detail_upgrade_payment", "upgrade_to", dataTicket?.price_name, selectedTicket?.selected_ticket?.price_name_to)}
236
+ product_subtitle={dataTicket?.event_title}
237
+ product_price={LibUtils.money(_amountTotal - (dataTicket?.previous_total || 0), currency)}
238
+ itemData={itemData}
239
+ isFree={calculate.subtotal == 0 && calculate.discount == 0} //tiket gratis
240
+ />
173
241
  </View>
174
242
 
175
243
 
@@ -186,7 +254,6 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
186
254
  payment_type: Number(item.type),
187
255
  }
188
256
  setSelectedPayment(payment)
189
- setPlatformFee({ fee_platform_type: item?.fee_platform_type || 'NONE', fee_platform_amount: item?.fee_platform_amount || 0 })
190
257
  setCharge(item.charge)
191
258
  setChargePercent(item.charge_percent)
192
259
  }}
@@ -150,19 +150,22 @@ export default function m(props: EventOrder_detail_visitorProps): any {
150
150
  }
151
151
  </View>
152
152
  </View>
153
- <View style={{ alignContent: 'center', alignItems: 'center' }}>
154
- {
155
- item.hasOwnProperty('seat_name') && item?.seat_name != "" && item?.seat_name?.includes('#') ?
156
- <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
157
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16, color: "#000" }}> {front} </Text>
158
- <Text allowFontScaling={false} style={{ marginLeft: 3, fontWeight: 'bold', fontSize: 16, color: '#000', }}> {end} </Text>
159
- </View>
160
- :
161
- <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
162
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: "#000" }}>{item?.seat_name}</Text>
163
- </View>
164
- }
165
- </View>
153
+ {
154
+ item.hasOwnProperty('seat_name') && item?.seat_name != "" &&
155
+ <View style={{ alignContent: 'center', alignItems: 'center' }}>
156
+ {
157
+ item?.seat_name?.includes('#') ?
158
+ <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
159
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16, color: "#000" }}> {front} </Text>
160
+ <Text allowFontScaling={false} style={{ marginLeft: 3, fontWeight: 'bold', fontSize: 16, color: '#000', }}> {end} </Text>
161
+ </View>
162
+ :
163
+ <View key={i} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, marginBottom: 7, paddingHorizontal: 5, backgroundColor: '#fff', borderRadius: 5, marginRight: 7, ...LibStyle.elevation(5), }}>
164
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: "#000" }}>{item?.seat_name}</Text>
165
+ </View>
166
+ }
167
+ </View>
168
+ }
166
169
  </View>
167
170
  )
168
171
  })
@@ -37,7 +37,7 @@ export default function m(props: EventScan_itemProps): any {
37
37
  <View style={applyStyle({ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' })}>
38
38
  <Text allowFontScaling={false} style={applyStyle({ color: props?.colorText ? props?.colorText : "#000", fontSize: 14 })}>{props.item.price_name}</Text>
39
39
  {
40
- props.item.hasOwnProperty('seat_name') &&
40
+ props.item.hasOwnProperty('seat_name') && props?.item?.seat_name != "" &&
41
41
  <View style={applyStyle({ height: 35, width: 35, backgroundColor: "#fff", borderWidth: 1, borderColor: LibStyle.colorPrimary, borderRadius: 4, justifyContent: 'center', alignContent: 'center', alignItems: 'center' })}>
42
42
  <LibIcon name="seat" color={LibStyle.colorPrimary} size={15} />
43
43
  <Text allowFontScaling={false} style={applyStyle({ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorPrimary })}>{props.item.seat_name}</Text>
package/event/step.tsx CHANGED
@@ -19,7 +19,7 @@ export default function m(props: EventStepProps): any {
19
19
  return (
20
20
  <VIEW
21
21
  onPress={() => { if (urls && urls.length > 0) Linking.openURL(urls[0]) }}
22
- style={{ flexDirection: 'row', marginLeft: 10, paddingRight: 25, paddingBottom: 10 }}>
22
+ style={{ flexDirection: 'row', marginLeft: 15, paddingRight: 25, paddingBottom: 10 }}>
23
23
  <View style={{ marginRight: 15, marginTop: 3, borderRadius: 15, width: 14, height: 14, backgroundColor: "#f5e71e", borderStyle: "solid", borderWidth: 2, borderColor: "#70472b" }} />
24
24
  <View style={{ flex: 1 }} >
25
25
  <RenderHtml contentWidth={LibStyle.width} source={{ html: props?.text?.trim?.() }} />