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,238 @@
1
+ // withHooks
2
+ import { ComponentButton } from 'esoftplay/cache/component/button/import';
3
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
4
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
5
+ import { ComponentSlidingup } from 'esoftplay/cache/component/slidingup/import';
6
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
7
+ import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
8
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
9
+ import { LibInput_rectangle2 } from 'esoftplay/cache/lib/input_rectangle2/import';
10
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
11
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
12
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
13
+ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
14
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
15
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
16
+ import esp from 'esoftplay/esp';
17
+ import useSafeState from 'esoftplay/state';
18
+
19
+ import React, { useEffect, useRef } from 'react';
20
+ import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
21
+
22
+
23
+ export interface EventCounter_report_detailArgs {
24
+
25
+ }
26
+ export interface EventCounter_report_detailProps {
27
+
28
+ }
29
+
30
+ export interface ReportDetailRenderDetail extends EventCounter_report_detailProps {
31
+ data: any
32
+ type: number
33
+ date_end?: string
34
+ date_start?: string
35
+ onPressIncome: () => void
36
+ onPressExpenditure: () => void
37
+
38
+ }
39
+
40
+ export function showValueExtention(type: number, value: any) {
41
+ if (type == 1) {
42
+ return LibUtils.number(value)
43
+ } else {
44
+ return LibUtils.money(value)
45
+ }
46
+ }
47
+
48
+ function RenderDetail(props: ReportDetailRenderDetail) {
49
+ const { data, type, date_end, date_start } = props
50
+ let dateRange = LibUtils.moment(date_start).localeFormat("DD-MM-YYYY") == LibUtils.moment(date_end).localeFormat("DD-MM-YYYY") ? esp.lang("event/counter_report_detail", "today") : esp.lang("event/counter_report_detail", "date_start", LibUtils.moment(date_start).localeFormat("DD MMMM YYYY"))
51
+ return (
52
+ <View style={{ padding: 10, backgroundColor: LibStyle.colorBgGrey, borderRadius: 10, borderTopLeftRadius: 0, borderTopRightRadius: 0 }}>
53
+
54
+ <View style={{ backgroundColor: "#fff", marginBottom: 10, borderRadius: 10, padding: 10, flex: 1, justifyContent: 'space-between' }}>
55
+ <Text allowFontScaling={false} style={{ textAlign: 'left', flexWrap: 'wrap', fontSize: 12 }}>{esp.lang("event/counter_report_detail", "sell", dateRange)}</Text>
56
+ <Text allowFontScaling={false} style={{ textAlign: 'left', marginTop: 10, fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 18, color: LibStyle.colorGreen }}>{showValueExtention(type, type == 1 ? data?.credit?.transaction?.total : data?.debit?.transaction?.total)}</Text>
57
+ </View>
58
+
59
+ <View style={{ backgroundColor: "#fff", borderRadius: 10, padding: 10, marginBottom: 10 }}>
60
+ <Text allowFontScaling={false} style={{ textAlign: 'center', flexWrap: 'wrap', fontSize: 12 }}>{esp.lang("event/counter_report_detail", "total_withdraw")}</Text>
61
+ <Text allowFontScaling={false} style={{ textAlign: 'center', marginTop: 10, fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 24, color: LibStyle.colorBrown }}>{showValueExtention(type, data?.total_withdrawal)}</Text>
62
+ </View>
63
+
64
+ <View style={{ flexDirection: 'row' }}>
65
+ <View style={{ flex: 1, marginRight: 5, backgroundColor: "#fff", borderRadius: 10, padding: 10 }}>
66
+ <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginBottom: 10 }}>
67
+ <Text allowFontScaling={false} style={{ flex: 1, color: LibStyle.colorGreen, fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 14 }}>{type == 2 ? esp.lang("event/counter_report_detail", "income") : esp.lang("event/counter_report_detail", "ticket_add")}</Text>
68
+ <TouchableOpacity onPress={props.onPressIncome} style={{ marginLeft: 10 }} >
69
+ <LibIcon name='arrow-right-circle' color={LibStyle.colorBlue} size={18} />
70
+ </TouchableOpacity>
71
+ </View>
72
+
73
+ <Text allowFontScaling={false} style={{ fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 16, color: "#000" }}>{showValueExtention(type, data?.debit?.total)}</Text>
74
+
75
+ </View>
76
+
77
+ <View style={{ flex: 1, marginLeft: 5, backgroundColor: "#fff", borderRadius: 10, padding: 10 }}>
78
+ <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginBottom: 10 }}>
79
+ <Text allowFontScaling={false} style={{ flex: 1, color: LibStyle.colorRed, fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 14 }}>{type == 2 ? esp.lang("event/counter_report_detail", "outcome") : esp.lang("event/counter_report_detail", "ticket_min")}</Text>
80
+ <TouchableOpacity onPress={props.onPressExpenditure} style={{ marginLeft: 10 }}>
81
+ <LibIcon name='arrow-right-circle' color={LibStyle.colorBlue} size={18} />
82
+ </TouchableOpacity>
83
+ </View>
84
+ <Text allowFontScaling={false} style={{ fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 16, color: "#000" }}>{showValueExtention(type, data?.credit?.total)}</Text>
85
+ </View>
86
+ </View>
87
+
88
+ </View>
89
+ )
90
+ }
91
+
92
+ export default function m(props: EventCounter_report_detailProps): any {
93
+ const { url } = LibNavigation.getArgsAll(props)
94
+ const [result, setResult] = useSafeState<any>()
95
+ const [error, setError] = useSafeState<any>()
96
+ const dialogNotes = useRef<ComponentSlidingup>(null)
97
+ const inputNotes = useRef<LibInput_rectangle2>(null)
98
+
99
+ useEffect(() => {
100
+ loadData()
101
+ }, [])
102
+
103
+ function loadData() {
104
+ new LibCurl(url, null, (res, msg) => {
105
+ setResult(res)
106
+ }, (error) => {
107
+ setError(error)
108
+ }, 1)
109
+ }
110
+
111
+ function confirmReport(url: string, event_id: any, user_id: any) {
112
+ LibDialog.confirm(esp.lang("event/counter_report_detail", "report_title"), esp.lang("event/counter_report_detail", "report_msg"), esp.lang("event/counter_report_detail", "report_confirm"), () => {
113
+ LibProgress.show(esp.lang("event/counter_report_detail", "report_wait"))
114
+ let post = {
115
+ event_id: event_id,
116
+ user_id: user_id,
117
+ notes: inputNotes.current?.getText()
118
+ }
119
+ new LibCurl(url, post, (res, msg) => {
120
+ LibProgress.hide()
121
+ LibNavigation.back()
122
+ }, (error) => {
123
+ LibDialog.warning(esp.lang("event/counter_report_detail", "report_failed"), error?.message)
124
+ LibProgress.hide()
125
+ }, 1)
126
+ }, esp.lang("event/counter_report_detail", "report_cancel"), () => {
127
+
128
+ })
129
+ }
130
+
131
+ if (!result) {
132
+ return <LibLoading />
133
+ }
134
+
135
+ if (error) {
136
+ return (
137
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
138
+ <ComponentHeader title={esp.lang("event/counter_report_detail", "header_error")} />
139
+ <ComponentMessage message={error?.message} />
140
+ </View>
141
+ )
142
+ }
143
+
144
+ return (
145
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
146
+ <ComponentHeader title={esp.lang("event/counter_report_detail", "header_title")} subtitle={esp.lang("event/counter_report_detail", "header_subtitle", result?.user?.name)} />
147
+ <ScrollView>
148
+ <View style={{ backgroundColor: '#fff', padding: 10, margin: 15, borderRadius: 10, ...LibStyle.elevation(2) }}>
149
+ <View style={{ flexDirection: 'row', marginBottom: 10, justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' }}>
150
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
151
+ <View style={{ height: 50, width: 50, borderRadius: 10, backgroundColor: '#fff', ...LibStyle.elevation(10) }}>
152
+ <LibPicture source={{ uri: result?.user?.image }} style={{ height: 50, width: 50, borderRadius: 10 }} />
153
+ </View>
154
+ <View style={{ marginLeft: 10, marginRight: 15, }}>
155
+ <Text allowFontScaling={false} style={{ fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 16, flexWrap: 'wrap' }}>{result?.user?.name}</Text>
156
+ <Text allowFontScaling={false} style={{ fontFamily: 'SFProText', fontWeight: 'normal', color: '#CECED3', fontSize: 12, flexWrap: 'wrap' }}>{result?.user?.email}</Text>
157
+ </View>
158
+ </View>
159
+ </View>
160
+
161
+ <View style={{ flexDirection: 'row', borderRadius: 5, borderBottomLeftRadius: 0, borderBottomRightRadius: 0, padding: 10, paddingBottom: 5, overflow: 'hidden', backgroundColor: LibStyle.colorBgGrey }}>
162
+ <Text allowFontScaling={false} style={{ alignSelf: 'center', textAlign: 'center', fontFamily: "Arial", fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#000" }}>{esp.lang("event/counter_report_detail", "money")}</Text>
163
+ </View>
164
+
165
+ <RenderDetail
166
+ data={result?.money}
167
+ date_end={result?.date_end}
168
+ date_start={result?.date_start}
169
+ type={2}
170
+ onPressExpenditure={() => {
171
+ LibNavigation.navigate('event/counter_report_breakdown', { data: result?.money?.credit, type: 2 })
172
+ }}
173
+ onPressIncome={() => {
174
+ LibNavigation.navigate('event/counter_report_breakdown', { data: result?.money?.debit, type: 2 })
175
+ }}
176
+ />
177
+
178
+ {
179
+ result?.tickets?.length > 0 && result?.tickets?.map((item: any, i: number) => {
180
+ return (
181
+ <>
182
+ <View style={{ marginTop: 15, flexDirection: 'row', borderRadius: 5, borderBottomLeftRadius: 0, borderBottomRightRadius: 0, padding: 10, paddingBottom: 5, overflow: 'hidden', backgroundColor: LibStyle.colorBgGrey }}>
183
+ <Text allowFontScaling={false} style={{ alignSelf: 'center', textAlign: 'center', fontFamily: "Arial", fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#000" }}>{item.title}</Text>
184
+ </View>
185
+ <RenderDetail
186
+ data={item}
187
+ date_end={result?.date_end}
188
+ date_start={result?.date_start}
189
+ type={1}
190
+ onPressExpenditure={() => {
191
+ LibNavigation.navigate('event/counter_report_breakdown', { data: item?.credit, type: 1 })
192
+ }}
193
+ onPressIncome={() => {
194
+ LibNavigation.navigate('event/counter_report_breakdown', { data: item?.debit, type: 1 })
195
+ }}
196
+ />
197
+ </>
198
+ )
199
+ })
200
+ }
201
+
202
+ </View>
203
+
204
+ </ScrollView>
205
+ <View style={{ padding: 10 }}>
206
+ <ComponentButton label={esp.lang("event/counter_report_detail", "send_daily_report")} onPress={() => {
207
+ // confirmReport(result?.url_confirm, result?.event_id, result?.user_id)
208
+ dialogNotes.current?.show()
209
+ }} backgroundColor={LibStyle.colorPrimary} fontColor='#000' />
210
+ </View>
211
+
212
+ {/* dialog notes */}
213
+ <ComponentSlidingup ref={dialogNotes}>
214
+ <View style={{ backgroundColor: '#f6f6f6', borderTopRightRadius: 20, borderTopLeftRadius: 20, paddingHorizontal: 19, }}>
215
+ <Text allowFontScaling={false} style={{ marginTop: 26, marginBottom: 23, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, textAlign: "center", color: "#34495e" }}>{esp.lang("event/counter_report_detail", "notes")}</Text>
216
+
217
+ <LibInput_rectangle2
218
+ ref={inputNotes}
219
+ keyboardType="default"
220
+ returnKeyType="go"
221
+ placeholder={esp.lang("cashier/invoice", "label_note")}
222
+ maxLength={150}
223
+ onSubmitEditing={() => {
224
+ // inputNotes.current?.blur()
225
+ // dialogUser.current?.show()
226
+ }}
227
+ inputStyle={{ marginTop: 10, height: 70, textAlignVertical: 'top' }} style={{ height: 70, textAlignVertical: 'top', borderRadius: 4 }} multiline />
228
+
229
+ <ComponentButton label={esp.lang("event/counter_report_detail", "send")} onPress={() => {
230
+ confirmReport(result?.url_confirm, result?.event_id, result?.user_id)
231
+ }} backgroundColor={LibStyle.colorPrimary} fontColor='#000' style={{ marginTop: 25, marginBottom: 20 }} />
232
+
233
+ </View>
234
+ </ComponentSlidingup>
235
+
236
+ </View>
237
+ )
238
+ }
@@ -0,0 +1,56 @@
1
+ // withHooks
2
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
3
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
4
+ import { LibInfinite } from 'esoftplay/cache/lib/infinite/import';
5
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
6
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
7
+ import esp from 'esoftplay/esp';
8
+
9
+ import React from 'react';
10
+ import { Text, View } from 'react-native';
11
+
12
+
13
+ export interface EventCounter_report_detail_listArgs {
14
+
15
+ }
16
+ export interface EventCounter_report_detail_listProps {
17
+
18
+ }
19
+ export default function m(props: EventCounter_report_detail_listProps): any {
20
+ const { url } = LibNavigation.getArgsAll(props)
21
+
22
+ return (
23
+ <View style={{ flex: 1, backgroundColor: '#fff' }}>
24
+ <ComponentHeader title={esp.lang("event/counter_report_detail_list", "header_title")} />
25
+ <LibInfinite
26
+ url={url}
27
+
28
+ errorView={(error: any) => {
29
+ return (
30
+ <ComponentMessage message={error} />
31
+ )
32
+ }}
33
+ renderItem={(item) => {
34
+ return (
35
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 10, borderBottomWidth: 0.3, borderBottomColor: '#717171' }}>
36
+ <View style={{ flex: 3 }}>
37
+ <Text allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 12, color: "#000" }}>{item.title}</Text>
38
+ <Text allowFontScaling={false} style={{ marginTop: 4, fontFamily: 'SFProText', fontSize: 10 }}>{LibUtils.moment(item.created).serverFormat("DD MMM YYYY HH:mm")}</Text>
39
+ </View>
40
+ <View style={{ flex: 1, marginLeft: 10, }}>
41
+ <Text allowFontScaling={false} style={{ textAlign: 'right', fontFamily: 'SFProText', fontWeight: 'bold', fontSize: 12, color: "#000" }}>{LibUtils.money(item.hasOwnProperty('amount') ? item.amount : item.price)}</Text>
42
+ {
43
+ item.hasOwnProperty('qty') &&
44
+ <>
45
+ <Text allowFontScaling={false} style={{ textAlign: 'right', fontFamily: 'SFProText', fontSize: 10 }}>{esp.lang("event/counter_report_detail_list", "qty", LibUtils.number(item.qty))}</Text>
46
+ <Text allowFontScaling={false} style={{ textAlign: 'right', marginTop: 4, fontFamily: 'SFProText', fontSize: 14 }}>{LibUtils.money(item.total)}</Text>
47
+ </>
48
+ }
49
+ </View>
50
+ </View>
51
+ )
52
+ }}
53
+ />
54
+ </View>
55
+ )
56
+ }
@@ -0,0 +1,136 @@
1
+ // withHooks
2
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
3
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
4
+ import { EventCounter_history_item } from 'esoftplay/cache/event/counter_history_item/import';
5
+ import { EventCounter_status } from 'esoftplay/cache/event/counter_status/import';
6
+ import { EventCounter_type } from 'esoftplay/cache/event/counter_type/import';
7
+ import { LibInfinite } from 'esoftplay/cache/lib/infinite/import';
8
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
9
+ import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
10
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
11
+ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
12
+ import esp from 'esoftplay/esp';
13
+ import useSafeState from 'esoftplay/state';
14
+ import useGlobalSubscriber, { UseSubscribeReturn } from 'esoftplay/subscribe';
15
+ import { useTimeout } from 'esoftplay/timeout';
16
+
17
+ import React, { useEffect, useRef } from 'react';
18
+ import { Pressable, Text, TouchableOpacity, View } from 'react-native';
19
+
20
+
21
+ export interface EventCounter_requestArgs {
22
+
23
+ }
24
+ export interface EventCounter_requestProps {
25
+
26
+ }
27
+
28
+ function Status(props: any) {
29
+ const tabRef = useRef<LibScroll>(null)
30
+ const allStatus = EventCounter_status()
31
+ const timeout = useTimeout()
32
+
33
+ useEffect(() => {
34
+ if (props.status != 1)
35
+ timeout(() => {
36
+ tabRef?.current?.scrollToIndex?.(allStatus.map((s) => s.code).indexOf(props.status) - 1)
37
+ }, 500);
38
+ }, [])
39
+
40
+ function renderStatus(status: any, index: number) {
41
+ return (
42
+ <TouchableOpacity
43
+ key={index}
44
+ onPress={() => props.onChangeStatus(status.code)}
45
+ style={{ height: 32, marginVertical: 10, marginRight: 10, borderRadius: 20, backgroundColor: props.status == status.code ? props.colorTheme : 'transparent', borderColor: props.status == status.code ? 'transparent' : '#ccc', borderWidth: 1, paddingHorizontal: 17, justifyContent: 'center' }} >
46
+ <LibTextstyle textStyle='footnote' text={status.text} style={{ color: props.status == status.code ? "white" : "#4E4E4E" }} />
47
+ </TouchableOpacity>
48
+ )
49
+ }
50
+
51
+ return (
52
+ <View style={{ minHeight: 50 }} >
53
+ <LibScroll
54
+ ref={tabRef}
55
+ initialNumToRender={20}
56
+ horizontal>
57
+ <View style={{ width: 10 }} />
58
+ {
59
+ allStatus.map(renderStatus)
60
+ }
61
+ </LibScroll>
62
+ {/* <MarketSection_menu size='line' /> */}
63
+ </View>
64
+ )
65
+ }
66
+
67
+ const subs = useGlobalSubscriber()
68
+ export function subscribe(): UseSubscribeReturn {
69
+ return subs
70
+ }
71
+ export default function m(props: EventCounter_requestProps): any {
72
+ const { event_id, status_user } = LibNavigation.getArgsAll(props)
73
+ const active_tab = LibNavigation.getArgs(props, 'active_tab', 1)
74
+ const [activeTab, setActiveTab] = useSafeState<any>(active_tab)
75
+ const type = EventCounter_type()
76
+ const ref = useRef<LibInfinite>(null)
77
+
78
+ const statusCode = LibNavigation.getArgs(props, 'status', 1)
79
+ const [status, setStatus] = useSafeState(statusCode)
80
+
81
+ let a = status_user == 1 ? 'event_eo_ticket_request?event_id=' + event_id + '&status=' + status : status_user == 2 ? 'event_manager_ticket_request?event_id=' + event_id + '&status=' + status : 'event_seller_ticket_request?event_id=' + event_id + '&status=' + status
82
+
83
+ let b = status_user == 1 ? 'event_eo_money_request?event_id=' + event_id + '&status=' + status : status_user == 2 ? 'event_manager_money_request?event_id=' + event_id + '&status=' + status : 'event_seller_money_request?event_id=' + event_id + '&status=' + status
84
+
85
+ let url = activeTab == 1 ? a : b
86
+ let colorTheme = status_user == 1 ? "#009AE4" : status_user == 2 ? "#00AA43" : "#6A0740"
87
+
88
+ function renderType(item: any, i: number) {
89
+ return (
90
+ <Pressable key={i} onPress={() => {
91
+ setActiveTab(item.id)
92
+ }} style={{ ...LibStyle.elevation(item.id == activeTab ? 3 : 0), flex: 1, padding: 7, backgroundColor: item.id == activeTab ? "#fff" : "#EEF1F8", borderRadius: 10 }}>
93
+ <Text allowFontScaling={false} style={{ alignSelf: 'center', textAlign: 'center', fontFamily: "Arial", fontWeight: item.id == activeTab ? "bold" : "normal", fontStyle: "normal", letterSpacing: 0, color: item.id == activeTab ? "#000" : "#aab0b7" }}>{item.title}</Text>
94
+ </Pressable>
95
+ )
96
+ }
97
+
98
+ function renderItem(item: any, i: number) {
99
+ return (
100
+ <EventCounter_history_item key={i} item={item} onPress={() => LibNavigation.navigate('event/counter_request_detail', { url: item.url, status_user: status_user })} is_ticket={activeTab == 1 ? true : false} />
101
+ )
102
+ }
103
+
104
+ subs.useSubscribe(() => {
105
+ ref.current?.loadData?.()
106
+ })
107
+
108
+ return (
109
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
110
+ <ComponentHeader title={esp.lang("event/counter_request", "header_title")} subtitle={status_user == 1 ? esp.lang("event/counter_request", "sub_eo") : status_user == 2 ? esp.lang("event/counter_request", "sub_lm") : esp.lang("event/counter_request", "sub_cashier")} />
111
+ <Status status={status} onChangeStatus={setStatus} colorTheme={colorTheme} />
112
+
113
+ <LibInfinite
114
+ ref={ref}
115
+ url={url}
116
+ key={activeTab + " " + status}
117
+ errorView={(error: any) => {
118
+ return (
119
+ <View style={{ margin: 15, borderRadius: 15, marginBottom: 0, backgroundColor: '#fff', overflow: 'hidden' }}>
120
+ <ComponentMessage message={error} />
121
+ </View>
122
+ )
123
+ }}
124
+ style={{ margin: 15, marginTop: 10, borderRadius: 15, backgroundColor: '#fff', }}
125
+ ListHeaderComponent={
126
+ <View style={{ flexDirection: 'row', borderRadius: 10, padding: 3, overflow: 'hidden', backgroundColor: LibStyle.colorBgGrey }}>
127
+ {
128
+ type.map(renderType)
129
+ }
130
+ </View>
131
+ }
132
+ renderItem={renderItem}
133
+ />
134
+ </View>
135
+ )
136
+ }
@@ -0,0 +1,211 @@
1
+ // withHooks
2
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
3
+ import { ComponentQr_bg } from 'esoftplay/cache/component/qr_bg/import';
4
+ import { EventCounter_requestProperty } from 'esoftplay/cache/event/counter_request/import';
5
+ import { LibAutoreload } from 'esoftplay/cache/lib/autoreload/import';
6
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
7
+ import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
8
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
9
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
10
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
11
+ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
12
+ import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
13
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
14
+ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
15
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
16
+ import { UserClass } from 'esoftplay/cache/user/class/import';
17
+ import esp from 'esoftplay/esp';
18
+ import useSafeState from 'esoftplay/state';
19
+ import { useTimeout } from 'esoftplay/timeout';
20
+
21
+ import LottieView from "lottie-react-native";
22
+ import React, { useEffect, useRef } from 'react';
23
+ import { Text, TouchableOpacity, View } from 'react-native';
24
+ import QRCode from 'react-native-qrcode-svg';
25
+
26
+
27
+ export interface EventCounter_request_detailArgs {
28
+
29
+ }
30
+ export interface EventCounter_request_detailProps {
31
+
32
+ }
33
+ export default function m(props: EventCounter_request_detailProps): any {
34
+ let { url, status_user } = LibNavigation.getArgsAll(props)
35
+ const user = UserClass.state().get()
36
+ const [result, setResult] = useSafeState<any>()
37
+ const animation = useRef<LottieView>(null)
38
+ const timeout = useTimeout()
39
+
40
+ useEffect(() => {
41
+ loadData()
42
+ LibAutoreload.set(() => {
43
+ loadData()
44
+ })
45
+ return () => LibAutoreload.clear()
46
+ }, [])
47
+
48
+ function loadData() {
49
+ new LibCurl(url, null, (res, msg) => {
50
+ setResult(res)
51
+ timeout(() => {
52
+ animation.current?.play()
53
+ }, 300);
54
+ }, (error) => {
55
+ LibDialog.warning(esp.lang("event/counter_request_detail", "load_failed"), error?.message)
56
+ LibNavigation.back()
57
+ }, 1)
58
+ }
59
+
60
+ function acceptRequest(url: string) {
61
+ LibDialog.confirm(esp.lang("event/counter_request_detail", "acc_title"), esp.lang("event/counter_request_detail", "acc_msg"), esp.lang("event/counter_request_detail", "acc_confirm"), () => {
62
+ LibProgress.show(esp.lang("event/counter_request_detail", "acc_wait"))
63
+ new LibCurl(url, null, (res, msg) => {
64
+ EventCounter_requestProperty.subscribe().trigger()
65
+ LibProgress.hide()
66
+ LibDialog.info(esp.lang("event/counter_request_detail", "acc_ok"), msg)
67
+ LibNavigation.back()
68
+ }, (error) => {
69
+ LibProgress.hide()
70
+ LibDialog.warning(esp.lang("event/counter_request_detail", "acc_no"), error?.message)
71
+ }, 1)
72
+ }, esp.lang("event/counter_request_detail", "acc_cancel"), () => {
73
+
74
+ })
75
+ }
76
+
77
+ function cancelRequest(url: string) {
78
+ LibDialog.confirm(esp.lang("event/counter_request_detail", "cancel_title"), esp.lang("event/counter_request_detail", "cancel_msg"), esp.lang("event/counter_request_detail", "cancel_confirm"), () => {
79
+ LibProgress.show(esp.lang("event/counter_request_detail", "cancel_wait"))
80
+ new LibCurl(url, null, (res, msg) => {
81
+ EventCounter_requestProperty.subscribe().trigger()
82
+ LibProgress.hide()
83
+ LibDialog.info(esp.lang("event/counter_request_detail", "cancel_ok"), msg)
84
+ LibNavigation.back()
85
+ }, (error) => {
86
+ LibProgress.hide()
87
+ LibDialog.warning(esp.lang("event/counter_request_detail", "cancel_no"), error?.message)
88
+ }, 1)
89
+ }, esp.lang("event/counter_request_detail", "cancel_cancel"), () => {
90
+
91
+ })
92
+ }
93
+
94
+ if (!result) {
95
+ return (
96
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
97
+ <ComponentHeader title={esp.lang("event/counter_request_detail", "header_loading")} />
98
+ <LibLoading />
99
+ </View>
100
+ )
101
+ }
102
+
103
+ let isCoEo = user?.is_eo?.length > 0 && user?.is_eo?.find((item: any, i: number) => item.id == result?.event_id)
104
+
105
+ return (
106
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
107
+ <ComponentHeader title={esp.lang("event/counter_request_detail", "header_title")} />
108
+
109
+ <LibScroll onRefresh={loadData}>
110
+ <View style={{ margin: 15, padding: 15, ...LibStyle.elevation(2), borderRadius: 5, backgroundColor: '#fff', }}>
111
+ <View style={{ alignItems: 'center' }} >
112
+ <Text allowFontScaling={false} style={{ marginBottom: 23, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, textAlign: "center", color: result?.status == 1 ? '#e99222' : result?.status == 2 ? '#57d24e' : result?.status == 3 ? '#c53030' : '#091440' }}>{
113
+ result?.status == 1 ? esp.lang("event/counter_request_detail", "status_1") : result?.status == 2 ? esp.lang("event/counter_request_detail", "status_2") : result?.status == 3 ? esp.lang("event/counter_request_detail", "status_3") : esp.lang("event/counter_request_detail", "status_expired")
114
+ }</Text>
115
+
116
+ <LottieView
117
+ ref={animation}
118
+ loop={false}
119
+ style={{
120
+ width: 150,
121
+ height: 150,
122
+ }}
123
+ source={esp.assets(result?.status == 1 ? 'pending.json' : result?.status == 2 ? 'success.json' : result?.status == 3 ? 'canceled.json' : 'expired.json')}
124
+ // OR find more Lottie files @ https://lottiefiles.com/featured
125
+ // Just click the one you like, place that file in the 'assets' folder to the left, and replace the above 'require' statement
126
+ />
127
+ </View>
128
+ <Text style={{ alignSelf: 'center', textAlign: 'center', fontFamily: 'ArialBold', fontSize: 17, marginTop: 10, color: '#4a4a4a' }} >{result?.title}</Text>
129
+ <Text style={{ alignSelf: 'center', textAlign: 'center', fontFamily: 'Arial', fontSize: 13, marginTop: 15, color: '#999' }} >{LibUtils.moment(result?.created).serverFormat('dddd, DD MMMM YYYY HH:mm')}</Text>
130
+ {
131
+ result?.amount != 0 &&
132
+ <Text style={{ alignSelf: 'center', textAlign: 'center', fontFamily: 'ArialBold', fontSize: 25, marginTop: 10, color: LibStyle.colorPrimary }} >{esp.lang("event/counter_request_detail", "all_ticket", result?.hasOwnProperty("saldo") ? LibUtils.money(result?.amount) : LibUtils.number(result?.amount))}</Text>
133
+ }
134
+
135
+ <LibTextstyle text={esp.lang("event/counter_request_detail", "text_from")} textStyle="m_overline" style={{ color: '#999', marginTop: 20 }} />
136
+ <View style={{ flexDirection: 'row', marginTop: 5, alignItems: 'center' }} >
137
+ <LibPicture style={{ height: 40, width: 40, borderRadius: 20, backgroundColor: '#f1f2f3', marginRight: 20 }} source={result?.sender_image == "" ? esp.assets('icons/ic_no_image_merchant.png') : { uri: result?.sender_image }} />
138
+ <View style={{ flex: 1 }} >
139
+ <LibTextstyle text={result?.sender_name} textStyle={'body'} />
140
+ </View>
141
+ </View>
142
+ <LibTextstyle text={esp.lang("event/counter_request_detail", "text_receiver")} textStyle="m_overline" style={{ color: '#999', marginTop: 15 }} />
143
+ <View style={{ flexDirection: 'row', marginTop: 5, alignItems: 'center' }} >
144
+ <LibPicture style={{ height: 40, width: 40, borderRadius: 20, backgroundColor: '#f1f2f3', marginRight: 20 }} source={result?.receiver_image == "" ? esp.assets('icons/ic_no_image_merchant.png') : { uri: result?.receiver_image }} />
145
+ <View style={{ flex: 1 }} >
146
+ <LibTextstyle text={result?.receiver_name} textStyle={'body'} />
147
+ {
148
+ LibUtils.checkUndefined(result, 'receiver_account') &&
149
+ <LibTextstyle text={result?.receiver_account} textStyle={'footnote'} style={{ color: "#888" }} />
150
+ }
151
+ </View>
152
+ </View>
153
+ {
154
+ result.notes != '' &&
155
+ <>
156
+ <LibTextstyle text={esp.lang("event/counter_request_detail", "message")} textStyle="m_overline" style={{ color: '#999', marginTop: 30, marginBottom: 5, }} />
157
+ <LibTextstyle text={result.notes} textStyle={'body'} style={{}} />
158
+ </>
159
+ }
160
+ {
161
+ result?.hasOwnProperty("info") && result?.info != '' &&
162
+ <View style={{ flexDirection: 'row', borderRadius: 10, backgroundColor: '#FEFBEB', borderColor: "#FFCC29", borderWidth: 1, borderStyle: 'dashed', alignContent: 'center', alignItems: 'center', flex: 1, marginTop: 15, padding: 10 }} >
163
+ <Text allowFontScaling={false} style={{ flex: 1, fontFamily: "Arial", fontSize: 12, fontStyle: "normal", letterSpacing: 0 }} >{result?.info}</Text>
164
+
165
+ </View>
166
+ }
167
+
168
+ {
169
+ (result?.sender_id == user?.id || isCoEo?.eo_id == result?.sender_id) && (result?.sender_type == status_user) && result?.status == 1 &&
170
+ <>
171
+ <View style={{ borderRadius: 10, backgroundColor: '#FEFBEB', borderColor: "#FFCC29", borderWidth: 1, borderStyle: 'dashed', alignContent: 'center', alignItems: 'center', flex: 1, marginTop: 15, padding: 10 }}>
172
+ <Text allowFontScaling={false} style={{ flex: 1, fontFamily: "Arial", fontSize: 12, fontStyle: "normal", letterSpacing: 0 }} >{esp.lang("event/counter_request_detail", "msg_scan", result?.title)}</Text>
173
+ </View>
174
+ <ComponentQr_bg>
175
+ <View style={{ margin: 15, alignSelf: 'center' }}>
176
+ <QRCode ecl="H" size={LibStyle.width - 60} value={result?.url_receiver} />
177
+ </View>
178
+ </ComponentQr_bg>
179
+ </>
180
+ }
181
+ </View>
182
+ <View />
183
+ </LibScroll>
184
+
185
+ <View style={{ padding: 10 }}>
186
+
187
+ {
188
+ (result?.receiver_id == user?.id || isCoEo?.eo_id == result?.receiver_id) && (!status_user || result?.receiver_type == status_user) && result?.status == 1 ?
189
+ <TouchableOpacity onPress={() => {
190
+ acceptRequest(result?.url_accept)
191
+ }} >
192
+ <View style={{ width: LibStyle.width - 20, backgroundColor: LibStyle.colorGreen, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' }} >
193
+ <Text style={{ color: 'white', fontFamily: 'ArialBold', fontSize: 13 }} >{esp.lang("event/counter_request_detail", "btn_accept")}</Text>
194
+ </View>
195
+ </TouchableOpacity>
196
+ :
197
+ (result?.sender_id == user?.id || isCoEo?.eo_id == result?.sender_id) && (result?.sender_type == status_user) && result?.status == 1 &&
198
+ <TouchableOpacity onPress={() => {
199
+ cancelRequest(result?.url_cancel)
200
+ }} >
201
+ <View style={{ width: LibStyle.width - 20, backgroundColor: LibStyle.colorRed, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center' }} >
202
+ <Text style={{ color: 'white', fontFamily: 'ArialBold', fontSize: 13 }} >{esp.lang("event/counter_request_detail", "btn_cancel")}</Text>
203
+ </View>
204
+ </TouchableOpacity>
205
+ }
206
+
207
+ </View>
208
+
209
+ </View>
210
+ )
211
+ }