esoftplay-event 0.0.1 → 0.0.2
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/event/artist.tsx +11 -7
- package/event/artist_detail.tsx +3 -5
- package/event/artist_detailv2.tsx +386 -0
- package/event/artistv2.tsx +162 -0
- package/event/button_order_detail.tsx +43 -0
- package/event/countdown_base.tsx +16 -3
- package/event/countdown_event.tsx +47 -0
- package/event/detail.tsx +30 -37
- package/event/detail2.tsx +354 -0
- package/event/exchange_ticket.tsx +1 -1
- package/event/exchange_ticket_list.tsx +2 -3
- package/event/exchange_ticket_result.tsx +1 -1
- package/event/firebase_socket.ts +8 -0
- package/event/loading_page.tsx +4 -2
- package/event/order.tsx +23 -36
- package/event/order_detail.tsx +119 -41
- package/event/order_detail_upgrade.tsx +8 -5
- package/event/order_detail_upgrade_payment.tsx +17 -11
- package/event/order_detail_visitor.tsx +33 -33
- package/event/order_detail_waiting.tsx +45 -20
- package/event/order_item.tsx +1 -1
- package/event/order_lottery.tsx +48 -36
- package/event/order_reschedule.tsx +50 -52
- package/event/order_share_to.tsx +11 -24
- package/event/order_share_to_detail.tsx +8 -3
- package/event/order_waiting.tsx +1 -1
- package/event/queue_pricing.tsx +16 -3
- package/event/refresh_button.tsx +3 -5
- package/event/scan_item.tsx +2 -2
- package/event/seat.tsx +19 -11
- package/event/seat_map_new.tsx +313 -0
- package/event/secure_page.debug.tsx +34 -0
- package/event/secure_page.live.tsx +35 -0
- package/event/secure_page.tsx +6 -5
- package/event/test.tsx +240 -155
- package/event/ticket_list.tsx +49 -21
- package/event/ticket_list2.tsx +83 -34
- package/event/tms_check_code.tsx +6 -0
- package/event/tms_check_ticket_result.tsx +36 -7
- package/event/tms_dashboard.tsx +85 -3
- package/event/tms_gate.tsx +6 -0
- package/event/tms_home.tsx +1 -4
- package/event/tms_in_failed.tsx +1 -1
- package/event/tms_in_log.tsx +2 -0
- package/event/tms_in_success.tsx +1 -1
- package/event/tms_log.tsx +10 -25
- package/event/tms_out.tsx +1 -1
- package/event/tms_out_failed.tsx +1 -1
- package/event/visitor_input.tsx +23 -5
- package/event/visitor_inputv2.tsx +397 -0
- package/event/voucher.tsx +2 -0
- package/event/voucher2.tsx +14 -6
- package/id.json +25 -9
- package/package.json +1 -1
- package/event/entrance.tsx +0 -215
- package/event/entrance_again.tsx +0 -199
- package/event/entrance_failed.tsx +0 -190
- package/event/entrance_idcard.tsx +0 -199
- package/event/entrance_list.tsx +0 -264
- package/event/entrance_list_item.tsx +0 -88
- package/event/entrance_log.tsx +0 -130
- package/event/entrance_success.tsx +0 -153
- package/event/entrance_warning.tsx +0 -91
- package/event/exit.tsx +0 -91
- package/event/exit_failed.tsx +0 -135
- package/event/exit_list.tsx +0 -118
- package/event/exit_log.tsx +0 -130
- package/event/exit_success.tsx +0 -143
- package/event/exit_temporary.tsx +0 -226
- package/event/firebase_socket.debug.ts +0 -260
- package/event/firebase_socket.live.ts +0 -335
- package/event/hall_in.tsx +0 -148
- package/event/hall_in_failed.tsx +0 -270
- package/event/hall_in_list.tsx +0 -222
- package/event/hall_in_log.tsx +0 -134
- package/event/hall_in_success.tsx +0 -132
- package/event/hall_out.tsx +0 -143
- package/event/hall_out_failed.tsx +0 -133
- package/event/hall_out_list.tsx +0 -215
- package/event/hall_out_log.tsx +0 -133
- package/event/hall_out_success.tsx +0 -130
- package/event/log.tsx +0 -433
- package/event/seat_map_test.tsx +0 -401
|
@@ -76,13 +76,14 @@ export default function m(props: EventOrder_share_to_detailProps): any {
|
|
|
76
76
|
set_qty(_qty == 1 ? 1 : _qty - 1)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function shareTicket() {
|
|
79
|
+
function shareTicket(p: any) {
|
|
80
80
|
LibDialog.warningConfirm(esp.lang("event/order_share_to_detail", "title_confirm_share_ticket"), esp.lang("event/order_share_to_detail", "msg_confirm_share_ticket"), esp.lang("event/order_share_to_detail", "btn_yes_confirm_share_ticket"), () => {
|
|
81
81
|
let post = {
|
|
82
82
|
receiver_email: userTo?.email,
|
|
83
83
|
booking_id: result?.booking_id,
|
|
84
84
|
qty_shared: _qty,
|
|
85
|
-
trx_id: trxId
|
|
85
|
+
trx_id: trxId,
|
|
86
|
+
pin: p
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
LibProgress.show(esp.lang("event/order_share_to_detail", "msg_wait"))
|
|
@@ -170,7 +171,11 @@ export default function m(props: EventOrder_share_to_detailProps): any {
|
|
|
170
171
|
receiver_email: userTo.email,
|
|
171
172
|
})
|
|
172
173
|
} else {
|
|
173
|
-
|
|
174
|
+
LibNavigation.navigateForResult("bigbang/payment_pin", undefined, 1132).then((p) => {
|
|
175
|
+
if (p) {
|
|
176
|
+
shareTicket(p)
|
|
177
|
+
}
|
|
178
|
+
})
|
|
174
179
|
}
|
|
175
180
|
}} />
|
|
176
181
|
|
package/event/order_waiting.tsx
CHANGED
|
@@ -86,7 +86,7 @@ export default function m(props: EventOrder_waitingProps): any {
|
|
|
86
86
|
item?.status == 0 ?
|
|
87
87
|
<View style={applyStyle({ marginHorizontal: 25, marginBottom: 10, flex: 1, borderTopColor: "#000", borderTopWidth: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', alignContent: 'center' })}>
|
|
88
88
|
<View style={{ flex: 1 }}>
|
|
89
|
-
<EventCountdown_base expired={LibUtils.moment(item?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss')} style={applyStyle({ fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
|
|
89
|
+
<EventCountdown_base expired={LibUtils.moment(item?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss', item?.timezone)} style={applyStyle({ fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
|
|
90
90
|
</View>
|
|
91
91
|
{
|
|
92
92
|
!!item?.booking_code &&
|
package/event/queue_pricing.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
|
7
7
|
import esp from 'esoftplay/esp';
|
|
8
8
|
import useGlobalState, { useGlobalReturn } from 'esoftplay/global';
|
|
9
9
|
import useSafeState from 'esoftplay/state';
|
|
10
|
-
import { useTimeout } from 'esoftplay/timeout';
|
|
10
|
+
import { useDebounce, useTimeout } from 'esoftplay/timeout';
|
|
11
11
|
import { useKeepAwake } from 'expo-keep-awake';
|
|
12
12
|
import LottieView from 'lottie-react-native';
|
|
13
13
|
import React, { useEffect, useRef } from 'react';
|
|
@@ -47,17 +47,30 @@ export default function m(props: EventQueueProps): any {
|
|
|
47
47
|
event_id = String(event_id)
|
|
48
48
|
const [number, setNumber, getNumber] = useSafeState(esp.lang("event/queue_pricing", "info"))
|
|
49
49
|
const animation = useRef<LottieView>(null)
|
|
50
|
-
let refTimeout = useRef<any>()
|
|
50
|
+
let refTimeout = useRef<any>(null)
|
|
51
51
|
const pathQueue = EVENT_PRICING_QUEUE
|
|
52
52
|
|
|
53
53
|
const timeout = useTimeout()
|
|
54
|
+
const redebounce = useDebounce()
|
|
54
55
|
useKeepAwake()
|
|
55
56
|
|
|
57
|
+
function checkIsHasNumber() {
|
|
58
|
+
redebounce(() => {
|
|
59
|
+
if (!(Number(number) > 0)) {
|
|
60
|
+
addQueue(String(pathQueue), String(event_id), () => {
|
|
61
|
+
getCurrentQueue(1)
|
|
62
|
+
});
|
|
63
|
+
checkIsHasNumber()
|
|
64
|
+
}
|
|
65
|
+
}, 7000)
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
useEffect(() => {
|
|
57
69
|
setQueueStatus(1)
|
|
58
70
|
addQueue(String(pathQueue), String(event_id), () => {
|
|
59
71
|
getCurrentQueue(1)
|
|
60
72
|
});
|
|
73
|
+
checkIsHasNumber()
|
|
61
74
|
timeout(() => {
|
|
62
75
|
animation.current?.play()
|
|
63
76
|
}, 300);
|
|
@@ -76,7 +89,7 @@ export default function m(props: EventQueueProps): any {
|
|
|
76
89
|
clearTimeout(refTimeout.current)
|
|
77
90
|
refTimeout.current = setTimeout(() => {
|
|
78
91
|
LibNavigation.replace('event/queue_pricing', { event_id, autoPass })
|
|
79
|
-
},
|
|
92
|
+
}, 12000);
|
|
80
93
|
}
|
|
81
94
|
}, [queueStatus])
|
|
82
95
|
|
package/event/refresh_button.tsx
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
// withHooks
|
|
2
|
+
// noPage
|
|
2
3
|
|
|
3
4
|
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
4
5
|
import useSafeState from 'esoftplay/state';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import { Animated, TouchableOpacity } from 'react-native';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
export interface EventRefresh_buttonArgs {
|
|
10
|
-
|
|
11
|
-
}
|
|
12
9
|
export interface EventRefresh_buttonProps {
|
|
13
10
|
onPress: () => void,
|
|
14
11
|
size?: number
|
|
12
|
+
containerStyle?: any
|
|
15
13
|
}
|
|
16
14
|
export default function m(props: EventRefresh_buttonProps): any {
|
|
17
15
|
const [anim, setAnim] = useSafeState(new Animated.Value(0))
|
|
@@ -31,7 +29,7 @@ export default function m(props: EventRefresh_buttonProps): any {
|
|
|
31
29
|
})
|
|
32
30
|
|
|
33
31
|
return (
|
|
34
|
-
<TouchableOpacity onPress={() => { rotate(); props.onPress(); }} style={{ height: 30, width: 30, alignItems: 'center', justifyContent: 'center' }} >
|
|
32
|
+
<TouchableOpacity onPress={() => { rotate(); props.onPress(); }} style={{ height: 30, width: 30, alignItems: 'center', justifyContent: 'center', ...props.containerStyle }} >
|
|
35
33
|
<Animated.View style={{ height: size + 8, width: size + 8, transform: [{ rotate: rotateAnim }], alignItems: 'center', justifyContent: 'center' }} >
|
|
36
34
|
<LibIcon name="refresh" size={size} color="#999" />
|
|
37
35
|
</Animated.View>
|
package/event/scan_item.tsx
CHANGED
|
@@ -49,11 +49,11 @@ export default function m(props: EventScan_itemProps): any {
|
|
|
49
49
|
<View style={{}}>
|
|
50
50
|
{
|
|
51
51
|
props?.item?.hall_scanned && props?.item?.hall_scanned != "0000-00-00 00:00:00" &&
|
|
52
|
-
<Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#c9c9c9", marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.hall_scanned).serverFormat("DD MMMM YYYY H:m:s")}</Text>
|
|
52
|
+
<Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#c9c9c9", marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.hall_scanned).serverFormat("DD MMMM YYYY H:m:s ", props?.item?.scanned_detail?.timezone) /* + props.item?.scanned_detail?.timezone_locale || "" */}</Text>
|
|
53
53
|
}
|
|
54
54
|
{
|
|
55
55
|
!Array.isArray(props?.item?.scanned_detail) && props?.item?.scanned_detail?.scanned != "" && props?.item?.scanned_detail?.scanned != "0000-00-00 00:00:00" &&
|
|
56
|
-
<Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: LibStyle.colorRed, marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.
|
|
56
|
+
<Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: LibStyle.colorRed, marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.scanned_detail?.scanned).serverFormat("DD MMMM YYYY H:m:s ", props?.item?.scanned_detail?.timezone) /* + props.item?.scanned_detail?.timezone_locale || "" */}</Text>
|
|
57
57
|
}
|
|
58
58
|
{
|
|
59
59
|
props.item?.status == 1 &&
|
package/event/seat.tsx
CHANGED
|
@@ -130,7 +130,6 @@ export default function m(props: EventSeatProps): any {
|
|
|
130
130
|
})
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
134
133
|
function loadDataSize() {
|
|
135
134
|
let post = {
|
|
136
135
|
event_id: dataTicket?.event_id,
|
|
@@ -222,14 +221,13 @@ export default function m(props: EventSeatProps): any {
|
|
|
222
221
|
LibNavigation.sendBackResult(value)
|
|
223
222
|
}
|
|
224
223
|
|
|
225
|
-
function shareTicket() {
|
|
224
|
+
function shareTicket(p: any) {
|
|
226
225
|
if (dataTicket?.qty != counter) {
|
|
227
226
|
LibToastProperty.show(esp.lang("event/seat", "select_seat1"))
|
|
228
227
|
return
|
|
229
228
|
}
|
|
230
229
|
|
|
231
|
-
let
|
|
232
|
-
let _colId = result?.list?.filter((item: any) => item.check).map((it: any) => it.seat_column)
|
|
230
|
+
let seatName = result?.list?.filter((item: any) => item.check).map((it: any) => it.seat_name)
|
|
233
231
|
let _bookingMemberId = result?.list?.filter((item: any) => item.check).map((it: any) => it.id)
|
|
234
232
|
|
|
235
233
|
LibDialog.confirm(esp.lang("event/seat", "share_title"), esp.lang("event/seat", "share_msg"), esp.lang("event/seat", "share_confirm"), () => {
|
|
@@ -237,10 +235,10 @@ export default function m(props: EventSeatProps): any {
|
|
|
237
235
|
receiver_email: receiver_email,
|
|
238
236
|
booking_id: result?.booking_id,
|
|
239
237
|
qty_shared: dataTicket?.qty,
|
|
240
|
-
|
|
241
|
-
column_id: _colId.join('|'),
|
|
238
|
+
seat_name: seatName.join('|'),
|
|
242
239
|
booking_member_id: _bookingMemberId.join('|'),
|
|
243
|
-
trx_id: trxId
|
|
240
|
+
trx_id: trxId,
|
|
241
|
+
pin: p
|
|
244
242
|
}
|
|
245
243
|
|
|
246
244
|
LibProgress.show(esp.lang("event/seat", "share_wait"))
|
|
@@ -262,7 +260,7 @@ export default function m(props: EventSeatProps): any {
|
|
|
262
260
|
})
|
|
263
261
|
}
|
|
264
262
|
|
|
265
|
-
function sendBackTicket() {
|
|
263
|
+
function sendBackTicket(p: any) {
|
|
266
264
|
if (dataTicket?.qty != counter) {
|
|
267
265
|
LibToastProperty.show(esp.lang("event/seat", "select_seat2"))
|
|
268
266
|
return
|
|
@@ -274,7 +272,8 @@ export default function m(props: EventSeatProps): any {
|
|
|
274
272
|
let _bookingMemberId = result?.tickets?.filter((item: any) => item.check).map((it: any) => it.id)
|
|
275
273
|
|
|
276
274
|
let post = {
|
|
277
|
-
booking_member_id: _bookingMemberId.join('|')
|
|
275
|
+
booking_member_id: _bookingMemberId.join('|'),
|
|
276
|
+
pin: p
|
|
278
277
|
}
|
|
279
278
|
new LibCurl('event_booking_shared_return?booking_id=' + result?.booking_id + '&qty_shared=' + dataTicket?.qty, post, (res, msg) => {
|
|
280
279
|
// LibNotify(res)
|
|
@@ -438,7 +437,11 @@ export default function m(props: EventSeatProps): any {
|
|
|
438
437
|
</ScrollView>
|
|
439
438
|
<View style={{ paddingVertical: 10, paddingHorizontal: 20 }} >
|
|
440
439
|
<EventButton label={esp.lang("event/seat", "next")} onPress={() => {
|
|
441
|
-
|
|
440
|
+
LibNavigation.navigateForResult("bigbang/payment_pin", undefined, 1132).then((p) => {
|
|
441
|
+
if (p) {
|
|
442
|
+
shareTicket(p)
|
|
443
|
+
}
|
|
444
|
+
})
|
|
442
445
|
}} style={{ backgroundColor: dataTicket?.qty != counter ? LibStyle.colorGrey : LibStyle.colorPrimary }} />
|
|
443
446
|
</View>
|
|
444
447
|
</>
|
|
@@ -464,7 +467,12 @@ export default function m(props: EventSeatProps): any {
|
|
|
464
467
|
</ScrollView>
|
|
465
468
|
<View style={{ paddingVertical: 10, paddingHorizontal: 20 }} >
|
|
466
469
|
<EventButton label={esp.lang("event/seat", "next")} onPress={() => {
|
|
467
|
-
|
|
470
|
+
LibNavigation.navigateForResult("bigbang/payment_pin", undefined, 1132).then((p) => {
|
|
471
|
+
if (p) {
|
|
472
|
+
sendBackTicket(p)
|
|
473
|
+
}
|
|
474
|
+
})
|
|
475
|
+
|
|
468
476
|
}} style={{ backgroundColor: dataTicket?.qty != counter ? LibStyle.colorGrey : LibStyle.colorPrimary }} />
|
|
469
477
|
</View>
|
|
470
478
|
</>
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
import { Canvas, Group, RoundedRect, Text, useFont } from '@shopify/react-native-skia';
|
|
3
|
+
import { EventButton } from 'esoftplay/cache/event/button/import';
|
|
4
|
+
import { EventHeader } from 'esoftplay/cache/event/header/import';
|
|
5
|
+
import { EventMessage } from 'esoftplay/cache/event/message/import';
|
|
6
|
+
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
7
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
8
|
+
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
9
|
+
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
10
|
+
import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
|
|
11
|
+
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
12
|
+
import { UseMap } from 'esoftplay/cache/use/map/import';
|
|
13
|
+
import esp from 'esoftplay/esp';
|
|
14
|
+
import useSafeState from 'esoftplay/state';
|
|
15
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
16
|
+
import { Dimensions, Pressable, ScrollView, View } from 'react-native';
|
|
17
|
+
import { TapGestureHandler, TapGestureHandlerStateChangeEvent } from 'react-native-gesture-handler';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export interface EventSeat_map_newArgs {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
export interface EventSeat_map_newProps {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
export default function m(props: any): any {
|
|
27
|
+
const { dataTicket, url } = LibNavigation.getArgsAll<any>(props)
|
|
28
|
+
const qty = dataTicket?.qty
|
|
29
|
+
|
|
30
|
+
const deviceWidth = Dimensions.get('window').width;
|
|
31
|
+
const [scale, setScale] = useState(1);
|
|
32
|
+
const [boundingBox, setBoundingBox] = useSafeState({ "x1": 1, "x2": 2, "y1": 1, "y2": 2 })
|
|
33
|
+
const [data, setData, getData] = useSafeState<[number, number, string, number][]>([])
|
|
34
|
+
const initialBoxSize = 30;
|
|
35
|
+
const contentWidth = (boundingBox.x2 - (boundingBox.x1 - 1.1)) * initialBoxSize
|
|
36
|
+
const [, setSelectedSeat, getSelectedSeat] = useSafeState<any>([])
|
|
37
|
+
const [errBookedSeat, setErrBookedSeat] = useSafeState()
|
|
38
|
+
|
|
39
|
+
// Scale boxSize so that contentWidth fits deviceWidth
|
|
40
|
+
const scaleToFit = deviceWidth / contentWidth;
|
|
41
|
+
const boxSize = initialBoxSize * scaleToFit;
|
|
42
|
+
|
|
43
|
+
// Recalculate xs, ys, width, height with scaled boxSize
|
|
44
|
+
const xsScaled = getData()?.map(([x]) => isNaN(x) ? 0 : (boxSize) + (x * boxSize));
|
|
45
|
+
const ysScaled = getData()?.map(([_, y]) => isNaN(y) ? 0 : (boxSize) + (y * boxSize));
|
|
46
|
+
|
|
47
|
+
const width = Math.max(deviceWidth, xsScaled.length && xsScaled.every(v => !isNaN(v)) ? Math.max(...xsScaled) + boxSize : boxSize * 2);
|
|
48
|
+
const height = ysScaled.length && ysScaled.every(v => !isNaN(v)) ? Math.max(...ysScaled) + boxSize : boxSize * 2;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// Preload all possible fonts at top level (to avoid render hook errors)
|
|
52
|
+
const fontSizes = [boxSize * 0.35, boxSize * 0.30, boxSize * 0.27, boxSize * 0.25, boxSize * 0.20];
|
|
53
|
+
const fonts = fontSizes.map(size => useFont(esp.assets('fonts/MonoSpace.ttf'), size));
|
|
54
|
+
|
|
55
|
+
const getFontByLength = (length: number) => {
|
|
56
|
+
if (length <= 2) return fonts[0];
|
|
57
|
+
if (length == 3) return fonts[1];
|
|
58
|
+
if (length == 4) return fonts[2];
|
|
59
|
+
if (length == 5) return fonts[3];
|
|
60
|
+
return fonts[4];
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getFontSizeByLength = (length: number) => {
|
|
64
|
+
if (length <= 2) return fontSizes[0];
|
|
65
|
+
if (length == 3) return fontSizes[1];
|
|
66
|
+
if (length == 4) return fontSizes[2];
|
|
67
|
+
if (length == 5) return fontSizes[3];
|
|
68
|
+
return fontSizes[4];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
// const size: any = {
|
|
73
|
+
// 1: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.3),
|
|
74
|
+
// 2: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.3),
|
|
75
|
+
// 3: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.25),
|
|
76
|
+
// 4: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.27),
|
|
77
|
+
// 5: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.25),
|
|
78
|
+
// 6: useFont(esp.assets('fonts/MonoSpace.ttf'), boxSize * 0.15),
|
|
79
|
+
// }
|
|
80
|
+
|
|
81
|
+
const handleTap = useCallback((event: TapGestureHandlerStateChangeEvent) => {
|
|
82
|
+
if (event.nativeEvent.state !== 5) return;
|
|
83
|
+
// Adjust tap coordinates for scale
|
|
84
|
+
const x = event.nativeEvent.x / scale;
|
|
85
|
+
const y = event.nativeEvent.y / scale;
|
|
86
|
+
for (let i = 0; i < getData()?.length; i++) {
|
|
87
|
+
const [sx, sy, seatName, status] = getData()?.[i];
|
|
88
|
+
const xSize = (boxSize / 2) + (sx * boxSize);
|
|
89
|
+
const ySize = (boxSize / 2) + (sy * boxSize);
|
|
90
|
+
|
|
91
|
+
if (x >= xSize && x <= xSize + boxSize && y >= ySize && y <= ySize + boxSize) {
|
|
92
|
+
if (status == 0) {
|
|
93
|
+
setSelectedSeat((prev: any) => {
|
|
94
|
+
if (!prev?.includes(seatName)) {
|
|
95
|
+
if (prev?.length < qty) {
|
|
96
|
+
return [...prev, seatName];
|
|
97
|
+
}
|
|
98
|
+
LibToastProperty.show(esp.lang("event/seat_map", "max_seat", qty))
|
|
99
|
+
return prev;
|
|
100
|
+
}
|
|
101
|
+
return prev.filter((s: string) => s != seatName);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
}, [data, boxSize, scale]);
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
loadDataSeatmapBooked()
|
|
112
|
+
return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
|
|
113
|
+
}, [])
|
|
114
|
+
|
|
115
|
+
function updateIndexByRes(data: any, res: any) {
|
|
116
|
+
const resArr = res.split(",").map((item: any) => item.trim()); // biar aman dari spasi
|
|
117
|
+
return data.map((row: any) => {
|
|
118
|
+
if (resArr.includes(row[2])) {
|
|
119
|
+
return [row[0], row[1], row[2], 3];
|
|
120
|
+
}
|
|
121
|
+
return row;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function loadDataSeatmap(seatBooked: any) {
|
|
126
|
+
new LibCurl("v3/event_seat", {
|
|
127
|
+
event_id: dataTicket?.event_id,
|
|
128
|
+
price_id: dataTicket?.selected_ticket?.price_id,
|
|
129
|
+
ondate: dataTicket?.ondate || dataTicket?.selected_ticket?.list?.ondate
|
|
130
|
+
}, (res, msg) => {
|
|
131
|
+
// esp.log(res);
|
|
132
|
+
setBoundingBox(res.metadata.bounding_box)
|
|
133
|
+
let x = res.layout.split(';').map((item: any) => item.split(',')).map(([x, y, seatName, status]: any) => [Number(x), Number(y), seatName, Number(status)])
|
|
134
|
+
let updated = updateIndexByRes(x, seatBooked)
|
|
135
|
+
setData(updated)
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function loadDataSeatmapBooked() {
|
|
140
|
+
new LibCurl("v3/event_seat_booked", {
|
|
141
|
+
event_id: dataTicket?.event_id,
|
|
142
|
+
price_id: dataTicket?.selected_ticket?.price_id,
|
|
143
|
+
ondate: dataTicket?.ondate || dataTicket?.selected_ticket?.list?.ondate
|
|
144
|
+
}, (res, msg) => {
|
|
145
|
+
loadDataSeatmap(res)
|
|
146
|
+
setErrBookedSeat(undefined)
|
|
147
|
+
}, (err) => {
|
|
148
|
+
setErrBookedSeat(err?.message)
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (errBookedSeat) {
|
|
153
|
+
return (
|
|
154
|
+
<View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
|
|
155
|
+
<EventHeader title={esp.lang("event/seat_map", "header_title")} />
|
|
156
|
+
<View style={{ flex: 1 }}>
|
|
157
|
+
<EventMessage
|
|
158
|
+
message={errBookedSeat}
|
|
159
|
+
children={
|
|
160
|
+
<EventButton
|
|
161
|
+
label='Coba lagi'
|
|
162
|
+
style={{ marginHorizontal: 15 }}
|
|
163
|
+
onPress={() => {
|
|
164
|
+
loadDataSeatmapBooked()
|
|
165
|
+
}}
|
|
166
|
+
/>
|
|
167
|
+
}
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
170
|
+
</View>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<View key={scale} style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }} >
|
|
176
|
+
<EventHeader title={esp.lang("event/seat_map", "header_title")} />
|
|
177
|
+
<View style={{ flex: 1 }}>
|
|
178
|
+
<View style={{ marginBottom: 5, }}>
|
|
179
|
+
<ScrollView style={{ padding: 10, paddingLeft: 0, }} horizontal>
|
|
180
|
+
<UseMap
|
|
181
|
+
data={getLegends()}
|
|
182
|
+
renderItem={(item) => (
|
|
183
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginLeft: 15, marginRight: 5 }} >
|
|
184
|
+
<View style={{ height: 20, width: 20, borderRadius: 2, borderWidth: 0.5, backgroundColor: item[0], marginRight: 8 }} />
|
|
185
|
+
<LibTextstyle textStyle='caption1' text={item[1]} />
|
|
186
|
+
</View>
|
|
187
|
+
)}
|
|
188
|
+
/>
|
|
189
|
+
</ScrollView>
|
|
190
|
+
</View>
|
|
191
|
+
<ScrollView horizontal >
|
|
192
|
+
<ScrollView >
|
|
193
|
+
<TapGestureHandler onHandlerStateChange={handleTap}>
|
|
194
|
+
<View>
|
|
195
|
+
<Canvas
|
|
196
|
+
style={{
|
|
197
|
+
width: width * scale,
|
|
198
|
+
height: height * scale,
|
|
199
|
+
padding: 10,
|
|
200
|
+
backgroundColor: LibStyle.colorBgGrey,
|
|
201
|
+
|
|
202
|
+
}}>
|
|
203
|
+
{
|
|
204
|
+
getData()?.map(([x, y, name, status], i) => {
|
|
205
|
+
const isSelected = getSelectedSeat()?.includes(name)
|
|
206
|
+
const color = isSelected ? "#8EF67B" : getColorByStatus(status)
|
|
207
|
+
const xSize = (boxSize / 2) + (x * boxSize)
|
|
208
|
+
const ySize = (boxSize / 2) + (y * boxSize)
|
|
209
|
+
|
|
210
|
+
const fontSize = getFontSizeByLength(name?.length);
|
|
211
|
+
const font = getFontByLength(name?.length);
|
|
212
|
+
|
|
213
|
+
const textWidthApprox = fontSize * name?.length * 0.6;
|
|
214
|
+
const textX = xSize + (boxSize - textWidthApprox) / 2;
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<Group key={i}>
|
|
218
|
+
<RoundedRect
|
|
219
|
+
x={xSize - 1}
|
|
220
|
+
r={(boxSize + 2) * 0.1}
|
|
221
|
+
y={ySize - 1}
|
|
222
|
+
width={boxSize + 2}
|
|
223
|
+
transform={[{ scale }]}
|
|
224
|
+
height={boxSize + 2}
|
|
225
|
+
color={"#999"} />
|
|
226
|
+
<RoundedRect
|
|
227
|
+
x={xSize}
|
|
228
|
+
r={boxSize * 0.1}
|
|
229
|
+
y={ySize}
|
|
230
|
+
width={boxSize}
|
|
231
|
+
transform={[{ scale }]}
|
|
232
|
+
height={boxSize}
|
|
233
|
+
color={color} />
|
|
234
|
+
{name && font && (
|
|
235
|
+
<Text
|
|
236
|
+
x={textX}
|
|
237
|
+
y={(ySize) + boxSize * 0.60}
|
|
238
|
+
color={"#020202"}
|
|
239
|
+
text={name}
|
|
240
|
+
transform={[{ scale }]}
|
|
241
|
+
font={font} />
|
|
242
|
+
)}
|
|
243
|
+
</Group>
|
|
244
|
+
)
|
|
245
|
+
})
|
|
246
|
+
}
|
|
247
|
+
</Canvas>
|
|
248
|
+
</View>
|
|
249
|
+
</TapGestureHandler>
|
|
250
|
+
</ScrollView>
|
|
251
|
+
</ScrollView>
|
|
252
|
+
<View style={{ flexDirection: 'row', marginHorizontal: 12, height: 40, borderColor: '#060606', borderWidth: 1, borderRadius: 5, alignItems: 'center' }} >
|
|
253
|
+
<Pressable onPress={() => setScale((x) => x - 0.3)} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
|
|
254
|
+
<LibIcon.SimpleLineIcons name='magnifier-remove' />
|
|
255
|
+
</Pressable>
|
|
256
|
+
<Pressable onPress={() => setScale((x) => x + 0.3)} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
|
|
257
|
+
<LibIcon.SimpleLineIcons name='magnifier-add' />
|
|
258
|
+
</Pressable>
|
|
259
|
+
<View style={{ height: 40, width: 1, backgroundColor: '#060606', marginRight: 12 }} />
|
|
260
|
+
{/* <Text style={{}} >{esp.lang("event/seat_map", "selected", String(data.filter((x) => x == -1).length), qty)}</Text> */}
|
|
261
|
+
<LibTextstyle textStyle='callout'>{esp.lang("event/seat_map", "selected", String(getSelectedSeat().length), qty)}</LibTextstyle>
|
|
262
|
+
</View>
|
|
263
|
+
<EventButton
|
|
264
|
+
backgroundColor={getSelectedSeat()?.length < qty ? "#999" : LibStyle.colorPrimary}
|
|
265
|
+
testID={"save_btn"}
|
|
266
|
+
style={{ margin: 7 }}
|
|
267
|
+
label={esp.lang("event/seat_map", "save")}
|
|
268
|
+
onPress={() => {
|
|
269
|
+
let value = {
|
|
270
|
+
seat_label: getSelectedSeat()
|
|
271
|
+
}
|
|
272
|
+
if (getSelectedSeat()?.length < qty) {
|
|
273
|
+
LibToastProperty.show(esp.lang("event/seat_map", "seat_more", (qty - (getSelectedSeat()?.length)).toString()))
|
|
274
|
+
} else {
|
|
275
|
+
LibNavigation.sendBackResult(value, LibNavigation.getResultKey(props))
|
|
276
|
+
}
|
|
277
|
+
}}
|
|
278
|
+
/>
|
|
279
|
+
</View>
|
|
280
|
+
</View>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
function getLegends() {
|
|
285
|
+
const colors: any = [
|
|
286
|
+
["#fff", esp.lang("event/seat_map", "available"), 0],
|
|
287
|
+
["#8EF67B", esp.lang("event/seat_map", "chosen"), "-1"],
|
|
288
|
+
["#2EBBE8", esp.lang("event/seat_map", "reserved"), 3],
|
|
289
|
+
["#6C432C", esp.lang("event/seat_map", "chosen_by"), 7],
|
|
290
|
+
["#f1f2f3", esp.lang("event/seat_map", "way"), 5],
|
|
291
|
+
["#9FA1A4", esp.lang("event/seat_map", "not_sold"), 1],
|
|
292
|
+
["#6B71E6", esp.lang("event/seat_map", "seat_hold"), 2],
|
|
293
|
+
["#FF4866", esp.lang("event/seat_map", "wall"), 6],
|
|
294
|
+
["#FFA601", esp.lang("event/seat_map", "other_type"), 4],
|
|
295
|
+
["purple", esp.lang("event/seat_map", "stage"), 8]
|
|
296
|
+
]
|
|
297
|
+
return colors
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function getColorByStatus(statuses: number) {
|
|
301
|
+
const colors: any = {
|
|
302
|
+
8: 'purple',
|
|
303
|
+
0: '#fff',
|
|
304
|
+
1: "#9FA1A4",
|
|
305
|
+
2: "#6B71E6",
|
|
306
|
+
3: "#2EBBE8",
|
|
307
|
+
4: "#FFA601",
|
|
308
|
+
5: "#fff",
|
|
309
|
+
6: "#FF4866",
|
|
310
|
+
7: "#6C432C"
|
|
311
|
+
}
|
|
312
|
+
return colors[statuses]
|
|
313
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// // useLibs
|
|
2
|
+
|
|
3
|
+
// import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
4
|
+
// import { useEffect } from 'react';
|
|
5
|
+
// import { CaptureProtection } from 'react-native-capture-protection';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// export interface EventSecure_pageProps {
|
|
9
|
+
|
|
10
|
+
// }
|
|
11
|
+
// export default function m(): any {
|
|
12
|
+
// const can_screencapture = UserClass.state().get('config', 'can_screencapture')
|
|
13
|
+
// // const focus = useIsFocused()
|
|
14
|
+
|
|
15
|
+
// useEffect(() => {
|
|
16
|
+
// let subs: any
|
|
17
|
+
// if (!__DEV__)
|
|
18
|
+
// if (can_screencapture != 1) {
|
|
19
|
+
// CaptureProtection.prevent();
|
|
20
|
+
// // subs = RNPrevent?.addListener?.(() => { })
|
|
21
|
+
// }
|
|
22
|
+
// return () => {
|
|
23
|
+
// if (!__DEV__)
|
|
24
|
+
// if (can_screencapture != 1) {
|
|
25
|
+
// setTimeout(() => {
|
|
26
|
+
// CaptureProtection.allow();
|
|
27
|
+
// }, 500);
|
|
28
|
+
// // subs?.remove?.()
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
// }, [])
|
|
32
|
+
|
|
33
|
+
// return null
|
|
34
|
+
// }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// // useLibs
|
|
2
|
+
|
|
3
|
+
// import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
4
|
+
// import { useEffect } from 'react';
|
|
5
|
+
// import RNPrevent from "react-native-screenshot-prevent";
|
|
6
|
+
|
|
7
|
+
// export interface EventSecure_pageProps {
|
|
8
|
+
|
|
9
|
+
// }
|
|
10
|
+
// export default function m(): any {
|
|
11
|
+
// const can_screencapture = UserClass.state().get('config', 'can_screencapture')
|
|
12
|
+
// // const focus = useIsFocused()
|
|
13
|
+
|
|
14
|
+
// useEffect(() => {
|
|
15
|
+
// let subs: any
|
|
16
|
+
// if (!__DEV__)
|
|
17
|
+
// if (can_screencapture != 1) {
|
|
18
|
+
// RNPrevent?.enabled?.(true)
|
|
19
|
+
// RNPrevent?.enableSecureView?.()
|
|
20
|
+
// // subs = RNPrevent?.addListener?.(() => { })
|
|
21
|
+
// }
|
|
22
|
+
// return () => {
|
|
23
|
+
// if (!__DEV__)
|
|
24
|
+
// if (can_screencapture != 1) {
|
|
25
|
+
// setTimeout(() => {
|
|
26
|
+
// RNPrevent?.disableSecureView?.()
|
|
27
|
+
// RNPrevent?.enabled?.(false)
|
|
28
|
+
// }, 500)
|
|
29
|
+
// // subs?.remove?.()
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
// }, [])
|
|
33
|
+
|
|
34
|
+
// return null
|
|
35
|
+
// }
|
package/event/secure_page.tsx
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { CaptureProtection } from 'react-native-capture-protection';
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
export interface EventSecure_pageProps {
|
|
8
9
|
|
|
@@ -15,15 +16,15 @@ export default function m(): any {
|
|
|
15
16
|
let subs: any
|
|
16
17
|
if (!__DEV__)
|
|
17
18
|
if (can_screencapture != 1) {
|
|
18
|
-
|
|
19
|
-
RNPrevent?.enableSecureView?.()
|
|
19
|
+
CaptureProtection.prevent();
|
|
20
20
|
// subs = RNPrevent?.addListener?.(() => { })
|
|
21
21
|
}
|
|
22
22
|
return () => {
|
|
23
23
|
if (!__DEV__)
|
|
24
24
|
if (can_screencapture != 1) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
CaptureProtection.allow();
|
|
27
|
+
}, 500);
|
|
27
28
|
// subs?.remove?.()
|
|
28
29
|
}
|
|
29
30
|
}
|