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,32 @@
1
+ // withHooks
2
+ // noPage
3
+
4
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
5
+
6
+ import React from 'react';
7
+ import { Text, TouchableOpacity, View } from 'react-native';
8
+
9
+
10
+ export interface EventCounter_sectionArgs {
11
+
12
+ }
13
+ export interface EventCounter_sectionProps {
14
+ title: string
15
+ onPress: () => void
16
+ icon?: any
17
+ iconColor?: string
18
+ showIcon?: boolean
19
+ }
20
+ export default function m(props: EventCounter_sectionProps): any {
21
+ return (
22
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between', margin: 15, marginTop: 5 }}>
23
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16 }}>{props.title}</Text>
24
+ {
25
+ props.showIcon &&
26
+ <TouchableOpacity onPress={() => { props.onPress() }}>
27
+ <LibIcon name={props.icon ? props.icon : "chevron-right-circle"} color={props.iconColor ? props.iconColor : "#717171"} />
28
+ </TouchableOpacity>
29
+ }
30
+ </View>
31
+ )
32
+ }
@@ -0,0 +1,277 @@
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 { EventCounter_user_list_item } from 'esoftplay/cache/event/counter_user_list_item/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 } from 'esoftplay/cache/lib/input/import';
10
+ import { LibInput_rectangle2 } from 'esoftplay/cache/lib/input_rectangle2/import';
11
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
12
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
13
+ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
14
+ import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
15
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
16
+ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
17
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
18
+ import esp from 'esoftplay/esp';
19
+ import useSafeState from 'esoftplay/state';
20
+
21
+ import React, { useEffect, useRef } from 'react';
22
+ import { KeyboardAvoidingView, Pressable, Text, TouchableOpacity, View } from 'react-native';
23
+
24
+
25
+ export interface EventCounter_sendArgs {
26
+
27
+ }
28
+ export interface EventCounter_sendProps {
29
+
30
+ }
31
+ export default function m(props: EventCounter_sendProps): any {
32
+
33
+ const { event_id, status_user } = LibNavigation.getArgsAll(props)
34
+ const [type, setType] = useSafeState<any>(1) // ini type antara cash atau tiket
35
+ const [typeTicket, setTypeTicket] = useSafeState<any>() // ini type tiket
36
+ const [selectedUser, setSelectedUser] = useSafeState<any>()
37
+ const [resultTypeTicket, setResultTypeTicket] = useSafeState<any>()
38
+ const [error, setError] = useSafeState<any>()
39
+ const [showLoading, setShowLoading] = useSafeState<boolean>(false)
40
+
41
+ let inputAmount = useRef<LibInput>(null)
42
+ const inputNotes = useRef<LibInput_rectangle2>(null)
43
+
44
+ let ticketUrl = status_user == 1 ? "event_eo_ticket?event_id=" + event_id : status_user == 2 ? "event_manager_ticket?event_id=" + event_id : "event_seller_ticket?event_id=" + event_id
45
+ let moneyUrl = status_user == 1 ? "event_eo_money?event_id=" + event_id : status_user == 2 ? "event_manager_money?event_id=" + event_id : "event_seller_money?event_id=" + event_id
46
+ let urlLoadData = type == 1 ? moneyUrl : ticketUrl
47
+
48
+ let urlTypeTicket = status_user == 1 ? "event_eo_ticket_request_send" : status_user == 2 ? "event_manager_ticket_request_send" : "event_seller_ticket_request_send"
49
+ let urlTypeCash = status_user == 1 ? "event_eo_money_request_send" : status_user == 2 ? "event_manager_money_request_send" : "event_seller_money_request_send"
50
+
51
+ let urlSend = type == 1 ? urlTypeCash : urlTypeTicket
52
+
53
+ useEffect(() => {
54
+ loadData()
55
+ }, [])
56
+
57
+ useEffect(() => {
58
+ loadData()
59
+ }, [type])
60
+
61
+ function loadData() {
62
+ setError(undefined)
63
+ setShowLoading(true)
64
+ new LibCurl(urlLoadData, null, (res, msg) => {
65
+ setResultTypeTicket(res)
66
+ setShowLoading(false)
67
+ }, (error) => {
68
+ setError(error)
69
+ }, 1)
70
+ }
71
+
72
+ function checkInput() {
73
+ if (!event_id) {
74
+ LibToastProperty.show(esp.lang("event/counter_send", "empty_event_id"))
75
+ return false
76
+ }
77
+ if (type == 2 && !typeTicket) {
78
+ LibToastProperty.show(esp.lang("event/counter_send", "empty_type_ticket"))
79
+ return false
80
+ }
81
+ if (inputAmount.current?.getText() == "") {
82
+ inputAmount.current?.setError(esp.lang("event/counter_send", "empty_qty"))
83
+ return false
84
+ }
85
+ if (!selectedUser) {
86
+ LibToastProperty.show(esp.lang("event/counter_send", "empty_user"))
87
+ return false
88
+ }
89
+ return true
90
+ }
91
+
92
+ function sendRequest() {
93
+
94
+ // biar gampang kalo ada apa2
95
+ let postTicket = {
96
+ event_id: event_id,
97
+ price_id: typeTicket?.price_id,
98
+ ondate: typeTicket?.ondate,
99
+ user_id: selectedUser?.user_id,
100
+ user_type: selectedUser?.type,
101
+ qty: inputAmount.current?.getText(),
102
+ notes: inputNotes.current?.getText(),
103
+ }
104
+
105
+ let postCash = {
106
+ event_id: event_id,
107
+ user_id: selectedUser?.user_id,
108
+ user_type: selectedUser?.type,
109
+ amount: inputAmount.current?.getText(),
110
+ notes: inputNotes.current?.getText(),
111
+ }
112
+
113
+ LibDialog.confirm(esp.lang("event/counter_send", "send_title"), esp.lang("event/counter_send", "send_msg"), esp.lang("event/counter_send", "send_confirm"), () => {
114
+ LibProgress.show(esp.lang("event/counter_send", "send_wait"))
115
+ new LibCurl(urlSend, type == 1 ? postCash : postTicket, (res, msg) => {
116
+ LibProgress.hide()
117
+ LibDialog.info(esp.lang("event/counter_send", "send_ok"), msg)
118
+ LibNavigation.back()
119
+ loadData()
120
+ }, (error) => {
121
+ LibDialog.warning(esp.lang("event/counter_send", "send_no"), error?.message)
122
+ LibProgress.hide()
123
+ }, 1)
124
+ }, esp.lang("event/counter_send", "send_cancel"), () => { })
125
+ }
126
+
127
+ let colorTheme = status_user == 1 ? "#009AE4" : status_user == 2 ? "#00AA43" : "#6A0740"
128
+
129
+ function renderTypeTicket(item: any, i: number) {
130
+ const styleId_Z23v85x: any = { marginLeft: 5, flexWrap: 'wrap', fontFamily: 'SFProText', color: Number(item.debit) == 0 ? "#717171" : "#000" }
131
+ let itemSelected = item.price_id + item.ondate
132
+ let typeSelected = typeTicket?.price_id + typeTicket?.ondate
133
+ const isAllDate = item.ondate == '0000-00-00'
134
+ return (
135
+ <Pressable key={i} onPress={() => {
136
+ if (Number(item.debit) == 0) {
137
+ LibToastProperty.show(esp.lang("event/counter_send", "ticket_sold"))
138
+ } else {
139
+ inputAmount.current?.setText("")
140
+ setTypeTicket(item)
141
+ }
142
+ }} style={styleId_1eMW7i} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }}>
143
+ <LibIcon name={itemSelected == typeSelected ? "radiobox-marked" : "radiobox-blank"} color={Number(item.debit) == 0 ? "#717171" : itemSelected == typeSelected ? colorTheme : "#000"} />
144
+ <Text allowFontScaling={false} style={styleId_Z23v85x}>{item.price_name + " (" + (isAllDate ? esp.lang("event/counter_send", "all_date") : LibUtils.moment(item.ondate).localeFormat("D MMM YYYY")) + ") " + " (" + (Number(item?.debit) - Number(item?.credit)) + ")"}</Text>
145
+ </Pressable>
146
+ )
147
+ }
148
+
149
+ return (
150
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
151
+ <ComponentHeader title={esp.lang("event/counter_send", "header_title")} subtitle={status_user == 1 ? esp.lang("event/counter_send", "sub_eo") : status_user == 2 ? esp.lang("event/counter_send", "sub_lm") : esp.lang("event/counter_send", "sub_cashier")} />
152
+ <KeyboardAvoidingView style={{ flex: 1 }}>
153
+
154
+ <LibScroll style={{ flex: 1 }} onRefresh={loadData}>
155
+ <View style={{ margin: 15, backgroundColor: '#fff', padding: 10, borderRadius: 15, marginBottom: 0, flexDirection: 'row' }}>
156
+ <TouchableOpacity onPress={() => {
157
+ setType(1)
158
+ inputAmount.current?.setText("")
159
+ }} style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
160
+ <TouchableOpacity onPress={() => {
161
+ setType(1)
162
+ inputAmount.current?.setText("")
163
+ }} style={{ marginRight: 10 }} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }} >
164
+ <LibIcon name={type == 1 ? "radiobox-marked" : "radiobox-blank"} color={type == 1 ? colorTheme : "#000"} />
165
+ </TouchableOpacity>
166
+ <Text allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: 'SFProText', fontWeight: 'bold' }}>{esp.lang("event/counter_send", "text_money")}</Text>
167
+ </TouchableOpacity>
168
+ <TouchableOpacity onPress={() => {
169
+ setType(2)
170
+ inputAmount.current?.setText("")
171
+ }} style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
172
+ <TouchableOpacity onPress={() => {
173
+ setType(2)
174
+ inputAmount.current?.setText("")
175
+ }} style={{ marginRight: 10 }} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }} >
176
+ <LibIcon name={type == 2 ? "radiobox-marked" : "radiobox-blank"} color={type == 2 ? colorTheme : "#000"} />
177
+ </TouchableOpacity>
178
+ <Text allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: 'SFProText', fontWeight: 'bold' }}>{esp.lang("event/counter_send", "text_ticket")}</Text>
179
+ </TouchableOpacity>
180
+ </View>
181
+
182
+ {
183
+ type == 2 &&
184
+ <>
185
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between', margin: 15, marginBottom: 0 }}>
186
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold' }}>{esp.lang("event/counter_send", "ticket_type")}</Text>
187
+ </View>
188
+ {
189
+ error ?
190
+ <View style={{ margin: 15, borderRadius: 15, marginBottom: 0, backgroundColor: '#fff', overflow: 'hidden' }}>
191
+ <ComponentMessage message={error?.message} />
192
+ </View>
193
+ :
194
+ <View style={{ margin: 15, backgroundColor: '#fff', padding: 10, borderRadius: 15, marginBottom: 0, flexDirection: 'row', flexWrap: 'wrap' }}>
195
+ {
196
+ showLoading ?
197
+ <LibLoading />
198
+ :
199
+ resultTypeTicket?.map?.(renderTypeTicket)
200
+ }
201
+ </View>
202
+ }
203
+ </>
204
+ }
205
+
206
+ <View style={{ margin: 15, backgroundColor: '#fff', padding: 10, borderRadius: 15 }}>
207
+ <Text allowFontScaling={false} style={{ alignSelf: 'center', fontWeight: 'bold', fontFamily: 'SFProText' }}>{esp.lang("event/counter_send", "text_amount")}</Text>
208
+ <LibInput
209
+ ref={inputAmount}
210
+ keyboardType="phone-pad"
211
+ maskFrom="end"
212
+ mask="###.###.###.###.###"
213
+ onChangeText={(t) => {
214
+ if (parseInt(inputAmount.current!.getText()) > (Number(typeTicket?.debit) - Number(typeTicket?.credit))) {
215
+ inputAmount.current?.setError(esp.lang("event/counter_send", "available_ticket", LibUtils.number(Number(typeTicket?.debit) - Number(typeTicket?.credit))))
216
+ return false
217
+ }
218
+ }}
219
+ label=""
220
+ style={{ marginTop: -15, letterSpacing: 0, fontSize: 30, textAlign: 'center' }}
221
+ />
222
+
223
+ <LibInput_rectangle2
224
+ ref={inputNotes}
225
+ keyboardType="default"
226
+ placeholder={esp.lang("cashier/invoice", "label_note")}
227
+ maxLength={150}
228
+ onSubmitEditing={() => {
229
+ }}
230
+ inputStyle={{ marginTop: 10, height: 70, textAlignVertical: 'top' }} style={{ margin: 15, marginTop: 0, height: 70, textAlignVertical: 'top', borderRadius: 4 }} multiline />
231
+
232
+ </View>
233
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between', margin: 15, marginTop: 0, marginBottom: 10 }}>
234
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold' }}>{esp.lang("event/counter_send", "text_choose_user")}</Text>
235
+ </View>
236
+
237
+ {
238
+ selectedUser ?
239
+ <EventCounter_user_list_item
240
+ email={selectedUser?.email}
241
+ image={selectedUser?.image}
242
+ name={selectedUser?.name}
243
+ user_id={selectedUser?.user_id}
244
+ showType
245
+ type={selectedUser?.type}
246
+ showChange
247
+ onChange={() => {
248
+ LibNavigation.navigateForResult('event/counter_user_list', { event_id: event_id, is_navResult: true, status_user: status_user, is_ticket: type }).then((item) => {
249
+ setSelectedUser(item)
250
+ })
251
+ }}
252
+ />
253
+ :
254
+ <Pressable onPress={() => {
255
+ LibNavigation.navigateForResult('event/counter_user_list', { event_id: event_id, is_navResult: true, status_user: status_user, is_ticket: type }).then((item) => {
256
+ setSelectedUser(item)
257
+ })
258
+ }} style={{ margin: 15, marginBottom: 10, marginTop: 0, backgroundColor: '#fff', padding: 10, borderRadius: 15, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' }}>
259
+ <Text allowFontScaling={false} style={{ flexWrap: 'wrap', fontFamily: 'SFProText', fontWeight: 'bold' }}>{esp.lang("event/counter_send", "text_select_user")}</Text>
260
+ <LibIcon name={"chevron-right-circle-outline"} color={colorTheme} />
261
+ </Pressable>
262
+ }
263
+
264
+ </LibScroll>
265
+
266
+ <ComponentButton label={esp.lang("event/counter_send", "btn_send")} onPress={() => {
267
+ if (checkInput()) {
268
+ sendRequest()
269
+ }
270
+ }} backgroundColor={colorTheme} style={{ margin: 15 }} />
271
+
272
+ </KeyboardAvoidingView>
273
+
274
+ </View >
275
+ )
276
+ }
277
+ const styleId_1eMW7i: any = { marginBottom: 5, marginTop: 5, marginRight: 10, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'center' }
@@ -0,0 +1,32 @@
1
+ // useLibs
2
+ import esp from 'esoftplay/esp';
3
+
4
+
5
+ // noPage
6
+ export interface EventCounter_statusProps {
7
+ text: string,
8
+ code: number
9
+ }
10
+
11
+
12
+ export default function m(): EventCounter_statusProps[] {
13
+ return [
14
+ {
15
+ text: esp.lang("event/counter_status", "waiting_confirm"),
16
+ code: 1,
17
+ },
18
+ {
19
+ text: esp.lang("event/counter_status", "received"),
20
+ code: 2,
21
+ },
22
+ {
23
+ text: esp.lang("event/counter_status", "cancel"),
24
+ code: 3,
25
+ },
26
+ {
27
+ text: esp.lang("event/counter_status", "expierd"),
28
+ code: 4,
29
+ },
30
+
31
+ ]
32
+ }
@@ -0,0 +1,23 @@
1
+ // useLibs
2
+ // noPage
3
+ import esp from 'esoftplay/esp';
4
+
5
+
6
+ export interface EventCounter_typeProps {
7
+ id: any,
8
+ title: string
9
+ }
10
+
11
+
12
+ export default function m(): EventCounter_typeProps[] {
13
+ return [
14
+ {
15
+ id: 1,
16
+ title: esp.lang("event/counter_type", "ticket")
17
+ },
18
+ {
19
+ id: 2,
20
+ title: esp.lang("event/counter_type", "money")
21
+ },
22
+ ]
23
+ }
@@ -0,0 +1,197 @@
1
+ // withHooks
2
+ import { applyStyle } from 'esoftplay';
3
+ import { ComponentButton } from 'esoftplay/cache/component/button/import';
4
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
5
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
6
+ import { ComponentSlidingup } from 'esoftplay/cache/component/slidingup/import';
7
+ import { EventCounter_eoProperty } from 'esoftplay/cache/event/counter_eo/import';
8
+ import { EventCounter_user_list_item } from 'esoftplay/cache/event/counter_user_list_item/import';
9
+ import { LibCollaps } from 'esoftplay/cache/lib/collaps/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 { LibList } from 'esoftplay/cache/lib/list/import';
15
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
16
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
17
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
18
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
19
+ import { UserPopup } from 'esoftplay/cache/user/popup/import';
20
+ import esp from 'esoftplay/esp';
21
+ import useSafeState from 'esoftplay/state';
22
+
23
+ import React, { useEffect, useRef } from 'react';
24
+ import { Text, TouchableOpacity, View } from 'react-native';
25
+
26
+
27
+ export interface EventCounter_user_listArgs {
28
+
29
+ }
30
+ export interface EventCounter_user_listProps {
31
+
32
+ }
33
+ export default function m(props: EventCounter_user_listProps): any {
34
+ const { event_id, is_navResult, status_user, is_ticket } = LibNavigation.getArgsAll(props)
35
+ const dialogAdd = useRef<ComponentSlidingup>(null)
36
+ const dialogUser = useRef<ComponentSlidingup>(null)
37
+ const [result, setResult] = useSafeState<any>()
38
+ const [error, setError] = useSafeState<any>()
39
+
40
+ const [email, setEmail] = useSafeState<string>('')
41
+ const [counter, setCounter] = useSafeState<number>(1)
42
+
43
+ let url = status_user == 1 ? "event_eo_receiver?event_id=" + event_id + "&is_ticket=" + (is_ticket == 2 ? 1 : 0) : status_user == 2 ? "event_manager_receiver?event_id=" + event_id + "&is_ticket=" + (is_ticket == 2 ? 1 : 0) : "event_seller_receiver?event_id=" + event_id + "&is_ticket=" + (is_ticket == 2 ? 1 : 0)
44
+
45
+ useEffect(() => {
46
+ return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
47
+ }, [])
48
+
49
+ useEffect(() => {
50
+ loadData()
51
+ }, [])
52
+
53
+ function loadData() {
54
+ new LibCurl(url, null, (res, msg) => {
55
+ setResult(res)
56
+ }, (err) => {
57
+ setError(err)
58
+ // LibDialog.warning("Oops", err)
59
+ }, 1)
60
+ }
61
+
62
+ function addLM() {
63
+ let post = {
64
+ event_id: event_id,
65
+ email: email
66
+ }
67
+
68
+ LibDialog.confirm(esp.lang("event/counter_user_list", "add_lm_title"), esp.lang("event/counter_user_list", "add_lm_msg"), esp.lang("event/counter_user_list", "add_lm_confirm"), () => {
69
+ new LibCurl('event_manager_edit', post, (res, msg) => {
70
+ setCounter(counter + 1)
71
+ LibDialog.info(esp.lang("event/counter_user_list", "add_lm_ok"), msg)
72
+ dialogUser.current?.hide()
73
+ }, (error) => {
74
+ LibDialog.warning(esp.lang("event/counter_user_list", "add_lm_no"), error?.message)
75
+ dialogUser.current?.hide()
76
+ }, 1)
77
+ }, esp.lang("event/counter_user_list", "add_lm_cancel"), () => { })
78
+
79
+ }
80
+
81
+ function deleteLM(_email: string) {
82
+ let post = {
83
+ event_id: event_id,
84
+ email: _email
85
+ }
86
+
87
+ LibDialog.confirm(esp.lang("event/counter_user_list", "delete_lm_title"), esp.lang("event/counter_user_list", "delete_lm_msg"), esp.lang("event/counter_user_list", "delete_lm_confirm"), () => {
88
+ new LibCurl('event_manager_delete', post, (res, msg) => {
89
+ setCounter(counter + 1)
90
+ LibDialog.info(esp.lang("event/counter_user_list", "delete_lm_ok"), msg)
91
+ }, (error) => {
92
+ LibDialog.warning(esp.lang("event/counter_user_list", "delete_lm_no"), error?.message)
93
+ }, 1)
94
+ }, esp.lang("event/counter_user_list", "delete_lm_cancel"), () => { })
95
+ }
96
+
97
+ function renderUser(item2: any, i2: number) {
98
+ return (
99
+ <EventCounter_user_list_item {...item2} key={i2} onSelect={() => {
100
+ if (is_navResult) {
101
+ LibNavigation.sendBackResult(item2)
102
+ } else {
103
+
104
+ }
105
+ }} showDelete={is_navResult ? false : true} onDelete={() => deleteLM(item2.email)} />
106
+ )
107
+ }
108
+
109
+ function renderItem(item: any, i: number) {
110
+ if (item?.list_user?.length > 0) {
111
+ return (
112
+ <LibCollaps
113
+ header={(show) =>
114
+ <View style={applyStyle({ marginTop: 16, marginLeft: 15, marginRight: 15, marginBottom: 5, padding: 16, justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', flexDirection: 'row', borderRadius: 15, backgroundColor: '#fff', ...LibStyle.elevation(2) })}>
115
+ <Text allowFontScaling={false} style={applyStyle({ flex: 1, fontFamily: "Arial", fontSize: 16, fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" })}>{item.title}</Text>
116
+ <LibIcon name={!show ? "chevron-down" : "chevron-up"} />
117
+ </View>
118
+ } >
119
+ {
120
+ item?.list_user?.map(renderUser)
121
+ }
122
+ </LibCollaps>
123
+ )
124
+ } else {
125
+ return null
126
+ }
127
+ }
128
+
129
+ return (
130
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
131
+ <ComponentHeader title={esp.lang("event/counter_user_list", "header_title")} subtitle={status_user == 1 ? esp.lang("event/counter_user_list", "sub_eo") : status_user == 2 ? esp.lang("event/counter_user_list", "sub_lm") : esp.lang("event/counter_user_list", "sub_cashier")} />
132
+
133
+ <LibList
134
+ data={result}
135
+ ListHeaderComponent={
136
+ <View style={{ opacity: is_navResult ? 0 : 1, flexDirection: 'row', justifyContent: 'space-between', margin: 15, marginTop: is_navResult ? -10 : 0, marginBottom: 0 }}>
137
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16 }}>{esp.lang("event/counter_user_list", "locket_manager")}</Text>
138
+ <TouchableOpacity onPress={() => dialogAdd.current?.show()}>
139
+ <LibIcon name="plus-circle" color="#717171" />
140
+ </TouchableOpacity>
141
+ </View>
142
+ }
143
+ ListEmptyComponent={() => {
144
+ if (error) {
145
+ return (
146
+ <View style={{ margin: 15, borderRadius: 15, marginBottom: 0, backgroundColor: '#fff', overflow: 'hidden' }}>
147
+ <ComponentMessage message={error?.message} />
148
+ </View>
149
+ )
150
+ } else {
151
+ return (
152
+ <View style={{ flex: 1, height: LibStyle.height - (LibStyle.STATUSBAR_HEIGHT + 60), alignContent: 'center', alignItems: 'center', alignSelf: 'center', justifyContent: 'center' }}>
153
+ <LibLoading />
154
+ </View>
155
+ )
156
+ }
157
+ }}
158
+ renderItem={renderItem}
159
+ />
160
+
161
+ <ComponentSlidingup ref={dialogAdd}>
162
+ <View style={{ backgroundColor: '#fff', borderTopLeftRadius: 20, borderTopRightRadius: 20 }}>
163
+ <View style={{ height: 4, width: 32, borderRadius: 2, backgroundColor: "#C6C6C6", marginTop: 10, marginBottom: 10, alignSelf: 'center' }} />
164
+ <View style={{ margin: 15 }}>
165
+ <LibInput_rectangle
166
+ autoCapitalize="none"
167
+ onChangeText={(t) => {
168
+ LibUtils.debounce(() => {
169
+ setEmail(t)
170
+ }, 500)
171
+ }}
172
+ style={{ borderColor: '#c4c4c4', height: 35, marginTop: 8, borderRadius: 15, }}
173
+ placeholder={esp.lang("event/counter_user_list", "input_email")}
174
+ />
175
+ <ComponentButton label={esp.lang("event/counter_user_list", "btn_save")} style={{ borderRadius: 15, marginTop: 20 }} backgroundColor={LibStyle.colorGreen} onPress={() => {
176
+ if (EventCounter_eoProperty.checkEmail(email)) {
177
+ dialogAdd.current?.hide()
178
+ dialogUser.current?.show()
179
+ }
180
+ }} />
181
+ </View>
182
+ </View>
183
+ </ComponentSlidingup>
184
+
185
+ <ComponentSlidingup ref={dialogUser}>
186
+ <View style={{ backgroundColor: '#fff', borderTopLeftRadius: 20, borderTopRightRadius: 20 }}>
187
+ <View style={{ height: 4, width: 32, borderRadius: 2, backgroundColor: "#C6C6C6", marginTop: 10, marginBottom: 10, alignSelf: 'center' }} />
188
+ <UserPopup email={email.trim()} redirect={() => {
189
+ addLM()
190
+ }} cancel={() => {
191
+ dialogUser.current?.hide()
192
+ }} />
193
+ </View>
194
+ </ComponentSlidingup>
195
+ </View>
196
+ )
197
+ }