esoftplay-event 0.0.0-a → 0.0.0-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 (172) hide show
  1. package/event/additional.tsx +4 -4
  2. package/event/additional_input.tsx +11 -11
  3. package/event/alert.tsx +32 -0
  4. package/event/artist.tsx +166 -0
  5. package/event/artist_detail.tsx +520 -0
  6. package/event/artist_detail_multi.tsx +548 -0
  7. package/event/badge.tsx +22 -0
  8. package/event/button.tsx +40 -0
  9. package/event/config.ts +4 -0
  10. package/event/countdown.tsx +5 -5
  11. package/event/countdown_base.tsx +83 -0
  12. package/event/counter_cashier.tsx +11 -11
  13. package/event/counter_cashier_report.tsx +6 -6
  14. package/event/counter_cashier_sell.tsx +7 -7
  15. package/event/counter_eo.tsx +19 -19
  16. package/event/counter_history.tsx +4 -4
  17. package/event/counter_lm.tsx +16 -16
  18. package/event/counter_report.tsx +4 -4
  19. package/event/counter_report_breakdown.tsx +2 -2
  20. package/event/counter_report_detail.tsx +12 -12
  21. package/event/counter_report_detail_list.tsx +4 -4
  22. package/event/counter_request.tsx +4 -4
  23. package/event/counter_request_detail.tsx +6 -6
  24. package/event/counter_send.tsx +6 -6
  25. package/event/counter_user_list.tsx +13 -13
  26. package/event/coupon.tsx +4 -4
  27. package/event/coupon_claim.tsx +4 -4
  28. package/event/coupon_claim_detail.tsx +8 -7
  29. package/event/coupon_claim_history.tsx +9 -9
  30. package/event/coupon_claim_reimburse.tsx +7 -8
  31. package/event/coupon_claim_reimburse_history.tsx +4 -4
  32. package/event/coupon_claim_reimburse_history_detail.tsx +4 -4
  33. package/event/coupon_claim_staff.tsx +10 -10
  34. package/event/coupon_detail.tsx +3 -3
  35. package/event/coupon_event_list.tsx +4 -4
  36. package/event/coupon_generate.tsx +4 -4
  37. package/event/coupon_generate_event.tsx +4 -4
  38. package/event/coupon_generate_list.tsx +2 -2
  39. package/event/date_picker.tsx +5 -5
  40. package/event/detail.tsx +12 -15
  41. package/event/entrance.tsx +17 -17
  42. package/event/entrance_again.tsx +22 -23
  43. package/event/entrance_failed.tsx +15 -15
  44. package/event/entrance_idcard.tsx +23 -23
  45. package/event/entrance_list.tsx +24 -24
  46. package/event/entrance_list_item.tsx +6 -6
  47. package/event/entrance_log.tsx +24 -24
  48. package/event/entrance_success.tsx +8 -8
  49. package/event/entrance_warning.tsx +14 -14
  50. package/event/exchange_reward.tsx +2 -2
  51. package/event/exchange_reward_result.tsx +7 -8
  52. package/event/exchange_ticket.tsx +11 -12
  53. package/event/exchange_ticket_list.tsx +10 -12
  54. package/event/exchange_ticket_result.tsx +11 -12
  55. package/event/exit.tsx +9 -9
  56. package/event/exit_failed.tsx +12 -12
  57. package/event/exit_list.tsx +15 -15
  58. package/event/exit_log.tsx +22 -22
  59. package/event/exit_success.tsx +8 -8
  60. package/event/exit_temporary.tsx +21 -21
  61. package/event/expander.tsx +36 -0
  62. package/event/fab.tsx +24 -0
  63. package/event/firebase_socket.ts +365 -0
  64. package/event/hall_in.tsx +13 -13
  65. package/event/hall_in_failed.tsx +22 -22
  66. package/event/hall_in_list.tsx +17 -17
  67. package/event/hall_in_log.tsx +24 -24
  68. package/event/hall_in_success.tsx +8 -8
  69. package/event/hall_out.tsx +13 -13
  70. package/event/hall_out_failed.tsx +11 -11
  71. package/event/hall_out_list.tsx +17 -17
  72. package/event/hall_out_log.tsx +24 -24
  73. package/event/hall_out_success.tsx +8 -8
  74. package/event/header.tsx +119 -0
  75. package/event/label_input.tsx +23 -0
  76. package/event/list.tsx +20 -21
  77. package/event/list_filter.tsx +12 -13
  78. package/event/list_item.tsx +76 -0
  79. package/event/list_item2.tsx +78 -0
  80. package/event/loading_page.tsx +248 -0
  81. package/event/log.tsx +54 -54
  82. package/event/message.tsx +32 -0
  83. package/event/order.tsx +323 -0
  84. package/event/order_detail.tsx +813 -0
  85. package/event/order_detail_payment.tsx +153 -0
  86. package/event/order_detail_upgrade.tsx +164 -0
  87. package/event/order_detail_upgrade_button.tsx +60 -0
  88. package/event/order_detail_upgrade_payment.tsx +221 -0
  89. package/event/order_detail_visitor.tsx +196 -0
  90. package/event/order_detail_waiting.tsx +520 -0
  91. package/event/order_history.tsx +101 -0
  92. package/event/order_item.tsx +118 -0
  93. package/event/order_lottery.tsx +172 -0
  94. package/event/order_reschedule.tsx +439 -0
  95. package/event/order_reschedule_list.tsx +85 -0
  96. package/event/order_share_to.tsx +219 -0
  97. package/event/order_share_to_detail.tsx +181 -0
  98. package/event/order_status.tsx +66 -0
  99. package/event/order_waiting.tsx +143 -0
  100. package/event/pending_trx.tsx +50 -0
  101. package/event/qc_idcard.tsx +10 -10
  102. package/event/qc_idcard_failed.tsx +4 -4
  103. package/event/qc_idcard_success.tsx +4 -4
  104. package/event/qr_bg.tsx +22 -0
  105. package/event/queue_out.tsx +3 -3
  106. package/event/queue_pricing.tsx +2 -3
  107. package/event/rating.tsx +49 -0
  108. package/event/rating_mini.tsx +35 -0
  109. package/event/review.tsx +3 -3
  110. package/event/review_add.tsx +8 -8
  111. package/event/review_detail.tsx +4 -4
  112. package/event/review_item.tsx +4 -4
  113. package/event/scan_item.tsx +2 -2
  114. package/event/schedule.tsx +8 -9
  115. package/event/seat.tsx +16 -18
  116. package/event/seat_autopick.tsx +4 -4
  117. package/event/seat_map.tsx +4 -4
  118. package/event/seat_map_test.tsx +2 -2
  119. package/event/section_menu.tsx +40 -0
  120. package/event/sheet.tsx +73 -0
  121. package/event/slider.tsx +46 -0
  122. package/event/step.tsx +29 -0
  123. package/event/ticket_list.tsx +15 -16
  124. package/event/ticket_list2.tsx +16 -17
  125. package/event/tms.tsx +4 -4
  126. package/event/tms_add.tsx +7 -8
  127. package/event/tms_add_result.tsx +4 -4
  128. package/event/tms_check_code.tsx +160 -0
  129. package/event/tms_check_ticket.tsx +72 -0
  130. package/event/tms_check_ticket_result.tsx +384 -0
  131. package/event/tms_dashboard.tsx +7 -7
  132. package/event/tms_event_list.tsx +46 -43
  133. package/event/tms_gate.tsx +96 -0
  134. package/event/tms_home.tsx +639 -0
  135. package/event/tms_idcard.tsx +203 -0
  136. package/event/tms_in.tsx +215 -0
  137. package/event/tms_in_again.tsx +199 -0
  138. package/event/tms_in_failed.tsx +190 -0
  139. package/event/tms_in_hall.tsx +148 -0
  140. package/event/tms_in_hall_failed.tsx +270 -0
  141. package/event/tms_in_hall_list.tsx +222 -0
  142. package/event/tms_in_hall_log.tsx +134 -0
  143. package/event/tms_in_hall_success.tsx +132 -0
  144. package/event/tms_in_list.tsx +264 -0
  145. package/event/tms_in_log.tsx +130 -0
  146. package/event/tms_in_success.tsx +155 -0
  147. package/event/tms_in_warning.tsx +91 -0
  148. package/event/tms_list_item.tsx +88 -0
  149. package/event/tms_log.tsx +435 -0
  150. package/event/tms_out.tsx +91 -0
  151. package/event/tms_out_failed.tsx +135 -0
  152. package/event/tms_out_hall.tsx +143 -0
  153. package/event/tms_out_hall_failed.tsx +133 -0
  154. package/event/tms_out_hall_list.tsx +215 -0
  155. package/event/tms_out_hall_log.tsx +133 -0
  156. package/event/tms_out_hall_success.tsx +130 -0
  157. package/event/tms_out_list.tsx +118 -0
  158. package/event/tms_out_log.tsx +131 -0
  159. package/event/tms_out_success.tsx +143 -0
  160. package/event/tms_out_temporary.tsx +226 -0
  161. package/event/toggle.tsx +30 -0
  162. package/event/transaction.ts +34 -0
  163. package/event/turnstile_event_gate.tsx +2 -2
  164. package/event/turnstile_event_list.tsx +4 -4
  165. package/event/turnstile_event_ticket.tsx +4 -4
  166. package/event/turnstile_settings.tsx +11 -11
  167. package/event/turnstile_settings_otp.tsx +4 -4
  168. package/event/turnstile_settings_status.tsx +2 -2
  169. package/event/voucher.tsx +9 -10
  170. package/event/voucher_multi.tsx +4 -5
  171. package/id.json +644 -0
  172. package/package.json +1 -1
