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
package/event/log.tsx ADDED
@@ -0,0 +1,435 @@
1
+ // withHooks
2
+ import { useEffect, useRef } from 'react';
3
+
4
+ import { BigbangGate_infoProperty } from 'esoftplay/cache/bigbang/gate_info/import';
5
+ import { ComponentButton } from 'esoftplay/cache/component/button/import';
6
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
7
+ import { EventEntrance_log } from 'esoftplay/cache/event/entrance_log/import';
8
+ import { EventEntrance_successProperty } from 'esoftplay/cache/event/entrance_success/import';
9
+ import { EventExit_log } from 'esoftplay/cache/event/exit_log/import';
10
+ import { EventExit_successProperty } from 'esoftplay/cache/event/exit_success/import';
11
+ import { EventHall_in_log } from 'esoftplay/cache/event/hall_in_log/import';
12
+ import { EventHall_in_successProperty } from 'esoftplay/cache/event/hall_in_success/import';
13
+ import { EventHall_out_log } from 'esoftplay/cache/event/hall_out_log/import';
14
+ import { EventHall_out_successProperty } from 'esoftplay/cache/event/hall_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 { ScrollView, Text, View } from 'react-native';
35
+ import Pressable from '../lib/pressable';
36
+
37
+
38
+ export interface EventLogArgs {
39
+
40
+ }
41
+ export interface EventLogProps {
42
+
43
+ }
44
+
45
+ export interface LogItem {
46
+ text: string
47
+ value: string
48
+ onPress: () => void
49
+ valuecolor?: string
50
+ }
51
+
52
+ function Item(props: LogItem) {
53
+ return (
54
+ <Pressable
55
+ onPress={() => {
56
+ props.onPress()
57
+ }} style={{ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginHorizontal: 15, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: LibStyle.colorLightGrey }}>
58
+ <LibTextstyle text={props.text} textStyle="subhead" />
59
+ <LibTextstyle text={LibUtils.number(props.value)} style={{ color: props.valuecolor ? props.valuecolor : "#000" }} textStyle="title2" />
60
+ </Pressable>
61
+ )
62
+ }
63
+
64
+ // Fungsi untuk menjumlahkan nilai per kategori
65
+ export function sumValuesPerCategory(data: any) {
66
+ let categoryTotals: any = {};
67
+
68
+ // Iterasi setiap kategori
69
+ for (const category in data) {
70
+ let categoryTotal = 0;
71
+ const gates = data[category];
72
+
73
+ // Iterasi setiap gate di dalam kategori
74
+ for (const gate in gates) {
75
+ const times = gates[gate];
76
+
77
+ // Iterasi setiap waktu dan menambahkan nilainya ke total per kategori
78
+ for (const time in times) {
79
+ categoryTotal += times[time];
80
+ }
81
+ }
82
+
83
+ // Simpan total kategori dalam objek hasil
84
+ categoryTotals[category] = categoryTotal;
85
+ }
86
+ return categoryTotals;
87
+ }
88
+
89
+
90
+ const useDetectStateChange = (state: any, duration: number) => {
91
+ const [trigger, setTrigger] = useSafeState(false);
92
+
93
+ useEffect(() => {
94
+ let timer: NodeJS.Timeout;
95
+ const handleStateChange = () => {
96
+ clearTimeout(timer);
97
+ timer = setTimeout(() => {
98
+ setTrigger(true);
99
+ }, duration);
100
+ }; handleStateChange(); return () => { clearTimeout(timer); };
101
+ }, [state, duration]);
102
+
103
+ return trigger;
104
+ };
105
+
106
+
107
+ export default function m(props: EventLogProps): any {
108
+ const selectedRef = useRef<LibSlidingup>(null)
109
+ const { event_id, gate, fromPage }: any = LibNavigation.getArgsAll(props)
110
+ const [, setSelectedData, getSelectedData] = useSafeState<any[]>([])
111
+ const [titleSliding, setTitleSliding] = useSafeState()
112
+ let counter = useRef(0).current
113
+ let counterDone = useRef(0).current
114
+
115
+ const backupEntrance = EventEntrance_successProperty.syncUsedTiket().useSelector(s => s)
116
+ const isStuckEntrance = useDetectStateChange(backupEntrance, 10000)
117
+
118
+ const backupExit = EventExit_successProperty.syncTicketExit().useSelector(s => s)
119
+ const isStuckExit = useDetectStateChange(backupExit, 10000)
120
+
121
+ const backupHall = EventHall_in_successProperty.syncHallIn().useSelector(s => s)
122
+ const isStuckHall = useDetectStateChange(backupHall, 10000)
123
+
124
+ const backupHall_out = EventHall_out_successProperty.syncHallOut().useSelector(s => s)
125
+ const isStuckHall_out = useDetectStateChange(backupHall_out, 10000)
126
+
127
+ let data = BigbangGate_infoProperty.counterState().get()
128
+
129
+ function transformData(data: any) {
130
+ const result: any = {};
131
+
132
+ // Iterasi setiap key dalam data
133
+ Object.entries(data)?.forEach(([key, value]: any) => {
134
+ // Inisialisasi array untuk setiap key di result
135
+ result[key] = [];
136
+ esp.log(key, value);
137
+ // Iterasi setiap id dan timestamps
138
+ Object.entries(value)?.forEach(([id, timestamps]: any) => {
139
+ // Menggunakan map untuk mengonversi timestamps menjadi array pasangan [timestamp, count]
140
+ const pairs = Object.entries(timestamps)?.map(([timestamp, count]) => [timestamp, count]);
141
+ // Menambahkan hasil pasangan ke result[key]
142
+ result[key]?.push(...pairs);
143
+ });
144
+ });
145
+ setSelectedData(result)
146
+ return result;
147
+ }
148
+
149
+ function closing() {
150
+ const counter = BigbangGate_infoProperty.getDataByDate()
151
+ let url = 'event_tms_closing' + LibUtils.objectToUrlParam({ event_id: event_id, gate_id: gate?.id })
152
+ let post = {
153
+ closing: JSON.stringify(counter)
154
+ }
155
+
156
+ LibDialog.warningConfirm(esp.lang("event/log", "title"), esp.lang("event/log", "msg"), esp.lang("event/log", "ok"), () => {
157
+ LibProgress.show(esp.lang("event/log", "wait"))
158
+ new LibCurl(url, post, (res, msg) => {
159
+ LibProgress.hide()
160
+ LibToastProperty.show(msg)
161
+ LibNavigation.back()
162
+
163
+ // reset counter
164
+ BigbangGate_infoProperty.counterState().reset()
165
+ EventEntrance_successProperty.syncUsedTiket().reset()
166
+ EventExit_successProperty.syncTicketExit().reset()
167
+ EventHall_in_successProperty.syncHallIn().reset()
168
+ EventHall_out_successProperty.syncHallOut().reset()
169
+
170
+ }, (err) => {
171
+ LibProgress.hide()
172
+ LibDialog.warning(esp.lang("event/log", "oops"), err?.message)
173
+ })
174
+ }, esp.lang("event/log", "no"), () => { })
175
+
176
+ }
177
+
178
+ function isEmptyObject(obj: any) {
179
+ return JSON.stringify(obj) === "{}";
180
+ }
181
+
182
+
183
+ return (
184
+ <View style={{ flex: 1 }}>
185
+ <ComponentHeader title={esp.lang("event/log", "header_title")} />
186
+ <ScrollView>
187
+ {/* scan gate in */}
188
+ <LibCollaps
189
+ header={(show) => {
190
+ return (
191
+ <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" }}>
192
+ <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: '#fff' }}>{esp.lang("event/log", "report_gate_in")}</Text>
193
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} color='#fff' />
194
+ </View>
195
+ )
196
+ }}
197
+ show
198
+ >
199
+ <EventEntrance_log
200
+ onPress={(type: string, title: string) => {
201
+ setSelectedData(transformData(data)[type])
202
+ selectedRef.current?.show()
203
+ setTitleSliding(title)
204
+ }}
205
+ />
206
+ </LibCollaps>
207
+
208
+ {/* scan gate out */}
209
+ <LibCollaps
210
+ show
211
+ header={(show) => {
212
+ return (
213
+ <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" }}>
214
+ <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/log", "report_gate_out")}</Text>
215
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} color='#fff' />
216
+ </View>
217
+ )
218
+ }}>
219
+ <EventExit_log
220
+ onPress={(type: string, title: string) => {
221
+ setSelectedData(transformData(data)[type])
222
+ selectedRef.current?.show()
223
+ setTitleSliding(title)
224
+ }}
225
+ />
226
+
227
+ </LibCollaps>
228
+
229
+ {/* scan hall in */}
230
+ <LibCollaps
231
+ show
232
+ header={(show) => {
233
+ return (
234
+ <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" }}>
235
+ <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: LibStyle.colorGreen }}>{esp.lang("event/log", "report_hall_in")}</Text>
236
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} />
237
+ </View>
238
+ )
239
+ }}>
240
+ <View>
241
+
242
+ </View>
243
+ <EventHall_in_log
244
+ onPress={(type: string, title: string) => {
245
+ setSelectedData(transformData(data)[type])
246
+ selectedRef.current?.show()
247
+ setTitleSliding(title)
248
+ }}
249
+ />
250
+ </LibCollaps>
251
+
252
+ {/* scan hall out */}
253
+ <LibCollaps
254
+ show
255
+ header={(show) => {
256
+ return (
257
+ <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" }}>
258
+ <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold', color: LibStyle.colorRed }}>{esp.lang("event/log", "report_hall_out")}</Text>
259
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} />
260
+ </View>
261
+ )
262
+ }}>
263
+ <EventHall_out_log
264
+ onPress={(type: string, title: string) => {
265
+ setSelectedData(transformData(data)[type])
266
+ selectedRef.current?.show()
267
+ setTitleSliding(title)
268
+ }}
269
+ />
270
+ </LibCollaps>
271
+
272
+ </ScrollView>
273
+ <UseCondition if={backupExit.length == 0 && backupEntrance.length == 0 && backupHall.length == 0 && backupHall_out.length == 0} fallback={
274
+ <UseCondition if={isStuckEntrance || isStuckExit || isStuckHall || isStuckHall_out} >
275
+ <View style={{ padding: 10 }}>
276
+ <LibTextstyle textStyle='caption2' text={esp.lang("event/log", "alert")} />
277
+ <ComponentButton
278
+ style={{ marginTop: 10 }}
279
+ label={esp.lang("event/log", "btn_title")}
280
+ backgroundColor='#000'
281
+ onPress={() => {
282
+ LibDialog.confirm(esp.lang("event/log", "send_title"), esp.lang("event/log", "send_msg"), esp.lang("event/log", "send_ok"), () => {
283
+ if (backupEntrance.length > 0) {
284
+ counter = counter + 1
285
+ Storage.setItem('event/entrance_log_copy_scanned', JSON.stringify(backupEntrance)).then(() => {
286
+ sendFileTelegram('event/entrance_log_copy_scanned', () => {
287
+ counterDone = counterDone + 1
288
+ if (counter == counterDone) {
289
+ if (!fromPage) {
290
+ closing()
291
+ }
292
+ }
293
+ })
294
+ })
295
+ }
296
+
297
+ if (backupExit.length > 0) {
298
+ counter = counter + 1
299
+ Storage.setItem('event/exit_log_copy_scanned', JSON.stringify(backupExit)).then(() => {
300
+ sendFileTelegram('event/exit_log_copy_scanned', () => {
301
+ counterDone = counterDone + 1
302
+ if (counter == counterDone) {
303
+ if (!fromPage) {
304
+ closing()
305
+ }
306
+ }
307
+ })
308
+ })
309
+ }
310
+
311
+ if (backupHall.length > 0) {
312
+ counter = counter + 1
313
+ Storage.setItem('event/hall_log_copy_scanned', JSON.stringify(backupHall)).then(() => {
314
+ sendFileTelegram('event/hall_log_copy_scanned', () => {
315
+ counterDone = counterDone + 1
316
+ if (counter == counterDone) {
317
+ if (!fromPage) {
318
+ closing()
319
+ }
320
+ }
321
+ })
322
+ })
323
+ }
324
+
325
+ if (backupHall_out.length > 0) {
326
+ counter = counter + 1
327
+ Storage.setItem('event/hallout_log_copy_scanned', JSON.stringify(backupHall_out)).then(() => {
328
+ sendFileTelegram('event/hallout_log_copy_scanned', () => {
329
+ counterDone = counterDone + 1
330
+ if (counter == counterDone) {
331
+ if (!fromPage) {
332
+ closing()
333
+ }
334
+ }
335
+ })
336
+ })
337
+ }
338
+ }, esp.lang("event/log", "send_no"), () => { })
339
+ }} />
340
+ </View>
341
+ </UseCondition>
342
+ } >
343
+ <ComponentButton
344
+ style={{ margin: 10 }}
345
+ label={esp.lang("event/log", "btn_close")} onPress={() => {
346
+ if (isEmptyObject(data)) {
347
+ LibToastProperty.show(esp.lang("event/log", "empty_data"))
348
+ } else {
349
+ closing()
350
+ }
351
+ }} />
352
+ </UseCondition>
353
+ <LibSlidingup ref={selectedRef} >
354
+ <View style={{ height: 500, backgroundColor: 'white', borderTopLeftRadius: 20, borderTopRightRadius: 20 }} >
355
+ <Pressable onPress={() => selectedRef.current?.hide()} style={{ height: 4, borderRadius: 2, backgroundColor: '#aaa', width: 40, margin: 16, alignSelf: 'center', }} />
356
+ <View style={{ alignContent: 'center', alignItems: 'center', marginVertical: 15 }}>
357
+ <LibTextstyle textStyle="headline" text={esp.lang("event/log", "hourly_detail")} />
358
+ <LibTextstyle textStyle="headline" text={titleSliding} />
359
+ </View>
360
+ <ScrollView>
361
+ {
362
+ getSelectedData().map((item: any, i: number) => {
363
+ return (
364
+ <View key={i} style={{ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginHorizontal: 15, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: LibStyle.colorLightGrey }}>
365
+ <LibTextstyle text={LibUtils.moment(item[0] + ":00:00").serverFormat('DD MMM YYYY HH:mm')} textStyle="subhead" />
366
+ <LibTextstyle text={LibUtils.number(item[1])} style={{ color: "#000" }} textStyle="title2" />
367
+ </View>
368
+ )
369
+ })
370
+ }
371
+ </ScrollView>
372
+ </View>
373
+ </LibSlidingup >
374
+ </View>
375
+ )
376
+ }
377
+
378
+ async function sendFileTelegram(filePath: string, onDone: () => void) {
379
+ try {
380
+ let dbPath = Storage.getDBPath(filePath)
381
+ let fileInfo = await FileSystem.getInfoAsync(dbPath, {});
382
+ if (!fileInfo.exists) {
383
+ return
384
+ }
385
+
386
+ LibProgress.show(esp.lang("event/log", "sending_log"))
387
+ const fileName = fileInfo?.uri?.split('/').pop();
388
+ const formData = new FormData();
389
+ const email = UserClass.state().get('email')
390
+
391
+ let msg = [
392
+ '#log_tms from ' + email + ' with ' + Constants.deviceName,
393
+ esp.config('domain'),
394
+ // JSON.stringify({
395
+ // ...counter,
396
+ // waiting: EventEntrance_successProperty.syncUsedTiket().get().length
397
+ // }, undefined, 2),
398
+ // `RUMUS:`,
399
+ // `send = api_ok + api_no + blank `,
400
+ // `opengate = scan - scan_failed`,
401
+ // `waiting = opengate - api_ok`,
402
+ ].join('\n')
403
+ formData.append('caption', msg);
404
+ formData.append('chat_id', '-1001737180019');
405
+ formData.append('document', {
406
+ uri: dbPath,
407
+ name: email + '-' + fileName,
408
+ type: 'text/csv',
409
+ });
410
+ formData.append('document', {
411
+ uri: dbPath,
412
+ name: email + '-' + fileName,
413
+ type: 'text/csv',
414
+ });
415
+ const response = await fetch(
416
+ `https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendDocument`,
417
+ {
418
+ method: 'POST',
419
+ body: formData,
420
+ }
421
+ );
422
+
423
+ const result = await response.json();
424
+ if (result.ok == true) {
425
+ LibToastProperty.show(esp.lang("event/log", "log_send"))
426
+ onDone()
427
+ } else {
428
+ LibToastProperty.show(result?.description)
429
+ }
430
+ LibProgress.hide()
431
+ } catch (error) {
432
+ LibToastProperty.show(JSON.stringify(error))
433
+ LibProgress.hide()
434
+ }
435
+ }
@@ -0,0 +1,209 @@
1
+ // withHooks
2
+ import { useEffect, useRef } from 'react';
3
+
4
+ import { ComponentButton } from 'esoftplay/cache/component/button/import';
5
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
6
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
7
+ import { ComponentSlidingup } from 'esoftplay/cache/component/slidingup/import';
8
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
9
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
10
+ import { LibInput_rectangle2 } from 'esoftplay/cache/lib/input_rectangle2/import';
11
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
12
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
13
+ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
14
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
15
+ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
16
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
17
+ import esp from 'esoftplay/esp';
18
+ import useSafeState from 'esoftplay/state';
19
+ import React from 'react';
20
+ import { Keyboard, RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
21
+
22
+
23
+ export interface EventQc_idcardArgs {
24
+
25
+ }
26
+ export interface EventQc_idcardProps {
27
+
28
+ }
29
+
30
+ export function openScanner(event_id: any) {
31
+ LibNavigation.navigateForResult('component/scanner').then((value: any) => {
32
+ if (value) {
33
+ let post = {
34
+ qr: value,
35
+ event_id: event_id
36
+ }
37
+ LibProgress.show(esp.lang("event/qc_idcard", "wait"))
38
+ new LibCurl('event_exhibitor_qc', post, (res, msg) => {
39
+ LibProgress.hide()
40
+ LibNavigation.navigate('event/qc_idcard_success', {
41
+ data: { ...res.data },
42
+ event_id: event_id
43
+ })
44
+ }, (err) => {
45
+ LibProgress.hide()
46
+ LibNavigation.navigate('event/qc_idcard_failed', {
47
+ message: err?.message,
48
+ result: err?.result,
49
+ event_id: event_id
50
+ })
51
+ }, 1)
52
+ }
53
+ })
54
+ }
55
+
56
+ export default function m(props: EventQc_idcardProps): any {
57
+ const { data } = LibNavigation.getArgsAll(props)
58
+
59
+ const [result, setResult] = useSafeState<any>()
60
+ const [error, setError] = useSafeState<any>()
61
+ const [query, setQuery] = useSafeState<any>()
62
+ const [showReset, setShowReset] = useSafeState<boolean>(false)
63
+ const [counter, setCounter] = useSafeState(1)
64
+ const [refreshing, setRefreshing] = useSafeState<boolean>(false);
65
+ const dialogDetailExhibitor = useRef<ComponentSlidingup>(null)
66
+
67
+ const [selectedExhibitor, setSelectedExhibitor] = useSafeState<any>()
68
+
69
+ function loadData() {
70
+ let post = {
71
+ event_id: data?.id
72
+ }
73
+ let url = query ? 'event_exhibitor_qc_report?search=' + query : 'event_exhibitor_qc_report'
74
+ LibProgress.show(esp.lang("event/qc_idcard", "wait"))
75
+ new LibCurl(url, post, (res, msg) => {
76
+ setResult(res)
77
+ setError(undefined)
78
+ setRefreshing(false)
79
+ LibProgress.hide()
80
+ }, (err) => {
81
+ setRefreshing(false)
82
+ LibProgress.hide()
83
+ setResult(undefined)
84
+ setError(err)
85
+ }, 1)
86
+ }
87
+
88
+ useEffect(() => {
89
+ loadData()
90
+ }, [])
91
+
92
+ useEffect(() => {
93
+ loadData()
94
+ }, [counter])
95
+
96
+
97
+ function renderItem(item: any, i: number) {
98
+ return (
99
+ <TouchableOpacity onPress={() => {
100
+ setSelectedExhibitor(item)
101
+ LibUtils.debounce(() => {
102
+ dialogDetailExhibitor?.current?.show()
103
+ }, 100)
104
+ }} key={i} style={{ ...LibStyle.elevation(2), marginBottom: 5, margin: 10, backgroundColor: '#fff', borderRadius: 5 }}>
105
+ <View style={{ padding: 10, borderBottomWidth: 1, borderBottomColor: LibStyle.colorGrey, flexDirection: 'row', justifyContent: 'space-between' }}>
106
+ <Text allowFontScaling={false} numberOfLines={2} ellipsizeMode='tail' style={{ flex: 3, fontWeight: 'bold', fontSize: 16 }}>{item?.exhibitor_name}</Text>
107
+ <Text allowFontScaling={false} style={{ flex: 1, fontWeight: 'bold', textAlign: 'right', fontSize: 16 }}>{LibUtils.number(item?.qty)}</Text>
108
+ </View>
109
+ </TouchableOpacity>
110
+ )
111
+ }
112
+
113
+
114
+ function onRefresh() {
115
+ setRefreshing(true)
116
+ loadData()
117
+ }
118
+
119
+ if (!result && !error) {
120
+ return <LibLoading />
121
+ }
122
+
123
+ return (
124
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
125
+ <ComponentHeader title='QC ID CARD' subtitle={data?.name} />
126
+ {/* <Image source={{ uri: 'https://static.vecteezy.com/system/resources/previews/005/594/108/non_2x/mobile-application-for-scanning-qr-code-hand-holding-smartphone-scan-qr-code-icon-phone-app-barcode-scanner-vector.jpg' }} style={{ flex: 1, opacity: 0.3, resizeMode: 'cover' }} /> */}
127
+ <View style={{ backgroundColor: '#fff', padding: 16, paddingBottom: 10, }} >
128
+ <View style={{ flexDirection: 'row' }}>
129
+ <LibInput_rectangle2
130
+ style={{ marginTop: 0, borderRadius: 5, flex: 1, height: 38 }}
131
+ placeholder={esp.lang("event/qc_idcard", "search_exhibitor")}
132
+ onChangeText={(e) => {
133
+ LibUtils.debounce(() => {
134
+ setQuery(e)
135
+ }, 200)
136
+ }}
137
+ blurOnSubmit
138
+ returnKeyType='go'
139
+ onSubmitEditing={() => {
140
+ if (query?.trim()) {
141
+ setCounter(counter + 1)
142
+ setShowReset(true)
143
+ }
144
+ }}
145
+ />
146
+ <TouchableOpacity onPress={() => {
147
+ if (query) {
148
+ setCounter(counter + 1)
149
+ Keyboard.dismiss()
150
+ setShowReset(true)
151
+ }
152
+ }} style={{ marginLeft: 5, height: 38, width: 38, backgroundColor: LibStyle.colorGreen, alignContent: 'center', justifyContent: 'center', alignItems: 'center', borderRadius: 5 }}>
153
+ <LibIcon name='magnify' color='#fff' />
154
+ </TouchableOpacity>
155
+ </View>
156
+ {
157
+ showReset &&
158
+ <TouchableOpacity onPress={() => {
159
+ setQuery(undefined)
160
+ setCounter(counter + 1)
161
+ setShowReset(false)
162
+ }} style={{ flexDirection: 'row' }}>
163
+ <View style={{ marginTop: 10, flexDirection: 'row', alignContent: 'center', alignItems: 'center', backgroundColor: LibStyle.colorRed, paddingVertical: 4, padding: 7, borderRadius: 5 }} >
164
+ <LibTextstyle textStyle="caption1" text={query} style={{ color: 'white' }} />
165
+ <LibIcon name='close-circle' style={{ marginLeft: 8 }} color="#fff" size={15} />
166
+ </View>
167
+ </TouchableOpacity>
168
+ }
169
+ </View>
170
+ <ScrollView refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />}>
171
+ {
172
+ result?.length > 0 && result?.map(renderItem)
173
+ }
174
+ {
175
+ error &&
176
+ <ComponentMessage message={error?.message} style={{ marginTop: 30 }} />
177
+ }
178
+ </ScrollView>
179
+
180
+ <View style={{ padding: 10, backgroundColor: '#fff' }}>
181
+ <ComponentButton label={esp.lang("event/qc_idcard", "scan")} onPress={() => {
182
+ openScanner(data?.id)
183
+ }}
184
+ backgroundColor={LibStyle.colorGreen} />
185
+ </View>
186
+ <ComponentSlidingup ref={dialogDetailExhibitor}>
187
+ <View style={{ backgroundColor: '#f6f6f6', borderTopRightRadius: 20, borderTopLeftRadius: 20, paddingBottom: 35, paddingTop: 20, paddingHorizontal: 19, maxHeight: LibStyle.height - (LibStyle.height / 3) }}>
188
+ <ScrollView>
189
+ <View style={{ padding: 10, borderBottomWidth: 1, borderBottomColor: LibStyle.colorGrey, flexDirection: 'row', justifyContent: 'space-between' }}>
190
+ <Text allowFontScaling={false} numberOfLines={2} ellipsizeMode='tail' style={{ flex: 3, fontWeight: 'bold', fontSize: 16 }}>{selectedExhibitor?.exhibitor_name}</Text>
191
+ <Text allowFontScaling={false} style={{ flex: 1, fontWeight: 'bold', textAlign: 'right', fontSize: 16 }}>{LibUtils.number(selectedExhibitor?.qty)}</Text>
192
+ </View>
193
+ {
194
+ selectedExhibitor?.detail?.length > 0 && selectedExhibitor?.detail?.map((x: any, ii: number) => {
195
+ return (
196
+ <View key={ii} style={{ padding: 10, borderBottomWidth: 1, borderBottomColor: LibStyle.colorGrey, flexDirection: 'row', justifyContent: 'space-between' }}>
197
+ <Text allowFontScaling={false} numberOfLines={2} ellipsizeMode='tail' style={{ flex: 3, }}>{x.department_name}</Text>
198
+ <Text allowFontScaling={false} style={{ flex: 1, textAlign: 'right', }}>{LibUtils.number(x.qty)}</Text>
199
+ </View>
200
+ )
201
+ })
202
+ }
203
+ </ScrollView>
204
+ </View>
205
+ </ComponentSlidingup>
206
+
207
+ </View>
208
+ )
209
+ }