esoftplay-event 0.0.0-a
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 +11 -0
- package/event/additional.tsx +188 -0
- package/event/additional_input.tsx +316 -0
- package/event/block_invitation.tsx +48 -0
- package/event/countdown.tsx +72 -0
- package/event/counter_cashier.tsx +180 -0
- package/event/counter_cashier_report.tsx +114 -0
- package/event/counter_cashier_sell.tsx +135 -0
- package/event/counter_eo.tsx +451 -0
- package/event/counter_history.tsx +74 -0
- package/event/counter_history_item.tsx +48 -0
- package/event/counter_info.tsx +96 -0
- package/event/counter_lm.tsx +273 -0
- package/event/counter_menu.tsx +85 -0
- package/event/counter_report.tsx +105 -0
- package/event/counter_report_breakdown.tsx +93 -0
- package/event/counter_report_detail.tsx +238 -0
- package/event/counter_report_detail_list.tsx +56 -0
- package/event/counter_request.tsx +136 -0
- package/event/counter_request_detail.tsx +211 -0
- package/event/counter_section.tsx +32 -0
- package/event/counter_send.tsx +277 -0
- package/event/counter_status.tsx +32 -0
- package/event/counter_type.tsx +23 -0
- package/event/counter_user_list.tsx +197 -0
- package/event/counter_user_list_item.tsx +143 -0
- package/event/coupon.tsx +124 -0
- package/event/coupon_claim.tsx +198 -0
- package/event/coupon_claim_detail.tsx +175 -0
- package/event/coupon_claim_history.tsx +279 -0
- package/event/coupon_claim_reimburse.tsx +111 -0
- package/event/coupon_claim_reimburse_history.tsx +72 -0
- package/event/coupon_claim_reimburse_history_detail.tsx +117 -0
- package/event/coupon_claim_staff.tsx +256 -0
- package/event/coupon_detail.tsx +98 -0
- package/event/coupon_event_list.tsx +77 -0
- package/event/coupon_generate.tsx +258 -0
- package/event/coupon_generate_event.tsx +79 -0
- package/event/coupon_generate_list.tsx +56 -0
- package/event/date_picker.tsx +152 -0
- package/event/detail.tsx +352 -0
- package/event/entrance.tsx +215 -0
- package/event/entrance_again.tsx +200 -0
- package/event/entrance_failed.tsx +190 -0
- package/event/entrance_idcard.tsx +203 -0
- package/event/entrance_list.tsx +264 -0
- package/event/entrance_list_item.tsx +88 -0
- package/event/entrance_log.tsx +130 -0
- package/event/entrance_success.tsx +155 -0
- package/event/entrance_warning.tsx +91 -0
- package/event/exchange_reward.tsx +31 -0
- package/event/exchange_reward_result.tsx +137 -0
- package/event/exchange_ticket.tsx +234 -0
- package/event/exchange_ticket_list.tsx +191 -0
- package/event/exchange_ticket_result.tsx +211 -0
- package/event/exit.tsx +91 -0
- package/event/exit_failed.tsx +135 -0
- package/event/exit_list.tsx +118 -0
- package/event/exit_log.tsx +131 -0
- package/event/exit_success.tsx +143 -0
- package/event/exit_temporary.tsx +226 -0
- package/event/hall_in.tsx +148 -0
- package/event/hall_in_failed.tsx +270 -0
- package/event/hall_in_list.tsx +222 -0
- package/event/hall_in_log.tsx +134 -0
- package/event/hall_in_success.tsx +132 -0
- package/event/hall_out.tsx +143 -0
- package/event/hall_out_failed.tsx +133 -0
- package/event/hall_out_list.tsx +215 -0
- package/event/hall_out_log.tsx +133 -0
- package/event/hall_out_success.tsx +130 -0
- package/event/list.tsx +219 -0
- package/event/list_filter.tsx +124 -0
- package/event/log.tsx +435 -0
- package/event/qc_idcard.tsx +209 -0
- package/event/qc_idcard_failed.tsx +78 -0
- package/event/qc_idcard_success.tsx +68 -0
- package/event/queue_out.tsx +186 -0
- package/event/queue_pricing.tsx +152 -0
- package/event/randomseat.tsx +33 -0
- package/event/review.tsx +117 -0
- package/event/review_add.tsx +342 -0
- package/event/review_detail.tsx +67 -0
- package/event/review_item.tsx +76 -0
- package/event/scan_item.tsx +66 -0
- package/event/schedule.tsx +135 -0
- package/event/seat.tsx +628 -0
- package/event/seat_autopick.tsx +120 -0
- package/event/seat_map.tsx +408 -0
- package/event/seat_map_matrix.tsx +94 -0
- package/event/seat_map_test.tsx +401 -0
- package/event/ticket_list.tsx +722 -0
- package/event/ticket_list2.tsx +680 -0
- package/event/timer.tsx +58 -0
- package/event/tms.tsx +103 -0
- package/event/tms_add.tsx +94 -0
- package/event/tms_add_result.tsx +175 -0
- package/event/tms_dashboard.tsx +89 -0
- package/event/tms_event_list.tsx +66 -0
- package/event/turnstile_event_gate.tsx +74 -0
- package/event/turnstile_event_item.tsx +41 -0
- package/event/turnstile_event_list.tsx +69 -0
- package/event/turnstile_event_ticket.tsx +95 -0
- package/event/turnstile_settings.tsx +327 -0
- package/event/turnstile_settings_otp.tsx +58 -0
- package/event/turnstile_settings_status.tsx +50 -0
- package/event/voucher.tsx +149 -0
- package/event/voucher_multi.tsx +181 -0
- package/fonts/Arial.ttf +0 -0
- package/fonts/ArialBold.ttf +0 -0
- package/fonts/DecoNumbers.ttf +0 -0
- package/fonts/MonoSpace.ttf +0 -0
- package/fonts/SFProText.ttf +0 -0
- package/fonts/digital.ttf +0 -0
- package/fonts/mono.ttf +0 -0
- package/id.json +1113 -0
- package/index.js +2 -0
- package/libs.json +1 -0
- package/mover.js +0 -0
- package/package.json +16 -0
- package/publisher.js +84 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
import { applyStyle } from 'esoftplay';
|
|
3
|
+
import { ComponentButton } from 'esoftplay/cache/component/button/import';
|
|
4
|
+
import { ComponentHeader } from 'esoftplay/cache/component/header/import';
|
|
5
|
+
import { LibCollaps } from 'esoftplay/cache/lib/collaps/import';
|
|
6
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
7
|
+
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
8
|
+
import { LibPicture } from 'esoftplay/cache/lib/picture/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 esp from 'esoftplay/esp';
|
|
13
|
+
import useSafeState from 'esoftplay/state';
|
|
14
|
+
import { useEffect } from 'react';
|
|
15
|
+
|
|
16
|
+
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
17
|
+
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
18
|
+
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export interface EventSeat_autopickArgs {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
export interface EventSeat_autopickProps {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
export default function m(props: EventSeat_autopickProps): any {
|
|
30
|
+
|
|
31
|
+
const { event_id, ondate, price_id, qty } = LibNavigation.getArgsAll(props)
|
|
32
|
+
const [availableSeat, setAvailableSeat] = useSafeState()
|
|
33
|
+
|
|
34
|
+
let data = [
|
|
35
|
+
{
|
|
36
|
+
id: 1,
|
|
37
|
+
title: esp.lang("event/seat_autopick", "seat_lined")
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 2,
|
|
41
|
+
title: esp.lang("event/seat_autopick", "seat_free")
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
const [selectedType, setSelectedType] = useSafeState()
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
loadData()
|
|
48
|
+
return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
|
|
49
|
+
}, [])
|
|
50
|
+
|
|
51
|
+
function loadData() {
|
|
52
|
+
let post = {
|
|
53
|
+
id: event_id,
|
|
54
|
+
ondate: ondate,
|
|
55
|
+
price_id: price_id
|
|
56
|
+
}
|
|
57
|
+
new LibCurl('event_seat_adjacent' + LibUtils.objectToUrlParam(post), null, (res, msg) => {
|
|
58
|
+
setAvailableSeat(res)
|
|
59
|
+
}, (err) => {
|
|
60
|
+
LibToastProperty.show(err?.message)
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!availableSeat) {
|
|
65
|
+
return <LibLoading />
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
|
|
71
|
+
<ComponentHeader title={esp.lang("event/seat_autopick", "confirm")} />
|
|
72
|
+
<ScrollView>
|
|
73
|
+
<LibTextstyle textStyle='m_overline' text={esp.lang("event/seat_autopick", "seat_option")} style={{ textAlign: 'center', marginBottom: 20, lineHeight: 20, color: '#000', fontSize: 16, margin: 15, marginTop: 25, fontWeight: 'bold' }} />
|
|
74
|
+
{
|
|
75
|
+
data?.map((item: any, i: number) => {
|
|
76
|
+
let show = true
|
|
77
|
+
let available = item.id == 1 ? Number(qty) <= Number(availableSeat) : true
|
|
78
|
+
return (
|
|
79
|
+
<LibCollaps key={i} style={{ backgroundColor: '#fff', margin: 15, borderRadius: 5, marginTop: 0 }} show={show} header={(show) =>
|
|
80
|
+
<View style={{ borderBottomWidth: 1, borderBottomColor: '#c9c9c9', overflow: 'hidden', padding: 10, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
|
|
81
|
+
<TouchableOpacity activeOpacity={available ? 0 : 1} onPress={() => {
|
|
82
|
+
if (available) {
|
|
83
|
+
setSelectedType(item)
|
|
84
|
+
} else {
|
|
85
|
+
LibToastProperty.show(esp.lang("event/seat_autopick", "seat_not_available"))
|
|
86
|
+
}
|
|
87
|
+
}} style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
|
|
88
|
+
<LibIcon name={selectedType?.id == item?.id ? 'checkbox-marked-circle-outline' : 'checkbox-blank-circle-outline'} color={selectedType?.id == item?.id ? LibStyle.colorPrimary : '#e6e6e6'} />
|
|
89
|
+
<View style={{ marginLeft: 10 }}>
|
|
90
|
+
<LibTextstyle textStyle='m_overline' text={item.title} style={{ color: available ? "#000" : '#e6e6e6', fontSize: 14, fontWeight: selectedType?.id == item?.id ? 'bold' : 'normal', letterSpacing: 1 }} />
|
|
91
|
+
<Text allowFontScaling={false} style={{ color: available ? LibStyle.colorGreen : LibStyle.colorRed, fontSize: 10, letterSpacing: 1 }}>{available ? esp.lang("event/seat_autopick", "available") : esp.lang("event/seat_autopick", "not_available")}</Text>
|
|
92
|
+
</View>
|
|
93
|
+
</TouchableOpacity>
|
|
94
|
+
<LibIcon name={show ? 'chevron-down' : 'chevron-up'} color={available ? "#000" : '#e6e6e6'} />
|
|
95
|
+
</View>
|
|
96
|
+
}>
|
|
97
|
+
<View style={{ marginHorizontal: 15, backgroundColor: '#fff', marginTop: -20 }}>
|
|
98
|
+
<LibPicture source={esp.assets(item.id == 1 ? 'lined.png' : 'spread.png')} resizeMode='contain' style={{ alignItems: 'center', justifyContent: 'center', alignContent: 'center', alignSelf: 'center', width: LibStyle.width - 100, height: (LibStyle.width - 100) / 2 }} />
|
|
99
|
+
<Text allowFontScaling={false} style={{ fontSize: 10, letterSpacing: 1, margin: 10, marginTop: 0 }}>{esp.lang("event/seat_autopick", "ilustrasi") + item.title}</Text>
|
|
100
|
+
</View>
|
|
101
|
+
</LibCollaps>
|
|
102
|
+
)
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
</ScrollView>
|
|
106
|
+
|
|
107
|
+
<View style={applyStyle({ margin: 10, marginVertical: 5 })}>
|
|
108
|
+
<ComponentButton testID={"next_btn"} label={esp.lang("event/ticket_list", "next")} onPress={() => {
|
|
109
|
+
if (!selectedType) {
|
|
110
|
+
LibToastProperty.show(esp.lang("event/seat_autopick", "seat_empty"))
|
|
111
|
+
return
|
|
112
|
+
} else {
|
|
113
|
+
LibNavigation.sendBackResult(selectedType?.id == 1 ? 1 : 0)
|
|
114
|
+
}
|
|
115
|
+
}} style={applyStyle({ backgroundColor: LibStyle.colorPrimary })} />
|
|
116
|
+
</View>
|
|
117
|
+
|
|
118
|
+
</View>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
|
|
3
|
+
import { ComponentButton } from 'esoftplay/cache/component/button/import';
|
|
4
|
+
import { ComponentHeader } from 'esoftplay/cache/component/header/import';
|
|
5
|
+
import { EventSeat_map_matrix } from 'esoftplay/cache/event/seat_map_matrix/import';
|
|
6
|
+
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
7
|
+
import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
|
|
8
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
9
|
+
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
10
|
+
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
11
|
+
import { LibObject } from 'esoftplay/cache/lib/object/import';
|
|
12
|
+
import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
13
|
+
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
14
|
+
import { LibTap } from 'esoftplay/cache/lib/tap/import';
|
|
15
|
+
import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
|
|
16
|
+
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
17
|
+
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
18
|
+
import { UseMap } from 'esoftplay/cache/use/map/import';
|
|
19
|
+
import esp from 'esoftplay/esp';
|
|
20
|
+
import useLazyState from 'esoftplay/lazy';
|
|
21
|
+
import { useTimeout } from 'esoftplay/timeout';
|
|
22
|
+
import React, { useEffect, useRef } from 'react';
|
|
23
|
+
import { Dimensions, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export type DataTicket = {
|
|
27
|
+
"event_id": string,
|
|
28
|
+
"event_title": string,
|
|
29
|
+
"charge_payment": number,
|
|
30
|
+
"charge_payment_type": string,
|
|
31
|
+
"images": Array<{
|
|
32
|
+
"image": string,
|
|
33
|
+
"title": string,
|
|
34
|
+
"description": string,
|
|
35
|
+
}>,
|
|
36
|
+
"qty": string,
|
|
37
|
+
"selected_ticket": {
|
|
38
|
+
"price_id": string,
|
|
39
|
+
"type": string,
|
|
40
|
+
"list": {
|
|
41
|
+
"ondate": string,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default function m(props: any) {
|
|
47
|
+
const { dataTicket, url } = LibNavigation.getArgsAll<any>(props)
|
|
48
|
+
const qty = dataTicket?.qty
|
|
49
|
+
let numRows = useRef(0)
|
|
50
|
+
let numCols = useRef(0)
|
|
51
|
+
let selectedSeat = useRef<any>(null).current
|
|
52
|
+
|
|
53
|
+
const [, setLockId, getLockId] = useLazyState(0)
|
|
54
|
+
const [isLocks, setIsLocks, getIsLocks] = useLazyState({})
|
|
55
|
+
const [, setIsSubmit, getIsSubmit] = useLazyState(false)
|
|
56
|
+
const [, setLockedSeat, getLockedSeat] = useLazyState<any[]>([])
|
|
57
|
+
const [seatNames, setSeatNames] = useLazyState<string[]>([])
|
|
58
|
+
const [data, setData] = useLazyState<number[]>([])
|
|
59
|
+
const [squareSize, setSquareSize] = useLazyState<number>(100)
|
|
60
|
+
const [coordinates, setCoordinates] = useLazyState<string[]>([])
|
|
61
|
+
const [selectedSeatData, setSelectedSeatData] = useLazyState<any>({})
|
|
62
|
+
const [stage, setStage] = useLazyState('')
|
|
63
|
+
const margin = squareSize * 0.25 // margin size in pixels
|
|
64
|
+
const boxSize = squareSize + margin
|
|
65
|
+
const timeout = useTimeout()
|
|
66
|
+
const rB = squareSize * 0.1
|
|
67
|
+
|
|
68
|
+
function next() {
|
|
69
|
+
let x = squareSize * 3 / 2
|
|
70
|
+
if (x <= 40) {
|
|
71
|
+
LibProgress.show(esp.lang("event/seat_map", "zoom"))
|
|
72
|
+
timeout(() => {
|
|
73
|
+
setSquareSize(x)()
|
|
74
|
+
}, 300)
|
|
75
|
+
} else {
|
|
76
|
+
LibToastProperty.show(esp.lang("event/seat_map", "zoom_max"))
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function prev() {
|
|
81
|
+
let x = squareSize * 2 / 3
|
|
82
|
+
if (x >= 10) {
|
|
83
|
+
LibProgress.show(esp.lang("event/seat_map", "zoom_out"))
|
|
84
|
+
timeout(() => {
|
|
85
|
+
setSquareSize(x)()
|
|
86
|
+
}, 300)
|
|
87
|
+
} else {
|
|
88
|
+
LibToastProperty.show(esp.lang("event/seat_map", "zoom_out_max"))
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
timeout(() => {
|
|
94
|
+
LibProgress.hide()
|
|
95
|
+
}, 300)
|
|
96
|
+
}, [squareSize])
|
|
97
|
+
|
|
98
|
+
function resetZoom() {
|
|
99
|
+
return setSquareSize((Dimensions.get('screen').width / numCols.current) * 0.8)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
function lockRelease() {
|
|
104
|
+
if (getLockedSeat().length > 0) {
|
|
105
|
+
const y = getLockedSeat().map((item) => item.y).join('|')
|
|
106
|
+
const x = getLockedSeat().map((item) => item.x).join('|')
|
|
107
|
+
toggleLock(1, y, x, () => {
|
|
108
|
+
loadData()
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
function toggleLock(lock: number, _y: string, _x: string, onDone?: () => void, onFailed?: (msg: string) => void) {
|
|
115
|
+
const lockUrl = [
|
|
116
|
+
'event_seat_lock_acquire',
|
|
117
|
+
'event_seat_lock_release',
|
|
118
|
+
'event_seat_lock_check'
|
|
119
|
+
]
|
|
120
|
+
setLockId(getLockId() + 1)
|
|
121
|
+
const idx = getLockId()
|
|
122
|
+
|
|
123
|
+
setIsLocks(LibObject.set(getIsLocks(), false)(idx))
|
|
124
|
+
new LibCurl(lockUrl[lock], {
|
|
125
|
+
event_id: dataTicket.event_id,
|
|
126
|
+
price_id: dataTicket?.selected_ticket?.price_id,
|
|
127
|
+
ondate: dataTicket?.selected_ticket?.list?.ondate,
|
|
128
|
+
row_id: _y,
|
|
129
|
+
column_id: _x,
|
|
130
|
+
},
|
|
131
|
+
(res, msg) => {
|
|
132
|
+
setIsLocks(LibObject.set(getIsLocks(), true)(idx))()
|
|
133
|
+
onDone?.()
|
|
134
|
+
},
|
|
135
|
+
(err, msg) => {
|
|
136
|
+
setIsLocks(LibObject.set(getIsLocks(), true)(idx))()
|
|
137
|
+
onFailed?.(err.message)
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
loadData()
|
|
143
|
+
return () => {
|
|
144
|
+
LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
|
|
145
|
+
if (!getIsSubmit())
|
|
146
|
+
lockRelease()
|
|
147
|
+
}
|
|
148
|
+
}, []);
|
|
149
|
+
|
|
150
|
+
function loadData() {
|
|
151
|
+
new LibCurl(url + '?' + LibUtils.objectToUrlParam({
|
|
152
|
+
offset_row: 1, offset_column: 1
|
|
153
|
+
}), {
|
|
154
|
+
event_id: dataTicket.event_id,
|
|
155
|
+
price_id: dataTicket?.selected_ticket?.price_id,
|
|
156
|
+
ondate: dataTicket?.selected_ticket?.list?.ondate,
|
|
157
|
+
compact: 4
|
|
158
|
+
}, (res, msg) => {
|
|
159
|
+
setStage(res.title)
|
|
160
|
+
setLockedSeat(res.locked)
|
|
161
|
+
lockRelease()
|
|
162
|
+
numRows.current = res.seat_row
|
|
163
|
+
numCols.current = res.seat_column
|
|
164
|
+
resetZoom()
|
|
165
|
+
setSeatNames(buildSeatNames(res.list.names, res.list.layout, setCoordinates))
|
|
166
|
+
const sizes = res.list.statuses;
|
|
167
|
+
const sizesArray: number[] = [];
|
|
168
|
+
sizes?.split(",").forEach((size: string) => {
|
|
169
|
+
if (size.includes('x')) {
|
|
170
|
+
const [v, x] = size?.split("x");
|
|
171
|
+
for (let i = 0; i < parseInt(v); i++) {
|
|
172
|
+
sizesArray.push(parseInt(x));
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
175
|
+
sizesArray.push(parseInt(size))
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
setData(sizesArray)()
|
|
179
|
+
}, (err) => {
|
|
180
|
+
LibNavigation.back()
|
|
181
|
+
LibToastProperty.show(err.message)
|
|
182
|
+
}, 1)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function toggleSeat(x: number, y: number) {
|
|
186
|
+
const cx = Math.floor(x / boxSize)
|
|
187
|
+
const cy = Math.floor(y / boxSize)
|
|
188
|
+
const index = (((cy * numCols.current) + cx))
|
|
189
|
+
const [_x, _y] = coordinates[index]?.split?.(":")
|
|
190
|
+
|
|
191
|
+
selectedSeat = {
|
|
192
|
+
x: _x,
|
|
193
|
+
y: _y,
|
|
194
|
+
index: index,
|
|
195
|
+
name: seatNames[index]
|
|
196
|
+
}
|
|
197
|
+
const countQty = data.filter((x) => x == -1).length
|
|
198
|
+
setData(LibObject.update(data, (old) => {
|
|
199
|
+
let out = old;
|
|
200
|
+
if (old == 0) {
|
|
201
|
+
if (countQty >= qty) {
|
|
202
|
+
LibToastProperty.show(esp.lang("event/seat_map", "max_seat", qty))
|
|
203
|
+
} else {
|
|
204
|
+
setSelectedSeatData(LibObject.set(selectedSeatData, selectedSeat)(selectedSeat.index))
|
|
205
|
+
out = -1;
|
|
206
|
+
toggleLock(0, _y, _x)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (old == -1) {
|
|
210
|
+
out = 0;
|
|
211
|
+
setSelectedSeatData(LibObject.set(selectedSeatData, () => null)(selectedSeat.index))
|
|
212
|
+
toggleLock(1, _y, _x)
|
|
213
|
+
}
|
|
214
|
+
return out
|
|
215
|
+
})(selectedSeat.index))()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (data.length == 0) {
|
|
219
|
+
return <LibLoading />
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const disabled = Object.values(isLocks).some((v) => v == false)
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<View style={styles.container}>
|
|
226
|
+
<ComponentHeader title={esp.lang("event/seat_map", "header_title")} subtitle={dataTicket?.selected_ticket?.type} />
|
|
227
|
+
<View style={{ alignItems: 'center', flex: 1 }}>
|
|
228
|
+
<ScrollView showsVerticalScrollIndicator style={{ marginTop: 12 }} >
|
|
229
|
+
<View style={{ marginVertical: 10 }} >
|
|
230
|
+
<ScrollView horizontal>
|
|
231
|
+
<UseMap
|
|
232
|
+
data={getLegends()}
|
|
233
|
+
renderItem={(item) => (
|
|
234
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', marginLeft: 15, marginRight: 5 }} >
|
|
235
|
+
<View style={{ height: 20, width: 20, borderRadius: 2, borderWidth: 0.5, backgroundColor: item[0], marginRight: 8 }} />
|
|
236
|
+
<LibTextstyle textStyle='caption1' text={item[1]} />
|
|
237
|
+
</View>
|
|
238
|
+
)}
|
|
239
|
+
/>
|
|
240
|
+
</ScrollView>
|
|
241
|
+
</View>
|
|
242
|
+
<View style={{ height: 40, marginLeft: 20, marginRight: 20, backgroundColor: LibStyle.colorPrimary, marginBottom: 20, borderRadius: 2, justifyContent: 'center', alignItems: 'center' }} >
|
|
243
|
+
<Text style={{ color: 'white', fontWeight: 'bold' }} >{stage || 'Depan'}</Text>
|
|
244
|
+
</View>
|
|
245
|
+
<ScrollView horizontal showsHorizontalScrollIndicator >
|
|
246
|
+
<LibTap onCoordinateGet={toggleSeat}>
|
|
247
|
+
<EventSeat_map_matrix
|
|
248
|
+
title={stage}
|
|
249
|
+
data={data}
|
|
250
|
+
mapWidth={numCols.current * boxSize + (margin)}
|
|
251
|
+
mapHeight={numRows.current * boxSize + (margin)}
|
|
252
|
+
seatNames={seatNames}
|
|
253
|
+
numCols={numCols}
|
|
254
|
+
boxSize={boxSize}
|
|
255
|
+
margin={margin}
|
|
256
|
+
squareSize={squareSize}
|
|
257
|
+
rB={rB}
|
|
258
|
+
/>
|
|
259
|
+
</LibTap>
|
|
260
|
+
</ScrollView>
|
|
261
|
+
</ScrollView>
|
|
262
|
+
</View>
|
|
263
|
+
<View style={{ flexDirection: 'row', marginHorizontal: 12, height: 40, borderColor: '#060606', borderWidth: 1, borderRadius: 5, alignItems: 'center' }} >
|
|
264
|
+
<Pressable onPress={prev} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
|
|
265
|
+
<LibIcon.SimpleLineIcons name='magnifier-remove' />
|
|
266
|
+
</Pressable>
|
|
267
|
+
<Pressable onPress={next} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
|
|
268
|
+
<LibIcon.SimpleLineIcons name='magnifier-add' />
|
|
269
|
+
</Pressable>
|
|
270
|
+
<View style={{ height: 40, width: 1, backgroundColor: '#060606', marginRight: 12 }} />
|
|
271
|
+
<Text style={{}} >{esp.lang("event/seat_map", "selected", String(data.filter((x) => x == -1).length), qty)}</Text>
|
|
272
|
+
</View>
|
|
273
|
+
<ComponentButton
|
|
274
|
+
backgroundColor={disabled ? "#aaa" : LibStyle.colorPrimary}
|
|
275
|
+
testID={"save_btn"}
|
|
276
|
+
style={{ margin: 12 }}
|
|
277
|
+
label={disabled ? esp.lang("event/seat_map", "wait") : esp.lang("event/seat_map", "save")}
|
|
278
|
+
onPress={() => {
|
|
279
|
+
if (disabled) {
|
|
280
|
+
LibToastProperty.show(esp.lang("event/seat_map", "wait_toast"))
|
|
281
|
+
return
|
|
282
|
+
}
|
|
283
|
+
const nonNull = Object.values(selectedSeatData).filter((x) => x != null)
|
|
284
|
+
let value = {
|
|
285
|
+
column_id: nonNull.map((x: any) => x.x).join('|'),
|
|
286
|
+
row_id: nonNull.map((x: any) => x.y).join('|'),
|
|
287
|
+
seat_name: nonNull.map((x: any) => x.name)
|
|
288
|
+
}
|
|
289
|
+
if (nonNull.length < qty) {
|
|
290
|
+
LibToastProperty.show(esp.lang("event/seat_map", "seat_more", (qty - (nonNull.length)).toString()))
|
|
291
|
+
} else {
|
|
292
|
+
LibProgress.show(esp.lang("event/seat_map", "check_seat"))
|
|
293
|
+
const nonNull = Object.values(selectedSeatData).filter((x) => x != null)
|
|
294
|
+
toggleLock(2, nonNull.map((item: any) => item.y).join('|'), nonNull.map((item: any) => item.x).join('|'), () => {
|
|
295
|
+
LibProgress.hide()
|
|
296
|
+
setIsSubmit(true)
|
|
297
|
+
LibNavigation.sendBackResult(value, LibNavigation.getResultKey(props))
|
|
298
|
+
}, (msg) => {
|
|
299
|
+
LibProgress.hide()
|
|
300
|
+
LibDialog.warning(esp.lang("event/seat_map", "oops"), msg)
|
|
301
|
+
})
|
|
302
|
+
}
|
|
303
|
+
}} />
|
|
304
|
+
</View>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
function buildSeatNames(input: string, { letter_axis, letter_position }: any, cb?: (coordinates: string[]) => void) {
|
|
311
|
+
const output = [];
|
|
312
|
+
let coordinates = []
|
|
313
|
+
const sections = input?.split?.(",");
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
function renderNames(letter_axis: string, letter_position: number, x: number, y: number) {
|
|
317
|
+
coordinates.push(x + ':' + y)
|
|
318
|
+
if (letter_position == 0) {
|
|
319
|
+
if (letter_axis == 'x')
|
|
320
|
+
output.push(toBase26(x) + y)
|
|
321
|
+
else if (letter_axis == 'y') {
|
|
322
|
+
output.push(toBase26(y) + x)
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
if (letter_axis == 'x')
|
|
326
|
+
output.push(y + toBase26(x))
|
|
327
|
+
else if (letter_axis == 'y') {
|
|
328
|
+
output.push(x + toBase26(y))
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
for (let a = 0; a < sections.length; a++) {
|
|
335
|
+
if (sections[a].length == 0) {
|
|
336
|
+
output.push("")
|
|
337
|
+
coordinates.push('0:0')
|
|
338
|
+
} else {
|
|
339
|
+
const [x, y] = sections[a]?.split?.(":")
|
|
340
|
+
if (!x.includes("-") && !y.includes('-')) {
|
|
341
|
+
renderNames(letter_axis, letter_position, parseInt(x), parseInt(y))
|
|
342
|
+
} else {
|
|
343
|
+
const [xfrom, xto] = x?.split("-")
|
|
344
|
+
const [yfrom, yto] = y?.split("-")
|
|
345
|
+
if (xto) {
|
|
346
|
+
if (parseInt(xfrom) <= parseInt(xto)) {
|
|
347
|
+
for (let i1 = parseInt(xfrom); i1 <= parseInt(xto); i1++) {
|
|
348
|
+
renderNames(letter_axis, letter_position, i1, parseInt(y))
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
coordinates.push('0:0')
|
|
352
|
+
output.push("")
|
|
353
|
+
}
|
|
354
|
+
} else if (yto) {
|
|
355
|
+
if (parseInt(yfrom) <= parseInt(yto)) {
|
|
356
|
+
for (let i = parseInt(yfrom); i <= parseInt(yto); i++) {
|
|
357
|
+
renderNames(letter_axis, letter_position, i, parseInt(y))
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
coordinates.push('0:0')
|
|
361
|
+
output.push("")
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (cb) cb(coordinates)
|
|
369
|
+
|
|
370
|
+
return output
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
// Function to convert a number to base26
|
|
375
|
+
function toBase26(num: number) {
|
|
376
|
+
let result = "";
|
|
377
|
+
|
|
378
|
+
while (num > 0) {
|
|
379
|
+
let remainder = (num - 1) % 26;
|
|
380
|
+
result = String.fromCharCode(65 + remainder) + result;
|
|
381
|
+
num = Math.floor((num - 1) / 26);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return result;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function getLegends() {
|
|
388
|
+
const colors: any = [
|
|
389
|
+
["#F1F1F1", esp.lang("event/seat_map", "available"), 0],
|
|
390
|
+
["#8EF67B", esp.lang("event/seat_map", "chosen"), "-1"],
|
|
391
|
+
["#2EBBE8", esp.lang("event/seat_map", "reserved"), 3],
|
|
392
|
+
["#6C432C", esp.lang("event/seat_map", "chosen_by"), 7],
|
|
393
|
+
["#fff", esp.lang("event/seat_map", "way"), 5],
|
|
394
|
+
["#9FA1A4", esp.lang("event/seat_map", "not_sold"), 1],
|
|
395
|
+
["#6B71E6", esp.lang("event/seat_map", "seat_hold"), 2],
|
|
396
|
+
["#FF4866", esp.lang("event/seat_map", "wall"), 6],
|
|
397
|
+
["#FFA601", esp.lang("event/seat_map", "other_type"), 4],
|
|
398
|
+
["purple", esp.lang("event/seat_map", "stage"), 8]
|
|
399
|
+
]
|
|
400
|
+
return colors
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
const styles = StyleSheet.create({
|
|
405
|
+
container: {
|
|
406
|
+
flex: 1,
|
|
407
|
+
},
|
|
408
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
// noPage
|
|
3
|
+
import esp from "esoftplay/esp";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export interface EventSeat_map_matrixArgs {
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
export interface EventSeat_map_matrixProps {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
export default function m(props: any): any {
|
|
14
|
+
const { Group, RoundedRect, Text, useFont, Canvas } = require('@shopify/react-native-skia')
|
|
15
|
+
const { mapWidth, mapHeight, data, seatNames, numCols, boxSize, margin, squareSize, rB, title } = props
|
|
16
|
+
const halfMargin = margin * 0.5
|
|
17
|
+
const fontSize = squareSize * 0.25;
|
|
18
|
+
const font = useFont(esp.assets("fonts/Arial.ttf"), fontSize);
|
|
19
|
+
let col = 0
|
|
20
|
+
let row = 0
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Canvas style={{ width: mapWidth, height: mapHeight }} >
|
|
24
|
+
{
|
|
25
|
+
data.map((status: number, i: number) => {
|
|
26
|
+
const c = seatNames[i]
|
|
27
|
+
const color = status == -1 ? "#8EF67B" : "#f1f1f1"
|
|
28
|
+
if (i % (numCols.current) == 0) {
|
|
29
|
+
col = i / (numCols.current)
|
|
30
|
+
}
|
|
31
|
+
row = i % numCols.current
|
|
32
|
+
const xSize = row * (boxSize) + margin
|
|
33
|
+
const ySize = col * (boxSize) + margin
|
|
34
|
+
|
|
35
|
+
if (status == 0 || status == -1) {
|
|
36
|
+
return (
|
|
37
|
+
<Group key={row + ":" + col}>
|
|
38
|
+
<RoundedRect
|
|
39
|
+
x={xSize /* + squareSize * 0.05 */}
|
|
40
|
+
r={rB}
|
|
41
|
+
y={ySize}
|
|
42
|
+
width={squareSize /* - (squareSize * 0.1) */}
|
|
43
|
+
height={squareSize}
|
|
44
|
+
color={color} />
|
|
45
|
+
<Text
|
|
46
|
+
x={(xSize) + squareSize * 0.3}
|
|
47
|
+
y={(ySize) + squareSize * 0.60}
|
|
48
|
+
color="#020202"
|
|
49
|
+
text={c}
|
|
50
|
+
font={font} />
|
|
51
|
+
</Group>
|
|
52
|
+
)
|
|
53
|
+
} else if (status == 8) {
|
|
54
|
+
return (
|
|
55
|
+
<RoundedRect
|
|
56
|
+
key={row + ":" + col}
|
|
57
|
+
x={xSize - halfMargin}
|
|
58
|
+
r={0}
|
|
59
|
+
y={ySize - halfMargin}
|
|
60
|
+
width={boxSize}
|
|
61
|
+
height={boxSize}
|
|
62
|
+
color={getColorByStatus(status)} />
|
|
63
|
+
)
|
|
64
|
+
} else {
|
|
65
|
+
return (
|
|
66
|
+
<RoundedRect
|
|
67
|
+
key={row + ":" + col}
|
|
68
|
+
x={xSize}
|
|
69
|
+
r={rB}
|
|
70
|
+
y={ySize}
|
|
71
|
+
width={squareSize}
|
|
72
|
+
height={squareSize}
|
|
73
|
+
color={getColorByStatus(status)} />)
|
|
74
|
+
}
|
|
75
|
+
})}
|
|
76
|
+
</Canvas>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
function getColorByStatus(statuses: number) {
|
|
82
|
+
const colors: any = {
|
|
83
|
+
8: 'purple',
|
|
84
|
+
0: "#fff",
|
|
85
|
+
1: "#9FA1A4",
|
|
86
|
+
2: "#6B71E6",
|
|
87
|
+
3: "#2EBBE8",
|
|
88
|
+
4: "#FFA601",
|
|
89
|
+
5: "#fff",
|
|
90
|
+
6: "#FF4866",
|
|
91
|
+
7: "#6C432C"
|
|
92
|
+
}
|
|
93
|
+
return colors[statuses]
|
|
94
|
+
}
|