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.
Files changed (121) hide show
  1. package/config.json +11 -0
  2. package/event/additional.tsx +188 -0
  3. package/event/additional_input.tsx +316 -0
  4. package/event/block_invitation.tsx +48 -0
  5. package/event/countdown.tsx +72 -0
  6. package/event/counter_cashier.tsx +180 -0
  7. package/event/counter_cashier_report.tsx +114 -0
  8. package/event/counter_cashier_sell.tsx +135 -0
  9. package/event/counter_eo.tsx +451 -0
  10. package/event/counter_history.tsx +74 -0
  11. package/event/counter_history_item.tsx +48 -0
  12. package/event/counter_info.tsx +96 -0
  13. package/event/counter_lm.tsx +273 -0
  14. package/event/counter_menu.tsx +85 -0
  15. package/event/counter_report.tsx +105 -0
  16. package/event/counter_report_breakdown.tsx +93 -0
  17. package/event/counter_report_detail.tsx +238 -0
  18. package/event/counter_report_detail_list.tsx +56 -0
  19. package/event/counter_request.tsx +136 -0
  20. package/event/counter_request_detail.tsx +211 -0
  21. package/event/counter_section.tsx +32 -0
  22. package/event/counter_send.tsx +277 -0
  23. package/event/counter_status.tsx +32 -0
  24. package/event/counter_type.tsx +23 -0
  25. package/event/counter_user_list.tsx +197 -0
  26. package/event/counter_user_list_item.tsx +143 -0
  27. package/event/coupon.tsx +124 -0
  28. package/event/coupon_claim.tsx +198 -0
  29. package/event/coupon_claim_detail.tsx +175 -0
  30. package/event/coupon_claim_history.tsx +279 -0
  31. package/event/coupon_claim_reimburse.tsx +111 -0
  32. package/event/coupon_claim_reimburse_history.tsx +72 -0
  33. package/event/coupon_claim_reimburse_history_detail.tsx +117 -0
  34. package/event/coupon_claim_staff.tsx +256 -0
  35. package/event/coupon_detail.tsx +98 -0
  36. package/event/coupon_event_list.tsx +77 -0
  37. package/event/coupon_generate.tsx +258 -0
  38. package/event/coupon_generate_event.tsx +79 -0
  39. package/event/coupon_generate_list.tsx +56 -0
  40. package/event/date_picker.tsx +152 -0
  41. package/event/detail.tsx +352 -0
  42. package/event/entrance.tsx +215 -0
  43. package/event/entrance_again.tsx +200 -0
  44. package/event/entrance_failed.tsx +190 -0
  45. package/event/entrance_idcard.tsx +203 -0
  46. package/event/entrance_list.tsx +264 -0
  47. package/event/entrance_list_item.tsx +88 -0
  48. package/event/entrance_log.tsx +130 -0
  49. package/event/entrance_success.tsx +155 -0
  50. package/event/entrance_warning.tsx +91 -0
  51. package/event/exchange_reward.tsx +31 -0
  52. package/event/exchange_reward_result.tsx +137 -0
  53. package/event/exchange_ticket.tsx +234 -0
  54. package/event/exchange_ticket_list.tsx +191 -0
  55. package/event/exchange_ticket_result.tsx +211 -0
  56. package/event/exit.tsx +91 -0
  57. package/event/exit_failed.tsx +135 -0
  58. package/event/exit_list.tsx +118 -0
  59. package/event/exit_log.tsx +131 -0
  60. package/event/exit_success.tsx +143 -0
  61. package/event/exit_temporary.tsx +226 -0
  62. package/event/hall_in.tsx +148 -0
  63. package/event/hall_in_failed.tsx +270 -0
  64. package/event/hall_in_list.tsx +222 -0
  65. package/event/hall_in_log.tsx +134 -0
  66. package/event/hall_in_success.tsx +132 -0
  67. package/event/hall_out.tsx +143 -0
  68. package/event/hall_out_failed.tsx +133 -0
  69. package/event/hall_out_list.tsx +215 -0
  70. package/event/hall_out_log.tsx +133 -0
  71. package/event/hall_out_success.tsx +130 -0
  72. package/event/list.tsx +219 -0
  73. package/event/list_filter.tsx +124 -0
  74. package/event/log.tsx +435 -0
  75. package/event/qc_idcard.tsx +209 -0
  76. package/event/qc_idcard_failed.tsx +78 -0
  77. package/event/qc_idcard_success.tsx +68 -0
  78. package/event/queue_out.tsx +186 -0
  79. package/event/queue_pricing.tsx +152 -0
  80. package/event/randomseat.tsx +33 -0
  81. package/event/review.tsx +117 -0
  82. package/event/review_add.tsx +342 -0
  83. package/event/review_detail.tsx +67 -0
  84. package/event/review_item.tsx +76 -0
  85. package/event/scan_item.tsx +66 -0
  86. package/event/schedule.tsx +135 -0
  87. package/event/seat.tsx +628 -0
  88. package/event/seat_autopick.tsx +120 -0
  89. package/event/seat_map.tsx +408 -0
  90. package/event/seat_map_matrix.tsx +94 -0
  91. package/event/seat_map_test.tsx +401 -0
  92. package/event/ticket_list.tsx +722 -0
  93. package/event/ticket_list2.tsx +680 -0
  94. package/event/timer.tsx +58 -0
  95. package/event/tms.tsx +103 -0
  96. package/event/tms_add.tsx +94 -0
  97. package/event/tms_add_result.tsx +175 -0
  98. package/event/tms_dashboard.tsx +89 -0
  99. package/event/tms_event_list.tsx +66 -0
  100. package/event/turnstile_event_gate.tsx +74 -0
  101. package/event/turnstile_event_item.tsx +41 -0
  102. package/event/turnstile_event_list.tsx +69 -0
  103. package/event/turnstile_event_ticket.tsx +95 -0
  104. package/event/turnstile_settings.tsx +327 -0
  105. package/event/turnstile_settings_otp.tsx +58 -0
  106. package/event/turnstile_settings_status.tsx +50 -0
  107. package/event/voucher.tsx +149 -0
  108. package/event/voucher_multi.tsx +181 -0
  109. package/fonts/Arial.ttf +0 -0
  110. package/fonts/ArialBold.ttf +0 -0
  111. package/fonts/DecoNumbers.ttf +0 -0
  112. package/fonts/MonoSpace.ttf +0 -0
  113. package/fonts/SFProText.ttf +0 -0
  114. package/fonts/digital.ttf +0 -0
  115. package/fonts/mono.ttf +0 -0
  116. package/id.json +1113 -0
  117. package/index.js +2 -0
  118. package/libs.json +1 -0
  119. package/mover.js +0 -0
  120. package/package.json +16 -0
  121. package/publisher.js +84 -0
