esoftplay-event 0.0.1-c → 0.0.1-e

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 (44) hide show
  1. package/config.json +1 -1
  2. package/event/artist.tsx +3 -6
  3. package/event/detail.tsx +0 -44
  4. package/event/order.tsx +2 -1
  5. package/event/order_detail.tsx +2 -4
  6. package/event/order_detail_upgrade_payment.tsx +13 -7
  7. package/event/order_detail_waiting.tsx +21 -9
  8. package/event/order_share_to.tsx +2 -2
  9. package/event/scan_item.tsx +2 -2
  10. package/event/seat_map_new.tsx +313 -0
  11. package/event/test.tsx +240 -155
  12. package/event/ticket_list.tsx +8 -5
  13. package/event/ticket_list2.tsx +1 -1
  14. package/event/tms_check_ticket_result.tsx +5 -5
  15. package/event/tms_in_failed.tsx +1 -1
  16. package/id.json +5 -4
  17. package/package.json +1 -1
  18. package/event/entrance.tsx +0 -215
  19. package/event/entrance_again.tsx +0 -199
  20. package/event/entrance_failed.tsx +0 -190
  21. package/event/entrance_idcard.tsx +0 -199
  22. package/event/entrance_list.tsx +0 -264
  23. package/event/entrance_list_item.tsx +0 -88
  24. package/event/entrance_log.tsx +0 -130
  25. package/event/entrance_success.tsx +0 -153
  26. package/event/entrance_warning.tsx +0 -91
  27. package/event/exit.tsx +0 -91
  28. package/event/exit_failed.tsx +0 -135
  29. package/event/exit_list.tsx +0 -118
  30. package/event/exit_log.tsx +0 -130
  31. package/event/exit_success.tsx +0 -143
  32. package/event/exit_temporary.tsx +0 -226
  33. package/event/hall_in.tsx +0 -148
  34. package/event/hall_in_failed.tsx +0 -270
  35. package/event/hall_in_list.tsx +0 -222
  36. package/event/hall_in_log.tsx +0 -134
  37. package/event/hall_in_success.tsx +0 -132
  38. package/event/hall_out.tsx +0 -143
  39. package/event/hall_out_failed.tsx +0 -133
  40. package/event/hall_out_list.tsx +0 -215
  41. package/event/hall_out_log.tsx +0 -133
  42. package/event/hall_out_success.tsx +0 -130
  43. package/event/log.tsx +0 -433
  44. 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
- });