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
@@ -0,0 +1,180 @@
1
+ // withHooks
2
+ import { ComponentButton } from 'esoftplay/cache/component/button/import';
3
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
4
+ import { ComponentSlidingup } from 'esoftplay/cache/component/slidingup/import';
5
+ import { EventCounter_eoProperty } from 'esoftplay/cache/event/counter_eo/import';
6
+ import { EventCounter_history_item } from 'esoftplay/cache/event/counter_history_item/import';
7
+ import { EventCounter_info } from 'esoftplay/cache/event/counter_info/import';
8
+ import { EventCounter_menu } from 'esoftplay/cache/event/counter_menu/import';
9
+ import { EventCounter_section } from 'esoftplay/cache/event/counter_section/import';
10
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
11
+ import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
12
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
13
+ import { LibInput_rectangle } from 'esoftplay/cache/lib/input_rectangle/import';
14
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
15
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
16
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
17
+ import { UserPopup } from 'esoftplay/cache/user/popup/import';
18
+ import esp from 'esoftplay/esp';
19
+ import useSafeState from 'esoftplay/state';
20
+
21
+ import React, { useEffect, useRef } from 'react';
22
+ import { Pressable, RefreshControl, ScrollView, Text, View } from 'react-native';
23
+
24
+
25
+ export interface EventCounter_cashierArgs {
26
+
27
+ }
28
+ export interface EventCounter_cashierProps {
29
+
30
+ }
31
+ export default function m(props: EventCounter_cashierProps): any {
32
+ const { is_seller } = LibNavigation.getArgsAll(props)
33
+ const dialogAdd = useRef<ComponentSlidingup>(null)
34
+ const dialogUser = useRef<ComponentSlidingup>(null)
35
+
36
+ const [email, setEmail] = useSafeState<string>('')
37
+
38
+ const [result, setResult] = useSafeState<any>()
39
+ const [refreshing, setRefreshing] = useSafeState<boolean>(false);
40
+
41
+ useEffect(() => {
42
+ loadData()
43
+ }, [])
44
+
45
+ function loadData() {
46
+ new LibCurl('event_seller_home?event_id=' + is_seller?.id, null, (res, msg) => {
47
+ setResult(res)
48
+ setRefreshing(false)
49
+ }, (error) => {
50
+ LibDialog.warning(esp.lang("event/counter_cashier", "load_failed"), error?.message)
51
+ LibNavigation.back()
52
+ setRefreshing(false)
53
+ }, 1)
54
+ }
55
+
56
+ function onRefresh() {
57
+ setRefreshing(true)
58
+ loadData()
59
+ }
60
+
61
+ function addLM() {
62
+ let post = {
63
+ event_id: is_seller?.id,
64
+ email: email.trim()
65
+ }
66
+
67
+ LibDialog.confirm(esp.lang("event/counter_cashier", "add_title"), esp.lang("event/counter_cashier", "add_msg"), esp.lang("event/counter_cashier", "add_confirm"), () => {
68
+ new LibCurl('event_seller_edit', post, (res, msg) => {
69
+ LibDialog.info(esp.lang("event/counter_cashier", "add_success"), msg)
70
+ loadData()
71
+ dialogUser.current?.hide()
72
+ }, (error) => {
73
+ LibDialog.warning(esp.lang("event/counter_cashier", "add_failed"), error?.message)
74
+ dialogUser.current?.hide()
75
+ }, 1)
76
+ }, esp.lang("event/counter_cashier", "add_cancel"), () => { })
77
+
78
+ }
79
+
80
+
81
+ if (!result) {
82
+ return (
83
+ <LibLoading />
84
+ )
85
+ }
86
+
87
+ function renderMoneyRequest(item: any, i: number) {
88
+ return (
89
+ <View style={styleId_ZEwY6z}>
90
+ <EventCounter_history_item item={item} is_ticket={false} onPress={() => LibNavigation.navigate('event/counter_request_detail', { url: item.url, status_user: 3 })} />
91
+ </View>
92
+ )
93
+ }
94
+
95
+ function renderTicketRequest(item: any, i: number) {
96
+ return (
97
+ <View style={styleId_ZEwY6z}>
98
+ <EventCounter_history_item item={item} is_ticket={true} onPress={() => LibNavigation.navigate('event/counter_request_detail', { url: item.url, status_user: 3 })} />
99
+ </View>
100
+ )
101
+ }
102
+
103
+
104
+ return (
105
+ <View style={{ flex: 1, backgroundColor: '#fff' }}>
106
+ <ComponentHeader title={esp.lang("event/counter_cashier", "header_title")} subtitle={is_seller?.name} bgColor={"#6A0740"} titleColor="#fff" notif />
107
+ {/* status_user 1 EO, 2 LM, 3 Seller */}
108
+ <EventCounter_menu colorTheme={"#6A0740"} event_id={is_seller?.id} status_user={3} />
109
+ <ScrollView style={{ marginTop: -20, backgroundColor: "#EEF1F8", borderTopLeftRadius: 15, borderTopRightRadius: 15 }} refreshControl={
110
+ <RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
111
+ }>
112
+ <Pressable onPress={() => LibNavigation.navigate('event/counter_cashier_report')} style={{ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', padding: 10, paddingHorizontal: 15, margin: 15, marginBottom: -10, borderRadius: 15, backgroundColor: '#fff', ...LibStyle.elevation(3) }}>
113
+ <Text allowFontScaling={false}>{esp.lang("event/counter_cashier", "sell_report")}</Text>
114
+ <LibIcon name='chevron-right' />
115
+ </Pressable>
116
+
117
+ {/* active balance */}
118
+ <EventCounter_info colorTheme={"#6A0740"} amount={result?.money} ticket={result?.ticket} event_id={is_seller?.id} status_user={3} />
119
+
120
+ {/* request */}
121
+ {
122
+ result?.money_request?.length > 0 &&
123
+ <EventCounter_section icon="chevron-right-circle" onPress={() => { LibNavigation.navigate('event/counter_request', { event_id: is_seller?.id, status_user: 3 }) }} title={esp.lang("event/counter_cashier", "money")} />
124
+ }
125
+ {
126
+ result?.money_request?.length > 0 && result?.money_request?.map(renderMoneyRequest)
127
+ }
128
+
129
+ {
130
+ result?.ticket_request?.length > 0 &&
131
+ <EventCounter_section icon="chevron-right-circle" onPress={() => { LibNavigation.navigate('event/counter_request', { event_id: is_seller?.id, status_user: 3 }) }} title={esp.lang("event/counter_cashier", "ticket")} />
132
+ }
133
+ {
134
+ result?.ticket_request?.length > 0 && result?.ticket_request?.map(renderTicketRequest)
135
+ }
136
+
137
+ </ScrollView>
138
+
139
+ <ComponentSlidingup ref={dialogAdd}>
140
+ <View style={{ backgroundColor: '#fff', borderTopLeftRadius: 20, borderTopRightRadius: 20 }}>
141
+ <View style={{ height: 4, width: 32, borderRadius: 2, backgroundColor: "#C6C6C6", marginTop: 10, marginBottom: 10, alignSelf: 'center' }} />
142
+ <View style={{ margin: 15 }}>
143
+ <LibInput_rectangle
144
+ autoCapitalize="none"
145
+ onChangeText={setEmail}
146
+ style={{ borderColor: '#c4c4c4', height: 35, marginTop: 8, borderRadius: 15, }}
147
+ placeholder={esp.lang("event/counter_cashier", "email")}
148
+ keyboardType="email-address"
149
+ onSubmitEditing={() => {
150
+ if (EventCounter_eoProperty.checkEmail(email.trim())) {
151
+ dialogAdd.current?.hide()
152
+ dialogUser.current?.show()
153
+ }
154
+ }}
155
+ />
156
+ <ComponentButton label={esp.lang("event/counter_cashier", "next")} style={{ borderRadius: 15, marginTop: 20 }} backgroundColor={email == "" ? LibStyle.colorGrey : "#6A0740"} onPress={() => {
157
+ if (EventCounter_eoProperty.checkEmail(email.trim())) {
158
+ dialogAdd.current?.hide()
159
+ dialogUser.current?.show()
160
+ }
161
+ }} />
162
+ </View>
163
+ </View>
164
+ </ComponentSlidingup>
165
+
166
+ <ComponentSlidingup ref={dialogUser}>
167
+ <View style={{ backgroundColor: '#fff', borderTopLeftRadius: 20, borderTopRightRadius: 20 }}>
168
+ <View style={{ height: 4, width: 32, borderRadius: 2, backgroundColor: "#C6C6C6", marginTop: 10, marginBottom: 10, alignSelf: 'center' }} />
169
+ <UserPopup email={email.trim()} redirect={() => {
170
+ addLM()
171
+ }} cancel={() => {
172
+ dialogUser.current?.hide()
173
+ }} />
174
+ </View>
175
+ </ComponentSlidingup>
176
+
177
+ </View >
178
+ )
179
+ }
180
+ const styleId_ZEwY6z: any = { margin: 15, marginTop: 0, borderRadius: 15, backgroundColor: '#fff', overflow: 'hidden' }
@@ -0,0 +1,114 @@
1
+ // withHooks
2
+
3
+ import { applyStyle } from 'esoftplay';
4
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
5
+ import { ComponentSlidingup } from 'esoftplay/cache/component/slidingup/import';
6
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
7
+ import { LibInfinite } from 'esoftplay/cache/lib/infinite/import';
8
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
9
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
10
+ import { UserClass } from 'esoftplay/cache/user/class/import';
11
+ import esp from 'esoftplay/esp';
12
+ import useSafeState from 'esoftplay/state';
13
+ import React, { useRef } from 'react';
14
+ import { Pressable, Text, View } from 'react-native';
15
+ import { ScrollView } from 'react-native-gesture-handler';
16
+
17
+
18
+ export interface EventCounter_cashier_reportArgs {
19
+
20
+ }
21
+ export interface EventCounter_cashier_reportProps {
22
+
23
+ }
24
+
25
+ export default function m(props: EventCounter_cashier_reportProps): any {
26
+ const is_seller = UserClass?.state?.()?.get()?.is_seller?.[0]
27
+ let dialogOtherTicket = useRef<ComponentSlidingup>(null)
28
+
29
+ const [codes, setCodes] = useSafeState<any>()
30
+ const [totalTrx, setTotalTrx] = useSafeState<any>()
31
+
32
+ function renderItem(item: any, i: number) {
33
+ return (
34
+ <Pressable onPress={() => { }} style={applyStyle({ padding: 10, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', borderBottomColor: "#EEF1F8", borderBottomWidth: 1 })}>
35
+ <View style={applyStyle({ flex: 3 })}>
36
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
37
+ <Text allowFontScaling={false} style={applyStyle({ flex: 1, fontSize: 16, color: LibStyle.colorBlue })}>#{item?.booking_code}</Text>
38
+ {
39
+ item?.hasOwnProperty("price_name") && item?.price_name != "" &&
40
+ <Text allowFontScaling={false} style={{ flex: 1, textAlign: 'right', fontSize: 13 }}>{item?.price_name} {item?.ondate != "0000-00-00" && "- " + LibUtils.moment(item?.ondate).localeFormat("D MMM YYYY")}</Text>
41
+ }
42
+
43
+ </View>
44
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
45
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 12, lineHeight: 18 })}>Code : {item?.code[0]} {item?.code?.length > 1 ? ", " : ""}</Text>
46
+ {
47
+ item?.code?.length > 1 &&
48
+ <Pressable onPress={() => {
49
+ setCodes(item?.code)
50
+ LibUtils.debounce(() => {
51
+ dialogOtherTicket?.current?.show()
52
+ }, 100)
53
+ }}>
54
+ <Text allowFontScaling={false} style={{ fontSize: 12, fontWeight: "normal", textDecorationLine: 'underline', fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorBlue }}>{esp.lang("event/counter_cashier_report", "other", Number(item?.code?.length - 1).toString())}</Text>
55
+ </Pressable>
56
+ }
57
+ </View>
58
+
59
+ <View style={{ marginTop: 5, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
60
+ <Text allowFontScaling={false} style={{ flex: 1, }}>{item.qty} Tiket</Text>
61
+ <Text allowFontScaling={false} style={{ flex: 1, textAlign: 'right', }}>{LibUtils?.money(item?.total)}</Text>
62
+ </View>
63
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
64
+ <LibIcon name='cash' color='green' size={30} />
65
+ <Text allowFontScaling={false} style={{ marginLeft: 8 }}>{item?.payment_title}</Text>
66
+ </View>
67
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, color: "#797979" })}>{LibUtils.moment(item?.created).serverFormat("DD MMMM YYYY hh:mm:ss")}</Text>
68
+
69
+ </View>
70
+ </Pressable>
71
+ )
72
+ }
73
+
74
+ return (
75
+ <View style={{ flex: 1, backgroundColor: '#fff' }}>
76
+ <ComponentHeader title={esp.lang("event/counter_cashier_report", "header_title")} subtitle={is_seller?.name} bgColor={"#6A0740"} titleColor="#fff" notif />
77
+
78
+ <LibInfinite
79
+ url={'event_seller_ticket_sell_history?event_id=' + is_seller?.id}
80
+ // isDebug={1}
81
+ ListHeaderComponent={
82
+ <View style={{ padding: 7, marginBottom: 10, borderBottomWidth: 1, borderBottomColor: LibStyle.colorPrimary, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
83
+ <Text allowFontScaling={false} style={{ fontSize: 18 }}>{esp.lang("event/counter_cashier_report", "total_trx")}</Text>
84
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
85
+ <View style={{ backgroundColor: LibStyle.colorRed, height: 17, padding: 5, paddingVertical: 2, borderRadius: 10, alignContent: 'center', alignItems: 'center' }}>
86
+ <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 12, letterSpacing: 0, color: "#ffffff" }}>{totalTrx > 99 ? "99+" : String(totalTrx)}</Text>
87
+ </View>
88
+ </View>
89
+ </View>
90
+ }
91
+ onResult={(res) => {
92
+ setTotalTrx(res?.total)
93
+ }}
94
+ renderItem={renderItem}
95
+ />
96
+ <ComponentSlidingup ref={dialogOtherTicket}>
97
+ <View style={{ backgroundColor: 'white', maxHeight: LibStyle.height - (LibStyle.height / 3), borderTopRightRadius: 20, borderTopLeftRadius: 20, padding: 20 }}>
98
+ <ScrollView>
99
+ <Text allowFontScaling={false} style={{ marginBottom: 23, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "center", color: "#34495e" }}>{esp.lang("event/counter_cashier_report", "list_code")}</Text>
100
+ {
101
+ codes?.map((item: any, i: number) => {
102
+ return (
103
+ <View key={i} style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', backgroundColor: LibStyle.colorBgGrey, padding: 10, marginBottom: 10, borderRadius: 5, flex: 1 }}>
104
+ <Text allowFontScaling={false} style={{ fontSize: 17, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, textAlign: "center", color: '#000', paddingLeft: 3, paddingRight: 3 }}>{item}</Text>
105
+ </View>
106
+ )
107
+ })
108
+ }
109
+ </ScrollView>
110
+ </View>
111
+ </ComponentSlidingup>
112
+ </View>
113
+ )
114
+ }
@@ -0,0 +1,135 @@
1
+ // withHooks
2
+
3
+ import { applyStyle } from 'esoftplay';
4
+ import { BigbangTransaction } from 'esoftplay/cache/bigbang/transaction/import';
5
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
6
+ import { ComponentQr_bg } from 'esoftplay/cache/component/qr_bg/import';
7
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
8
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
9
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
10
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
11
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
12
+ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
13
+ import { LibWorkloop } from 'esoftplay/cache/lib/workloop/import';
14
+ import { UserClass } from 'esoftplay/cache/user/class/import';
15
+ import esp from 'esoftplay/esp';
16
+ import useGlobalState from 'esoftplay/global';
17
+ import useSafeState from 'esoftplay/state';
18
+ import LottieView from "lottie-react-native";
19
+ import React, { useEffect, useRef } from 'react';
20
+ import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
21
+ import QRCode from 'react-native-qrcode-svg';
22
+
23
+ export interface EventCounter_cashier_sellArgs {
24
+
25
+ }
26
+ export interface EventCounter_cashier_sellProps {
27
+
28
+ }
29
+
30
+ const state = useGlobalState<any>({}, { persistKey: 'event_counter_cashier_sell_scan' })
31
+
32
+ export function syncToServer(trx_id?: string, qrTicket?: string, cb?: (state: number) => void) {
33
+ if (qrTicket && trx_id) {
34
+ state.set(LibObject.set(state.get(), trx_id)(qrTicket))
35
+ }
36
+ const event_id = UserClass?.state?.()?.get()?.is_seller?.[0]?.id
37
+ if (event_id) {
38
+ Object.keys(state.get() || {}).forEach((key, index) => {
39
+ if (state.get()[key]) {
40
+ const trx_id = state.get()[key]
41
+ const post = {
42
+ event_id,
43
+ trx_id: trx_id,
44
+ qrs: key
45
+ }
46
+ new LibCurl('event_seller_ticket_sell', post, (res, msg) => {
47
+ if (res.length > 0) {
48
+ let dt = state.get();
49
+ res.forEach(({ qr, status }: any) => {
50
+ if (qr == qrTicket && cb) {
51
+ cb(status)
52
+ }
53
+ if (status != 0)
54
+ delete dt[qr]
55
+ })
56
+ state.set(dt || {})
57
+ if (Object.keys(state.get() || {}).length > 0)
58
+ LibWorkloop.execNextTix(syncToServer)
59
+ }
60
+ }, (err) => {
61
+ if (Object.keys(state.get() || {}).length > 0)
62
+ LibWorkloop.execNextTix(syncToServer)
63
+ }, 1)
64
+ }
65
+ })
66
+ }
67
+ }
68
+
69
+
70
+ const statusText = (status: number | string): any => {
71
+ const statusTex: any = {
72
+ "0": esp.lang("event/counter_cashier_sell", "status_0"),
73
+ "1": esp.lang("event/counter_cashier_sell", "status_1"),
74
+ "2": esp.lang("event/counter_cashier_sell", "status_2")
75
+ }
76
+ return statusTex[status] || "Loading..."
77
+ }
78
+
79
+
80
+ export default function m(props: EventCounter_cashier_sellProps): any {
81
+
82
+ const { qr } = LibNavigation.getArgsAll<any>(props);
83
+ const [trxId] = useSafeState(BigbangTransaction().getTrxId())
84
+ const is_seller = UserClass?.state?.()?.get()?.is_seller?.[0]
85
+ const [status, setStatus] = useSafeState(-1)
86
+
87
+ const animation = useRef<LottieView>(null)
88
+
89
+ useEffect(() => {
90
+ if (status > -1) {
91
+ animation.current?.play()
92
+ } else {
93
+ syncToServer(trxId, qr, setStatus)
94
+ }
95
+ }, [status])
96
+
97
+ return (
98
+ <View style={{ backgroundColor: 'white', flex: 1 }} >
99
+ <ComponentHeader title={esp.lang("event/counter_cashier_sell", "header")} subtitle={is_seller?.name} bgColor={"#6A0740"} titleColor="#fff" notif />
100
+ <ScrollView>
101
+ <View style={{ alignItems: 'center', paddingTop: 50, flex: 1 }} >
102
+ <LottieView
103
+ ref={animation}
104
+ loop={false}
105
+ style={{ width: 200, height: 200, }}
106
+ source={esp.assets(status == 1 ? 'success.json' : status == 2 ? 'reject.json' : 'pending.json')} />
107
+ <LibTextstyle style={{ textAlign: 'center', margin: 16 }} textStyle='m_button' text={statusText(status)} />
108
+ <ComponentQr_bg>
109
+ <QRCode ecl="H"
110
+ size={200}
111
+ value={qr}
112
+ />
113
+ </ComponentQr_bg>
114
+ <LibTextstyle textStyle='title2' text={qr} style={{ marginTop: 10, marginBottom: 20, fontWeight: 'bold' }} />
115
+ </View>
116
+ </ScrollView>
117
+ <View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginBottom: 20 }} >
118
+ <TouchableOpacity onPress={() => { LibNavigation.back() }} style={applyStyle({ width: (LibStyle.width - 40) * 0.5, borderWidth: 2, borderColor: LibStyle.colorRed, height: 40, borderRadius: 16, backgroundColor: LibStyle.colorRed, flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
119
+ <LibIcon size={18} color={'white'} name="close" style={applyStyle({ fontWeight: 'bold', transform: [{ rotate: '180deg' }] })} />
120
+ <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: 'white', marginLeft: 10 })} >{esp.lang("event/counter_cashier_sell", "done")}</Text>
121
+ </TouchableOpacity>
122
+ <TouchableOpacity onPress={() => {
123
+ LibNavigation.replace('component/scanner', {
124
+ event_id: is_seller?.id,
125
+ fromPage: 'event/counter_eo',
126
+ status_user: 3
127
+ })
128
+ }} style={applyStyle({ width: (LibStyle.width - 40) * 0.5, borderWidth: 2, borderColor: LibStyle.colorGreen, height: 40, borderRadius: 16, backgroundColor: LibStyle.colorGreen, flexDirection: 'row-reverse', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
129
+ <LibIcon size={18} color={'white'} name="qrcode" style={applyStyle({ fontWeight: 'bold', transform: [{ rotate: '180deg' }] })} />
130
+ <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: 'white', marginRight: 10 })} >{esp.lang("event/counter_cashier_sell", "scan_again")}</Text>
131
+ </TouchableOpacity>
132
+ </View>
133
+ </View>
134
+ )
135
+ }