esoftplay-event 0.0.2-g → 0.0.2-i
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.
- package/config.json +1 -1
- package/event/artist_detail.tsx +157 -98
- package/event/artist_detail_multi.tsx +81 -15
- package/event/exchange_ticket_list.tsx +23 -14
- package/event/order_detail.tsx +330 -241
- package/event/order_detail_upgrade.tsx +171 -100
- package/event/order_detail_upgrade_payment.tsx +94 -33
- package/event/order_detail_visitor.tsx +17 -8
- package/event/step.tsx +1 -1
- package/event/ticket_list.tsx +81 -42
- package/event/ticket_list2.tsx +103 -27
- package/event/tms_gate.tsx +11 -0
- package/event/tms_home.tsx +23 -13
- package/event/tms_in.tsx +0 -2
- package/event/visitor_index.tsx +1 -1
- package/id.json +4 -1
- package/package.json +1 -1
package/config.json
CHANGED
package/event/artist_detail.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { EventCountdownProperty } from 'esoftplay/cache/event/countdown/import';
|
|
|
7
7
|
import { EventHeader } from 'esoftplay/cache/event/header/import';
|
|
8
8
|
import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
|
|
9
9
|
import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
|
|
10
|
+
import { EventOrder_itemProperty } from 'esoftplay/cache/event/order_item/import';
|
|
10
11
|
import { EventShare } from 'esoftplay/cache/event/share/import';
|
|
11
12
|
import { LibCarrousel } from 'esoftplay/cache/lib/carrousel/import';
|
|
12
13
|
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
@@ -25,7 +26,7 @@ import esp from 'esoftplay/esp';
|
|
|
25
26
|
import moment from 'esoftplay/moment';
|
|
26
27
|
import useSafeState from 'esoftplay/state';
|
|
27
28
|
import React, { useEffect } from 'react';
|
|
28
|
-
import { Pressable, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
29
|
+
import { ActivityIndicator, Pressable, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
export interface EventArtist_detailProps {
|
|
@@ -44,6 +45,7 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
44
45
|
const [selectedTicket, setSelectedTicket, getSelectedTicket] = useSafeState<any>()
|
|
45
46
|
const [priceList, setPriceList] = useSafeState<any>()
|
|
46
47
|
const [showAll, setShowAll] = useSafeState<any>({});
|
|
48
|
+
const [loading, setLoading] = useSafeState<boolean>(false)
|
|
47
49
|
|
|
48
50
|
useEffect(() => {
|
|
49
51
|
loadDataPrice()
|
|
@@ -101,7 +103,7 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
101
103
|
})
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
function proceedToPayment() {
|
|
106
|
+
async function proceedToPayment() {
|
|
105
107
|
if (!selectedTicket) {
|
|
106
108
|
if (priceList?.every((v: any) => v?.status == 0)) {
|
|
107
109
|
LibToastProperty.show(esp.lang("event/artist_detail", "ticket_not_available"))
|
|
@@ -126,81 +128,88 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
126
128
|
dataPost.adjacent_seats = 1
|
|
127
129
|
}
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
dataBookingEvent: { ...dataPost, qty: qty },
|
|
135
|
-
subscribed: subscribed
|
|
136
|
-
})
|
|
137
|
-
} else {
|
|
138
|
-
LibNavigation.navigateForResult('event/seat_map_new', {
|
|
131
|
+
let finalDataPost = { ...dataPost }
|
|
132
|
+
|
|
133
|
+
if (getSelectedTicket()?.use_seat === 1) {
|
|
134
|
+
if (getSelectedTicket()?.config?.seat_autopick !== 1) {
|
|
135
|
+
const seat = await LibNavigation.navigateForResult('event/seat_map_new', {
|
|
139
136
|
url: 'event_seat',
|
|
140
|
-
dataTicket:
|
|
141
|
-
}).then((value) => {
|
|
142
|
-
dataPost.seat_label = value.seat_label
|
|
143
|
-
|
|
144
|
-
if (data?.has_addition && data?.has_addition == 1) {
|
|
145
|
-
LibNavigation.navigateForResult('event/additional', { type_ticket: selectedTicket?.type, ondate: selectedTicket?.list?.ondate, event_id: data?.event_id, qty: qty, data: dataPost }, 221).then((additions) => {
|
|
146
|
-
if (additions != "") {
|
|
147
|
-
dataPost.addition = additions
|
|
148
|
-
}
|
|
149
|
-
LibNavigation.navigate('payment/ticket', {
|
|
150
|
-
order_type: eventConfig?.order_type?.ticket,
|
|
151
|
-
tax: getSelectedTicket()?.tax || data?.tax,
|
|
152
|
-
dataBookingEvent: dataPost,
|
|
153
|
-
fee_platform: {
|
|
154
|
-
fee_platform_amount: data?.fee_platform_amount,
|
|
155
|
-
fee_platform_type: data?.fee_platform_type,
|
|
156
|
-
},
|
|
157
|
-
subscribed: subscribed
|
|
158
|
-
})
|
|
159
|
-
})
|
|
160
|
-
} else {
|
|
161
|
-
LibNavigation.navigate('payment/ticket', {
|
|
162
|
-
order_type: eventConfig?.order_type?.ticket,
|
|
163
|
-
tax: getSelectedTicket()?.tax || data?.tax,
|
|
164
|
-
dataBookingEvent: dataPost,
|
|
165
|
-
fee_platform: {
|
|
166
|
-
fee_platform_amount: data?.fee_platform_amount,
|
|
167
|
-
fee_platform_type: data?.fee_platform_type,
|
|
168
|
-
},
|
|
169
|
-
subscribed: subscribed
|
|
170
|
-
})
|
|
171
|
-
}
|
|
172
|
-
})
|
|
173
|
-
}
|
|
174
|
-
} else {
|
|
175
|
-
if (selectedTicket?.hasOwnProperty("has_addition") && selectedTicket?.has_addition == 1) {
|
|
176
|
-
LibNavigation.navigateForResult('event/additional', { type_ticket: selectedTicket?.type, ondate: selectedTicket?.list?.ondate, event_id: data?.event_id, qty: qty, data: dataPost, price_id: selectedTicket?.price_id }, 221).then((additions) => {
|
|
177
|
-
if (additions != "") {
|
|
178
|
-
dataPost.addition = additions
|
|
179
|
-
}
|
|
180
|
-
LibNavigation.navigate('payment/ticket', {
|
|
181
|
-
order_type: eventConfig?.order_type?.ticket,
|
|
182
|
-
tax: getSelectedTicket()?.tax || data?.tax,
|
|
183
|
-
dataBookingEvent: dataPost,
|
|
184
|
-
fee_platform: {
|
|
185
|
-
fee_platform_amount: data?.fee_platform_amount,
|
|
186
|
-
fee_platform_type: data?.fee_platform_type,
|
|
187
|
-
},
|
|
188
|
-
subscribed: subscribed
|
|
189
|
-
})
|
|
190
|
-
})
|
|
191
|
-
} else {
|
|
192
|
-
LibNavigation.navigate('payment/ticket', {
|
|
193
|
-
order_type: eventConfig?.order_type?.ticket,
|
|
194
|
-
tax: getSelectedTicket()?.tax || data?.tax,
|
|
195
|
-
dataBookingEvent: dataPost,
|
|
196
|
-
fee_platform: {
|
|
197
|
-
fee_platform_amount: data?.fee_platform_amount,
|
|
198
|
-
fee_platform_type: data?.fee_platform_type,
|
|
199
|
-
},
|
|
200
|
-
subscribed: subscribed
|
|
137
|
+
dataTicket: finalDataPost,
|
|
201
138
|
})
|
|
139
|
+
|
|
140
|
+
finalDataPost = {
|
|
141
|
+
...finalDataPost,
|
|
142
|
+
seat_label: seat?.seat_label
|
|
143
|
+
}
|
|
202
144
|
}
|
|
203
145
|
}
|
|
146
|
+
|
|
147
|
+
finalDataPost = await handleAdditionIfNeeded(finalDataPost, qty)
|
|
148
|
+
const args = await buildPaymentArgs(finalDataPost, qty)
|
|
149
|
+
LibNavigation.navigate('payment/ticket', args)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async function buildPaymentArgs(dataPost: any, qty: number) {
|
|
153
|
+
setLoading(true)
|
|
154
|
+
const conf = await curlPriceConfig(getSelectedTicket()?.price_id)
|
|
155
|
+
setLoading(false)
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
order_type: eventConfig?.order_type?.ticket,
|
|
159
|
+
tax: conf?.tax ?? getSelectedTicket()?.tax ?? data?.tax ?? 0,
|
|
160
|
+
dataBookingEvent: { ...dataPost, qty },
|
|
161
|
+
subscribed,
|
|
162
|
+
fee_platform: conf?.fee_platform_amount != null
|
|
163
|
+
? {
|
|
164
|
+
fee_platform_amount: conf.fee_platform_amount || 0,
|
|
165
|
+
fee_platform_type: conf.fee_platform_type || "NONE",
|
|
166
|
+
}
|
|
167
|
+
: {
|
|
168
|
+
fee_platform_amount: data?.fee_platform_amount || 0,
|
|
169
|
+
fee_platform_type: data?.fee_platform_type || "NONE",
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function handleAdditionIfNeeded(dataPost: any, qty: number) {
|
|
175
|
+
if (getSelectedTicket()?.has_addition !== 1) return dataPost
|
|
176
|
+
|
|
177
|
+
const additions = await LibNavigation.navigateForResult(
|
|
178
|
+
'event/additional',
|
|
179
|
+
{
|
|
180
|
+
type_ticket: selectedTicket?.type,
|
|
181
|
+
ondate: selectedTicket?.list?.ondate,
|
|
182
|
+
event_id: data?.event_id,
|
|
183
|
+
qty,
|
|
184
|
+
data: dataPost,
|
|
185
|
+
price_id: selectedTicket?.price_id
|
|
186
|
+
},
|
|
187
|
+
221
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
return additions ? { ...dataPost, addition: additions } : dataPost
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
function curlPriceConfig(price_id: string): Promise<any> {
|
|
195
|
+
return new Promise((resolve) => {
|
|
196
|
+
if (!data?.url_price_config) {
|
|
197
|
+
resolve({})
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
new LibCurl(
|
|
202
|
+
data.url_price_config,
|
|
203
|
+
null,
|
|
204
|
+
(res) => {
|
|
205
|
+
resolve(res?.[price_id] || {})
|
|
206
|
+
},
|
|
207
|
+
(err) => {
|
|
208
|
+
LibToastProperty.show(err?.message)
|
|
209
|
+
resolve({})
|
|
210
|
+
}
|
|
211
|
+
)
|
|
212
|
+
})
|
|
204
213
|
}
|
|
205
214
|
|
|
206
215
|
function add(): void {
|
|
@@ -212,10 +221,27 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
212
221
|
}
|
|
213
222
|
|
|
214
223
|
function min(): void {
|
|
215
|
-
|
|
216
|
-
|
|
224
|
+
const currentQty = qty
|
|
225
|
+
const selectedTicket = getSelectedTicket()
|
|
226
|
+
|
|
227
|
+
// kalau qty - 1 <= 0 → set qty 0 dan unselect tiket
|
|
228
|
+
if (currentQty - 1 <= 0) {
|
|
229
|
+
setQty(0)
|
|
230
|
+
setSelectedTicket(null) // atau undefined sesuai project
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ambil qty_min dengan cara manual
|
|
235
|
+
let qtyMin = 1 // default
|
|
236
|
+
if (selectedTicket && selectedTicket.qty_min) {
|
|
237
|
+
qtyMin = selectedTicket.qty_min
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// kurangi qty tapi tetap patuhi qty_min
|
|
241
|
+
if (currentQty <= qtyMin) {
|
|
242
|
+
setQty(qtyMin)
|
|
217
243
|
} else {
|
|
218
|
-
setQty(
|
|
244
|
+
setQty(currentQty - 1)
|
|
219
245
|
}
|
|
220
246
|
}
|
|
221
247
|
|
|
@@ -287,29 +313,50 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
287
313
|
}
|
|
288
314
|
}} activeOpacity={itemT?.status == 1 ? 0 : 1} key={iT} style={{ flex: 1, flexDirection: 'row', backgroundColor: colorBackground, justifyContent: 'space-between', padding: 10, alignItems: 'center' }}>
|
|
289
315
|
{
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
:
|
|
293
|
-
|
|
294
|
-
<View style={applyStyle({ marginLeft: 10, marginHorizontal: 20, width: 42, height: 42, borderRadius: 5, backgroundColor: "#fff", borderStyle: "solid", borderWidth: 1, borderColor: _selectedTicket ? "#3ea4dc" : '#999', alignContent: 'center', alignItems: 'center', justifyContent: 'center' })}>
|
|
316
|
+
ticketWithDate ?
|
|
317
|
+
// view untuk yang ada tanggalnya
|
|
318
|
+
<View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center', }}>
|
|
319
|
+
<View style={applyStyle({ marginLeft: 10, marginHorizontal: 20, width: 42, height: 42, borderRadius: 5, backgroundColor: colorBackground, borderStyle: "solid", borderWidth: textOpacity, borderColor: _selectedTicket ? "#3ea4dc" : '#999', alignContent: 'center', alignItems: 'center', justifyContent: 'center' })}>
|
|
295
320
|
<Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0.23, textAlign: "center", color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('DD')}</Text>
|
|
296
321
|
</View>
|
|
297
322
|
<View style={applyStyle({ flexDirection: 'column', flex: 1 })}>
|
|
298
323
|
{
|
|
299
|
-
item?.status == 1 && itemT
|
|
324
|
+
item?.status == 1 && itemT.status != 1 &&
|
|
300
325
|
<View style={applyStyle({ flexDirection: 'row', marginBottom: 5 })}>
|
|
301
|
-
<View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', marginTop: 5, borderWidth: 1, backgroundColor: itemT
|
|
302
|
-
<Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color
|
|
326
|
+
<View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', marginTop: 5, borderWidth: 1, backgroundColor: itemT.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: itemT.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 })}>
|
|
327
|
+
<Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: /* itemT.status == 2 ? "#000" : */ "#fff", fontWeight: 'bold' })}>{itemT.status == 0 ? esp.lang("event/ticket_list", "sold_out") : esp.lang("event/ticket_list", "coming_soon")}</Text>
|
|
303
328
|
</View>
|
|
304
329
|
</View>
|
|
305
330
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
|
|
331
|
+
<>
|
|
332
|
+
<Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('dddd')}</Text>
|
|
333
|
+
<View style={applyStyle({ flexDirection: 'row', alignItems: "center" })}>
|
|
334
|
+
<Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('MMMM')}</Text>
|
|
335
|
+
<Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, marginLeft: 5, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('YYYY')}</Text>
|
|
336
|
+
</View>
|
|
337
|
+
</>
|
|
311
338
|
</View>
|
|
312
|
-
|
|
339
|
+
</View>
|
|
340
|
+
:
|
|
341
|
+
// view untuk yang undangan dan khusus
|
|
342
|
+
<View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
|
|
343
|
+
<LibPicture source={esp.assets('icons/ic_special2.png')} style={{ height: 42, width: 42 }} />
|
|
344
|
+
<View style={{ marginLeft: 14, flex: 1 }} >
|
|
345
|
+
{
|
|
346
|
+
item?.status == 1 && itemT.status != 1 &&
|
|
347
|
+
<View style={applyStyle({ flexDirection: 'row', marginBottom: 5 })}>
|
|
348
|
+
<View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', marginTop: 5, borderWidth: 1, backgroundColor: itemT.status == 0 ? LibStyle.colorRed : LibStyle.colorPrimary, borderColor: itemT.status == 0 ? LibStyle.colorRed : LibStyle.colorPrimary, borderRadius: 5, padding: 3, opacity: 0.8 })}>
|
|
349
|
+
<Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: "#fff", fontWeight: 'bold' })}>{itemT.status == 0 ? esp.lang("event/ticket_list", "sold_out") : esp.lang("event/ticket_list", "coming_soon")}</Text>
|
|
350
|
+
</View>
|
|
351
|
+
</View>
|
|
352
|
+
}
|
|
353
|
+
{/* <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{item.type}</Text> */}
|
|
354
|
+
{
|
|
355
|
+
item.info != "" &&
|
|
356
|
+
<EventHtmltext allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: "Arial", fontSize: 11, fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{item.info}</EventHtmltext>
|
|
357
|
+
}
|
|
358
|
+
</View>
|
|
359
|
+
</View>
|
|
313
360
|
}
|
|
314
361
|
|
|
315
362
|
<View style={applyStyle({ marginRight: 5, marginLeft: 5, flexDirection: 'column' })} >
|
|
@@ -321,13 +368,13 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
321
368
|
item?.status == 1 && (ticketWithDate || ticketSpecial) && _selectedTicket &&
|
|
322
369
|
<View style={applyStyle({ marginTop: 4, flexDirection: 'row', marginLeft: 8, alignContent: 'center', alignItems: 'center' })}>
|
|
323
370
|
<TouchableOpacity onPress={() => { min() }}>
|
|
324
|
-
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
|
|
371
|
+
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", justifyContent: 'center', alignContent: 'center', alignItems: 'center' })}>
|
|
325
372
|
<LibIcon name="minus" color="#e74c3c" />
|
|
326
373
|
</View>
|
|
327
374
|
</TouchableOpacity>
|
|
328
375
|
<Text style={applyStyle({ fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#9b9b9b", marginLeft: 13, marginRight: 13 })}>{qty}</Text>
|
|
329
376
|
<TouchableOpacity onPress={() => { add() }}>
|
|
330
|
-
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
|
|
377
|
+
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", justifyContent: 'center', alignContent: 'center', alignItems: 'center' })}>
|
|
331
378
|
<LibIcon name="plus" color="#16a085" />
|
|
332
379
|
</View>
|
|
333
380
|
</TouchableOpacity>
|
|
@@ -438,6 +485,7 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
438
485
|
|
|
439
486
|
let textOpacity = item?.status == 1 ? 1 : 0.3
|
|
440
487
|
let selTic = item.price_id == selectedTicket?.price_id
|
|
488
|
+
let ticketWithDate = item.price_date == 1 && item.use_code == 0
|
|
441
489
|
return (
|
|
442
490
|
<Pressable onPress={() => {
|
|
443
491
|
|
|
@@ -467,7 +515,7 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
467
515
|
}
|
|
468
516
|
</View>
|
|
469
517
|
{
|
|
470
|
-
item.info != "" &&
|
|
518
|
+
item.info != "" && ticketWithDate &&
|
|
471
519
|
<View style={{ marginTop: 3, alignContent: 'center', alignItems: 'center', flexDirection: 'row', marginRight: 5 }}>
|
|
472
520
|
<Text allowFontScaling={false} style={{ fontSize: 12, color: LibStyle.colorBlue }}>{item.info}</Text>
|
|
473
521
|
</View>
|
|
@@ -506,11 +554,22 @@ export default function m(props: EventArtist_detailProps): any {
|
|
|
506
554
|
<Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 12, textAlign: "center", textAlignVertical: 'center', color: 'black', marginHorizontal: 10 })} >{esp.lang("event/artist_detail", "booking_end")}</Text>
|
|
507
555
|
</View>
|
|
508
556
|
:
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
557
|
+
<>
|
|
558
|
+
{
|
|
559
|
+
loading ?
|
|
560
|
+
<View style={{ minWidth: '100%', alignSelf: 'center' }} >
|
|
561
|
+
<View style={{ borderWidth: 1, borderColor: 'rgba(0, 0, 0, 0)', height: 40, borderRadius: 16, backgroundColor: "#e6e6e6", alignItems: 'center', justifyContent: 'center', paddingHorizontal: 9 }} >
|
|
562
|
+
<ActivityIndicator size={"small"} color={LibStyle.colorPrimary} />
|
|
563
|
+
</View>
|
|
564
|
+
</View>
|
|
565
|
+
:
|
|
566
|
+
<EventButton label={esp.lang("event/artist_detail", "buy_ticket")} onPress={() => {
|
|
567
|
+
EventIndexProperty.isLogin(() => {
|
|
568
|
+
proceedToPayment()
|
|
569
|
+
})
|
|
570
|
+
}} style={{ backgroundColor: LibStyle.colorGreen, marginTop: 2, marginHorizontal: 15 }} />
|
|
571
|
+
}
|
|
572
|
+
</>
|
|
514
573
|
}
|
|
515
574
|
</>
|
|
516
575
|
:
|
|
@@ -27,7 +27,7 @@ import useLazyState from 'esoftplay/lazy';
|
|
|
27
27
|
import moment from 'esoftplay/moment';
|
|
28
28
|
import useSafeState from 'esoftplay/state';
|
|
29
29
|
import React, { useEffect } from 'react';
|
|
30
|
-
import { Pressable, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
30
|
+
import { ActivityIndicator, Pressable, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
export interface EventArtist_detail_multiProps {
|
|
@@ -84,6 +84,7 @@ export default function m(props: EventArtist_detail_multiProps): any {
|
|
|
84
84
|
const [, setDataPostBooking, getDataPostBooking] = useLazyState<any>([])
|
|
85
85
|
const [dataAddition, setDataAddition] = useSafeState<any>([])
|
|
86
86
|
const [showAll, setShowAll] = useSafeState<any>({});
|
|
87
|
+
const [loading, setLoading] = useSafeState<boolean>(false)
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
useEffect(() => {
|
|
@@ -178,7 +179,7 @@ export default function m(props: EventArtist_detail_multiProps): any {
|
|
|
178
179
|
if (dataAddition?.length > 0) {
|
|
179
180
|
dataEvent.addition = dataAddition
|
|
180
181
|
}
|
|
181
|
-
|
|
182
|
+
let args: any = {
|
|
182
183
|
order_type: EventConfigProperty?.state()?.get()?.order_type?.ticket,
|
|
183
184
|
fee_platform: {
|
|
184
185
|
fee_platform_amount: data?.fee_platform_amount,
|
|
@@ -187,9 +188,39 @@ export default function m(props: EventArtist_detail_multiProps): any {
|
|
|
187
188
|
subscribed: subscribed,
|
|
188
189
|
dataEvent: dataEvent,
|
|
189
190
|
dataTicket: getDataPostBooking(),
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const selectedPriceIds = getDataPostBooking().filter((x: any) => x.selected == 1).map((x: any) => x.price_id)
|
|
194
|
+
curlPriceConfig(selectedPriceIds, (filteredFee) => {
|
|
195
|
+
const editedDataTicket = getDataPostBooking().map((item: any) => {
|
|
196
|
+
const priceId = item.price_id;
|
|
197
|
+
if (filteredFee?.[priceId]) {
|
|
198
|
+
return {
|
|
199
|
+
...item,
|
|
200
|
+
...filteredFee?.[priceId]
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return item;
|
|
204
|
+
})
|
|
205
|
+
args["fee_platform"] = undefined
|
|
206
|
+
args["dataTicket"] = editedDataTicket
|
|
207
|
+
LibNavigation.navigate('payment/ticket_multi', args)
|
|
190
208
|
})
|
|
191
209
|
})
|
|
192
210
|
|
|
211
|
+
function curlPriceConfig(price_id: string, onDone: (data: any) => void) {
|
|
212
|
+
setLoading(true)
|
|
213
|
+
if (data?.url_price_config) {
|
|
214
|
+
new LibCurl(data?.url_price_config, null, (res, msg) => {
|
|
215
|
+
setLoading(false)
|
|
216
|
+
onDone(res?.[price_id])
|
|
217
|
+
}, (err) => {
|
|
218
|
+
setLoading(false)
|
|
219
|
+
LibToastProperty.show(err?.message)
|
|
220
|
+
})
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
193
224
|
function loadDataPrice() {
|
|
194
225
|
new LibCurl(data?.price_list_url, null, (res, msg) => {
|
|
195
226
|
|
|
@@ -334,18 +365,43 @@ export default function m(props: EventArtist_detail_multiProps): any {
|
|
|
334
365
|
item?.status == 1 && (ticketWithDate || ticketSpecial) && itemC.selected == 1 &&
|
|
335
366
|
<View style={applyStyle({ marginTop: 4, flexDirection: 'row', marginLeft: 8, alignContent: 'center', alignItems: 'center' })}>
|
|
336
367
|
<TouchableOpacity onPress={() => {
|
|
337
|
-
// min()
|
|
338
368
|
let qty = 1
|
|
339
|
-
if (itemC.qty <=
|
|
340
|
-
|
|
369
|
+
if (Number(itemC.qty) - 1 <= 0) {
|
|
370
|
+
// set 0 & unselect tiket
|
|
371
|
+
qty = 0
|
|
372
|
+
|
|
373
|
+
const data = new LibObject(priceList)
|
|
374
|
+
.update((itemList) => {
|
|
375
|
+
itemList.selected = 0
|
|
376
|
+
itemList.qty = 0
|
|
377
|
+
itemList.seat_autopick = item.config?.seat_autopick
|
|
378
|
+
itemList.use_seat = item.use_seat
|
|
379
|
+
return itemList
|
|
380
|
+
})(i, 'list', iC)
|
|
381
|
+
.update((priceTypeItem) => {
|
|
382
|
+
return ({
|
|
383
|
+
...priceTypeItem,
|
|
384
|
+
selected: priceTypeItem.list.some((item: any) => item.selected == 1) ? 1 : 0
|
|
385
|
+
})
|
|
386
|
+
})(i)
|
|
387
|
+
.value()
|
|
388
|
+
|
|
389
|
+
setPriceList(data)
|
|
390
|
+
|
|
341
391
|
} else {
|
|
342
|
-
|
|
343
|
-
|
|
392
|
+
// patuhi qty_min
|
|
393
|
+
if (itemC.qty <= item.qty_min) {
|
|
394
|
+
qty = Number(item.qty_min)
|
|
395
|
+
} else {
|
|
396
|
+
qty = Number(itemC.qty) - 1
|
|
397
|
+
}
|
|
344
398
|
|
|
345
|
-
|
|
399
|
+
// set qty baru
|
|
400
|
+
setPriceList(LibObject.set(getPriceList(), qty)(i, 'list', iC, 'qty'))
|
|
401
|
+
}
|
|
346
402
|
|
|
347
403
|
}}>
|
|
348
|
-
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
|
|
404
|
+
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", justifyContent: 'center', alignContent: 'center', alignItems: 'center' })}>
|
|
349
405
|
<LibIcon name="minus" color="#e74c3c" />
|
|
350
406
|
</View>
|
|
351
407
|
</TouchableOpacity>
|
|
@@ -363,7 +419,7 @@ export default function m(props: EventArtist_detail_multiProps): any {
|
|
|
363
419
|
setPriceList(LibObject.set(getPriceList(), qty)(i, 'list', iC, 'qty'))
|
|
364
420
|
|
|
365
421
|
}}>
|
|
366
|
-
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
|
|
422
|
+
<View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", justifyContent: 'center', alignContent: 'center', alignItems: 'center' })}>
|
|
367
423
|
<LibIcon name="plus" color="#16a085" />
|
|
368
424
|
</View>
|
|
369
425
|
</TouchableOpacity>
|
|
@@ -536,11 +592,21 @@ export default function m(props: EventArtist_detail_multiProps): any {
|
|
|
536
592
|
<Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 12, textAlign: "center", textAlignVertical: 'center', color: 'black', marginHorizontal: 10 })} >{esp.lang("event/artist_detail", "booking_end")}</Text>
|
|
537
593
|
</View>
|
|
538
594
|
:
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
595
|
+
<>
|
|
596
|
+
{
|
|
597
|
+
loading ?
|
|
598
|
+
<View style={{ minWidth: '100%', alignSelf: 'center' }} >
|
|
599
|
+
<View style={{ borderWidth: 1, borderColor: 'rgba(0, 0, 0, 0)', height: 40, borderRadius: 16, backgroundColor: "#e6e6e6", alignItems: 'center', justifyContent: 'center', paddingHorizontal: 9 }} >
|
|
600
|
+
<ActivityIndicator size={"small"} color={LibStyle.colorPrimary} />
|
|
601
|
+
</View>
|
|
602
|
+
</View> :
|
|
603
|
+
<EventButton label={esp.lang("event/artist_detail", "buy_ticket")} onPress={() => {
|
|
604
|
+
EventIndexProperty.isLogin(() => {
|
|
605
|
+
proceedToPayment()
|
|
606
|
+
})
|
|
607
|
+
}} style={{ backgroundColor: LibStyle.colorGreen, marginTop: 2, marginHorizontal: 15 }} />
|
|
608
|
+
}
|
|
609
|
+
</>
|
|
544
610
|
}
|
|
545
611
|
</>
|
|
546
612
|
:
|
|
@@ -14,6 +14,7 @@ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
|
14
14
|
import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
|
|
15
15
|
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
16
16
|
import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
|
|
17
|
+
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
17
18
|
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
18
19
|
import { UseCondition } from 'esoftplay/cache/use/condition/import';
|
|
19
20
|
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
@@ -55,6 +56,10 @@ export default function m(props: EventExchange_ticket_listProps): any {
|
|
|
55
56
|
return 0
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
function isEmptyObject(obj: any) {
|
|
60
|
+
return JSON.stringify(obj) === "{}";
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
return (
|
|
59
64
|
<View style={{ flex: 1, }}>
|
|
60
65
|
<EventHeader title={esp.lang("event/exchange_ticket", "exchange_history")} />
|
|
@@ -156,20 +161,24 @@ export default function m(props: EventExchange_ticket_listProps): any {
|
|
|
156
161
|
<EventButton
|
|
157
162
|
style={{ margin: 10 }}
|
|
158
163
|
label={esp.lang("event/tms_log", "btn_close")} onPress={() => {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
164
|
+
if (isEmptyObject(log)) {
|
|
165
|
+
LibToastProperty.show(esp.lang("event/tms_log", "empty_data"))
|
|
166
|
+
} else {
|
|
167
|
+
LibDialog.confirm(esp.lang("event/tms_log", "send_title"), "Kirim laporan scan exchange tiket ke admin?", esp.lang("event/tms_log", "send_ok"), () => {
|
|
168
|
+
LibProgress.show("Loading..")
|
|
169
|
+
sendTm("#closing_exchange\n" + JSON.stringify({
|
|
170
|
+
domain: esp.config('domain'),
|
|
171
|
+
tms_name: UserClass.state().get('name'),
|
|
172
|
+
email: UserClass.state().get('email'),
|
|
173
|
+
event_name: EventTms_dashboardProperty.closingDataState()?.get()?.event_name,
|
|
174
|
+
data: EventExchange_ticketProperty.stateExchangeLog.get()
|
|
175
|
+
}, undefined, 2), '-1001737180019', undefined, () => {
|
|
176
|
+
EventExchange_ticketProperty.stateExchangeLog.reset()
|
|
177
|
+
LibProgress.hide()
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
}, esp.lang("event/tms_log", "send_no"), () => { })
|
|
181
|
+
}
|
|
173
182
|
|
|
174
183
|
}} />
|
|
175
184
|
|