@@ -0,0 +1,401 @@
1
+ // withHooks
2
+
3
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
4
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
5
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
6
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
7
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
8
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
9
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
10
+ import { LibTap } from 'esoftplay/cache/lib/tap/import';
11
+ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
12
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
13
+ import esp from 'esoftplay/esp';
14
+ import useLazyState from 'esoftplay/lazy';
15
+ import React, { useEffect, useRef } from 'react';
16
+ import { Dimensions, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
17
+ import Animated, { useAnimatedProps, useSharedValue, withTiming } from 'react-native-reanimated';
18
+ import Svg, { G, Rect, Text as SVGText } from 'react-native-svg';
19
+
20
+ const AnimatedRect = Animated.createAnimatedComponent(Rect);
21
+ const AnimatedSVG = Animated.createAnimatedComponent(Svg);
22
+ const AnimatedSVGText = Animated.createAnimatedComponent(SVGText);
23
+
24
+
25
+ export default function m(props: any) {
26
+ const { dataTicket, url } = LibNavigation.getArgsAll<any>(props)
27
+ const qty = dataTicket?.qty
28
+ let numRows = useRef(0)
29
+ let numCols = useRef(0)
30
+ let selectedSeat = useRef<any>(null).current
31
+
32
+ const [seatNames, setSeatNames] = useLazyState<string[]>([])
33
+ const [data, setData] = useLazyState<number[]>([])
34
+ const [coordinates, setCoordinates] = useLazyState<string[]>([])
35
+ const [selectedSeatData, setSelectedSeatData] = useLazyState<any>({})
36
+
37
+
38
+ const squareSizeAnimated = useSharedValue(10)
39
+ const marginAnimated = useSharedValue(squareSizeAnimated.value * 0.25)
40
+ const boxSizeAnimated = useSharedValue(squareSizeAnimated.value + marginAnimated.value)
41
+ const rBAnimated = useSharedValue(squareSizeAnimated.value * 0.1)
42
+
43
+ function change(x: any) {
44
+ const val = x * 0.25
45
+ squareSizeAnimated.value = x
46
+ marginAnimated.value = val
47
+ boxSizeAnimated.value = x + val
48
+ rBAnimated.value = x * 0.1
49
+
50
+ }
51
+
52
+ function plus() {
53
+ let x = squareSizeAnimated.value * 3 / 2
54
+ if (x <= 50) {
55
+ change(x)
56
+ }
57
+ }
58
+
59
+ function min() {
60
+ let x = squareSizeAnimated.value * 2 / 3
61
+ if (x >= 10)
62
+ change(x)
63
+ }
64
+
65
+ function resetZoomAnim() {
66
+ const square = (Dimensions.get('screen').width / numRows.current) * 0.75
67
+ const margin = square * 0.25
68
+
69
+ squareSizeAnimated.value = square
70
+ marginAnimated.value = margin
71
+ boxSizeAnimated.value = square + margin
72
+ rBAnimated.value = square * 0.1
73
+ }
74
+
75
+ useEffect(() => {
76
+ new LibCurl(url + '?' + LibUtils.objectToUrlParam({
77
+ offset_row: 1, offset_column: 1
78
+ }), {
79
+ event_id: dataTicket.event_id,
80
+ price_id: dataTicket?.selected_ticket?.price_id,
81
+ ondate: dataTicket?.selected_ticket?.list?.ondate,
82
+ compact: 4
83
+ }, (res, msg) => {
84
+ numRows.current = res.seat_row
85
+ numCols.current = res.seat_column
86
+ resetZoomAnim()
87
+ setSeatNames(buildSeatNames(res.list.names, res.list.layout, setCoordinates))
88
+ const sizes = res.list.statuses;
89
+ const sizesArray: number[] = [];
90
+ sizes?.split(",").forEach((size: string) => {
91
+ if (size.includes('x')) {
92
+ const [v, x] = size?.split("x");
93
+ for (let i = 0; i < parseInt(v); i++) {
94
+ sizesArray.push(parseInt(x));
95
+ }
96
+ } else {
97
+ sizesArray.push(parseInt(size))
98
+ }
99
+ });
100
+ setData(sizesArray)()
101
+ })
102
+ }, []);
103
+
104
+ function toggleSeat(x: number, y: number) {
105
+ const cx = Math.floor(x / boxSizeAnimated.value)
106
+ const cy = Math.floor(y / boxSizeAnimated.value)
107
+ const index = (((cy * numCols.current) + cx))
108
+ const [_x, _y] = coordinates[index]?.split(":")
109
+
110
+ selectedSeat = {
111
+ x: _x,
112
+ y: _y,
113
+ index: index,
114
+ name: seatNames[index]
115
+ }
116
+ const countQty = data.filter((x) => x == -1).length
117
+ setData(LibObject.update(data, (old) => {
118
+ let out = old;
119
+ if (old == 0) {
120
+ if (countQty >= qty) {
121
+ LibToastProperty.show(esp.lang("event/seat_map", "max_seat", qty))
122
+ } else {
123
+ setSelectedSeatData(LibObject.set(selectedSeatData, selectedSeat)(selectedSeat.index))
124
+ out = -1;
125
+ }
126
+ }
127
+ if (old == -1) {
128
+ out = 0;
129
+ setSelectedSeatData(LibObject.set(selectedSeatData, () => null)(selectedSeat.index))
130
+ }
131
+ return out
132
+ })(selectedSeat.index))()
133
+ }
134
+
135
+ if (data.length == 0) {
136
+ return <LibLoading />
137
+ }
138
+
139
+ return (
140
+ <View style={styles.container}>
141
+ <ComponentHeader title={esp.lang("event/seat_map_test", "header_title")} />
142
+ <View style={{ alignItems: 'center', flex: 1 }} >
143
+ <ScrollView showsVerticalScrollIndicator style={{ marginTop: 12 }} >
144
+ <View style={{ height: 30, marginHorizontal: 16, backgroundColor: LibStyle.colorPrimary, marginBottom: 20, borderRadius: 5, justifyContent: 'center', alignItems: 'center' }} >
145
+ <Text style={{ color: 'white', fontWeight: 'bold' }} >{esp.lang("event/seat_map_test", "front")}</Text>
146
+ </View>
147
+ <ScrollView horizontal showsHorizontalScrollIndicator >
148
+ <LibTap onCoordinateGet={toggleSeat}>
149
+ <MatrixAnimated
150
+ data={data}
151
+ numRows={numRows}
152
+ // mapWidth={numCols.current * boxSizeAnimated.value + (marginAnimated.value)}
153
+ // mapHeight={numRows.current * boxSizeAnimated.value + (marginAnimated.value)}
154
+ seatNames={seatNames}
155
+ numCols={numCols}
156
+ boxSize={boxSizeAnimated}
157
+ margin={marginAnimated}
158
+ squareSize={squareSizeAnimated}
159
+ rB={rBAnimated}
160
+ />
161
+ </LibTap>
162
+ </ScrollView>
163
+ </ScrollView>
164
+ </View>
165
+ <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }}>
166
+ <Pressable onPress={min} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
167
+ <LibIcon.SimpleLineIcons name='magnifier-remove' />
168
+ </Pressable>
169
+ <Pressable onPress={plus} style={{ height: 40, width: 40, alignItems: 'center', justifyContent: 'center' }} >
170
+ <LibIcon.SimpleLineIcons name='magnifier-add' />
171
+ </Pressable>
172
+ </View>
173
+ </View>
174
+ );
175
+ }
176
+
177
+
178
+ function MatrixAnimated(props: any) {
179
+ const { /* mapWidth, mapHeight, */ data, seatNames, numCols, numRows, boxSize, margin, squareSize, rB } = props
180
+ let col = 0
181
+ let row = 0
182
+
183
+ const svgProps = useAnimatedProps(() => {
184
+ return {
185
+ width: withTiming(numCols.current * boxSize.value + (margin.value)),
186
+ height: withTiming(numRows.current * boxSize.value + (margin.value)),
187
+ }
188
+ })
189
+
190
+ return (
191
+ <AnimatedSVG
192
+ animatedProps={svgProps}
193
+ // width={mapWidth} height={mapHeight}
194
+ >
195
+ {
196
+ data.map((status: number, i: number) => {
197
+ const c = seatNames[i]
198
+ const color = status == -1 ? "#8EF67B" : "#f1f1f1"
199
+ const colorDark = status == -1 ? "#15D71F" : "#aeaeae"
200
+ if (i % (numCols.current) == 0) {
201
+ col = i / (numCols.current)
202
+ }
203
+ row = i % numCols.current
204
+ // const xSize = row * (boxSize.value) + margin.value
205
+ // const ySize = col * (boxSize.value) + margin.value
206
+
207
+ const duration = 1000
208
+
209
+ const animatedPropsA = useAnimatedProps(() => {
210
+ return {
211
+ x: withTiming((row * (boxSize.value) + margin.value) + squareSize.value * 0.05, { duration }),
212
+ y: withTiming((col * (boxSize.value) + margin.value), { duration }),
213
+ rx: withTiming(rB.value, { duration }),
214
+ ry: withTiming(rB.value, { duration }),
215
+ width: withTiming(squareSize.value - (squareSize.value * 0.1), { duration }),
216
+ height: withTiming(squareSize.value, { duration }),
217
+ }
218
+ })
219
+
220
+ const animatedPropsB = useAnimatedProps(() => {
221
+ return {
222
+ x: withTiming((row * (boxSize.value) + margin.value), { duration }),
223
+ y: withTiming((col * (boxSize.value) + margin.value) + squareSize.value * 0.8, { duration }),
224
+ width: withTiming(squareSize.value, { duration }),
225
+ height: withTiming(squareSize.value * 0.2, { duration }),
226
+ }
227
+ })
228
+
229
+ const animatedPropsC = useAnimatedProps(() => {
230
+ return {
231
+ x: withTiming((row * (boxSize.value) + margin.value), { duration }),
232
+ y: withTiming((col * (boxSize.value) + margin.value) + squareSize.value * 0.5, { duration }),
233
+ width: withTiming(squareSize.value * 0.1, { duration }),
234
+ height: withTiming(squareSize.value * 0.5, { duration }),
235
+ }
236
+ })
237
+
238
+ const animatedPropsD = useAnimatedProps(() => {
239
+ return {
240
+ x: withTiming((row * (boxSize.value) + margin.value) + squareSize.value * 0.9, { duration }),
241
+ y: withTiming((col * (boxSize.value) + margin.value) + squareSize.value * 0.5, { duration }),
242
+ width: withTiming(squareSize.value * 0.1, { duration }),
243
+ height: withTiming(squareSize.value * 0.5, { duration }),
244
+ }
245
+ })
246
+
247
+ const animatedPropsE = useAnimatedProps(() => {
248
+ return {
249
+ x: withTiming([(row * (boxSize.value) + margin.value) + squareSize.value * 0.37], { duration }),
250
+ y: withTiming([(col * (boxSize.value) + margin.value) + squareSize.value * 0.6], { duration }),
251
+ fontSize: squareSize.value * 0.25,
252
+ }
253
+ })
254
+
255
+ const animatedPropsF = useAnimatedProps(() => {
256
+ return {
257
+ x: withTiming((row * (boxSize.value) + margin.value), { duration }),
258
+ y: withTiming((col * (boxSize.value) + margin.value), { duration }),
259
+ rx: withTiming(rB.value, { duration }),
260
+ ry: withTiming(rB.value, { duration }),
261
+ width: withTiming(squareSize.value, { duration }),
262
+ height: withTiming(squareSize.value, { duration }),
263
+ }
264
+ })
265
+
266
+ if (status == 0 || status == -1) {
267
+ return (
268
+ <G key={row + ":" + col}>
269
+ <AnimatedRect
270
+ animatedProps={animatedPropsA}
271
+ fill={color} />
272
+ <AnimatedRect
273
+ rx={2}
274
+ ry={2}
275
+ animatedProps={animatedPropsB}
276
+ fill={colorDark} />
277
+ <AnimatedRect
278
+ rx={2}
279
+ ry={2}
280
+ animatedProps={animatedPropsC}
281
+ fill={colorDark} />
282
+ <AnimatedRect
283
+ rx={2}
284
+ ry={2}
285
+ animatedProps={animatedPropsD}
286
+ fill={colorDark} />
287
+ <AnimatedSVGText
288
+ animatedProps={animatedPropsE}
289
+ fill="#060606"
290
+ textAnchor={"middle"}
291
+ >{c}</AnimatedSVGText>
292
+ </G>
293
+ )
294
+ } else {
295
+ return (<AnimatedRect
296
+ key={row + ":" + col}
297
+ animatedProps={animatedPropsF}
298
+ fill={getColorByStatus(status)} />)
299
+ }
300
+ })}
301
+ </AnimatedSVG>
302
+ )
303
+ }
304
+
305
+
306
+ function getColorByStatus(statuses: number) {
307
+ const colors: any = {
308
+ 0: "#fff",
309
+ 1: "#9FA1A4",
310
+ 2: "#6B71E6",
311
+ 3: "#2EBBE8",
312
+ 4: "#FFA601",
313
+ 5: "#fff",
314
+ 6: "#FF4866",
315
+ }
316
+ return colors[statuses]
317
+ }
318
+
319
+ function buildSeatNames(input: string, { letter_axis, letter_position }: any, cb?: (coordinates: string[]) => void) {
320
+ const output = [];
321
+ let coordinates = []
322
+ const sections = input?.split(",");
323
+
324
+
325
+ function renderNames(letter_axis: string, letter_position: number, x: number, y: number) {
326
+ coordinates.push(x + ':' + y)
327
+ if (letter_position == 0) {
328
+ if (letter_axis == 'x')
329
+ output.push(toBase26(x) + y)
330
+ else if (letter_axis == 'y') {
331
+ output.push(toBase26(y) + x)
332
+ }
333
+ } else {
334
+ if (letter_axis == 'x')
335
+ output.push(y + toBase26(x))
336
+ else if (letter_axis == 'y') {
337
+ output.push(x + toBase26(y))
338
+ }
339
+ }
340
+ }
341
+
342
+
343
+ for (let a = 0; a < sections.length; a++) {
344
+ if (sections[a].length == 0) {
345
+ output.push("")
346
+ coordinates.push('0:0')
347
+ } else {
348
+ const [x, y] = sections[a]?.split(":")
349
+ if (!x.includes("-") && !y.includes('-')) {
350
+ renderNames(letter_axis, letter_position, parseInt(x), parseInt(y))
351
+ } else {
352
+ const [xfrom, xto] = x?.split("-")
353
+ const [yfrom, yto] = y?.split("-")
354
+ if (xto) {
355
+ if (parseInt(xfrom) <= parseInt(xto)) {
356
+ for (let i1 = parseInt(xfrom); i1 <= parseInt(xto); i1++) {
357
+ renderNames(letter_axis, letter_position, i1, parseInt(y))
358
+ }
359
+ } else {
360
+ coordinates.push('0:0')
361
+ output.push("")
362
+ }
363
+ } else if (yto) {
364
+ if (parseInt(yfrom) <= parseInt(yto)) {
365
+ for (let i = parseInt(yfrom); i <= parseInt(yto); i++) {
366
+ renderNames(letter_axis, letter_position, i, parseInt(y))
367
+ }
368
+ } else {
369
+ coordinates.push('0:0')
370
+ output.push("")
371
+ }
372
+ }
373
+ }
374
+ }
375
+ }
376
+
377
+ if (cb) cb(coordinates)
378
+
379
+ return output
380
+ }
381
+
382
+
383
+ // Function to convert a number to base26
384
+ function toBase26(num: number) {
385
+ let result = "";
386
+
387
+ while (num > 0) {
388
+ let remainder = (num - 1) % 26;
389
+ result = String.fromCharCode(65 + remainder) + result;
390
+ num = Math.floor((num - 1) / 26);
391
+ }
392
+
393
+ return result;
394
+ }
395
+
396
+
397
+ const styles = StyleSheet.create({
398
+ container: {
399
+ flex: 1,
400
+ },
401
+ });