@@ -0,0 +1,88 @@
1
+ // withHooks
2
+
3
+ import { applyStyle } from 'esoftplay';
4
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
5
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
6
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
7
+ import { EventOrder_itemProperty } from 'esoftplay/cache/event/order_item/import';
8
+ import esp from 'esoftplay/esp';
9
+
10
+ import React from 'react';
11
+ import { Pressable, Text, View } from 'react-native';
12
+ import Svg, { Path } from 'react-native-svg';
13
+
14
+
15
+ export interface EventTms_list_itemArgs {
16
+
17
+ }
18
+ export interface EventTms_list_itemProps {
19
+ item: any,
20
+ onPress: () => void,
21
+ }
22
+ function debouncer() {
23
+ let timeout: any
24
+ return (func: () => any, delay: number): Function => {
25
+ clearTimeout(timeout)
26
+ timeout = setTimeout(func, delay);
27
+ return () => clearTimeout(timeout)
28
+ }
29
+ }
30
+ const debounce = debouncer()
31
+
32
+ export default function m(props: EventTms_list_itemProps): any {
33
+ const { item } = props
34
+ const z = (200 / 500) * (LibStyle.width - 50);
35
+
36
+ // let colorBg = item?.qty_left == 0 ? LibStyle.colorBgGrey : item.color == "#FFFFFF" ? LibStyle.colorPrimary : item?.color
37
+ let colorBg = item?.qty_left <= 0 ? LibStyle.colorBgGrey : item.color?.toUpperCase() == "#FFFFFF" ? LibStyle.colorPrimary : item?.color
38
+ let colorFg = item?.qty_left <= 0 ? "#aaa" : LibUtils.hexToRgba(item?.color, 0.5)
39
+ let colorText = item?.qty_left == 0 ? "#979797" : EventOrder_itemProperty.textColor(item.color)
40
+
41
+ if (item.price_id == "staff") {
42
+ return (
43
+ <Pressable onPress={() => { debounce(() => props.onPress(), 500) }} style={{ width: LibStyle.width - 50, marginBottom: 10, backgroundColor: colorBg, padding: 15, borderRadius: 10, ...LibStyle.elevation(3) }}>
44
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
45
+ <View style={{ height: 80, width: 80, borderRadius: 10, backgroundColor: LibStyle.colorBgGrey, ...LibStyle.elevation(3) }}>
46
+ <LibPicture source={{ uri: item?.user_image }} style={{ height: 80, width: 80, borderRadius: 10 }} />
47
+ </View>
48
+ <View style={{ marginHorizontal: 10, flex: 1, alignContent: 'center', justifyContent: 'center' }}>
49
+ <Text allowFontScaling={false} numberOfLines={2} style={applyStyle({ color: colorText, fontSize: 16, fontWeight: 'bold' })} >{item.user_name}</Text>
50
+ <Text allowFontScaling={false} style={applyStyle({ letterSpacing: 1, color: colorText, fontSize: 20, fontWeight: 'bold' })} >{item?.exhibitor_name?.split('-')[0]}</Text>
51
+ <Text allowFontScaling={false} numberOfLines={4} style={applyStyle({ letterSpacing: 1, color: colorText, fontSize: 16, fontWeight: 'normal' })} >{item?.exhibitor_name?.split('-')[1]}</Text>
52
+
53
+ </View>
54
+ </View>
55
+ </Pressable>
56
+ )
57
+ }
58
+
59
+ return (
60
+ <Pressable onPress={() => { debounce(() => props.onPress(), 500) }} style={applyStyle({ marginBottom: 10 })}>
61
+ <Svg width={LibStyle.width - 50} height={z} viewBox="0 0 544 210" fill="none">
62
+ <Path fill-rule="evenodd" fill={colorBg} clip-rule="evenodd" d="M0 15C0 6.71573 6.71573 0 15 0H529C537.284 0 544 6.71573 544 15V90C535.716 90 529 96.7157 529 105C529 113.284 535.716 120 544 120V195C544 203.284 537.284 210 529 210H15C6.71573 210 0 203.284 0 195V120C8.28427 120 15 113.284 15 105C15 96.7157 8.28427 90 0 90V15Z" />
63
+ <Path fill-rule="evenodd" fill={colorFg} clip-rule="evenodd" d="M16 0C7.16345 0 0 7.16344 0 16V91C8.2843 91 15 97.7157 15 106C15 114.284 8.2843 121 0 121V194C0 202.837 7.16345 210 16 210H185.924C187.623 210 189 208.623 189 206.924C189 205.281 187.68 203.974 186.124 203.446C181.981 202.04 179 198.118 179 193.5C179 190.516 180.245 187.823 182.244 185.911C182.407 185.755 182.572 185.597 182.739 185.439C185.671 182.647 189 179.478 189 175.5C189 171.522 185.671 168.353 182.739 165.561C182.572 165.403 182.407 165.245 182.244 165.089C180.245 163.177 179 160.484 179 157.5C179 154.156 180.563 151.178 182.998 149.255C185.858 146.996 189 144.145 189 140.5C189 136.855 185.858 134.004 182.998 131.745C180.563 129.822 179 126.844 179 123.5C179 120.516 180.245 117.823 182.244 115.911C182.407 115.755 182.572 115.597 182.739 115.439C185.671 112.647 189 109.478 189 105.5C189 101.522 185.671 98.3527 182.739 95.5614C182.572 95.4028 182.407 95.2454 182.244 95.0891C180.245 93.1775 179 90.4841 179 87.5C179 84.1564 180.563 81.1778 182.998 79.2549C185.858 76.9962 189 74.1446 189 70.5C189 66.8554 185.858 64.0038 182.998 61.7451C180.563 59.8222 179 56.8436 179 53.5C179 50.5159 180.245 47.8225 182.244 45.9109C182.407 45.7546 182.572 45.5972 182.739 45.4386C185.671 42.6473 189 39.4782 189 35.5C189 31.5218 185.671 28.3527 182.739 25.5614C182.572 25.4028 182.407 25.2454 182.244 25.0891C180.245 23.1775 179 20.4841 179 17.5C179 13.0541 181.763 9.25356 185.666 7.72205C187.45 7.02203 189 5.50424 189 3.58798C189 1.60639 187.394 0 185.412 0H16Z" />
64
+ </Svg>
65
+
66
+ <View style={applyStyle({ position: 'absolute', width: LibStyle.width - 50, height: z, padding: 10, justifyContent: 'space-evenly', alignContent: 'center', alignItems: 'center' })}>
67
+ {
68
+ item.price_id == "staff" &&
69
+ <View style={applyStyle({ position: 'absolute', top: 12, right: 10, padding: 5, paddingHorizontal: 10, borderBottomLeftRadius: 10, borderTopRightRadius: 10, backgroundColor: 'red', margin: -10, marginBottom: 5 })}>
70
+ <Text allowFontScaling={false} style={applyStyle({ fontWeight: 'bold', color: colorText, fontSize: 12, })}>{item.price_id}</Text>
71
+ </View>
72
+ }
73
+ <View style={applyStyle({ flexDirection: 'row' })} >
74
+ <View style={applyStyle({ width: '35%', alignItems: 'center', justifyContent: 'center' })} >
75
+ <Text allowFontScaling={false} style={applyStyle({ color: colorText, fontWeight: 'bold', fontSize: 60, marginRight: '5%', textAlign: 'center' })}>{item.qty_left}</Text>
76
+ <Text allowFontScaling={false} style={applyStyle({ color: colorText, fontWeight: 'normal', fontSize: 20, marginRight: '5%', textAlign: 'center' })}>
77
+ <Text style={{ fontSize: 16 }}>{esp.lang("event/tms_list_item", "total")}</Text>
78
+ {item.qty}</Text>
79
+
80
+ </View>
81
+ <View style={applyStyle({ flex: 1, justifyContent: 'center', marginRight: '10%' })} >
82
+ <Text allowFontScaling={false} style={applyStyle({ color: colorText, fontSize: 25, fontWeight: 'bold', textAlign: 'center' })} >{item.title}</Text>
83
+ </View>
84
+ </View>
85
+ </View>
86
+ </Pressable>
87
+ )
88
+ }
@@ -0,0 +1,435 @@
1
+ // withHooks
2
+ import { useEffect, useRef } from 'react';
3
+
4
+ import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
5
+ import { EventButton } from 'esoftplay/cache/event/button/import';
6
+ import { EventTms_in_log } from 'esoftplay/cache/event/tms_in_log/import';
7
+ import { EventTms_in_successProperty } from 'esoftplay/cache/event/tms_in_success/import';
8
+ import { EventTms_out_log } from 'esoftplay/cache/event/tms_out_log/import';
9
+ import { EventTms_out_successProperty } from 'esoftplay/cache/event/tms_out_success/import';
10
+ import { EventTms_in_hall_log } from 'esoftplay/cache/event/tms_in_hall_log/import';
11
+ import { EventTms_in_hall_successProperty } from 'esoftplay/cache/event/tms_in_hall_success/import';
12
+ import { EventTms_out_hall_log } from 'esoftplay/cache/event/tms_out_hall_log/import';
13
+ import { EventTms_out_hall_successProperty } from 'esoftplay/cache/event/tms_out_hall_success/import';
14
+ import { EventHeader } from 'esoftplay/cache/event/header/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 EventTms_logArgs {
39
+
40
+ }
41
+ export interface EventTms_logProps {
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: EventTms_logProps): 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 = EventTms_in_successProperty.syncUsedTiket().useSelector(s => s)
116
+ const isStuckEntrance = useDetectStateChange(backupEntrance, 10000)
117
+
118
+ const backupExit = EventTms_out_successProperty.syncTicketExit().useSelector(s => s)
119
+ const isStuckExit = useDetectStateChange(backupExit, 10000)
120
+
121
+ const backupHall = EventTms_in_hall_successProperty.syncHallIn().useSelector(s => s)
122
+ const isStuckHall = useDetectStateChange(backupHall, 10000)
123
+
124
+ const backupHall_out = EventTms_out_hall_successProperty.syncHallOut().useSelector(s => s)
125
+ const isStuckHall_out = useDetectStateChange(backupHall_out, 10000)
126
+
127
+ let data = EventTms_homeProperty.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 = EventTms_homeProperty.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/tms_log", "title"), esp.lang("event/tms_log", "msg"), esp.lang("event/tms_log", "ok"), () => {
157
+ LibProgress.show(esp.lang("event/tms_log", "wait"))
158
+ new LibCurl(url, post, (res, msg) => {
159
+ LibProgress.hide()
160
+ LibToastProperty.show(msg)
161
+ LibNavigation.back()
162
+
163
+ // reset counter
164
+ EventTms_homeProperty.counterState().reset()
165
+ EventTms_in_successProperty.syncUsedTiket().reset()
166
+ EventTms_out_successProperty.syncTicketExit().reset()
167
+ EventTms_in_hall_successProperty.syncHallIn().reset()
168
+ EventTms_out_hall_successProperty.syncHallOut().reset()
169
+
170
+ }, (err) => {
171
+ LibProgress.hide()
172
+ LibDialog.warning(esp.lang("event/tms_log", "oops"), err?.message)
173
+ })
174
+ }, esp.lang("event/tms_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
+ <EventHeader title={esp.lang("event/tms_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/tms_log", "report_gate_in")}</Text>
193
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} color='#fff' />
194
+ </View>
195
+ )
196
+ }}
197
+ show
198
+ >
199
+ <EventTms_in_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/tms_log", "report_gate_out")}</Text>
215
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} color='#fff' />
216
+ </View>
217
+ )
218
+ }}>
219
+ <EventTms_out_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/tms_log", "report_hall_in")}</Text>
236
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} />
237
+ </View>
238
+ )
239
+ }}>
240
+ <View>
241
+
242
+ </View>
243
+ <EventTms_in_hall_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/tms_log", "report_hall_out")}</Text>
259
+ <LibIcon name={show ? 'chevron-up' : 'chevron-down'} />
260
+ </View>
261
+ )
262
+ }}>
263
+ <EventTms_out_hall_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/tms_log", "alert")} />
277
+ <EventButton
278
+ style={{ marginTop: 10 }}
279
+ label={esp.lang("event/tms_log", "btn_title")}
280
+ backgroundColor='#000'
281
+ onPress={() => {
282
+ LibDialog.confirm(esp.lang("event/tms_log", "send_title"), esp.lang("event/tms_log", "send_msg"), esp.lang("event/tms_log", "send_ok"), () => {
283
+ if (backupEntrance.length > 0) {
284
+ counter = counter + 1
285
+ Storage.setItem('event/tms_in_log_copy_scanned', JSON.stringify(backupEntrance)).then(() => {
286
+ sendFileTelegram('event/tms_in_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/tms_out_log_copy_scanned', JSON.stringify(backupExit)).then(() => {
300
+ sendFileTelegram('event/tms_out_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/tms_log", "send_no"), () => { })
339
+ }} />
340
+ </View>
341
+ </UseCondition>
342
+ } >
343
+ <EventButton
344
+ style={{ margin: 10 }}
345
+ label={esp.lang("event/tms_log", "btn_close")} onPress={() => {
346
+ if (isEmptyObject(data)) {
347
+ LibToastProperty.show(esp.lang("event/tms_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/tms_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/tms_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: EventTms_in_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/tms_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,91 @@
1
+ // withHooks
2
+ import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
3
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
4
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
5
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
6
+
7
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
8
+ import { UserClass } from 'esoftplay/cache/user/class/import';
9
+ import esp from 'esoftplay/esp';
10
+ import React, { useEffect } from 'react';
11
+ import { View } from 'react-native';
12
+
13
+
14
+ export interface EventTms_outArgs {
15
+
16
+ }
17
+ export interface EventTms_outProps {
18
+
19
+ }
20
+ export default function m(props: EventTms_outProps): any {
21
+ const { scan_type, url_ticket_update, url_ticket_detail, price_type, gate_type, qr_code, event_id, email, selectGate, typeScanner, event_title, qty, configPriority }: any = LibNavigation.getArgsAll<any>(props)
22
+
23
+ let args = {
24
+ selectGate: selectGate,
25
+ fromPage: 'event/tms_home',
26
+ event_id: event_id,
27
+ event_title: event_title,
28
+ typeScanner: typeScanner,
29
+ gate_type: gate_type,
30
+ price_type: price_type,
31
+ url_ticket_detail: url_ticket_detail,
32
+ url_ticket_update: url_ticket_update,
33
+ configPriority: configPriority,
34
+ scan_type: scan_type
35
+ }
36
+
37
+ useEffect(() => {
38
+ loadData()
39
+ }, [])
40
+
41
+ function loadData() {
42
+ EventTms_homeProperty.addCounterOutScan(1, "0")
43
+
44
+ let post = {
45
+ event_id: event_id,
46
+ gate_id: selectGate?.id,
47
+ user_qr: encodeURIComponent(qr_code),
48
+ email: email ? email : "",
49
+ }
50
+
51
+ new LibCurl('event_tms_out', post, (res) => {
52
+ // setResult(res)
53
+ let modifyList = res.list.length > 0 && res.list.map((item: any, i: number) => {
54
+ return ({
55
+ ...item,
56
+ checked: i == 0 ? 1 : 0
57
+ })
58
+ })
59
+ let finalData = {
60
+ ...res,
61
+ list: modifyList
62
+ }
63
+
64
+ esp.log(res);
65
+
66
+ if (modifyList.length == 1) {
67
+ let a = modifyList?.filter((item: any) => item.checked == 1).map((it: any) => it.id)
68
+ let postOut = {
69
+ event_id: event_id,
70
+ ids: JSON.stringify(a),
71
+ gate_id: selectGate?.id,
72
+ trx_id: new Date().getTime() + "" + UserClass.state().get()?.id,
73
+ price_id: modifyList?.filter((item: any) => item.checked == 1).map((it: any) => it.price_id),
74
+ scanned_out: LibUtils.moment().format('YYYY-MM-DD HH:mm:ss'),
75
+ }
76
+ let urlOut = "event_tms_out_confirm"
77
+ LibNavigation.replace('event/tms_out_success', { data: finalData, ...args, url: urlOut, post: postOut })
78
+ } else {
79
+ LibNavigation.replace('event/tms_out_list', { data: finalData, ...args })
80
+ }
81
+ }, (error) => {
82
+ LibNavigation.replace('event/tms_out_failed', { msgError: error, ...args, postGetData: post })
83
+ }, 1)
84
+ }
85
+
86
+ return (
87
+ <View style={{ flex: 1, backgroundColor: '#fff', alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
88
+ <LibLoading />
89
+ </View>
90
+ )
91
+ }