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.
- package/config.json +11 -0
- package/event/additional.tsx +188 -0
- package/event/additional_input.tsx +316 -0
- package/event/block_invitation.tsx +48 -0
- package/event/countdown.tsx +72 -0
- package/event/counter_cashier.tsx +180 -0
- package/event/counter_cashier_report.tsx +114 -0
- package/event/counter_cashier_sell.tsx +135 -0
- package/event/counter_eo.tsx +451 -0
- package/event/counter_history.tsx +74 -0
- package/event/counter_history_item.tsx +48 -0
- package/event/counter_info.tsx +96 -0
- package/event/counter_lm.tsx +273 -0
- package/event/counter_menu.tsx +85 -0
- package/event/counter_report.tsx +105 -0
- package/event/counter_report_breakdown.tsx +93 -0
- package/event/counter_report_detail.tsx +238 -0
- package/event/counter_report_detail_list.tsx +56 -0
- package/event/counter_request.tsx +136 -0
- package/event/counter_request_detail.tsx +211 -0
- package/event/counter_section.tsx +32 -0
- package/event/counter_send.tsx +277 -0
- package/event/counter_status.tsx +32 -0
- package/event/counter_type.tsx +23 -0
- package/event/counter_user_list.tsx +197 -0
- package/event/counter_user_list_item.tsx +143 -0
- package/event/coupon.tsx +124 -0
- package/event/coupon_claim.tsx +198 -0
- package/event/coupon_claim_detail.tsx +175 -0
- package/event/coupon_claim_history.tsx +279 -0
- package/event/coupon_claim_reimburse.tsx +111 -0
- package/event/coupon_claim_reimburse_history.tsx +72 -0
- package/event/coupon_claim_reimburse_history_detail.tsx +117 -0
- package/event/coupon_claim_staff.tsx +256 -0
- package/event/coupon_detail.tsx +98 -0
- package/event/coupon_event_list.tsx +77 -0
- package/event/coupon_generate.tsx +258 -0
- package/event/coupon_generate_event.tsx +79 -0
- package/event/coupon_generate_list.tsx +56 -0
- package/event/date_picker.tsx +152 -0
- package/event/detail.tsx +352 -0
- package/event/entrance.tsx +215 -0
- package/event/entrance_again.tsx +200 -0
- package/event/entrance_failed.tsx +190 -0
- package/event/entrance_idcard.tsx +203 -0
- package/event/entrance_list.tsx +264 -0
- package/event/entrance_list_item.tsx +88 -0
- package/event/entrance_log.tsx +130 -0
- package/event/entrance_success.tsx +155 -0
- package/event/entrance_warning.tsx +91 -0
- package/event/exchange_reward.tsx +31 -0
- package/event/exchange_reward_result.tsx +137 -0
- package/event/exchange_ticket.tsx +234 -0
- package/event/exchange_ticket_list.tsx +191 -0
- package/event/exchange_ticket_result.tsx +211 -0
- package/event/exit.tsx +91 -0
- package/event/exit_failed.tsx +135 -0
- package/event/exit_list.tsx +118 -0
- package/event/exit_log.tsx +131 -0
- package/event/exit_success.tsx +143 -0
- package/event/exit_temporary.tsx +226 -0
- package/event/hall_in.tsx +148 -0
- package/event/hall_in_failed.tsx +270 -0
- package/event/hall_in_list.tsx +222 -0
- package/event/hall_in_log.tsx +134 -0
- package/event/hall_in_success.tsx +132 -0
- package/event/hall_out.tsx +143 -0
- package/event/hall_out_failed.tsx +133 -0
- package/event/hall_out_list.tsx +215 -0
- package/event/hall_out_log.tsx +133 -0
- package/event/hall_out_success.tsx +130 -0
- package/event/list.tsx +219 -0
- package/event/list_filter.tsx +124 -0
- package/event/log.tsx +435 -0
- package/event/qc_idcard.tsx +209 -0
- package/event/qc_idcard_failed.tsx +78 -0
- package/event/qc_idcard_success.tsx +68 -0
- package/event/queue_out.tsx +186 -0
- package/event/queue_pricing.tsx +152 -0
- package/event/randomseat.tsx +33 -0
- package/event/review.tsx +117 -0
- package/event/review_add.tsx +342 -0
- package/event/review_detail.tsx +67 -0
- package/event/review_item.tsx +76 -0
- package/event/scan_item.tsx +66 -0
- package/event/schedule.tsx +135 -0
- package/event/seat.tsx +628 -0
- package/event/seat_autopick.tsx +120 -0
- package/event/seat_map.tsx +408 -0
- package/event/seat_map_matrix.tsx +94 -0
- package/event/seat_map_test.tsx +401 -0
- package/event/ticket_list.tsx +722 -0
- package/event/ticket_list2.tsx +680 -0
- package/event/timer.tsx +58 -0
- package/event/tms.tsx +103 -0
- package/event/tms_add.tsx +94 -0
- package/event/tms_add_result.tsx +175 -0
- package/event/tms_dashboard.tsx +89 -0
- package/event/tms_event_list.tsx +66 -0
- package/event/turnstile_event_gate.tsx +74 -0
- package/event/turnstile_event_item.tsx +41 -0
- package/event/turnstile_event_list.tsx +69 -0
- package/event/turnstile_event_ticket.tsx +95 -0
- package/event/turnstile_settings.tsx +327 -0
- package/event/turnstile_settings_otp.tsx +58 -0
- package/event/turnstile_settings_status.tsx +50 -0
- package/event/voucher.tsx +149 -0
- package/event/voucher_multi.tsx +181 -0
- package/fonts/Arial.ttf +0 -0
- package/fonts/ArialBold.ttf +0 -0
- package/fonts/DecoNumbers.ttf +0 -0
- package/fonts/MonoSpace.ttf +0 -0
- package/fonts/SFProText.ttf +0 -0
- package/fonts/digital.ttf +0 -0
- package/fonts/mono.ttf +0 -0
- package/id.json +1113 -0
- package/index.js +2 -0
- package/libs.json +1 -0
- package/mover.js +0 -0
- package/package.json +16 -0
- package/publisher.js +84 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
import { ComponentHeader } from 'esoftplay/cache/component/header/import';
|
|
3
|
+
import { LibInput } from 'esoftplay/cache/lib/input/import';
|
|
4
|
+
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
5
|
+
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
6
|
+
import moment from 'esoftplay/moment';
|
|
7
|
+
import { useRef } from 'react';
|
|
8
|
+
|
|
9
|
+
import { ComponentMessage } from 'esoftplay/cache/component/message/import';
|
|
10
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
11
|
+
import { LibInfinite } from 'esoftplay/cache/lib/infinite/import';
|
|
12
|
+
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
13
|
+
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
|
|
14
|
+
import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
|
|
15
|
+
import esp from 'esoftplay/esp';
|
|
16
|
+
import useLazyState from 'esoftplay/lazy';
|
|
17
|
+
import useSafeState from 'esoftplay/state';
|
|
18
|
+
import React from 'react';
|
|
19
|
+
import { Pressable, Text, View } from 'react-native';
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export interface EventCoupon_generateArgs {
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export interface EventCoupon_generateProps {
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
export default function m(props: EventCoupon_generateProps): any {
|
|
29
|
+
const { event_id, event_name, image } = LibNavigation.getArgsAll(props)
|
|
30
|
+
const [data, setData] = useLazyState<any>()
|
|
31
|
+
const [error, setError] = useLazyState<string>("")
|
|
32
|
+
const [t, setT] = useSafeState<number>(new Date().getTime())
|
|
33
|
+
const inputEmailRef = useRef<LibInput>(null)
|
|
34
|
+
const inputNominalRef = useRef<LibInput>(null)
|
|
35
|
+
const inputDescRef = useRef<LibInput>(null)
|
|
36
|
+
|
|
37
|
+
const infiniteRef = useRef<LibInfinite>(null)
|
|
38
|
+
|
|
39
|
+
const [coupon, setCoupon, getCoupon] = useLazyState<any>()
|
|
40
|
+
|
|
41
|
+
const imgWidth = LibStyle?.width - 50
|
|
42
|
+
const imgHeight = imgWidth / 1920 * 1080
|
|
43
|
+
|
|
44
|
+
function load() {
|
|
45
|
+
const curl = esp.mod("lib/curl")
|
|
46
|
+
new curl("event_coupon_admin_detail?event_id=" + event_id + "&coupon_id=" + getCoupon()?.coupon_id, null, (result, message) => {
|
|
47
|
+
setData(result)()
|
|
48
|
+
}, (error) => {
|
|
49
|
+
setError(error?.message)
|
|
50
|
+
}, 1)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function doSendVoucher() {
|
|
54
|
+
const email: any = inputEmailRef.current?.getText()
|
|
55
|
+
const amount = inputNominalRef.current?.getText()
|
|
56
|
+
const notes = inputDescRef.current?.getText()
|
|
57
|
+
|
|
58
|
+
if (email == "") {
|
|
59
|
+
esp.modProp("lib/toast").show(esp.lang("event/coupon_generate", "email_empty"))
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
let reg = /^[\w-.]+@([\w-]+.)+[\w-]{2,4}$/;
|
|
63
|
+
if (email && reg.test(email) === false) {
|
|
64
|
+
esp.modProp("lib/toast").show(esp.lang("event/coupon_generate", "email_invalid"))
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
if (amount == "") {
|
|
68
|
+
esp.modProp("lib/toast").show(esp.lang("event/coupon_generate", "nominal_empty"))
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let post: any = {
|
|
73
|
+
event_id,
|
|
74
|
+
coupon_id: getCoupon()?.coupon_id,
|
|
75
|
+
user_email_to: email,
|
|
76
|
+
amount: amount
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (notes != "") {
|
|
80
|
+
post["notes"] = notes
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const doSend = () => {
|
|
84
|
+
esp.mod("lib/progress").show(esp.lang("event/coupon_generate", "send_progress", email))
|
|
85
|
+
const curl = esp.mod("lib/curl")
|
|
86
|
+
new curl("event_coupon_admin_send", post, (result, message) => {
|
|
87
|
+
load()
|
|
88
|
+
setT(new Date().getTime())
|
|
89
|
+
inputEmailRef.current?.setText("")
|
|
90
|
+
inputNominalRef.current?.setText("")
|
|
91
|
+
inputDescRef.current?.setText("")
|
|
92
|
+
esp.mod("lib/progress").hide()
|
|
93
|
+
esp.modProp("lib/toast").show(message)
|
|
94
|
+
}, (error) => {
|
|
95
|
+
esp.mod("lib/progress").hide()
|
|
96
|
+
esp.mod("lib/dialog").warning(esp.lang("event/coupon_generate", "send_failed"), error?.message)
|
|
97
|
+
}, 1)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
esp.mod("lib/dialog").confirm(esp.lang("event/coupon_generate", "send_title"), esp.lang("event/coupon_generate", "send_msg", email), esp.lang("event/coupon_generate", "send_btn"), () => {
|
|
101
|
+
doSend()
|
|
102
|
+
}, esp.lang("event/coupon_generate", "send_cancel"), () => { })
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function buildUrl(url: string) {
|
|
107
|
+
if (t) {
|
|
108
|
+
url += url.includes('?') ? '&' : '?'
|
|
109
|
+
url += 't=' + t
|
|
110
|
+
}
|
|
111
|
+
return url
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<View style={{ flex: 1 }}>
|
|
116
|
+
<ComponentHeader title={esp.lang("event/coupon_generate", "header")} subtitle={event_name} />
|
|
117
|
+
{
|
|
118
|
+
<LibScroll onRefresh={() => infiniteRef.current?.loadData()}>
|
|
119
|
+
<View style={[{ backgroundColor: "white", marginHorizontal: 15, marginTop: 15, padding: 10, borderRadius: 10 }, LibStyle.elevation(3)]}>
|
|
120
|
+
<Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 14 }}>{event_name}</Text>
|
|
121
|
+
|
|
122
|
+
<View style={[{ marginTop: 5, borderRadius: 15, backgroundColor: '#fff' }, LibStyle.elevation(2)]}>
|
|
123
|
+
<LibPicture source={{ uri: image }} resizeMode="cover" style={{ height: imgHeight, width: imgWidth, borderRadius: 5 }} />
|
|
124
|
+
</View>
|
|
125
|
+
</View>
|
|
126
|
+
|
|
127
|
+
<View style={[{ backgroundColor: "white", marginHorizontal: 15, marginTop: 15, marginBottom: 10, padding: 10, borderRadius: 10 }, LibStyle.elevation(3)]}>
|
|
128
|
+
|
|
129
|
+
{
|
|
130
|
+
coupon &&
|
|
131
|
+
<View style={[{ marginBottom: 4, borderRadius: 10, backgroundColor: '#fff' }, LibStyle.elevation(2)]}>
|
|
132
|
+
<LibPicture source={{ uri: coupon?.image }} resizeMode="cover" style={{ height: (LibStyle.width - 50) * 0.43, width: LibStyle.width - 50, borderRadius: 10 }} />
|
|
133
|
+
<View style={{ backgroundColor: "rgba(0, 0, 0, 0.5)", position: 'absolute', borderBottomLeftRadius: 10, borderBottomRightRadius: 10, bottom: 0, left: 0, right: 0, padding: 10 }}>
|
|
134
|
+
<Text allowFontScaling={false} style={{ flex: 1, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{coupon?.coupon_title}</Text>
|
|
135
|
+
</View>
|
|
136
|
+
<View style={{ position: 'absolute', top: (((LibStyle.width - 50) * 0.43) / 2) - 10, marginBottom: 15, flexDirection: 'row', justifyContent: 'space-between' }} >
|
|
137
|
+
<View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginLeft: -9.5 }} />
|
|
138
|
+
<View style={{ flex: 1 }} />
|
|
139
|
+
<View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginRight: -9.5 }} />
|
|
140
|
+
</View>
|
|
141
|
+
</View>
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
<Pressable onPress={() => {
|
|
145
|
+
esp.mod("lib/navigation").navigateForResult("event/coupon_generate_list", { event_id }, 120).then((value) => {
|
|
146
|
+
setCoupon(value)()
|
|
147
|
+
load()
|
|
148
|
+
})
|
|
149
|
+
}} style={{ borderWidth: 1, borderColor: "#e6e6e6", height: 34, borderRadius: 10, marginTop: 10, flexDirection: "row", alignItems: "center", paddingHorizontal: 10 }}>
|
|
150
|
+
{
|
|
151
|
+
coupon ?
|
|
152
|
+
<>
|
|
153
|
+
<Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 14, flex: 1 }}>{coupon?.coupon_title}</Text>
|
|
154
|
+
<LibIcon name='pencil' size={18} />
|
|
155
|
+
</>
|
|
156
|
+
: <>
|
|
157
|
+
<Text allowFontScaling={false} style={{ flex: 1, fontFamily: "Arial", fontSize: 14 }}>{"Pilih Kupon"}</Text>
|
|
158
|
+
<LibIcon name='chevron-right' />
|
|
159
|
+
</>
|
|
160
|
+
}
|
|
161
|
+
</Pressable>
|
|
162
|
+
<View style={{ borderWidth: 1, borderColor: "#e6e6e6", height: 34, borderRadius: 10, marginTop: 10, flexDirection: "row", alignItems: "center", paddingHorizontal: 10 }}>
|
|
163
|
+
<Text>Rp. </Text>
|
|
164
|
+
<LibInput
|
|
165
|
+
ref={inputNominalRef}
|
|
166
|
+
base
|
|
167
|
+
placeholder={esp.lang("event/coupon_generate", "input_nominal")}
|
|
168
|
+
onChangeText={() => { }}
|
|
169
|
+
keyboardType='numeric'
|
|
170
|
+
mask='###.###.###.###.###.###.###.###.###.###'
|
|
171
|
+
maskFrom='end'
|
|
172
|
+
returnKeyType='next'
|
|
173
|
+
onSubmitEditing={() => {
|
|
174
|
+
inputEmailRef.current?.focus()
|
|
175
|
+
}}
|
|
176
|
+
style={{ flex: 1, paddingHorizontal: 5 }}
|
|
177
|
+
/>
|
|
178
|
+
</View>
|
|
179
|
+
<View style={{ borderWidth: 1, borderColor: "#e6e6e6", height: 34, borderRadius: 10, marginTop: 10 }}>
|
|
180
|
+
<LibInput
|
|
181
|
+
ref={inputEmailRef}
|
|
182
|
+
base
|
|
183
|
+
placeholder={esp.lang("event/coupon_generate", "input_email")}
|
|
184
|
+
onChangeText={() => { }}
|
|
185
|
+
keyboardType='email-address'
|
|
186
|
+
returnKeyType='next'
|
|
187
|
+
onSubmitEditing={() => {
|
|
188
|
+
inputDescRef.current?.focus()
|
|
189
|
+
}}
|
|
190
|
+
style={{ flex: 1, paddingHorizontal: 10 }}
|
|
191
|
+
/>
|
|
192
|
+
</View>
|
|
193
|
+
<View style={{ borderWidth: 1, borderColor: "#e6e6e6", height: 80, borderRadius: 10, marginVertical: 10 }}>
|
|
194
|
+
<LibInput
|
|
195
|
+
ref={inputDescRef}
|
|
196
|
+
base
|
|
197
|
+
placeholder={"notes"}
|
|
198
|
+
multiline
|
|
199
|
+
onChangeText={() => { }}
|
|
200
|
+
returnKeyType='go'
|
|
201
|
+
onSubmitEditing={doSendVoucher}
|
|
202
|
+
style={{ flex: 1, padding: 10, textAlignVertical: "top" }}
|
|
203
|
+
/>
|
|
204
|
+
</View>
|
|
205
|
+
<Pressable
|
|
206
|
+
onPress={() => {
|
|
207
|
+
if (getCoupon()) {
|
|
208
|
+
doSendVoucher()
|
|
209
|
+
} else {
|
|
210
|
+
esp.modProp("lib/toast").show("Silahkan pilih kupon terlebih dahulu")
|
|
211
|
+
}
|
|
212
|
+
}}
|
|
213
|
+
style={{ backgroundColor: coupon ? LibStyle.colorGreen : "#e6e6e6", height: 34, alignItems: "center", justifyContent: "center", paddingHorizontal: 10, borderRadius: 10 }}>
|
|
214
|
+
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: "white" }}>{esp.lang("event/coupon_generate", "btn_send")}</Text>
|
|
215
|
+
</Pressable>
|
|
216
|
+
{
|
|
217
|
+
data &&
|
|
218
|
+
<View style={{ marginTop: 10, flexDirection: "row", alignItems: "center", justifyContent: "space-between" }}>
|
|
219
|
+
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, color: "#606060" }}>{esp.lang("event/coupon_generate", "quota_left")}</Text>
|
|
220
|
+
<Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 16, letterSpacing: 1 }}>{`${data?.qty_claimed} / ${data?.qty}`}</Text>
|
|
221
|
+
</View>
|
|
222
|
+
}
|
|
223
|
+
</View>
|
|
224
|
+
{
|
|
225
|
+
data && coupon &&
|
|
226
|
+
<LibInfinite
|
|
227
|
+
ref={infiniteRef}
|
|
228
|
+
key={coupon?.coupon_id + buildUrl("event_coupon_admin_claimed?event_id=" + event_id + "&coupon_id=" + getCoupon()?.coupon_id)}
|
|
229
|
+
url={buildUrl("event_coupon_admin_claimed?event_id=" + event_id + "&coupon_id=" + getCoupon()?.coupon_id)}
|
|
230
|
+
errorView={(error: any) => (
|
|
231
|
+
<ComponentMessage message={error} />
|
|
232
|
+
)}
|
|
233
|
+
renderItem={(item, index) => (
|
|
234
|
+
<View style={[{ backgroundColor: "white", marginHorizontal: 15, marginTop: 10, marginBottom: 5, padding: 10, borderRadius: 10, flexDirection: "row", alignItems: "center" }, LibStyle.elevation(3)]}>
|
|
235
|
+
<View style={{ width: 36, height: 36, borderRadius: 18, backgroundColor: "#909090", alignItems: "center", justifyContent: "center" }}>
|
|
236
|
+
<LibIcon name='send' size={20} color='#f1f1f1' />
|
|
237
|
+
</View>
|
|
238
|
+
<View style={{ flex: 1, marginLeft: 10 }}>
|
|
239
|
+
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, marginBottom: 5 }}>{item?.coupon_title}</Text>
|
|
240
|
+
<Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 14 }}>{LibUtils.money(item?.amount)}</Text>
|
|
241
|
+
<View style={{ flexDirection: "row", marginVertical: 5 }}>
|
|
242
|
+
<Text allowFontScaling={false} style={{ flex: 1, fontFamily: "Arial", fontSize: 12 }}>{String(item?.user_email).toLowerCase()}</Text>
|
|
243
|
+
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, color: "#606060" }}>{moment(item?.claimed_time).localeFormat("DD MMM YYYY HH:mm:ss")}</Text>
|
|
244
|
+
</View>
|
|
245
|
+
{
|
|
246
|
+
item?.notes && item?.notes != "" &&
|
|
247
|
+
<Text allowFontScaling={false} style={{ marginTop: 3, fontFamily: "Arial", fontSize: 12, color: "#606060", letterSpacing: 1 }}>{item?.notes}</Text>
|
|
248
|
+
}
|
|
249
|
+
</View>
|
|
250
|
+
</View>
|
|
251
|
+
)}
|
|
252
|
+
/>
|
|
253
|
+
}
|
|
254
|
+
</LibScroll>
|
|
255
|
+
}
|
|
256
|
+
</View>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
import { ComponentHeader } from 'esoftplay/cache/component/header/import';
|
|
3
|
+
import { ComponentMessage } from 'esoftplay/cache/component/message/import';
|
|
4
|
+
import { LibList } from 'esoftplay/cache/lib/list/import';
|
|
5
|
+
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
|
|
6
|
+
import { LibSkeleton } from 'esoftplay/cache/lib/skeleton/import';
|
|
7
|
+
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
8
|
+
import esp from 'esoftplay/esp';
|
|
9
|
+
import useLazyState from 'esoftplay/lazy';
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { Pressable, Text, View } from 'react-native';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export interface EventCoupon_generate_eventArgs {
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
export interface EventCoupon_generate_eventProps {
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
export default function m(props: EventCoupon_generate_eventProps): any {
|
|
23
|
+
const [result, setResult] = useLazyState<any>()
|
|
24
|
+
const [error, setError] = useLazyState<string>("")
|
|
25
|
+
|
|
26
|
+
const imgWidth = LibStyle?.width - 30
|
|
27
|
+
const imgHeight = imgWidth / 1920 * 1080
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
loadEvent()
|
|
31
|
+
}, [])
|
|
32
|
+
|
|
33
|
+
function loadEvent() {
|
|
34
|
+
const curl = esp.mod("lib/curl")
|
|
35
|
+
new curl("event_coupon_admin_event", null,
|
|
36
|
+
(result) => {
|
|
37
|
+
if (result.length > 1) {
|
|
38
|
+
setResult(result)()
|
|
39
|
+
} else {
|
|
40
|
+
esp.mod("lib/navigation").replace("event/coupon_generate", { ...result?.[0] })
|
|
41
|
+
}
|
|
42
|
+
}, (error) => {
|
|
43
|
+
setError(error?.message)()
|
|
44
|
+
}, 1)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<View style={{ flex: 1 }}>
|
|
50
|
+
<ComponentHeader title={"Daftar Event"} />
|
|
51
|
+
{
|
|
52
|
+
(!result && error == "") ?
|
|
53
|
+
<LibSkeleton>
|
|
54
|
+
<LibSkeleton.BoxFull size={imgHeight} />
|
|
55
|
+
<LibSkeleton.BoxFull size={imgHeight} />
|
|
56
|
+
<LibSkeleton.BoxFull size={imgHeight} />
|
|
57
|
+
</LibSkeleton>
|
|
58
|
+
:
|
|
59
|
+
<LibList
|
|
60
|
+
onRefresh={loadEvent}
|
|
61
|
+
data={result}
|
|
62
|
+
ListEmptyComponent={
|
|
63
|
+
error != "" ? <ComponentMessage message={error} /> : null
|
|
64
|
+
}
|
|
65
|
+
renderItem={(item: any, index: number) => (
|
|
66
|
+
<Pressable key={index} onPress={() => {
|
|
67
|
+
esp.mod("lib/navigation").navigate("event/coupon_generate", { ...item })
|
|
68
|
+
}} style={{ marginHorizontal: 15, marginTop: 15 }} >
|
|
69
|
+
<LibPicture source={{ uri: item?.image }} style={{ width: imgWidth, height: imgHeight, borderRadius: 10, resizeMode: 'cover', backgroundColor: '#f1f2f3' }} />
|
|
70
|
+
<View style={{ backgroundColor: "rgba(0, 0, 0, 0.5)", position: 'absolute', borderBottomLeftRadius: 10, borderBottomRightRadius: 10, bottom: 0, left: 0, right: 0, padding: 10 }}>
|
|
71
|
+
<Text allowFontScaling={false} style={{ flex: 1, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{item?.event_name}</Text>
|
|
72
|
+
</View>
|
|
73
|
+
</Pressable>
|
|
74
|
+
)}
|
|
75
|
+
/>
|
|
76
|
+
}
|
|
77
|
+
</View>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ComponentHeader } from 'esoftplay/cache/component/header/import';
|
|
5
|
+
import { LibInfinite } from 'esoftplay/cache/lib/infinite/import';
|
|
6
|
+
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
|
|
7
|
+
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
8
|
+
import esp from 'esoftplay/esp';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Text, TouchableOpacity, View } from 'react-native';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export interface EventCoupon_generate_listArgs {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
export interface EventCoupon_generate_listProps {
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
export default function m(props: EventCoupon_generate_listProps): any {
|
|
20
|
+
|
|
21
|
+
const key = esp.mod("lib/navigation").getResultKey(props)
|
|
22
|
+
const event_id = esp.mod("lib/navigation").getArgs(props, "event_id")
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
return () => esp.mod("lib/navigation").cancelBackResult(key)
|
|
26
|
+
}, [])
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<View style={{ flex: 1 }}>
|
|
31
|
+
<ComponentHeader title='Daftar Kupon' subtitle='Daftar kupon dapat digenerate' notif />
|
|
32
|
+
<LibInfinite
|
|
33
|
+
url={'event_coupon_admin?event_id=' + event_id}
|
|
34
|
+
renderItem={(item, i) => {
|
|
35
|
+
return (
|
|
36
|
+
<View style={{ flex: 1 }} key={i}>
|
|
37
|
+
<TouchableOpacity onPress={() => {
|
|
38
|
+
esp.mod("lib/navigation").sendBackResult(item, key)
|
|
39
|
+
}} style={[{ marginBottom: 4, margin: 15, borderRadius: 10, backgroundColor: '#fff' }, LibStyle.elevation(2)]}>
|
|
40
|
+
<LibPicture source={{ uri: item?.image }} resizeMode="cover" style={{ height: (LibStyle.width - 30) * 0.43, width: LibStyle.width - 30, borderRadius: 10 }} />
|
|
41
|
+
<View style={{ backgroundColor: "rgba(0, 0, 0, 0.5)", position: 'absolute', borderBottomLeftRadius: 10, borderBottomRightRadius: 10, bottom: 0, left: 0, right: 0, padding: 10 }}>
|
|
42
|
+
<Text allowFontScaling={false} style={{ flex: 1, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{item?.coupon_title}</Text>
|
|
43
|
+
</View>
|
|
44
|
+
<View style={{ position: 'absolute', top: (((LibStyle.width - 30) * 0.43) / 2) - 10, marginBottom: 15, flexDirection: 'row', justifyContent: 'space-between' }} >
|
|
45
|
+
<View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginLeft: -9.5 }} />
|
|
46
|
+
<View style={{ flex: 1 }} />
|
|
47
|
+
<View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginRight: -9.5 }} />
|
|
48
|
+
</View>
|
|
49
|
+
</TouchableOpacity>
|
|
50
|
+
</View>
|
|
51
|
+
)
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
</View>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
import { ComponentButton } from 'esoftplay/cache/component/button/import';
|
|
3
|
+
import { ComponentHeader } from 'esoftplay/cache/component/header/import';
|
|
4
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/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
|
+
import useSafeState from 'esoftplay/state';
|
|
9
|
+
|
|
10
|
+
import moment from 'esoftplay/moment';
|
|
11
|
+
import React, { useEffect } from 'react';
|
|
12
|
+
import { Text, View } from 'react-native';
|
|
13
|
+
import CalendarPicker from 'react-native-calendar-picker';
|
|
14
|
+
|
|
15
|
+
export interface EventDate_pickerArgs {
|
|
16
|
+
ranged: 'ranged' | 'notrange'
|
|
17
|
+
}
|
|
18
|
+
export interface EventDate_pickerProps {
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
export default function m(props: EventDate_pickerProps): any {
|
|
22
|
+
const date_start = LibNavigation.getArgs(props, "date_start")
|
|
23
|
+
const date_end = LibNavigation.getArgs(props, "date_end")
|
|
24
|
+
const ranged = LibNavigation.getArgs(props, "ranged")
|
|
25
|
+
const { minDate, maxDate } = LibNavigation.getArgsAll(props)
|
|
26
|
+
const [selectedStartDate, setSelectedStartDate] = useSafeState<any>()
|
|
27
|
+
const [selectedEndDate, setSelectedEndDate] = useSafeState<any>()
|
|
28
|
+
|
|
29
|
+
const oneDay = 24 * 60 * 60 * 1000; // hours*minutes*seconds*milliseconds
|
|
30
|
+
const diffDays = Math.round(Math.abs((selectedStartDate - selectedEndDate) / oneDay));
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
|
|
34
|
+
}, [])
|
|
35
|
+
|
|
36
|
+
function onDateChange(date: any, type: any) {
|
|
37
|
+
if (type === 'END_DATE') {
|
|
38
|
+
setSelectedEndDate(date)
|
|
39
|
+
} else {
|
|
40
|
+
setSelectedStartDate(date)
|
|
41
|
+
setSelectedEndDate(null)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function customDayHeaders(dayOfWeek: any) {
|
|
46
|
+
switch (dayOfWeek) { // can also evaluate month, year
|
|
47
|
+
case 4: // Thursday
|
|
48
|
+
return {
|
|
49
|
+
style: {
|
|
50
|
+
borderRadius: 12,
|
|
51
|
+
backgroundColor: 'cyan',
|
|
52
|
+
},
|
|
53
|
+
textStyle: {
|
|
54
|
+
color: 'blue',
|
|
55
|
+
fontSize: 22,
|
|
56
|
+
fontWeight: 'bold',
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const customDatesStyles = (date: any) => {
|
|
63
|
+
switch (date.isoWeekday()) {
|
|
64
|
+
case 7: // Sunday
|
|
65
|
+
return {
|
|
66
|
+
textStyle: {
|
|
67
|
+
color: 'red',
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<View style={{ flex: 1, backgroundColor: '#fff' }}>
|
|
75
|
+
<ComponentHeader title={esp.lang("event/date_picker", "header_title")} />
|
|
76
|
+
<CalendarPicker
|
|
77
|
+
allowRangeSelection={ranged == 'ranged' ? true : false}
|
|
78
|
+
weekdays={[esp.lang("event/date_picker", "day_1"), esp.lang("event/date_picker", "day_2"), esp.lang("event/date_picker", "day_3"), esp.lang("event/date_picker", "day_4"), esp.lang("event/date_picker", "day_5"), esp.lang("event/date_picker", "day_6"), esp.lang("event/date_picker", "day_7")]}
|
|
79
|
+
months={[esp.lang("event/date_picker", "month_jan"), esp.lang("event/date_picker", "month_feb"), esp.lang("event/date_picker", "month_mar"), esp.lang("event/date_picker", "month_apr"), esp.lang("event/date_picker", "month_mei"), esp.lang("event/date_picker", "month_jun"), esp.lang("event/date_picker", "month_jul"), esp.lang("event/date_picker", "month_aug"), esp.lang("event/date_picker", "month_sept"), esp.lang("event/date_picker", "month_oct"), esp.lang("event/date_picker", "month_nov"), esp.lang("event/date_picker", "month_des")]}
|
|
80
|
+
previousComponent={
|
|
81
|
+
<LibIcon name={"chevron-left"} />
|
|
82
|
+
}
|
|
83
|
+
nextComponent={
|
|
84
|
+
<LibIcon name={"chevron-right"} />
|
|
85
|
+
}
|
|
86
|
+
customDatesStyles={customDatesStyles}
|
|
87
|
+
customDayHeaderStyles={(days: any) => customDayHeaders(days)}
|
|
88
|
+
selectedDayColor={'#ed6536'}
|
|
89
|
+
selectedDayTextColor="#fff"
|
|
90
|
+
onDateChange={onDateChange}
|
|
91
|
+
selectedStartDate={date_start}
|
|
92
|
+
selectedEndDate={date_end}
|
|
93
|
+
minDate={minDate ? minDate : new Date()}
|
|
94
|
+
maxDate={maxDate ? maxDate : LibUtils.moment().add(10, 'years').localeFormat("YYYY-MM-DD")}
|
|
95
|
+
/>
|
|
96
|
+
<View style={{ margin: 15, height: 1, backgroundColor: '#e3e3e3' }} />
|
|
97
|
+
{
|
|
98
|
+
ranged == 'ranged' ?
|
|
99
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginLeft: 15, marginRight: 15 }}>
|
|
100
|
+
{
|
|
101
|
+
selectedStartDate == undefined &&
|
|
102
|
+
<Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4b4b4b" }}>{esp.lang("event/date_picker", "select_date_start")}</Text>
|
|
103
|
+
}
|
|
104
|
+
{
|
|
105
|
+
selectedStartDate !== undefined && selectedEndDate == undefined &&
|
|
106
|
+
<Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#ed6536" }}>{esp.lang("event/date_picker", "select_date_end")}</Text>
|
|
107
|
+
}
|
|
108
|
+
</View>
|
|
109
|
+
:
|
|
110
|
+
<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginLeft: 15, marginRight: 15 }}>
|
|
111
|
+
<Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4b4b4b" }}>{esp.lang("event/date_picker", "select_date")}</Text>
|
|
112
|
+
</View>
|
|
113
|
+
}
|
|
114
|
+
{
|
|
115
|
+
ranged == 'ranged' ?
|
|
116
|
+
<>
|
|
117
|
+
{
|
|
118
|
+
selectedStartDate !== undefined && selectedEndDate !== null &&
|
|
119
|
+
<>
|
|
120
|
+
<View style={{ flexDirection: 'row', margin: 15, marginTop: 0, justifyContent: 'space-between' }}>
|
|
121
|
+
<Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#ed6536" }}>{moment(selectedStartDate).localeFormat("DD MMM YYYY") + " - " + moment(selectedEndDate).localeFormat("DD MMM YYYY")}</Text>
|
|
122
|
+
<Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#ed6536" }}>{esp.lang("event/date_picker", "day", String(Number(diffDays + 1)))}</Text>
|
|
123
|
+
</View>
|
|
124
|
+
<View style={{ margin: 15, marginTop: 0 }}>
|
|
125
|
+
<ComponentButton onPress={() => {
|
|
126
|
+
LibNavigation.sendBackResult({
|
|
127
|
+
date_start: moment(selectedStartDate).localeFormat("YYYY-MM-DD"),
|
|
128
|
+
date_end: moment(selectedEndDate).localeFormat("YYYY-MM-DD"),
|
|
129
|
+
date: moment(selectedStartDate).localeFormat("DD MMM YYYY") + " - " + moment(selectedEndDate).localeFormat("DD MMM YYYY") + esp.lang("event/date_picker", "days", String(Number(diffDays + 1)))
|
|
130
|
+
})
|
|
131
|
+
}} label={esp.lang("event/date_picker", "btn_save")} backgroundColor="#fff" borderColor="#51b596" fontColor="#51b596" />
|
|
132
|
+
</View>
|
|
133
|
+
</>
|
|
134
|
+
}
|
|
135
|
+
</>
|
|
136
|
+
:
|
|
137
|
+
<>
|
|
138
|
+
<View style={{ flexDirection: 'row', margin: 15, marginTop: 0, justifyContent: 'space-between' }}>
|
|
139
|
+
<Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#ed6536" }}>{moment(selectedStartDate).localeFormat("DD MMM YYYY")}</Text>
|
|
140
|
+
</View>
|
|
141
|
+
<View style={{ margin: 15, marginTop: 0 }}>
|
|
142
|
+
<ComponentButton onPress={() => {
|
|
143
|
+
LibNavigation.sendBackResult({
|
|
144
|
+
date_start: moment(selectedStartDate).localeFormat("YYYY-MM-DD")
|
|
145
|
+
})
|
|
146
|
+
}} label={esp.lang("event/date_picker", "btn_save!")} backgroundColor="#fff" borderColor="#51b596" fontColor="#51b596" />
|
|
147
|
+
</View>
|
|
148
|
+
</>
|
|
149
|
+
}
|
|
150
|
+
</View>
|
|
151
|
+
)
|
|
152
|
+
}
|