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,279 @@
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 { useRef } from 'react';
6
+
7
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
8
+ import { LibInput } from 'esoftplay/cache/lib/input/import';
9
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
10
+ import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
11
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
12
+ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
13
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
14
+ import { MarketSection_menu } from 'esoftplay/cache/market/section_menu/import';
15
+ import { MarketSheet } from 'esoftplay/cache/market/sheet/import';
16
+ import { UseCondition } from 'esoftplay/cache/use/condition/import';
17
+ import esp from 'esoftplay/esp';
18
+ import useLazyState from 'esoftplay/lazy';
19
+ import moment from 'esoftplay/moment';
20
+ import useSafeState from 'esoftplay/state';
21
+ import React from 'react';
22
+ import { Pressable, Text, TouchableOpacity, View } from 'react-native';
23
+
24
+
25
+ export interface EventCoupon_claim_historyArgs {
26
+
27
+ }
28
+ export interface EventCoupon_claim_historyProps {
29
+ hideHeader?: boolean, config: any, event_id: string
30
+ }
31
+ export default function m(props: EventCoupon_claim_historyProps): any {
32
+ const { event_id, config } = esp.mod("lib/navigation").getArgsAll(props)
33
+ let lastDate = useRef('')
34
+
35
+ const usedConfig = props?.config || config
36
+ const usedEventId = props?.event_id || event_id
37
+
38
+ const baseURL = "event_coupon_tenant_redeemed_staff?event_id=" + usedEventId + "&tenant_id=" + usedConfig?.tenant_id
39
+
40
+ const date_start = moment().localeFormat("YYYY-MM-DD")
41
+ const date_end = moment().localeFormat("YYYY-MM-DD")
42
+ const [selectedDate, setSelectedDate] = useSafeState<any>({ date_start, date_end })
43
+ const [state, setState] = useSafeState<any>()
44
+ const [query, setQuery] = useSafeState<string>("")
45
+ const [staff, setStaff] = useLazyState<any>(usedConfig?.is_parent == 1 ? undefined : { staff_id: usedConfig?.staff_id })
46
+ const [typeIndex, setTypeIndex] = useLazyState<any>(usedConfig?.is_parent == 1 ? 0 : 1)
47
+ const headerShow = props?.hideHeader ? !props?.hideHeader : true
48
+ const slidingRef = useRef<LibSlidingup>(null)
49
+ const slidingDataRef = useRef<LibSlidingup>(null)
50
+ const inputRef = useRef<LibInput>(null)
51
+
52
+ const type = [esp.lang("event/coupon_claim_history", "all_data"), esp.lang("event/coupon_claim_history", "only_me")]
53
+
54
+ function buildUrl(url: string): string {
55
+ if (selectedDate?.date_start != "") {
56
+ url += url.includes('?') ? '&' : '?'
57
+ url += 'date_start=' + selectedDate?.date_start
58
+ }
59
+ if (selectedDate?.date_end != "") {
60
+ url += url.includes('?') ? '&' : '?'
61
+ url += 'date_end=' + selectedDate?.date_end
62
+ }
63
+ if (staff?.staff_id) {
64
+ url += url.includes('?') ? '&' : '?'
65
+ url += 'staff_id=' + staff?.staff_id
66
+ }
67
+ return url
68
+ }
69
+
70
+ function buildSearchUrl(url: string): string {
71
+ if (query != "") {
72
+ url += url.includes('?') ? '&' : '?'
73
+ url += 'keyword=' + query
74
+ }
75
+ return url
76
+ }
77
+
78
+ function doSearch() {
79
+ if (inputRef.current?.getText?.() && inputRef.current?.getText?.() != "") {
80
+ const email = inputRef.current?.getText?.()
81
+ setQuery(email)
82
+ }
83
+ }
84
+
85
+ const HeaderItem = (props: any) => {
86
+ return (
87
+ <View style={{ paddingHorizontal: 17, paddingVertical: 10, flexDirection: 'row', backgroundColor: LibUtils.hexToRgba(LibStyle.colorPrimary, 0.2), ...props?.containerStyle }} >
88
+ <View style={{ flex: 1 }} >
89
+ <LibTextstyle textStyle={"caption2"} text={esp.lang("event/coupon_claim_history", "date")} style={{ color: "#888" }} />
90
+ <LibTextstyle textStyle={"callout"} text={props?.date} />
91
+ <LibTextstyle textStyle={"caption2"} text={esp.lang("event/coupon_claim_history", "total_claim")} style={{ color: "#888", marginTop: 10 }} />
92
+ <LibTextstyle textStyle={"callout"} text={props?.qty} />
93
+ </View>
94
+ <View style={{ flex: 1, alignItems: "flex-end" }} >
95
+ <LibTextstyle textStyle={"caption2"} text={esp.lang("event/coupon_claim_history", "total")} style={{ color: "#888" }} />
96
+ <LibTextstyle textStyle={"callout"} text={props?.amount} style={{ fontWeight: "bold" }} />
97
+ </View>
98
+ </View>
99
+ )
100
+ }
101
+
102
+ return (
103
+ <View style={{ flex: 1 }}>
104
+ {
105
+ headerShow &&
106
+ <ComponentHeader title={esp.lang("event/coupon_claim_history", "header")} />
107
+ }
108
+ <View>
109
+ <Pressable onPress={() => {
110
+ LibNavigation.navigateForResult('feed/talent_date', { minDate: moment().add(-5, 'years').localeFormat('YYYY-MM-DD'), maxDate: moment().add(1, 'years').localeFormat('YYYY-MM-DD') }).then((item) => {
111
+ setSelectedDate(item)
112
+ })
113
+ }} style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
114
+ <View style={{ flex: 1, padding: 10, paddingHorizontal: 20, borderBottomWidth: 1, borderBottomColor: '#e9ecef', }}>
115
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/coupon_claim_history", "date_start")}</Text>
116
+ <Text allowFontScaling={false} style={{ marginTop: 4, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{LibUtils.moment(selectedDate?.date_start).localeFormat("DD MMM YYYY")}</Text>
117
+ </View>
118
+ <View style={{ flex: 1, padding: 10, paddingHorizontal: 20, borderBottomWidth: 1, borderBottomColor: '#e9ecef', }}>
119
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/coupon_claim_history", "date_end")}</Text>
120
+ <Text allowFontScaling={false} style={{ marginTop: 4, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{LibUtils.moment(selectedDate?.date_end).localeFormat("DD MMM YYYY")}</Text>
121
+ </View>
122
+ </Pressable>
123
+ {
124
+ usedConfig?.is_parent == 1 &&
125
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
126
+ <Pressable onPress={() => {
127
+ slidingRef?.current?.show()
128
+ }} style={{ flex: 1, padding: 10, paddingHorizontal: 20, borderBottomWidth: 1, borderBottomColor: '#e9ecef', flexDirection: "row", alignItems: "center" }}>
129
+ <View style={{ flex: 1 }}>
130
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/coupon_claim_history", "scan_staff")}</Text>
131
+ <Text allowFontScaling={false} numberOfLines={1} ellipsizeMode='middle' style={{ marginTop: 4, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{staff?.email || esp.lang("event/coupon_claim_history", "staff")}</Text>
132
+ </View>
133
+ <LibIcon.SimpleLineIcons name="arrow-down" size={15} />
134
+ </Pressable>
135
+ <Pressable onPress={() => {
136
+ slidingDataRef.current?.show()
137
+ }} style={{ flex: 1, padding: 10, paddingHorizontal: 20, borderBottomWidth: 1, borderBottomColor: '#e9ecef', flexDirection: "row", alignItems: "center" }}>
138
+ <View style={{ flex: 1 }}>
139
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/coupon_claim_history", "show_data")}</Text>
140
+ <Text allowFontScaling={false} style={{ marginTop: 4, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{type[typeIndex]}</Text>
141
+ </View>
142
+ <LibIcon.SimpleLineIcons name="arrow-down" size={15} />
143
+ </Pressable>
144
+ </View>
145
+ }
146
+ </View>
147
+ <LibInfinite
148
+ isDebug={1}
149
+ key={buildUrl(baseURL)}
150
+ url={buildUrl(baseURL)}
151
+ onRefresh={() => lastDate.current = ""}
152
+ errorView={(e: string) =>
153
+ <ComponentMessage message={e} />
154
+ }
155
+ onResponseEdit={(res) => {
156
+ let out = res.report
157
+ setState(out)
158
+ if (res?.report?.list.length > 0) {
159
+ out = esp.mod("lib/object").update(res?.report, (list) => list.map((item: any) => {
160
+ const used_at = moment(item.used_at).format("DD MMMM YYYY")
161
+ const showDate = lastDate.current != used_at
162
+ lastDate.current = used_at
163
+ return { ...item, showDate: showDate }
164
+ }))('list')
165
+ }
166
+ return out
167
+ }}
168
+ renderItem={(item: any, idx: number) => {
169
+ return (
170
+ <View key={idx}>
171
+ <UseCondition if={idx === 0} >
172
+ <HeaderItem
173
+ date={state?.date_end == state?.date_start ? moment(state?.date_start).localeFormat("dddd, DD MMMM YYYY") : LibUtils.getDateRange(state?.date_start, state?.date_end, " - ")}
174
+ qty={LibUtils.number(state?.qty)}
175
+ amount={LibUtils.money(state?.amount)} />
176
+ </UseCondition>
177
+ <UseCondition if={item?.showDate} >
178
+ <MarketSection_menu title={moment(item?.used_at).format("dddd, DD MMMM YYYY")} />
179
+ </UseCondition>
180
+ <View style={{ backgroundColor: "#f4f4f4", height: 2 }} />
181
+ <TouchableOpacity
182
+ onPress={() => { }}
183
+ style={{ flexDirection: "row", paddingHorizontal: 17, paddingTop: 10, paddingBottom: 8 }} >
184
+ <View style={{ flex: 1 }} >
185
+ <View style={{ flexDirection: "row", alignItems: "center" }} >
186
+ <LibIcon.Ionicons name="ticket" size={12} color="#888" />
187
+ <LibTextstyle textStyle="caption1" text={item?.title + " (" + item?.event_name + ")"} style={{ color: "#888", marginLeft: 5 }} />
188
+ </View>
189
+ <View style={{ flexDirection: 'row', alignItems: 'center' }} >
190
+ <LibTextstyle textStyle="caption1" text={item?.code} style={{ color: LibStyle.colorBlue }} />
191
+ </View>
192
+ <LibTextstyle textStyle="caption1" text={"QTY " + item?.qty} style={{ color: "#888" }} />
193
+ <LibTextstyle textStyle="caption1" text={LibUtils.moment(item?.used_at).serverFormat("DD MMMM YYYY H:mm:ss")} style={{ color: "#888" }} />
194
+ </View>
195
+ <View>
196
+ <LibTextstyle textStyle="caption1" text={item?.email_tenant} style={{ color: "#888", textAlign: "right" }} />
197
+ <LibTextstyle textStyle="footnote" text={LibUtils.money(item?.amount_total)} style={{ textAlign: "right" }} />
198
+ </View>
199
+ </TouchableOpacity>
200
+ </View>
201
+ )
202
+ }}
203
+ />
204
+
205
+ <MarketSheet
206
+ _ref={slidingDataRef}
207
+ title={esp.lang("event/coupon_claim_history", "show_data")}
208
+ options={[
209
+ ...type.map((x, i) => ({
210
+ text: x, onPress: () => {
211
+ setTypeIndex(i)()
212
+ setStaff(() => i == 1 ? { staff_id: usedConfig?.staff_id } : undefined)
213
+ }
214
+ }))
215
+ ]}
216
+ />
217
+
218
+ <LibSlidingup ref={slidingRef}>
219
+ <View style={{ minHeight: LibStyle.height * 0.3, maxHeight: LibStyle.height * 0.6, backgroundColor: "white", paddingTop: 10 }}>
220
+ <View style={{ marginHorizontal: 15, marginTop: 10, flexDirection: 'row', alignItems: 'center' }}>
221
+ <LibInput
222
+ ref={inputRef}
223
+ base
224
+ defaultValue={query}
225
+ placeholder={esp.lang("event/coupon_claim_history", "search_email")}
226
+ onChangeText={(t) => { }}
227
+ onSubmitEditing={() => doSearch()}
228
+ style={{ flex: 1, borderColor: '#E6E6E6', color: '#B8B8B8', borderWidth: 1, padding: 4, paddingLeft: 40, borderRadius: 10, backgroundColor: 'white', height: 40 }}
229
+ />
230
+ <View style={{ position: "absolute", top: 9, bottom: 0, left: 9 }}>
231
+ <LibIcon name="magnify" color="#E6E6E6" />
232
+ </View>
233
+ {
234
+ query != "" &&
235
+ <Pressable onPress={() => {
236
+ setQuery("")
237
+ inputRef.current?.setText("")
238
+ }} style={{ position: "absolute", top: 9, bottom: 0, right: 9 }}>
239
+ <LibIcon name="close" color={LibStyle.colorRed} />
240
+ </Pressable>
241
+ }
242
+ </View>
243
+
244
+ <LibInfinite
245
+ key={buildSearchUrl("event_coupon_tenant_list_history?tenant_id=" + usedConfig?.tenant_id)}
246
+ url={buildSearchUrl("event_coupon_tenant_list_history?tenant_id=" + usedConfig?.tenant_id)}
247
+ errorView={(e: string) => <ComponentMessage message={e} />}
248
+ isDebug={1}
249
+ ListHeaderComponent={
250
+ <>
251
+ {
252
+ !query &&
253
+ <Pressable onPress={() => {
254
+ setStaff(undefined)
255
+ slidingRef.current?.hide()
256
+ }} style={[{ backgroundColor: "white", marginHorizontal: 15, marginBottom: 5, marginTop: 10, padding: 10, borderRadius: 10, flexDirection: "row", alignItems: "center" }, LibStyle.elevation(3)]}>
257
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14 }}>{esp.lang("event/coupon_claim_history", "all_staff")}</Text>
258
+ </Pressable>
259
+ }
260
+ </>
261
+ }
262
+ renderItem={(item, index) => (
263
+ <Pressable onPress={() => {
264
+ setStaff(item)()
265
+ slidingRef.current?.hide()
266
+ }} key={index} style={[{ backgroundColor: "white", marginHorizontal: 15, marginBottom: 5, marginTop: 10, padding: 10, borderRadius: 10 }, LibStyle.elevation(3)]}>
267
+ {
268
+ item?.name && item?.name != "" &&
269
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, marginBottom: 3 }}>{esp.mod("lib/utils").ucwords(item?.name)}</Text>
270
+ }
271
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14 }}>{String(item?.email).toLowerCase()}</Text>
272
+ </Pressable>
273
+ )}
274
+ />
275
+ </View>
276
+ </LibSlidingup>
277
+ </View>
278
+ )
279
+ }
@@ -0,0 +1,111 @@
1
+ // withHooks
2
+ import { useEffect } from 'react';
3
+
4
+ import { ComponentButton } from 'esoftplay/cache/component/button/import';
5
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
6
+ import { ComponentTouchable } from 'esoftplay/cache/component/touchable/import';
7
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
8
+ import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
9
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
10
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
11
+ import esp from 'esoftplay/esp';
12
+ import useLazyState from 'esoftplay/lazy';
13
+ import React from 'react';
14
+ import { Text, View } from 'react-native';
15
+
16
+
17
+ export interface EventCoupon_claim_reimburseArgs {
18
+
19
+ }
20
+ export interface EventCoupon_claim_reimburseProps {
21
+
22
+ }
23
+ export default function m(props: EventCoupon_claim_reimburseProps): any {
24
+ const { event_id, tenant_id } = esp.mod("lib/navigation").getArgsAll(props)
25
+ const [reimburse, setReimburse] = useLazyState<any>()
26
+
27
+ useEffect(() => {
28
+ loadReimburse()
29
+ }, [])
30
+
31
+ function loadReimburse() {
32
+ setReimburse(undefined)
33
+ const curl = esp.mod("lib/curl")
34
+ new curl("event_coupon_tenant_reimburse?event_id=" + event_id + "&tenant_id=" + tenant_id, null, (result, message) => {
35
+ setReimburse(result)()
36
+ }, (error) => {
37
+
38
+ }, 1)
39
+ }
40
+
41
+ function submitReimburse() {
42
+ const doSubmit = () => {
43
+ const curl = esp.mod("lib/curl")
44
+ esp.mod("lib/progress").show(esp.lang("event/coupon_claim_reimburse", "please_wait"))
45
+ new curl("event_coupon_tenant_reimburse_submit", { tenant_id, event_id }, (result, message) => {
46
+ loadReimburse()
47
+ esp.modProp("lib/toast").show(message)
48
+ esp.mod("lib/progress").hide()
49
+ esp.mod("lib/navigation").navigate("event/coupon_claim_reimburse_history_detail", { url: result?.url })
50
+ }, (error) => {
51
+ esp.mod("lib/progress").hide()
52
+ esp.mod("lib/dialog").warning(esp.lang("event/coupon_claim", "warning_reimburse"), error?.message)
53
+ }, 1)
54
+ }
55
+
56
+ esp.mod('lib/dialog').warningConfirm(esp.lang("event/coupon_claim", "reimburse_title"),
57
+ esp.lang("event/coupon_claim", "reimburse_msg"),
58
+ esp.lang("event/coupon_claim", "reimburse_ok"), () => {
59
+ doSubmit()
60
+ },
61
+ esp.lang("event/coupon_claim", "reimburse_cancel"), () => { })
62
+ }
63
+
64
+ return (
65
+ <View style={{ flex: 1 }}>
66
+ <ComponentHeader title={esp.lang("event/coupon_claim_reimburse", "reimburse")} subtitle={esp.lang("event/coupon_claim_reimburse", "reimburse_subtitle")} />
67
+ <LibScroll onRefresh={loadReimburse}>
68
+ <View style={{ margin: 5, marginBottom: 5, marginTop: 10, borderRadius: 10, padding: 10 }}>
69
+ <View style={{ flexDirection: "row", justifyContent: "space-between" }}>
70
+ <View style={{ padding: 15, borderRadius: 10, backgroundColor: "#f1f1f1", width: (LibStyle.width - 45) * 0.5 }}>
71
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: "#000", marginBottom: 5 }}>{esp.lang("event/coupon_claim_reimburse", "total")}</Text>
72
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", flex: 1, flexWrap: 'wrap', fontSize: 20, fontWeight: 'bold', color: "#000" }}>{LibUtils.number(reimburse?.qty)}</Text>
73
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 10, color: LibStyle.colorBrown, marginTop: 5, textAlign: "right" }}>{esp.lang("event/coupon_claim_reimburse", "can_cashout")}</Text>
74
+ </View>
75
+ <View style={{ padding: 15, borderRadius: 10, backgroundColor: "#f1f1f1", width: (LibStyle.width - 45) * 0.5 }}>
76
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: "#000", marginBottom: 5 }}>{esp.lang("event/coupon_claim_reimburse", "amount")}</Text>
77
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", flex: 1, flexWrap: 'wrap', fontSize: 20, fontWeight: 'bold', color: "#000" }}>{LibUtils.money(reimburse?.amount)}</Text>
78
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 10, color: LibStyle.colorBrown, marginTop: 5, textAlign: "right" }}>{esp.lang("event/coupon_claim_reimburse", "can_cashout")}</Text>
79
+ </View>
80
+ </View>
81
+ </View>
82
+ <ComponentTouchable onPress={() => {
83
+ esp.mod("lib/navigation").navigate("event/coupon_claim_reimburse_history", { event_id, tenant_id })
84
+ }} style={{ padding: 15, borderRadius: 10, backgroundColor: "#f1f1f1", flexDirection: "row", alignItems: "center", marginHorizontal: 15 }}>
85
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", flex: 1, fontSize: 14, color: "#000" }}>{esp.lang("event/coupon_claim_reimburse", "history_cashout")}</Text>
86
+ <LibIcon name='chevron-right' />
87
+ </ComponentTouchable>
88
+
89
+ <View style={{ padding: 15, borderRadius: 10, backgroundColor: "#fff3cd", borderWidth: 1, borderColor: "#FDE68A", marginHorizontal: 15, marginTop: 15 }}>
90
+ <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 18, color: "#000", textAlign: "justify", paddingBottom: 5 }}>{esp.lang("event/coupon_claim_reimburse", "info")}</Text>
91
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: "#000", lineHeight: 17, textAlign: "justify", paddingBottom: 5 }}>{esp.lang("event/coupon_claim_reimburse", "info1")}</Text>
92
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: "#000", lineHeight: 17, textAlign: "justify", paddingBottom: 5 }}>{esp.lang("event/coupon_claim_reimburse", "info2")}</Text>
93
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: "#000", lineHeight: 17, textAlign: "justify", }}>{esp.lang("event/coupon_claim_reimburse", "info3")}</Text>
94
+ </View>
95
+
96
+ </LibScroll>
97
+ <ComponentButton
98
+ label={esp.lang("event/coupon_claim_reimburse", "doReimburse")}
99
+ backgroundColor={reimburse?.qty == 0 ? "#f1f1f1" : undefined}
100
+ onPress={() => {
101
+ if (reimburse?.qty > 0) {
102
+ submitReimburse()
103
+ } else {
104
+ esp.modProp("lib/toast").show(esp.lang("event/coupon_claim", "coupon_scan_empty"))
105
+ }
106
+ }}
107
+ style={{ margin: 15 }}
108
+ />
109
+ </View>
110
+ )
111
+ }
@@ -0,0 +1,72 @@
1
+ // withHooks
2
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
3
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
4
+ import esp from 'esoftplay/esp';
5
+ import { useEffect } from 'react';
6
+
7
+ import { applyStyle } from 'esoftplay';
8
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
9
+ import { LibList } from 'esoftplay/cache/lib/list/import';
10
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
11
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
12
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
13
+ import useSafeState from 'esoftplay/state';
14
+ import React from 'react';
15
+ import { Text, View } from 'react-native';
16
+ import Pressable from '../lib/pressable';
17
+
18
+
19
+ export interface EventCoupon_claim_reimburse_historyArgs {
20
+
21
+ }
22
+ export interface EventCoupon_claim_reimburse_historyProps {
23
+
24
+ }
25
+ export default function m(props: EventCoupon_claim_reimburse_historyProps): any {
26
+ const { event_id, tenant_id } = esp.mod("lib/navigation").getArgsAll(props)
27
+ const [datas, setDatas] = useSafeState<any>()
28
+ const [error, setError] = useSafeState<string>("")
29
+
30
+ useEffect(() => {
31
+ loadData()
32
+ }, [])
33
+
34
+ function loadData() {
35
+ new LibCurl("event_coupon_tenant_reimburse_list?event_id=" + event_id + "&tenant_id=" + tenant_id, null, (result) => {
36
+ esp.log({ result });
37
+ setDatas(result)
38
+ }, (error) => {
39
+ setError(error?.message)
40
+ })
41
+ }
42
+
43
+ return (
44
+ <View style={{ flex: 1 }}>
45
+ <ComponentHeader title={esp.lang("event/coupon_claim_reimburse_history", "reimburse_history")} />
46
+ {
47
+ <LibList
48
+ onRefresh={loadData}
49
+ data={datas}
50
+ ListEmptyComponent={
51
+ (!datas && error == "") ? <LibLoading /> :
52
+ error != "" ? <ComponentMessage message={error} style={{ marginTop: 50 }} /> : null
53
+ }
54
+ renderItem={(item: any, index: number) => (
55
+ <Pressable key={index} onPress={() => {
56
+ esp.mod("lib/navigation").navigate("event/coupon_claim_reimburse_history_detail", { url: item?.url })
57
+ }} style={applyStyle({ padding: 10, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', borderBottomColor: "#EEF1F8", borderBottomWidth: 1 })}>
58
+ <View style={applyStyle({ flex: 3 })}>
59
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 16, marginBottom: 5 })}>{item?.status_text}</Text>
60
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 12, color: "#797979" })}>{LibUtils.moment(item?.created).serverFormat("DD MMMM YYYY HH:mm:ss")}</Text>
61
+ </View>
62
+ <View>
63
+ <Text allowFontScaling={false} style={applyStyle({ marginBottom: 5, textAlign: 'right', fontWeight: 'bold', fontSize: 14, color: LibStyle.colorGreen })}>{esp.lang("event/coupon_claim_reimburse_history", "qty", LibUtils.number(item?.qty))}</Text>
64
+ <Text allowFontScaling={false} style={applyStyle({ textAlign: 'right', fontWeight: 'bold', fontSize: 14, color: LibStyle.colorRed })}>{LibUtils.money(item?.amount)}</Text>
65
+ </View>
66
+ </Pressable>
67
+ )}
68
+ />
69
+ }
70
+ </View>
71
+ )
72
+ }
@@ -0,0 +1,117 @@
1
+ // withHooks
2
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
3
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
4
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
5
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
6
+ import esp from 'esoftplay/esp';
7
+ import moment from 'esoftplay/moment';
8
+ import useSafeState from 'esoftplay/state';
9
+ import { useEffect, useRef } from 'react';
10
+
11
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
12
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
13
+ import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
14
+ import { LibWebview } from 'esoftplay/cache/lib/webview/import';
15
+ import { useTimeout } from 'esoftplay/timeout';
16
+ import LottieView from "lottie-react-native";
17
+ import React from 'react';
18
+ import { ScrollView, Text, View } from 'react-native';
19
+
20
+
21
+ export interface EventCoupon_claim_reimburse_history_detailArgs {
22
+
23
+ }
24
+ export interface EventCoupon_claim_reimburse_history_detailProps {
25
+
26
+ }
27
+ export default function m(props: EventCoupon_claim_reimburse_history_detailProps): any {
28
+ const { url } = LibNavigation.getArgsAll(props)
29
+ const [data, setData] = useSafeState<any>()
30
+ const [error, setError] = useSafeState<string>("")
31
+ const animation = useRef<LottieView>(null)
32
+ const timeout = useTimeout()
33
+
34
+ useEffect(() => {
35
+ if (data) {
36
+ timeout(() => {
37
+ animation.current?.play()
38
+ }, 300);
39
+ }
40
+ }, [data])
41
+
42
+ useEffect(getData, [])
43
+
44
+ function getData() {
45
+ const curl = esp.mod("lib/curl")
46
+ new curl(url, null, (result, message) => {
47
+ esp.log(result)
48
+ setData(result)
49
+ }, (error) => {
50
+ setError(error?.message)
51
+ }, 1)
52
+ }
53
+
54
+ return (
55
+ <View style={{ flex: 1 }}>
56
+ <ComponentHeader title={esp.lang("event/coupon_claim_reimburse_history_detail", "header")} />
57
+ <LibScroll onRefresh={getData}>
58
+ {
59
+ (!data && error == "") ? <LibLoading /> : error != "" ? <ComponentMessage message={error} />
60
+ :
61
+ <>
62
+ <View style={{ alignItems: 'center', marginTop: 20 }} >
63
+ {
64
+ <LottieView
65
+ ref={animation}
66
+ loop={false}
67
+ style={{
68
+ width: 200,
69
+ height: 200,
70
+ }}
71
+ source={esp.assets(data?.lottie)}
72
+ // OR find more Lottie files @ https://lottiefiles.com/featured
73
+ // Just click the one you like, place that file in the 'assets' folder to the left, and replace the above 'require' statement
74
+ />
75
+ }
76
+ </View>
77
+
78
+ <View style={{ marginHorizontal: 15, marginTop: 20, marginBottom: 15 }}>
79
+ <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 16, color: '#4a4a4a', textAlign: "center" }}>{LibUtils.ucwords(data?.status_text)}</Text>
80
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: '#4a4a4a', textAlign: "center", marginTop: 10 }}>{moment(data?.created).localeFormat("dddd, DD MMMM YYYY HH:mm:ss")}</Text>
81
+ <View style={{ flexDirection: "row", justifyContent: "space-between", marginTop: 30 }}>
82
+ <View style={{ padding: 15, borderRadius: 10, backgroundColor: "#f1f1f1", width: (LibStyle.width - 45) * 0.5 }}>
83
+ <Text allowFontScaling={false} style={{ fontSize: 14, color: "#000" }}>{esp.lang("event/coupon_claim_reimburse_history_detail", "nominal")}</Text>
84
+ <Text allowFontScaling={false} style={{ marginTop: 5, fontSize: 18, fontWeight: 'bold', color: "#000" }}>{LibUtils.money(data?.amount)}</Text>
85
+ </View>
86
+ <View style={{ padding: 15, borderRadius: 10, backgroundColor: "#f1f1f1", width: (LibStyle.width - 45) * 0.5 }}>
87
+ <Text allowFontScaling={false} style={{ fontSize: 14, color: "#000" }}>{esp.lang("event/coupon_claim_reimburse_history_detail", "qty")}</Text>
88
+ <Text allowFontScaling={false} style={{ marginTop: 5, fontSize: 18, fontWeight: 'bold', color: "#000" }}>{LibUtils.number(data?.qty)}</Text>
89
+ </View>
90
+ </View>
91
+ {
92
+ data?.notes && data?.notes != "" &&
93
+ <View style={{ padding: 15, borderRadius: 10, backgroundColor: "#f1f1f1", marginTop: 15 }}>
94
+ <Text allowFontScaling={false} style={{ fontSize: 14, color: "#000" }}>{"Alasan Penolakan"}</Text>
95
+ <Text allowFontScaling={false} style={{ marginTop: 5, fontSize: 18, fontWeight: 'bold', color: "#000" }}>{data?.notes}</Text>
96
+ </View>
97
+ }
98
+ </View>
99
+
100
+ {
101
+ data?.info && data?.info != "" && data?.info != null &&
102
+ <View style={{ marginHorizontal: 15, padding: 15, borderRadius: 10, backgroundColor: "#f1f1f1" }}>
103
+ <ScrollView>
104
+ <LibWebview source={{
105
+ html: `<style>body{background-color:#f1f1f1;}</style>${data?.info}`
106
+ }} onFinishLoad={() => { }} style={{ marginHorizontal: -20 }}
107
+ />
108
+ </ScrollView>
109
+ </View>
110
+ }
111
+ </>
112
+ }
113
+ <View />
114
+ </LibScroll>
115
+ </View>
116
+ )
117
+ }