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.
Files changed (83) hide show
  1. package/event/artist.tsx +11 -7
  2. package/event/artist_detail.tsx +3 -5
  3. package/event/artist_detailv2.tsx +386 -0
  4. package/event/artistv2.tsx +162 -0
  5. package/event/button_order_detail.tsx +43 -0
  6. package/event/countdown_base.tsx +16 -3
  7. package/event/countdown_event.tsx +47 -0
  8. package/event/detail.tsx +30 -37
  9. package/event/detail2.tsx +354 -0
  10. package/event/exchange_ticket.tsx +1 -1
  11. package/event/exchange_ticket_list.tsx +2 -3
  12. package/event/exchange_ticket_result.tsx +1 -1
  13. package/event/firebase_socket.ts +8 -0
  14. package/event/loading_page.tsx +4 -2
  15. package/event/order.tsx +23 -36
  16. package/event/order_detail.tsx +119 -41
  17. package/event/order_detail_upgrade.tsx +8 -5
  18. package/event/order_detail_upgrade_payment.tsx +17 -11
  19. package/event/order_detail_visitor.tsx +33 -33
  20. package/event/order_detail_waiting.tsx +45 -20
  21. package/event/order_item.tsx +1 -1
  22. package/event/order_lottery.tsx +48 -36
  23. package/event/order_reschedule.tsx +50 -52
  24. package/event/order_share_to.tsx +11 -24
  25. package/event/order_share_to_detail.tsx +8 -3
  26. package/event/order_waiting.tsx +1 -1
  27. package/event/queue_pricing.tsx +16 -3
  28. package/event/refresh_button.tsx +3 -5
  29. package/event/scan_item.tsx +2 -2
  30. package/event/seat.tsx +19 -11
  31. package/event/seat_map_new.tsx +313 -0
  32. package/event/secure_page.debug.tsx +34 -0
  33. package/event/secure_page.live.tsx +35 -0
  34. package/event/secure_page.tsx +6 -5
  35. package/event/test.tsx +240 -155
  36. package/event/ticket_list.tsx +49 -21
  37. package/event/ticket_list2.tsx +83 -34
  38. package/event/tms_check_code.tsx +6 -0
  39. package/event/tms_check_ticket_result.tsx +36 -7
  40. package/event/tms_dashboard.tsx +85 -3
  41. package/event/tms_gate.tsx +6 -0
  42. package/event/tms_home.tsx +1 -4
  43. package/event/tms_in_failed.tsx +1 -1
  44. package/event/tms_in_log.tsx +2 -0
  45. package/event/tms_in_success.tsx +1 -1
  46. package/event/tms_log.tsx +10 -25
  47. package/event/tms_out.tsx +1 -1
  48. package/event/tms_out_failed.tsx +1 -1
  49. package/event/visitor_input.tsx +23 -5
  50. package/event/visitor_inputv2.tsx +397 -0
  51. package/event/voucher.tsx +2 -0
  52. package/event/voucher2.tsx +14 -6
  53. package/id.json +25 -9
  54. package/package.json +1 -1
  55. package/event/entrance.tsx +0 -215
  56. package/event/entrance_again.tsx +0 -199
  57. package/event/entrance_failed.tsx +0 -190
  58. package/event/entrance_idcard.tsx +0 -199
  59. package/event/entrance_list.tsx +0 -264
  60. package/event/entrance_list_item.tsx +0 -88
  61. package/event/entrance_log.tsx +0 -130
  62. package/event/entrance_success.tsx +0 -153
  63. package/event/entrance_warning.tsx +0 -91
  64. package/event/exit.tsx +0 -91
  65. package/event/exit_failed.tsx +0 -135
  66. package/event/exit_list.tsx +0 -118
  67. package/event/exit_log.tsx +0 -130
  68. package/event/exit_success.tsx +0 -143
  69. package/event/exit_temporary.tsx +0 -226
  70. package/event/firebase_socket.debug.ts +0 -260
  71. package/event/firebase_socket.live.ts +0 -335
  72. package/event/hall_in.tsx +0 -148
  73. package/event/hall_in_failed.tsx +0 -270
  74. package/event/hall_in_list.tsx +0 -222
  75. package/event/hall_in_log.tsx +0 -134
  76. package/event/hall_in_success.tsx +0 -132
  77. package/event/hall_out.tsx +0 -143
  78. package/event/hall_out_failed.tsx +0 -133
  79. package/event/hall_out_list.tsx +0 -215
  80. package/event/hall_out_log.tsx +0 -133
  81. package/event/hall_out_success.tsx +0 -130
  82. package/event/log.tsx +0 -433
  83. package/event/seat_map_test.tsx +0 -401
