esoftplay-event 0.0.1 → 0.0.2-b

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 (86) hide show
  1. package/config.json +1 -1
  2. package/event/artist.tsx +11 -7
  3. package/event/artist_detail.tsx +3 -5
  4. package/event/artist_detailv2.tsx +386 -0
  5. package/event/artistv2.tsx +162 -0
  6. package/event/button_order_detail.tsx +43 -0
  7. package/event/countdown_base.tsx +16 -3
  8. package/event/countdown_event.tsx +48 -0
  9. package/event/detail.tsx +30 -37
  10. package/event/detail2.tsx +354 -0
  11. package/event/exchange_ticket.tsx +1 -1
  12. package/event/exchange_ticket_list.tsx +2 -3
  13. package/event/exchange_ticket_result.tsx +1 -1
  14. package/event/firebase_socket.ts +21 -11
  15. package/event/loading_page.tsx +4 -2
  16. package/event/order.tsx +23 -36
  17. package/event/order_detail.tsx +204 -61
  18. package/event/order_detail_upgrade.tsx +8 -5
  19. package/event/order_detail_upgrade_payment.tsx +17 -11
  20. package/event/order_detail_visitor.tsx +33 -33
  21. package/event/order_detail_waiting.tsx +45 -20
  22. package/event/order_item.tsx +1 -1
  23. package/event/order_lottery.tsx +49 -37
  24. package/event/order_reschedule.tsx +50 -52
  25. package/event/order_share_to.tsx +11 -24
  26. package/event/order_share_to_detail.tsx +8 -3
  27. package/event/order_waiting.tsx +1 -1
  28. package/event/queue_pricing.tsx +16 -3
  29. package/event/refresh_button.tsx +3 -5
  30. package/event/scan_item.tsx +2 -2
  31. package/event/seat.tsx +34 -13
  32. package/event/seat_map_new.tsx +316 -0
  33. package/event/secure_page.debug.tsx +34 -0
  34. package/event/secure_page.live.tsx +35 -0
  35. package/event/secure_page.tsx +6 -5
  36. package/event/test.tsx +240 -155
  37. package/event/ticket_list.tsx +48 -20
  38. package/event/ticket_list2.tsx +112 -39
  39. package/event/tms_check_code.tsx +6 -0
  40. package/event/tms_check_ticket_result.tsx +51 -13
  41. package/event/tms_dashboard.tsx +85 -3
  42. package/event/tms_gate.tsx +6 -0
  43. package/event/tms_home.tsx +1 -4
  44. package/event/tms_in_failed.tsx +1 -1
  45. package/event/tms_in_hall.tsx +4 -1
  46. package/event/tms_in_hall_failed.tsx +8 -10
  47. package/event/tms_in_log.tsx +2 -0
  48. package/event/tms_in_success.tsx +1 -1
  49. package/event/tms_log.tsx +10 -25
  50. package/event/tms_out.tsx +1 -1
  51. package/event/tms_out_failed.tsx +1 -1
  52. package/event/visitor_input.tsx +22 -5
  53. package/event/visitor_inputv2.tsx +453 -0
  54. package/event/voucher.tsx +2 -0
  55. package/event/voucher2.tsx +14 -6
  56. package/id.json +43 -9
  57. package/package.json +1 -1
  58. package/event/entrance.tsx +0 -215
  59. package/event/entrance_again.tsx +0 -199
  60. package/event/entrance_failed.tsx +0 -190
  61. package/event/entrance_idcard.tsx +0 -199
  62. package/event/entrance_list.tsx +0 -264
  63. package/event/entrance_list_item.tsx +0 -88
  64. package/event/entrance_log.tsx +0 -130
  65. package/event/entrance_success.tsx +0 -153
  66. package/event/entrance_warning.tsx +0 -91
  67. package/event/exit.tsx +0 -91
  68. package/event/exit_failed.tsx +0 -135
  69. package/event/exit_list.tsx +0 -118
  70. package/event/exit_log.tsx +0 -130
  71. package/event/exit_success.tsx +0 -143
  72. package/event/exit_temporary.tsx +0 -226
  73. package/event/firebase_socket.debug.ts +0 -260
  74. package/event/firebase_socket.live.ts +0 -335
  75. package/event/hall_in.tsx +0 -148
  76. package/event/hall_in_failed.tsx +0 -270
  77. package/event/hall_in_list.tsx +0 -222
  78. package/event/hall_in_log.tsx +0 -134
  79. package/event/hall_in_success.tsx +0 -132
  80. package/event/hall_out.tsx +0 -143
  81. package/event/hall_out_failed.tsx +0 -133
  82. package/event/hall_out_list.tsx +0 -215
  83. package/event/hall_out_log.tsx +0 -133
  84. package/event/hall_out_success.tsx +0 -130
  85. package/event/log.tsx +0 -433
  86. package/event/seat_map_test.tsx +0 -401
@@ -1,401 +0,0 @@
1
- // withHooks
2
-
3
- import { EventHeader } from 'esoftplay/cache/event/header/import';
4
- import { EventTap } from 'esoftplay/cache/event/tap/import';
5
- import { LibCurl } from 'esoftplay/cache/lib/curl/import';
6
- import { LibIcon } from 'esoftplay/cache/lib/icon/import';
7
- import { LibLoading } from 'esoftplay/cache/lib/loading/import';
8
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
9
- import { LibObject } from 'esoftplay/cache/lib/object/import';
10
- import { LibStyle } from 'esoftplay/cache/lib/style/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
- <EventHeader 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
- <EventTap 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
- </EventTap>
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
- });