esoftplay-event 0.0.2-w → 0.0.2-x

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.
@@ -0,0 +1,710 @@
1
+ // withHooks
2
+ import { EventAlert } from 'esoftplay/cache/event/alert/import';
3
+ import { EventButton } from 'esoftplay/cache/event/button/import';
4
+ import { EventConfigProperty } from 'esoftplay/cache/event/config/import';
5
+ import { EventCountdown_event } from 'esoftplay/cache/event/countdown_event/import';
6
+ import { EventHeader } from 'esoftplay/cache/event/header/import';
7
+ import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
8
+ import { EventOrder_itemProperty } from 'esoftplay/cache/event/order_item/import';
9
+ import { EventQueue, EventQueueProperty } from 'esoftplay/cache/event/queue/import';
10
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
11
+ import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
12
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
13
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
14
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
15
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
16
+ import { LibSkeleton } from 'esoftplay/cache/lib/skeleton/import';
17
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
18
+ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
19
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
20
+ import { UseCondition } from 'esoftplay/cache/use/condition/import';
21
+ import { UseDeeplinkProperty } from 'esoftplay/cache/use/deeplink/import';
22
+ import { UseTasks } from 'esoftplay/cache/use/tasks/import';
23
+ import esp from 'esoftplay/esp';
24
+ import useLazyState from 'esoftplay/lazy';
25
+ import useSafeState from 'esoftplay/state';
26
+ import { useEffect, useRef } from 'react';
27
+
28
+ import React from 'react';
29
+ import { ActivityIndicator, Pressable, RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
30
+
31
+
32
+ export interface EventTicket_list_newArgs {
33
+
34
+ }
35
+ export interface EventTicket_list_newProps {
36
+
37
+ }
38
+
39
+ const taskSeat = UseTasks()
40
+ export default function m(props: EventTicket_list_newProps): any {
41
+
42
+ const { url, is_multiprice }: any = useRef(LibNavigation.getArgsAll(props)).current
43
+
44
+ const [unAvailableResult, setUnavailableResult] = useLazyState<any>()
45
+ const [availableResult, setAvailableResult, getAvailableResult] = useSafeState<any>()
46
+ const [showAll, setShowAll] = useSafeState<any>({});
47
+ const [deeplinkParams] = UseDeeplinkProperty.params.useState()
48
+ const [loading, setLoading] = useSafeState<boolean>(false)
49
+ const [, setHasAdditionGlobal, getHasAdditionGlobal] = useLazyState<any>()
50
+
51
+ const [, setSelectedTickets, getSelectedTickets] = useSafeState<any[]>([])
52
+ const [urlPayment, setUrlPayment] = useLazyState<any>()
53
+
54
+ useEffect(() => {
55
+ EventConfigProperty.curlConfig('v2/config_order_type')
56
+ loadData()
57
+ }, [])
58
+
59
+ let dataEvent: any = {
60
+ event_id: availableResult?.id,
61
+ event_title: availableResult?.title,
62
+ charge_payment: availableResult?.charge_payment,
63
+ charge_payment_type: availableResult?.charge_payment_type,
64
+ images: availableResult?.images,
65
+ }
66
+
67
+ const [ticketSeat, resetTicketSeat] = taskSeat((item: any) => new Promise((next) => {
68
+ if (item.use_seat == 1) {
69
+ if (item.adjacent_seats == undefined || item.adjacent_seats == 0) {
70
+ LibNavigation.navigateForResult('event/seat_map_new', {
71
+ dataTicket: {
72
+ ...dataEvent,
73
+ qty: item.qty,
74
+ selected_ticket: {
75
+ price_id: item.price_id,
76
+ type: item.type,
77
+ list: {
78
+ ondate: item.ondate
79
+ }
80
+ }
81
+ }
82
+ }, item.list_id)
83
+ .then((value: any) => {
84
+ const merged = { ...item, ...value }
85
+ let a = LibObject.replaceItem(getSelectedTickets(), (it) => it.id == item.id, merged)()
86
+ setSelectedTickets(a)
87
+ next()
88
+ })
89
+ } else {
90
+ let a = LibObject.replaceItem(getSelectedTickets(), (it) => it.id == item.id, item)()
91
+ setSelectedTickets(a)
92
+ next()
93
+ }
94
+ } else {
95
+ let a = LibObject.replaceItem(getSelectedTickets(), (it) => it.id == item.id, item)()
96
+ setSelectedTickets(a)
97
+ next()
98
+ }
99
+ }), () => {
100
+ const hasGlobalAddition = getHasAdditionGlobal() == 1
101
+ const hasTicketAddition = getSelectedTickets()?.some((item: any) => Number(item.has_addition) == 1)
102
+ const needAdditional = hasGlobalAddition || hasTicketAddition
103
+
104
+ if (needAdditional) {
105
+ LibNavigation.navigateForResult('event/additional_new', {
106
+ dataTicket: getSelectedTickets(),
107
+ additionalGlobal: hasGlobalAddition
108
+ }).then((value) => {
109
+ if (value?.addition?.length > 0) {
110
+ dataEvent.addition = value?.addition
111
+ }
112
+
113
+ const selectedPriceIds = getSelectedTickets()?.map((x: any) => x.price_id)
114
+
115
+ curlPriceConfig(selectedPriceIds, (filteredFee) => {
116
+ const editedDataTicket = getSelectedTickets()?.map((item: any) => {
117
+ const priceId = item.price_id;
118
+ if (filteredFee?.[priceId]) {
119
+ return {
120
+ ...item,
121
+ ...filteredFee?.[priceId]
122
+ };
123
+ }
124
+ return item;
125
+ })
126
+
127
+ LibNavigation.navigate('payment/ticket_multi', {
128
+ order_type: EventConfigProperty?.state()?.get()?.order_type?.ticket,
129
+ dataEvent: dataEvent,
130
+ dataTicket: editedDataTicket,
131
+ url_payment: urlPayment,
132
+ })
133
+ })
134
+ })
135
+ } else {
136
+ const selectedPriceIds = getSelectedTickets()?.map((x: any) => x.price_id)
137
+
138
+ curlPriceConfig(selectedPriceIds, (filteredFee) => {
139
+ const editedDataTicket = getSelectedTickets()?.map((item: any) => {
140
+ const priceId = item.price_id;
141
+ if (filteredFee?.[priceId]) {
142
+ return {
143
+ ...item,
144
+ ...filteredFee?.[priceId]
145
+ };
146
+ }
147
+ return item;
148
+ })
149
+
150
+ LibNavigation.navigate('payment/ticket_multi', {
151
+ order_type: EventConfigProperty?.state()?.get()?.order_type?.ticket,
152
+ dataEvent: dataEvent,
153
+ dataTicket: editedDataTicket,
154
+ url_payment: urlPayment,
155
+ })
156
+ })
157
+ }
158
+
159
+ })
160
+
161
+ function curlPriceConfig(price_ids: string[], onDone: (data: any) => void) {
162
+ setLoading(true)
163
+ if (getAvailableResult()?.url_price_config) {
164
+ new LibCurl(getAvailableResult()?.url_price_config, null, (res, msg) => {
165
+ setLoading(false)
166
+ let filteredFee: any = {}
167
+ if (res) {
168
+ filteredFee = Object.fromEntries(
169
+ price_ids.flatMap(k => res[k] ? [[k, res[k]]] : [])
170
+ )
171
+ }
172
+ onDone(filteredFee)
173
+ }, (err) => {
174
+ setLoading(false)
175
+ LibToastProperty.show(err?.message)
176
+ })
177
+ } else {
178
+ setLoading(false)
179
+ onDone({})
180
+ }
181
+ }
182
+
183
+ function onRefresh() {
184
+ loadData()
185
+ }
186
+
187
+ function loadData() {
188
+ new LibCurl(url, null, (res, msg) => {
189
+
190
+ // esp.log(res);
191
+ const availablePriceType = LibObject.update(res, (arr: any[]) => arr?.filter((x) => x.status != 0))('price_list')
192
+ const unAvailablePriceType = LibObject.update(res, (arr: any[]) => arr?.filter((x) => x.status == 0))('price_list')
193
+ setUnavailableResult(unAvailablePriceType)
194
+ setAvailableResult(availablePriceType)
195
+ setHasAdditionGlobal(res?.has_addition_global)
196
+ setUrlPayment(res?.url_payment)
197
+
198
+ }, (error) => {
199
+ LibDialog.warningConfirm("Oops!", error?.message, "Ok", () => {
200
+ LibNavigation.back()
201
+ }, "", () => { })
202
+ }, 1)
203
+ }
204
+
205
+
206
+ function selectTicket(priceTypeItem: any, ticket: any, isMultiple: number) {
207
+ const selectedData = {
208
+ ...ticket,
209
+ qty: Number(priceTypeItem.qty_min),
210
+ qty_min: Number(priceTypeItem?.qty_min),
211
+ qty_max: Number(priceTypeItem?.qty_max),
212
+ list_id: ticket.list_id,
213
+ subtotal: Number(ticket.price) * Number(priceTypeItem.qty_min),
214
+ type: priceTypeItem?.name,
215
+ tax: priceTypeItem?.tax,
216
+ term: priceTypeItem?.term,
217
+ has_addition: priceTypeItem?.has_addition,
218
+ image_map: priceTypeItem?.image_map,
219
+ use_seat: priceTypeItem?.use_seat,
220
+ adjacent_seats: priceTypeItem?.config?.seat_autopick,
221
+ fee_amount: priceTypeItem?.fee_amount,
222
+ fee_type: priceTypeItem?.fee_type,
223
+ event_id: availableResult?.id
224
+ }
225
+
226
+ setSelectedTickets((prev) => {
227
+ const alreadySelected = prev.some(x => x.id == ticket.id)
228
+
229
+ // SINGLE
230
+ if (isMultiple != 1) {
231
+
232
+ // klik lagi = unselect
233
+ if (alreadySelected) {
234
+ return []
235
+ }
236
+
237
+ // replace semua
238
+ return [selectedData]
239
+ }
240
+
241
+ // MULTIPLE
242
+ // remove
243
+ if (alreadySelected) {
244
+ return prev.filter(x => x.id != ticket.id)
245
+ }
246
+
247
+ // add
248
+ return [...prev, selectedData]
249
+ })
250
+ }
251
+
252
+ function decreaseQty(id: string) {
253
+ setSelectedTickets((prev) => {
254
+ return prev.map((ticket) => {
255
+ // bukan target
256
+ if (ticket.id != id) {
257
+ return ticket
258
+ }
259
+
260
+ const nextQty = ticket.qty - 1
261
+ // kalau habis -> unselect
262
+ if (nextQty <= 0) {
263
+ return null
264
+ }
265
+
266
+ // patuhi qty_min
267
+ const finalQty = nextQty <= ticket.qty_min ? ticket.qty_min : nextQty
268
+ return {
269
+ ...ticket,
270
+ qty: finalQty,
271
+ subtotal: finalQty * ticket.price
272
+ }
273
+ })
274
+
275
+ // hapus null
276
+ .filter(Boolean)
277
+ })
278
+ }
279
+
280
+ function increaseQty(id: string) {
281
+ setSelectedTickets((prev) => {
282
+ return prev.map((ticket) => {
283
+ // bukan target
284
+ if (ticket.id != id) {
285
+ return ticket
286
+ }
287
+ const nextQty = ticket.qty + 1
288
+
289
+ // patuhi qty_max
290
+ if (nextQty > ticket.qty_max) {
291
+ return ticket
292
+ }
293
+
294
+ // patuhi quota
295
+ if (ticket.use_quota && nextQty > ticket.quota_left) {
296
+ return ticket
297
+ }
298
+
299
+ return {
300
+ ...ticket,
301
+ qty: nextQty,
302
+ subtotal:
303
+ nextQty * ticket.price
304
+ }
305
+ })
306
+ })
307
+ }
308
+
309
+ function checkSeatMap() {
310
+ resetTicketSeat()
311
+ ticketSeat(getSelectedTickets())
312
+ }
313
+
314
+ function getTicketStatusMessage(priceTypeItem: any, ticket: any) {
315
+ const status = priceTypeItem.status != 1 ? priceTypeItem.status : ticket.status
316
+
317
+ switch (status) {
318
+ case 2:
319
+ return "Segera Hadir"
320
+
321
+ case 0:
322
+ return "Habis terjual"
323
+
324
+ default:
325
+ return ""
326
+ }
327
+ }
328
+
329
+
330
+ function renderItem(itemC: any, iC: number, item: any) {
331
+ // itemC adalah item yang ada diindex list, kalo item itu adalah item yang ada diindex price_type
332
+ let ticketWithDate = item.price_date == 1 && item.use_code == 0
333
+ let ticketInvitation = item.price_date == 0 && item.use_code == 1
334
+ let ticketSpecial = item.price_date == 0 && item.use_code == 0
335
+
336
+ let _selectedTicket = getSelectedTickets()?.find(x => x.id == itemC.id)
337
+ const qty = _selectedTicket?.qty || 0
338
+ let isMultiple = is_multiprice
339
+
340
+ let colorDefault = _selectedTicket ? "#FFE9AD" : '#fff'
341
+ let colorBackground = item.status != 1 ? LibStyle.colorLightGrey : itemC.status != 1 ? LibStyle.colorLightGrey : colorDefault
342
+ let textOpacity = /* item.status == 1 ? 1 : */itemC?.status == 1 ? 1 : 0.3
343
+
344
+ let showCountDown = getAvailableResult()?.countdown_booking == "1" && itemC?.status == 1 && item?.status == 1 && item?.date_start != "0000-00-00 00:00:00" && item?.date_end != "0000-00-00 00:00:00" && LibUtils?.moment(item?.date_end).format("YYYY-MM-DD HH:mm:ss") >= LibUtils?.moment().format("YYYY-MM-DD HH:mm:ss")
345
+ let dateShowed = item?.price_date == 1 ?
346
+ LibUtils?.moment(item?.date_end).format("YYYY-MM-DD HH:mm:ss") > LibUtils?.moment(itemC?.ondate).format("YYYY-MM-DD HH:mm:ss") ? LibUtils?.moment(itemC?.ondate).add(1, "days").format("YYYY-MM-DD HH:mm:ss") : item?.date_end
347
+ : item?.date_end
348
+
349
+
350
+ return (
351
+ <TouchableOpacity key={iC} onPress={() => {
352
+ const isAvailable = item.status == 1 && itemC.status == 1
353
+
354
+ if (!isAvailable) {
355
+ LibToastProperty.show(getTicketStatusMessage(item, itemC))
356
+ return
357
+ }
358
+ selectTicket(item, itemC, isMultiple)
359
+
360
+ }} testID="ticket_item" activeOpacity={itemC.status == 1 ? 0 : 1} style={{ backgroundColor: colorBackground, borderBottomWidth: item.list.length == 1 ? 0 : 5, borderBottomColor: "#fff" }}>
361
+ <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', padding: 10, alignItems: 'center' }}>
362
+ {
363
+ ticketWithDate ?
364
+ // view untuk yang ada tanggalnya
365
+ <View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center', }}>
366
+ <View style={{ 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' }}>
367
+ <Text allowFontScaling={false} style={{ opacity: textOpacity, fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0.23, textAlign: "center", color: _selectedTicket ? "#3ea4dc" : '#999' }}>{LibUtils.moment(itemC.ondate).localeFormat('DD')}</Text>
368
+ </View>
369
+ <View style={{ flexDirection: 'column', flex: 1 }}>
370
+ {
371
+ item?.status == 1 && itemC.status != 1 &&
372
+ <View style={{ flexDirection: 'row', marginBottom: 5 }}>
373
+ <View style={{ alignContent: 'center', alignItems: 'center', justifyContent: 'center', marginTop: 5, borderWidth: 1, backgroundColor: itemC.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: itemC.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 }}>
374
+ <Text allowFontScaling={false} style={{ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: /* itemC.status == 2 ? "#000" : */ "#fff", fontWeight: 'bold' }}>{itemC.status == 0 ? "Habis terjual" : "Segera Hadir"}</Text>
375
+ </View>
376
+ </View>
377
+ }
378
+ {
379
+ showCountDown ?
380
+ <Text allowFontScaling={false} style={{ opacity: textOpacity, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{LibUtils.moment(itemC?.ondate).localeFormat('dddd, MMMM YYYY')}</Text>
381
+ :
382
+ <>
383
+ <Text allowFontScaling={false} style={{ opacity: textOpacity, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{LibUtils.moment(itemC.ondate).localeFormat('dddd')}</Text>
384
+ <View style={{ flexDirection: 'row' }}>
385
+ <Text allowFontScaling={false} style={{ opacity: textOpacity, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{LibUtils.moment(itemC.ondate).localeFormat('MMMM')}</Text>
386
+ <Text allowFontScaling={false} style={{ opacity: textOpacity, marginLeft: 7, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{LibUtils.moment(itemC.ondate).localeFormat('YYYY')}</Text>
387
+ </View>
388
+ </>
389
+ }
390
+ {
391
+ showCountDown &&
392
+ <EventCountdown_event date={dateShowed} containerStyle={{ marginVertical: -5 }} />
393
+ }
394
+ </View>
395
+ </View>
396
+ :
397
+ // view untuk yang undangan dan khusus
398
+ <View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
399
+ <LibPicture source={esp.assets(ticketInvitation ? 'icons/invitation2.png' : 'icons/ic_special2.png')} style={{ height: 42, width: 42 }} />
400
+ <View style={{ marginLeft: 14, flex: 1 }} >
401
+ {
402
+ item?.status == 1 && itemC.status != 1 &&
403
+ <View style={{ flexDirection: 'row', marginBottom: 5 }}>
404
+ <View style={{ alignContent: 'center', alignItems: 'center', justifyContent: 'center', marginTop: 5, borderWidth: 1, backgroundColor: itemC.status == 0 ? LibStyle.colorRed : LibStyle.colorPrimary, borderColor: itemC.status == 0 ? LibStyle.colorRed : LibStyle.colorPrimary, borderRadius: 5, padding: 3, opacity: 0.8 }}>
405
+ <Text allowFontScaling={false} style={{ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: "#fff", fontWeight: 'bold' }}>{itemC.status == 0 ? "Habis terjual" : "Segera Hadir"}</Text>
406
+ </View>
407
+ </View>
408
+ }
409
+ {<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{item.type}</Text>}
410
+ {
411
+ item.info != "" &&
412
+ <EventHtmltext allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: "Arial", fontSize: 11, fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' }}>{item.info}</EventHtmltext>
413
+ }
414
+ </View>
415
+ </View>
416
+ }
417
+
418
+ <View style={{ marginRight: 5, marginLeft: 5, flexDirection: 'column' }} >
419
+ {
420
+ (itemC.status == 1 || itemC.status == 0 || itemC.show_price == 1) &&
421
+ <Text allowFontScaling={false} style={{ opacity: ticketWithDate ? textOpacity : 1, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "right", color: _selectedTicket ? "#3ea4dc" : (itemC.price == 0 ? LibStyle.colorGreen : '#999') }} >{itemC.price == 0 ? "Free" : LibUtils.money(itemC.price, itemC.currency)}</Text>
422
+ }
423
+ {
424
+ (ticketWithDate || ticketSpecial) && _selectedTicket &&
425
+ <View style={{ marginTop: 4, flexDirection: 'row', marginLeft: 8, alignContent: 'center', alignItems: 'center' }}>
426
+ <Pressable hitSlop={{ top: 15, left: 15, right: 15, bottom: 15 }} testID='minus_btn' onPress={() => {
427
+ decreaseQty(itemC.id)
428
+ }}>
429
+ <View style={{ padding: 1, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
430
+ <LibIcon name="minus" color="#e74c3c" />
431
+ </View>
432
+ </Pressable>
433
+ <Text style={{ fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#9b9b9b", marginLeft: 13, marginRight: 13 }}>{qty}</Text>
434
+ <Pressable hitSlop={{ top: 15, left: 15, right: 15, bottom: 15 }} testID='plus_btn' onPress={() => {
435
+ increaseQty(itemC.id)
436
+ }}>
437
+ <View style={{ padding: 1, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
438
+ <LibIcon name="plus" color="#16a085" />
439
+ </View>
440
+ </Pressable>
441
+ </View>
442
+ }
443
+ </View>
444
+
445
+ {
446
+ itemC.url_artist != "" &&
447
+ <TouchableOpacity onPress={() => {
448
+ if (item.status == 1 && itemC.status == 1) {
449
+ LibNavigation.navigate('event/schedule2', {
450
+ url: itemC?.url_artist,
451
+ })
452
+
453
+ return
454
+ let itemTicket = {
455
+ ...item
456
+ }
457
+ let replaceList = LibObject.set(itemTicket, itemC)('list')
458
+ // ini jika dia gajadi beli dari halaman schedule.
459
+ // setSelectedTicket(replaceList)
460
+ // setQtyGlobal(itemT)
461
+ // releaseQueue()
462
+ // ini untuk dikirim ke halaman schedule
463
+ let dataPost: any = {
464
+ event_id: availableResult?.id,
465
+ event_title: availableResult?.title,
466
+ charge_payment: availableResult?.charge_payment,
467
+ charge_payment_type: availableResult?.charge_payment_type,
468
+ images: availableResult?.images,
469
+ selected_ticket: replaceList,
470
+ qty: itemC.hasOwnProperty("qty") ? itemC?.qty : 1,
471
+ }
472
+
473
+ LibNavigation.navigate('event/schedule', {
474
+ url: itemC?.url_artist,
475
+ schedule: itemC.schedule,
476
+ order_type: EventConfigProperty?.state()?.get()?.order_type?.ticket,
477
+ tax: item?.tax,
478
+ dataBookingEvent: dataPost,
479
+ is_multiprice: 1
480
+ })
481
+ }
482
+
483
+
484
+ }} activeOpacity={itemC.status == 1 ? 0 : 1} style={{ padding: 5, opacity: 1 }} hitSlop={{ top: 15, left: 15, right: 15, bottom: 15 }} >
485
+ <LibIcon name="information-outline" size={18} color={"#434343"} style={{ opacity: textOpacity }} />
486
+ </TouchableOpacity>
487
+ }
488
+
489
+
490
+ </View>
491
+ </TouchableOpacity>
492
+ )
493
+ }
494
+
495
+ let listLength = new Array(10).fill('')
496
+ const maxDisplay = 3;
497
+ const handleShowAll = (price_id: any) => {
498
+ setShowAll((prevShowAll: any) => ({
499
+ ...prevShowAll,
500
+ [price_id]: !prevShowAll[price_id],
501
+ }));
502
+ };
503
+
504
+ if (!availableResult) {
505
+ return (
506
+ <View style={{ flex: 1, backgroundColor: "#fff" }}>
507
+ <EventHeader title={"Beli tiket"} subtitle={"Pilih tanggal"} />
508
+ <LibSkeleton>
509
+ {
510
+ listLength.map((item: any, i: number) => {
511
+ return (
512
+ <View key={i}>
513
+ <View style={{ height: 30, width: '100%', backgroundColor: '#fff' }} />
514
+ <View style={{ padding: 10, width: '100%', flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' }}>
515
+ <View style={{ flexDirection: 'row' }}>
516
+ <View style={{ backgroundColor: '#fff', height: 42, width: 42, borderRadius: 3, marginRight: 10 }} />
517
+ <View style={{ width: '60%' }}>
518
+ <View style={{ backgroundColor: '#fff', height: 20, width: '40%' }} />
519
+ <View style={{ backgroundColor: '#fff', marginTop: 7, height: 14, width: '70%' }} />
520
+ </View>
521
+ </View>
522
+ <View style={{ backgroundColor: '#fff', height: 20, width: '10%' }} />
523
+ </View>
524
+ </View>
525
+ )
526
+ })
527
+ }
528
+ </LibSkeleton>
529
+ </View>
530
+ )
531
+ }
532
+
533
+ return (
534
+ <EventQueue event_id={Number(availableResult?.id)} >
535
+ <View style={{ flex: 1, backgroundColor: '#fff' }}>
536
+ {/* <LibFocus onFocus={onRefresh} /> */}
537
+ <EventHeader title={"Beli tiket"} subtitle={"Pilih tanggal"} />
538
+ <EventQueueProperty.QueueCountdown
539
+ onExpired={() => {
540
+ LibNavigation.back()
541
+ }}
542
+ />
543
+
544
+ <ScrollView refreshControl={<RefreshControl refreshing={false} onRefresh={onRefresh} />}>
545
+ <UseCondition if={is_multiprice == 1} >
546
+ <EventAlert
547
+ color={LibStyle.colorPrimary}
548
+ msg={"Kamu dapat memilih beberapa tiket sekaligus"}
549
+ style={{ marginHorizontal: 15 }}
550
+ useIcon
551
+ />
552
+ </UseCondition>
553
+ {
554
+ availableResult?.image_map != "" &&
555
+ <TouchableOpacity onPress={() => {
556
+ LibNavigation.navigate('lib/gallery', { image: availableResult?.image_map })
557
+ }} style={{ marginBottom: 10, marginTop: 20 }}>
558
+ <LibPicture source={{ uri: availableResult?.image_map }} style={{ alignSelf: 'center', height: LibStyle.width * 0.5, width: LibStyle.width }} resizeMode="contain" />
559
+ </TouchableOpacity>
560
+ }
561
+ <View style={{ flex: 1 }}>
562
+ {
563
+ availableResult?.price_list?.map?.((priceType: any, i: number) => {
564
+ let textOpacity = priceType?.status == 1 ? 1 : 0.3
565
+ let filterFullData = availableResult?.price_list?.filter((it: any) => it.status != 0)
566
+ const displayedData = showAll[priceType?.price_id] ? priceType?.list : priceType?.list.slice(0, maxDisplay);
567
+
568
+ let ticketWithDate = priceType.price_date == 1 && priceType.use_code == 0
569
+ let _selectedTicket = getSelectedTickets()?.some(x => x.price_id == priceType.price_id)
570
+
571
+ return (
572
+ <Pressable onPress={() => {
573
+
574
+ }} key={i} style={{ overflow: 'hidden', margin: 15, marginBottom: 5, marginTop: 10, backgroundColor: '#fff', borderRadius: 10, ...LibStyle.elevation(2), borderWidth: 1, borderColor: _selectedTicket ? LibStyle.colorBlue : LibStyle.colorBgGrey }}>
575
+ <View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius: 10, borderTopRightRadius: 10 }}>
576
+ {
577
+ priceType?.hasOwnProperty('label') && (priceType?.label != "" && priceType?.label != null) &&
578
+ <View style={{ flexDirection: 'row' }}>
579
+ <View style={{ alignContent: 'center', alignItems: 'center', justifyContent: 'center', borderWidth: 1, backgroundColor: priceType?.label_color, borderColor: priceType?.label_color, borderRadius: 3, padding: 2, paddingHorizontal: 5, opacity: 1 }}>
580
+ <Text allowFontScaling={false} style={{ fontSize: 10, fontStyle: "normal", letterSpacing: 0.5, color: EventOrder_itemProperty.textColor(priceType?.label_color), fontWeight: 'bold' }}>{priceType?.label}</Text>
581
+ </View>
582
+ </View>
583
+ }
584
+ <View style={{ alignContent: 'center', alignItems: 'center', flexDirection: 'row', justifyContent: 'space-between', }}>
585
+ <View style={{ flex: 2 }}>
586
+ <EventHtmltext allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold' }}>{priceType?.name}
587
+ {
588
+ Number(priceType?.qty_min) > 1 &&
589
+ <Text style={{ color: LibStyle.colorRed, fontSize: 10, fontWeight: 'normal' }}> {"(" + "Min.Order " + LibUtils.number(priceType?.qty_min) + ")"}</Text>
590
+ }
591
+ </EventHtmltext>
592
+ {
593
+ availableResult?.countdown_booking == "1" && displayedData?.length == 1 && priceType?.status == 1 && priceType?.date_start != "0000-00-00 00:00:00" && priceType?.date_end != "0000-00-00 00:00:00" && LibUtils.moment(priceType?.date_end).format("YYYY-MM-DD HH:mm:ss") >= LibUtils?.moment().format("YYYY-MM-DD HH:mm:ss") &&
594
+ <EventCountdown_event date={priceType?.date_end} containerStyle={{ marginVertical: -5 }} />
595
+ }
596
+
597
+ {
598
+ deeplinkParams?.type == 'event-voucher' && deeplinkParams?.price_id == priceType?.price_id ?
599
+ <Text allowFontScaling={false} style={{ color: "coral", fontSize: 12, fontWeight: 'bold' }}>{"Voucher terpasang: " + deeplinkParams?.code}</Text>
600
+ : null
601
+ }
602
+ </View>
603
+
604
+ {
605
+ priceType?.status != 1 &&
606
+ <View style={{ flex: 1, justifyContent: 'flex-end', flexDirection: 'row' }}>
607
+ <View style={{ alignContent: 'center', alignItems: 'center', justifyContent: 'center', borderWidth: 1, backgroundColor: priceType?.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: priceType?.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 }}>
608
+ <Text allowFontScaling={false} style={{ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: priceType?.status == 2 ? "#000" : "#fff", fontWeight: 'bold' }}>{priceType?.status == 0 ? "Habis terjual" : "Segera Hadir"}</Text>
609
+ </View>
610
+ </View>
611
+ }
612
+ </View>
613
+ {
614
+ priceType?.info != "" && ticketWithDate &&
615
+ <View style={{ marginTop: 3, alignContent: 'center', alignItems: 'center', flexDirection: 'row', marginRight: 5 }}>
616
+ <Text allowFontScaling={false} style={{ fontSize: 12, color: LibStyle.colorBlue }}>{priceType?.info}</Text>
617
+ </View>
618
+ }
619
+ </View>
620
+ {
621
+ displayedData?.map((itemC: any, iC: number) => renderItem(itemC, iC, priceType))
622
+ }
623
+
624
+ {
625
+ filterFullData[i]?.list?.length > 3 &&
626
+ <TouchableOpacity onPress={() => {
627
+ handleShowAll(priceType?.price_id)
628
+ }} style={{ borderTopColor: LibStyle.colorGrey, borderTopWidth: 0.8, flex: 1, padding: 8, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
629
+ <Text allowFontScaling={false} style={{ marginRight: 5, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorBlue }}>{showAll[priceType?.price_id] ? "Lebih sedikit" : "Lihat lebih banyak"}</Text>
630
+ <LibIcon name={showAll[priceType?.price_id] ? 'chevron-double-up' : 'chevron-double-down'} color={LibStyle.colorBlue} size={18} />
631
+ </TouchableOpacity>
632
+ }
633
+
634
+ </Pressable>
635
+ )
636
+ })
637
+ }
638
+
639
+ {/* ini view yang dibawah */}
640
+ <View style={{ marginTop: 30 }}>
641
+ {
642
+ unAvailableResult?.price_list?.length > 0 &&
643
+ <View style={{ margin: 15, marginTop: 0, marginBottom: 0, paddingBottom: 10, borderBottomWidth: 1, borderBottomColor: LibStyle.colorGrey }}>
644
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16 }}>{"Tiket tidak tersedia"}</Text>
645
+ </View>
646
+ }
647
+ {
648
+ unAvailableResult?.price_list?.map?.((item: any, i: number) => {
649
+ let textOpacity = item?.status == 1 ? 1 : 0.3
650
+ let ticketWithDate = item.price_date == 1 && item.use_code == 0
651
+ return (
652
+ <View key={i} style={{ overflow: 'hidden', margin: 15, marginBottom: 5, backgroundColor: '#fff', borderRadius: 10, ...LibStyle.elevation(2), borderWidth: 1, borderColor: item.selected == 1 ? LibStyle.colorBlue : LibStyle.colorBgGrey }}>
653
+ <View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius: 10, borderTopRightRadius: 10 }}>
654
+ <View style={{ alignContent: 'center', alignItems: 'center', flexDirection: 'row', justifyContent: 'space-between', }}>
655
+ <Text allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold' }}>{item.name}</Text>
656
+ {
657
+ item?.status != 1 &&
658
+ <View style={{ flexDirection: 'row' }}>
659
+ <View style={{ alignContent: 'center', alignItems: 'center', justifyContent: 'center', borderWidth: 1, backgroundColor: item.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: item.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 }}>
660
+ <Text allowFontScaling={false} style={{ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: item.status == 2 ? "#000" : "#fff", fontWeight: 'bold' }}>{item.status == 0 ? "Habis terjual" : "Segera Hadir"}</Text>
661
+ </View>
662
+ </View>
663
+ }
664
+ </View>
665
+ {
666
+ item.info != "" && ticketWithDate &&
667
+ <View style={{ marginTop: 3, alignContent: 'center', alignItems: 'center', flexDirection: 'row', marginRight: 5 }}>
668
+ <Text allowFontScaling={false} style={{ fontSize: 12, color: LibStyle.colorBlue }}>{item.info}</Text>
669
+ </View>
670
+ }
671
+ </View>
672
+ {
673
+ item.list.slice(0, 3).map((itemC: any, iC: number) => renderItem(itemC, iC, item, i))
674
+ }
675
+ </View>
676
+ )
677
+ })
678
+ }
679
+ </View>
680
+
681
+ </View>
682
+ </ScrollView>
683
+ <View style={{ margin: 10, marginVertical: 5 }}>
684
+ {
685
+ availableResult?.price_type_info != "" &&
686
+ <Text allowFontScaling={false} style={{ marginBottom: 10, fontFamily: "Arial", fontSize: 13, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorBlue }} >{availableResult && availableResult?.hasOwnProperty("price_type_info") && availableResult?.price_type_info}</Text>
687
+ }
688
+ {
689
+ loading ?
690
+ <View style={{ minWidth: '100%', alignSelf: 'center' }} >
691
+ <View style={{ borderWidth: 1, borderColor: 'rgba(0, 0, 0, 0)', height: 40, borderRadius: 16, backgroundColor: "#e6e6e6", alignItems: 'center', justifyContent: 'center', paddingHorizontal: 9 }} >
692
+ <ActivityIndicator size={"small"} color={LibStyle.colorPrimary} />
693
+ </View>
694
+ </View>
695
+ :
696
+ <EventButton testID={"next_btn"} label={"Selanjutnya"} onPress={() => {
697
+ if (getSelectedTickets()?.length > 0) {
698
+ checkSeatMap();
699
+ } else {
700
+ LibToastProperty.show("Silahkan pilih tanggal atau tipe tiket", 3000)
701
+ return
702
+ }
703
+
704
+ }} style={{ backgroundColor: LibStyle.colorPrimary }} />
705
+ }
706
+ </View>
707
+ </View>
708
+ </EventQueue>
709
+ )
710
+ }