package/event/log.tsx DELETED
@@ -1,433 +0,0 @@
1
- // withHooks
2
- import { useEffect, useRef } from 'react';
3
-
4
- import { EventButton } from 'esoftplay/cache/event/button/import';
5
- import { EventHeader } from 'esoftplay/cache/event/header/import';
6
- import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
7
- import { EventTms_in_hall_log } from 'esoftplay/cache/event/tms_in_hall_log/import';
8
- import { EventTms_in_hall_successProperty } from 'esoftplay/cache/event/tms_in_hall_success/import';
9
- import { EventTms_in_log } from 'esoftplay/cache/event/tms_in_log/import';
10
- import { EventTms_in_successProperty } from 'esoftplay/cache/event/tms_in_success/import';
11
- import { EventTms_out_hall_log } from 'esoftplay/cache/event/tms_out_hall_log/import';
12
- import { EventTms_out_hall_successProperty } from 'esoftplay/cache/event/tms_out_hall_success/import';
13
- import { EventTms_out_log } from 'esoftplay/cache/event/tms_out_log/import';
14
- import { EventTms_out_successProperty } from 'esoftplay/cache/event/tms_out_success/import';
15
- import { LibCollaps } from 'esoftplay/cache/lib/collaps/import';
16
- import { LibCurl } from 'esoftplay/cache/lib/curl/import';
17
- import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
18
- import { LibIcon } from 'esoftplay/cache/lib/icon/import';
19
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
20
- import { LibProgress } from 'esoftplay/cache/lib/progress/import';
21
- import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
22
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
23
- import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
24
- import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
25
- import { LibUtils } from 'esoftplay/cache/lib/utils/import';
26
- import { UseCondition } from 'esoftplay/cache/use/condition/import';
27
- import { UserClass } from 'esoftplay/cache/user/class/import';
28
- import esp from 'esoftplay/esp';
29
- import useSafeState from 'esoftplay/state';
30
- import Storage from 'esoftplay/storage';
31
- import Constants from 'expo-constants';
32
- import * as FileSystem from 'expo-file-system';
33
- import React from 'react';
34
- import { Pressable, ScrollView, Text, View } from 'react-native';
35
-
36
- export interface EventTms_logArgs {
37
-
38
- }
39
- export interface EventTms_logProps {
40
-
41
- }
42
-
43
- export interface LogItem {
44
- text: string
45
- value: string
46
- onPress: () => void
47
- valuecolor?: string
48
- }
49
-
50
- function Item(props: LogItem) {
51
- return (
52
- <Pressable
53
- onPress={() => {
54
- props.onPress()
55
- }} style={{ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginHorizontal: 15, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: LibStyle.colorLightGrey }}>
56
- <LibTextstyle text={props.text} textStyle="subhead" />
57
- <LibTextstyle text={LibUtils.number(props.value)} style={{ color: props.valuecolor ? props.valuecolor : "#000" }} textStyle="title2" />
58
- </Pressable>
59
- )
60
- }
61
-
62
- // Fungsi untuk menjumlahkan nilai per kategori
63
- export function sumValuesPerCategory(data: any) {
64
- let categoryTotals: any = {};
65
-
66
- // Iterasi setiap kategori
67
- for (const category in data) {
68
- let categoryTotal = 0;
69
- const gates = data[category];
70
-
71
- // Iterasi setiap gate di dalam kategori
72
- for (const gate in gates) {
73
- const times = gates[gate];
74
-
75
- // Iterasi setiap waktu dan menambahkan nilainya ke total per kategori
76
- for (const time in times) {
77
- categoryTotal += times[time];
78
- }
79
- }
80
-
81
- // Simpan total kategori dalam objek hasil
82
- categoryTotals[category] = categoryTotal;
83
- }
84
- return categoryTotals;
85
- }
86
-
87
-
88
- const useDetectStateChange = (state: any, duration: number) => {
89
- const [trigger, setTrigger] = useSafeState(false);
90
-
91
- useEffect(() => {
92
- let timer: NodeJS.Timeout;
93
- const handleStateChange = () => {
94
- clearTimeout(timer);
95
- timer = setTimeout(() => {
96
- setTrigger(true);
97
- }, duration);
98
- }; handleStateChange(); return () => { clearTimeout(timer); };
99
- }, [state, duration]);
100
-
101
- return trigger;
102
- };
103
-
104
-
105
- export default function m(props: EventTms_logProps): any {
106
- const selectedRef = useRef<LibSlidingup>(null)
107
- const { event_id, gate, fromPage }: any = LibNavigation.getArgsAll(props)
108
- const [, setSelectedData, getSelectedData] = useSafeState<any[]>([])
109
- const [titleSliding, setTitleSliding] = useSafeState()
110
- let counter = useRef(0).current
111
- let counterDone = useRef(0).current
112
-
113
- const backupEntrance = EventTms_in_successProperty.syncUsedTiket().useSelector(s => s)
114
- const isStuckEntrance = useDetectStateChange(backupEntrance, 10000)
115
-
116
- const backupExit = EventTms_out_successProperty.syncTicketExit().useSelector(s => s)
117
- const isStuckExit = useDetectStateChange(backupExit, 10000)
118
-
119
- const backupHall = EventTms_in_hall_successProperty.syncHallIn().useSelector(s => s)
120
- const isStuckHall = useDetectStateChange(backupHall, 10000)
121
-
122
- const backupHall_out = EventTms_out_hall_successProperty.syncHallOut().useSelector(s => s)
123
- const isStuckHall_out = useDetectStateChange(backupHall_out, 10000)
124
-
125
- let data = EventTms_homeProperty.counterState().get()
126
-
127
- function transformData(data: any) {
128
- const result: any = {};
129
-
130
- // Iterasi setiap key dalam data
131
- Object.entries(data)?.forEach(([key, value]: any) => {
132
- // Inisialisasi array untuk setiap key di result
133
- result[key] = [];
134
- esp.log(key, value);
135
- // Iterasi setiap id dan timestamps
136
- Object.entries(value)?.forEach(([id, timestamps]: any) => {
137
- // Menggunakan map untuk mengonversi timestamps menjadi array pasangan [timestamp, count]
138
- const pairs = Object.entries(timestamps)?.map(([timestamp, count]) => [timestamp, count]);
139
- // Menambahkan hasil pasangan ke result[key]
140
- result[key]?.push(...pairs);
141
- });
142
- });
143
- setSelectedData(result)
144
- return result;
145
- }
146
-
147
- function closing() {
148
- const counter = EventTms_homeProperty.getDataByDate()
149
- let url = 'event_tms_closing' + LibUtils.objectToUrlParam({ event_id: event_id, gate_id: gate?.id })
150
- let post = {
151
- closing: JSON.stringify(counter)
152
- }
153
-
154
- LibDialog.warningConfirm(esp.lang("event/tms_log", "title"), esp.lang("event/tms_log", "msg"), esp.lang("event/tms_log", "ok"), () => {
155
- LibProgress.show(esp.lang("event/tms_log", "wait"))
156
- new LibCurl(url, post, (res, msg) => {
157
- LibProgress.hide()
158
- LibToastProperty.show(msg)
159
- LibNavigation.back()
160
-
161
- // reset counter
162
- EventTms_homeProperty.counterState().reset()
163
- EventTms_in_successProperty.syncUsedTiket().reset()
164
- EventTms_out_successProperty.syncTicketExit().reset()
165
- EventTms_in_hall_successProperty.syncHallIn().reset()
166
- EventTms_out_hall_successProperty.syncHallOut().reset()
167
-
168
- }, (err) => {
169
- LibProgress.hide()
170
- LibDialog.warning(esp.lang("event/tms_log", "oops"), err?.message)
171
- })
172
- }, esp.lang("event/tms_log", "no"), () => { })
173
-
174
- }
175
-
176
- function isEmptyObject(obj: any) {
177
- return JSON.stringify(obj) === "{}";
178
- }
179
-
180
-
181
- return (
182
- <View style={{ flex: 1 }}>
183
- <EventHeader title={esp.lang("event/tms_log", "header_title")} />
184
- <ScrollView>
185
- {/* scan gate in */}
186
- <LibCollaps
187
- header={(show) => {
188
- return (
189
- <View style={{ ...LibStyle.elevation(2), borderTopLeftRadius: 5, borderTopRightRadius: 5, paddingHorizontal: 10, paddingVertical: 5, margin: 15, marginBottom: 5, backgroundColor: LibStyle.colorGreen, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between', borderBottomWidth: 2, borderBottomColor: "#c9c9c9" }}>
190
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: '#fff' }}>{esp.lang("event/tms_log", "report_gate_in")}</Text>
191
- <LibIcon name={show ? 'chevron-up' : 'chevron-down'} color='#fff' />
192
- </View>
193
- )
194
- }}
195
- show
196
- >
197
- <EventTms_in_log
198
- onPress={(type: string, title: string) => {
199
- setSelectedData(transformData(data)[type])
200
- selectedRef.current?.show()
201
- setTitleSliding(title)
202
- }}
203
- />
204
- </LibCollaps>
205
-
206
- {/* scan gate out */}
207
- <LibCollaps
208
- show
209
- header={(show) => {
210
- return (
211
- <View style={{ ...LibStyle.elevation(2), borderTopLeftRadius: 5, borderTopRightRadius: 5, paddingHorizontal: 10, paddingVertical: 5, margin: 15, marginBottom: 5, backgroundColor: LibStyle.colorRed, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between', borderBottomWidth: 2, borderBottomColor: "#c9c9c9" }}>
212
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/tms_log", "report_gate_out")}</Text>
213
- <LibIcon name={show ? 'chevron-up' : 'chevron-down'} color='#fff' />
214
- </View>
215
- )
216
- }}>
217
- <EventTms_out_log
218
- onPress={(type: string, title: string) => {
219
- setSelectedData(transformData(data)[type])
220
- selectedRef.current?.show()
221
- setTitleSliding(title)
222
- }}
223
- />
224
-
225
- </LibCollaps>
226
-
227
- {/* scan hall in */}
228
- <LibCollaps
229
- show
230
- header={(show) => {
231
- return (
232
- <View style={{ ...LibStyle.elevation(2), borderTopLeftRadius: 5, borderTopRightRadius: 5, paddingHorizontal: 10, paddingVertical: 5, margin: 15, marginBottom: 5, backgroundColor: "#fff", flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between', borderBottomWidth: 2, borderBottomColor: "#c9c9c9" }}>
233
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: LibStyle.colorGreen }}>{esp.lang("event/tms_log", "report_hall_in")}</Text>
234
- <LibIcon name={show ? 'chevron-up' : 'chevron-down'} />
235
- </View>
236
- )
237
- }}>
238
- <View>
239
-
240
- </View>
241
- <EventTms_in_hall_log
242
- onPress={(type: string, title: string) => {
243
- setSelectedData(transformData(data)[type])
244
- selectedRef.current?.show()
245
- setTitleSliding(title)
246
- }}
247
- />
248
- </LibCollaps>
249
-
250
- {/* scan hall out */}
251
- <LibCollaps
252
- show
253
- header={(show) => {
254
- return (
255
- <View style={{ ...LibStyle.elevation(2), borderTopLeftRadius: 5, borderTopRightRadius: 5, paddingHorizontal: 10, paddingVertical: 5, margin: 15, marginBottom: 5, backgroundColor: "#fff", flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between', borderBottomWidth: 2, borderBottomColor: "#c9c9c9" }}>
256
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: LibStyle.colorRed }}>{esp.lang("event/tms_log", "report_hall_out")}</Text>
257
- <LibIcon name={show ? 'chevron-up' : 'chevron-down'} />
258
- </View>
259
- )
260
- }}>
261
- <EventTms_out_hall_log
262
- onPress={(type: string, title: string) => {
263
- setSelectedData(transformData(data)[type])
264
- selectedRef.current?.show()
265
- setTitleSliding(title)
266
- }}
267
- />
268
- </LibCollaps>
269
-
270
- </ScrollView>
271
- <UseCondition if={backupExit.length == 0 && backupEntrance.length == 0 && backupHall.length == 0 && backupHall_out.length == 0} fallback={
272
- <UseCondition if={isStuckEntrance || isStuckExit || isStuckHall || isStuckHall_out} >
273
- <View style={{ padding: 10 }}>
274
- <LibTextstyle textStyle='caption2' text={esp.lang("event/tms_log", "alert")} />
275
- <EventButton
276
- style={{ marginTop: 10 }}
277
- label={esp.lang("event/tms_log", "btn_title")}
278
- backgroundColor='#000'
279
- onPress={() => {
280
- LibDialog.confirm(esp.lang("event/tms_log", "send_title"), esp.lang("event/tms_log", "send_msg"), esp.lang("event/tms_log", "send_ok"), () => {
281
- if (backupEntrance.length > 0) {
282
- counter = counter + 1
283
- Storage.setItem('event/tms_in_log_copy_scanned', JSON.stringify(backupEntrance)).then(() => {
284
- sendFileTelegram('event/tms_in_log_copy_scanned', () => {
285
- counterDone = counterDone + 1
286
- if (counter == counterDone) {
287
- if (!fromPage) {
288
- closing()
289
- }
290
- }
291
- })
292
- })
293
- }
294
-
295
- if (backupExit.length > 0) {
296
- counter = counter + 1
297
- Storage.setItem('event/tms_out_log_copy_scanned', JSON.stringify(backupExit)).then(() => {
298
- sendFileTelegram('event/tms_out_log_copy_scanned', () => {
299
- counterDone = counterDone + 1
300
- if (counter == counterDone) {
301
- if (!fromPage) {
302
- closing()
303
- }
304
- }
305
- })
306
- })
307
- }
308
-
309
- if (backupHall.length > 0) {
310
- counter = counter + 1
311
- Storage.setItem('event/hall_log_copy_scanned', JSON.stringify(backupHall)).then(() => {
312
- sendFileTelegram('event/hall_log_copy_scanned', () => {
313
- counterDone = counterDone + 1
314
- if (counter == counterDone) {
315
- if (!fromPage) {
316
- closing()
317
- }
318
- }
319
- })
320
- })
321
- }
322
-
323
- if (backupHall_out.length > 0) {
324
- counter = counter + 1
325
- Storage.setItem('event/hallout_log_copy_scanned', JSON.stringify(backupHall_out)).then(() => {
326
- sendFileTelegram('event/hallout_log_copy_scanned', () => {
327
- counterDone = counterDone + 1
328
- if (counter == counterDone) {
329
- if (!fromPage) {
330
- closing()
331
- }
332
- }
333
- })
334
- })
335
- }
336
- }, esp.lang("event/tms_log", "send_no"), () => { })
337
- }} />
338
- </View>
339
- </UseCondition>
340
- } >
341
- <EventButton
342
- style={{ margin: 10 }}
343
- label={esp.lang("event/tms_log", "btn_close")} onPress={() => {
344
- if (isEmptyObject(data)) {
345
- LibToastProperty.show(esp.lang("event/tms_log", "empty_data"))
346
- } else {
347
- closing()
348
- }
349
- }} />
350
- </UseCondition>
351
- <LibSlidingup ref={selectedRef} >
352
- <View style={{ height: 500, backgroundColor: 'white', borderTopLeftRadius: 20, borderTopRightRadius: 20 }} >
353
- <Pressable onPress={() => selectedRef.current?.hide()} style={{ height: 4, borderRadius: 2, backgroundColor: '#aaa', width: 40, margin: 16, alignSelf: 'center', }} />
354
- <View style={{ alignContent: 'center', alignItems: 'center', marginVertical: 15 }}>
355
- <LibTextstyle textStyle="headline" text={esp.lang("event/tms_log", "hourly_detail")} />
356
- <LibTextstyle textStyle="headline" text={titleSliding} />
357
- </View>
358
- <ScrollView>
359
- {
360
- getSelectedData().map((item: any, i: number) => {
361
- return (
362
- <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginHorizontal: 15, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: LibStyle.colorLightGrey }}>
363
- <LibTextstyle text={LibUtils.moment(item[0] + ":00:00").serverFormat('DD MMM YYYY HH:mm')} textStyle="subhead" />
364
- <LibTextstyle text={LibUtils.number(item[1])} style={{ color: "#000" }} textStyle="title2" />
365
- </View>
366
- )
367
- })
368
- }
369
- </ScrollView>
370
- </View>
371
- </LibSlidingup >
372
- </View>
373
- )
374
- }
375
-
376
- async function sendFileTelegram(filePath: string, onDone: () => void) {
377
- try {
378
- let dbPath = Storage.getDBPath(filePath)
379
- let fileInfo = await FileSystem.getInfoAsync(dbPath, {});
380
- if (!fileInfo.exists) {
381
- return
382
- }
383
-
384
- LibProgress.show(esp.lang("event/tms_log", "sending_log"))
385
- const fileName = fileInfo?.uri?.split('/').pop();
386
- const formData = new FormData();
387
- const email = UserClass.state().get('email')
388
-
389
- let msg = [
390
- '#log_tms from ' + email + ' with ' + Constants.deviceName,
391
- esp.config('domain'),
392
- // JSON.stringify({
393
- // ...counter,
394
- // waiting: EventTms_in_successProperty.syncUsedTiket().get().length
395
- // }, undefined, 2),
396
- // `RUMUS:`,
397
- // `send = api_ok + api_no + blank `,
398
- // `opengate = scan - scan_failed`,
399
- // `waiting = opengate - api_ok`,
400
- ].join('\n')
401
- formData.append('caption', msg);
402
- formData.append('chat_id', '-1001737180019');
403
- formData.append('document', {
404
- uri: dbPath,
405
- name: email + '-' + fileName,
406
- type: 'text/csv',
407
- });
408
- formData.append('document', {
409
- uri: dbPath,
410
- name: email + '-' + fileName,
411
- type: 'text/csv',
412
- });
413
- const response = await fetch(
414
- `https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendDocument`,
415
- {
416
- method: 'POST',
417
- body: formData,
418
- }
419
- );
420
-
421
- const result = await response.json();
422
- if (result.ok == true) {
423
- LibToastProperty.show(esp.lang("event/tms_log", "log_send"))
424
- onDone()
425
- } else {
426
- LibToastProperty.show(result?.description)
427
- }
428
- LibProgress.hide()
429
- } catch (error) {
430
- LibToastProperty.show(JSON.stringify(error))
431
- LibProgress.hide()
432
- }
433
- }