esoftplay-event 0.0.1-g → 0.0.1-h
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 +1 -1
- package/event/artistv2.tsx +97 -54
- package/event/order_detail.tsx +82 -15
- package/event/order_detail_visitor.tsx +10 -30
- package/event/order_share_to.tsx +1 -1
- package/event/seat.tsx +0 -1
- package/event/secure_page.debug.tsx +34 -0
- package/event/secure_page.live.tsx +35 -0
- package/event/secure_page.tsx +5 -6
- package/event/ticket_list.tsx +3 -6
- package/event/tms_in_failed.tsx +1 -1
- package/event/tms_out_failed.tsx +1 -1
- package/id.json +2 -0
- package/package.json +1 -1
- package/event/firebase_socket.debug.ts +0 -260
- package/event/firebase_socket.live.ts +0 -335
package/config.json
CHANGED
package/event/artistv2.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
|
|
3
|
-
import { applyStyle } from 'esoftplay';
|
|
4
3
|
import { EventCountdownProperty } from 'esoftplay/cache/event/countdown/import';
|
|
5
4
|
import { EventFirebase_socket, EventFirebase_socketProperty } from 'esoftplay/cache/event/firebase_socket/import';
|
|
6
5
|
import { EventHeader } from 'esoftplay/cache/event/header/import';
|
|
7
6
|
import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
|
|
8
7
|
import { EventMessage } from 'esoftplay/cache/event/message/import';
|
|
8
|
+
import { LibCarrousel } from 'esoftplay/cache/lib/carrousel/import';
|
|
9
9
|
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
10
10
|
import { LibList } from 'esoftplay/cache/lib/list/import';
|
|
11
11
|
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
@@ -41,7 +41,7 @@ export default function m(props: EventArtistv2Props): any {
|
|
|
41
41
|
/* get detail event untuk dapat config antrian */
|
|
42
42
|
|
|
43
43
|
// new LibCurl(url, null,
|
|
44
|
-
|
|
44
|
+
new LibCurl('v2/event_artist&event_id=411', null,
|
|
45
45
|
(res) => {
|
|
46
46
|
esp.log({ res });
|
|
47
47
|
new LibCurl(res?.[0]?.url_event || `event_detail/${res?.[0]?.event_id}`, null, (res) => {
|
|
@@ -77,67 +77,110 @@ export default function m(props: EventArtistv2Props): any {
|
|
|
77
77
|
is_subscribed_default: resultEvent?.config?.is_subscribed_default,
|
|
78
78
|
is_subscribed_label: resultEvent?.config?.is_subscribed_label
|
|
79
79
|
}
|
|
80
|
+
const width = LibStyle?.width
|
|
81
|
+
const sliderHeight = 0.50 * width
|
|
82
|
+
|
|
80
83
|
|
|
81
84
|
function renderItem(item: any, index: number) {
|
|
82
85
|
const styleId_Z2g4Hs7: any = { backgroundColor: '#FFC523', width: itemWidth, height: itemHeight, margin: 0.5, justifyContent: 'center', alignItems: 'center' }
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
86
|
+
|
|
87
|
+
if (item?.images?.length > 0) {
|
|
88
|
+
return (
|
|
89
|
+
<LibCarrousel
|
|
90
|
+
key={"p_slider"}
|
|
91
|
+
delay={4000}
|
|
92
|
+
style={{ height: sliderHeight, width: width }}
|
|
93
|
+
autoplay
|
|
94
|
+
>
|
|
95
|
+
{
|
|
96
|
+
item?.images?.map((item1: any, ii: number) => {
|
|
97
|
+
return (
|
|
98
|
+
<TouchableOpacity key={ii} onPress={() => {
|
|
99
|
+
esp.log("start");
|
|
100
|
+
EventIndexProperty.isLogin(async () => {
|
|
101
|
+
esp.log("1");
|
|
102
|
+
if (item.status == 1) {
|
|
103
|
+
esp.log("2");
|
|
104
|
+
if (isInPricingQueueConfig(item.event_id)) {
|
|
105
|
+
esp.log("3");
|
|
106
|
+
LibNavigation.navigateForResult('event/queue_pricing', { event_id: item?.event_id, autoPass: false })
|
|
107
|
+
}
|
|
108
|
+
esp.log("4");
|
|
109
|
+
EventCountdownProperty.countdownTime.set(moment().add(EventFirebase_socketProperty.eventQueueConfig.get(item?.event_id).time, 'seconds').localeFormat('YYYY-MM-DD HH:mm:ss'))
|
|
110
|
+
esp.log("5");
|
|
111
|
+
LibNavigation.navigate(item?.config?.hasOwnProperty('multiprice') && item?.config?.multiprice == 1 ?
|
|
112
|
+
'event/artist_detail_multi' :
|
|
113
|
+
'event/artist_detail', { url_price: item.url })
|
|
114
|
+
} else {
|
|
115
|
+
esp.log("6");
|
|
116
|
+
LibToastProperty.show(esp.lang("event/artist", "ticket_not_available"))
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
}} >
|
|
120
|
+
<LibPicture key={ii} source={{ uri: item1 }} style={{ height: sliderHeight, width: width, resizeMode: 'cover', backgroundColor: "#f1f2f3" }} />
|
|
121
|
+
</TouchableOpacity>
|
|
122
|
+
)
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
</LibCarrousel>
|
|
126
|
+
)
|
|
127
|
+
} else if (item?.images?.length == 1) {
|
|
128
|
+
return (
|
|
129
|
+
<TouchableOpacity key={index} onPress={() => {
|
|
130
|
+
esp.log("start");
|
|
131
|
+
EventIndexProperty.isLogin(async () => {
|
|
132
|
+
esp.log("1");
|
|
133
|
+
if (item.status == 1) {
|
|
134
|
+
esp.log("2");
|
|
135
|
+
if (isInPricingQueueConfig(item.event_id)) {
|
|
136
|
+
esp.log("3");
|
|
137
|
+
LibNavigation.navigateForResult('event/queue_pricing', { event_id: item?.event_id, autoPass: false })
|
|
138
|
+
}
|
|
139
|
+
esp.log("4");
|
|
140
|
+
EventCountdownProperty.countdownTime.set(moment().add(EventFirebase_socketProperty.eventQueueConfig.get(item?.event_id).time, 'seconds').localeFormat('YYYY-MM-DD HH:mm:ss'))
|
|
141
|
+
esp.log("5");
|
|
142
|
+
LibNavigation.navigate(item?.config?.hasOwnProperty('multiprice') && item?.config?.multiprice == 1 ?
|
|
143
|
+
'event/artist_detail_multi' :
|
|
144
|
+
'event/artist_detail', { url_price: item.url })
|
|
145
|
+
} else {
|
|
146
|
+
esp.log("6");
|
|
147
|
+
LibToastProperty.show(esp.lang("event/artist", "ticket_not_available"))
|
|
95
148
|
}
|
|
96
|
-
|
|
149
|
+
})
|
|
150
|
+
}} >
|
|
151
|
+
<LibPicture style={{ height: sliderHeight, width: width, resizeMode: 'cover', backgroundColor: "#f1f2f3" }} source={{ uri: item.images[0] }} />
|
|
152
|
+
</TouchableOpacity>
|
|
153
|
+
)
|
|
154
|
+
} else {
|
|
155
|
+
return (
|
|
156
|
+
<TouchableOpacity key={index} onPress={() => {
|
|
157
|
+
esp.log("start");
|
|
158
|
+
EventIndexProperty.isLogin(async () => {
|
|
159
|
+
esp.log("1");
|
|
160
|
+
if (item.status == 1) {
|
|
161
|
+
esp.log("2");
|
|
97
162
|
if (isInPricingQueueConfig(item.event_id)) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (item?.config?.hasOwnProperty('multiprice') && item?.config?.multiprice == 1) {
|
|
101
|
-
LibNavigation.navigate('event/artist_detail_multi', {
|
|
102
|
-
data: newItem,
|
|
103
|
-
subscribed: subs
|
|
104
|
-
})
|
|
105
|
-
} else {
|
|
106
|
-
LibNavigation.navigate('event/artist_detail', {
|
|
107
|
-
data: newItem,
|
|
108
|
-
subscribed: subs
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
} else {
|
|
113
|
-
if (item?.config?.hasOwnProperty('multiprice') && item?.config?.multiprice == 1) {
|
|
114
|
-
LibNavigation.navigate('event/artist_detail_multi', {
|
|
115
|
-
data: newItem,
|
|
116
|
-
subscribed: subs
|
|
117
|
-
})
|
|
118
|
-
} else {
|
|
119
|
-
LibNavigation.navigate('event/artist_detail', {
|
|
120
|
-
data: newItem,
|
|
121
|
-
subscribed: subs
|
|
122
|
-
})
|
|
123
|
-
}
|
|
163
|
+
esp.log("3");
|
|
164
|
+
LibNavigation.navigateForResult('event/queue_pricing', { event_id: item?.event_id, autoPass: false })
|
|
124
165
|
}
|
|
166
|
+
esp.log("4");
|
|
167
|
+
EventCountdownProperty.countdownTime.set(moment().add(EventFirebase_socketProperty.eventQueueConfig.get(item?.event_id).time, 'seconds').localeFormat('YYYY-MM-DD HH:mm:ss'))
|
|
168
|
+
esp.log("5");
|
|
169
|
+
LibNavigation.navigate(item?.config?.hasOwnProperty('multiprice') && item?.config?.multiprice == 1 ?
|
|
170
|
+
'event/artist_detail_multi' :
|
|
171
|
+
'event/artist_detail', { url_price: item.url })
|
|
125
172
|
} else {
|
|
126
|
-
|
|
173
|
+
esp.log("6");
|
|
174
|
+
LibToastProperty.show(esp.lang("event/artist", "ticket_not_available"))
|
|
127
175
|
}
|
|
128
176
|
})
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
<Text numberOfLines={2} style={styleId_2cYE4h}>{item.title}</Text>
|
|
137
|
-
</View>
|
|
138
|
-
}
|
|
139
|
-
</TouchableOpacity >
|
|
140
|
-
)
|
|
177
|
+
}} style={styleId_Z2g4Hs7}>
|
|
178
|
+
<Text numberOfLines={2} style={styleId_2cYE4h}>{item.title}</Text>
|
|
179
|
+
|
|
180
|
+
</TouchableOpacity>
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
|
|
141
184
|
}
|
|
142
185
|
|
|
143
186
|
return (
|
package/event/order_detail.tsx
CHANGED
|
@@ -20,6 +20,7 @@ import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
|
20
20
|
|
|
21
21
|
import { applyStyle } from 'esoftplay';
|
|
22
22
|
import { EventAlert } from 'esoftplay/cache/event/alert/import';
|
|
23
|
+
import { EventConfigProperty } from 'esoftplay/cache/event/config/import';
|
|
23
24
|
import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
|
|
24
25
|
import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
|
|
25
26
|
import { EventOrder_detail_upgrade_button } from 'esoftplay/cache/event/order_detail_upgrade_button/import';
|
|
@@ -28,6 +29,7 @@ import { EventQr_bg } from 'esoftplay/cache/event/qr_bg/import';
|
|
|
28
29
|
import { EventRating } from 'esoftplay/cache/event/rating/import';
|
|
29
30
|
import { EventSecure_page } from 'esoftplay/cache/event/secure_page/import';
|
|
30
31
|
import { EventStep } from 'esoftplay/cache/event/step/import';
|
|
32
|
+
import { LibGradient } from 'esoftplay/cache/lib/gradient/import';
|
|
31
33
|
import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
|
|
32
34
|
import { UseCondition } from 'esoftplay/cache/use/condition/import';
|
|
33
35
|
import esp from 'esoftplay/esp';
|
|
@@ -174,6 +176,7 @@ export default function m(props: EventOrder_detailProps): any {
|
|
|
174
176
|
}
|
|
175
177
|
|
|
176
178
|
useEffect(() => {
|
|
179
|
+
EventConfigProperty.curlConfig('v2/config_order_type')
|
|
177
180
|
loadData()
|
|
178
181
|
}, [])
|
|
179
182
|
|
|
@@ -202,21 +205,6 @@ export default function m(props: EventOrder_detailProps): any {
|
|
|
202
205
|
setDataReview(subs.getValue())
|
|
203
206
|
})
|
|
204
207
|
|
|
205
|
-
function doCancel(url: string): void {
|
|
206
|
-
LibDialog.warningConfirm(esp.lang("event/order_detail", "confirm"), esp.lang("event/order_detail", "cancel_this_order"), esp.lang("event/order_detail", "btn_yes"), () => {
|
|
207
|
-
LibProgress.show(esp.lang("event/order_detail", "please_wait"))
|
|
208
|
-
new LibCurl(url, null, (result: any, msg: any) => {
|
|
209
|
-
LibProgress.hide()
|
|
210
|
-
LibNavigation.back()
|
|
211
|
-
}, (error: any) => {
|
|
212
|
-
LibDialog.warning(esp.lang("event/order_detail", "cancel_err"), error?.message);
|
|
213
|
-
LibProgress.hide()
|
|
214
|
-
}, 1)
|
|
215
|
-
}, esp.lang("event/order_detail", "btn_cancel"), () => {
|
|
216
|
-
|
|
217
|
-
})
|
|
218
|
-
}
|
|
219
|
-
|
|
220
208
|
function addReturn(): void {
|
|
221
209
|
if (qty < Number(result.qty_returnable)) {
|
|
222
210
|
setQty(qty + 1)
|
|
@@ -243,6 +231,55 @@ export default function m(props: EventOrder_detailProps): any {
|
|
|
243
231
|
}, esp.lang("event/order_detail", "btn_cancel"), () => { })
|
|
244
232
|
}
|
|
245
233
|
|
|
234
|
+
function loadDataAddons(id: any, url: string) {
|
|
235
|
+
LibProgress.show(esp.lang("event/order_detail", "wait"))
|
|
236
|
+
new LibCurl(url, null, (res: any, msg: any) => {
|
|
237
|
+
esp.log({ res });
|
|
238
|
+
LibProgress.hide()
|
|
239
|
+
let dataBookingEvent = {
|
|
240
|
+
event_id: res?.event_id,
|
|
241
|
+
event_title: res?.event_name,
|
|
242
|
+
selected_ticket: {
|
|
243
|
+
price_id: res?.price_id,
|
|
244
|
+
currency: res?.currency,
|
|
245
|
+
tax: res?.tax,
|
|
246
|
+
fee: res?.fee,
|
|
247
|
+
fee_percent: res?.fee_percent,
|
|
248
|
+
term: res?.term,
|
|
249
|
+
has_addition: res?.has_addition,
|
|
250
|
+
list: {
|
|
251
|
+
ondate: res?.ondate,
|
|
252
|
+
price: res?.price,
|
|
253
|
+
price_id: res?.price_id,
|
|
254
|
+
currency: res?.currency,
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
qty: result?.qty
|
|
258
|
+
}
|
|
259
|
+
let fee_platform = {
|
|
260
|
+
fee_platform_amount: res?.fee_platform?.fee_platform_amount,
|
|
261
|
+
fee_platform_type: res?.fee_platform?.fee_platform_type
|
|
262
|
+
}
|
|
263
|
+
let show_fee_percentage = res?.show_fee_percentage
|
|
264
|
+
let tax = res?.tax
|
|
265
|
+
let order_type = EventConfigProperty.state().get()?.order_type?.ticket
|
|
266
|
+
let addons_id = id
|
|
267
|
+
let booking_id_ref = result?.id
|
|
268
|
+
LibNavigation.navigate('payment/ticket', {
|
|
269
|
+
order_type: order_type,
|
|
270
|
+
tax: tax,
|
|
271
|
+
fee_platform: fee_platform,
|
|
272
|
+
dataBookingEvent: dataBookingEvent,
|
|
273
|
+
show_fee_percentage,
|
|
274
|
+
addons_id,
|
|
275
|
+
booking_id_ref
|
|
276
|
+
})
|
|
277
|
+
}, (err: any) => {
|
|
278
|
+
LibProgress.hide()
|
|
279
|
+
esp.log({ err });
|
|
280
|
+
}, 1)
|
|
281
|
+
}
|
|
282
|
+
|
|
246
283
|
if (result == undefined && !coupons) {
|
|
247
284
|
return (
|
|
248
285
|
<View style={{ flex: 1, backgroundColor: '#f6f6f6' }}>
|
|
@@ -498,6 +535,36 @@ export default function m(props: EventOrder_detailProps): any {
|
|
|
498
535
|
}} />
|
|
499
536
|
</UseCondition>
|
|
500
537
|
|
|
538
|
+
|
|
539
|
+
{/* tombol add on */}
|
|
540
|
+
|
|
541
|
+
{
|
|
542
|
+
result?.addons?.length > 0 && result?.addons?.map((item: any, i: number) => {
|
|
543
|
+
return (
|
|
544
|
+
<TouchableOpacity key={i} onPress={() => {
|
|
545
|
+
loadDataAddons(item?.addons_id, item?.url)
|
|
546
|
+
}}>
|
|
547
|
+
<LibGradient
|
|
548
|
+
colors={["#F2789F", "#F9C5D5", "#F9C5D5", "#F2789F",]}
|
|
549
|
+
direction='top-to-bottom'
|
|
550
|
+
style={{ margin: 15, flexDirection: 'row', backgroundColor: '#F2789F', marginBottom: 0, borderWidth: 1, borderColor: 'red', borderRadius: 7, overflow: 'hidden' }}
|
|
551
|
+
>
|
|
552
|
+
<View style={{ padding: 10, paddingHorizontal: 15, borderTopLeftRadius: 7, borderBottomLeftRadius: 7 }}>
|
|
553
|
+
<LibIcon name='plus-circle' size={40} color='#fff' style={{ opacity: 1 }} />
|
|
554
|
+
</View>
|
|
555
|
+
<View style={{ flex: 1, backgroundColor: '#fff', borderTopRightRadius: 7, borderBottomRightRadius: 7, borderTopLeftRadius: 50, borderBottomLeftRadius: 50, alignContent: 'center', justifyContent: 'center', paddingLeft: 30 }}>
|
|
556
|
+
<Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: 'bold' }}>{item.title}</Text>
|
|
557
|
+
{
|
|
558
|
+
item.hasOwnProperty('subtitle') && item?.subtitle != "" &&
|
|
559
|
+
<Text allowFontScaling={false} numberOfLines={2} ellipsizeMode='tail' style={{ fontSize: 12, fontWeight: 'normal' }}>{item?.subtitle}</Text>
|
|
560
|
+
}
|
|
561
|
+
</View>
|
|
562
|
+
</LibGradient>
|
|
563
|
+
</TouchableOpacity>
|
|
564
|
+
)
|
|
565
|
+
})
|
|
566
|
+
}
|
|
567
|
+
|
|
501
568
|
{
|
|
502
569
|
// jika mau edit view dibawah ini, tekan ctrl + f terus paste prefik dibawah ini
|
|
503
570
|
// view_reviewed
|
|
@@ -32,7 +32,6 @@ export default function m(props: EventOrder_detail_visitorProps): any {
|
|
|
32
32
|
|
|
33
33
|
function loadData() {
|
|
34
34
|
new LibCurl(url, null, (res, msg) => {
|
|
35
|
-
esp.log({ res });
|
|
36
35
|
setResult(res)
|
|
37
36
|
}, (err) => {
|
|
38
37
|
setError(err)
|
|
@@ -106,11 +105,6 @@ export default function m(props: EventOrder_detail_visitorProps): any {
|
|
|
106
105
|
return finalResult
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
let filterBuyerVisitor = result?.tickets?.reduce((r: any, a: any) => {
|
|
110
|
-
r[a.email] = [...r[a.email] || [], a];
|
|
111
|
-
return r;
|
|
112
|
-
}, {});
|
|
113
|
-
|
|
114
108
|
return (
|
|
115
109
|
<View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
|
|
116
110
|
<EventHeader title={esp.lang("event/order_detail_visitor", "header")} />
|
|
@@ -123,44 +117,30 @@ export default function m(props: EventOrder_detail_visitorProps): any {
|
|
|
123
117
|
<ScrollView>
|
|
124
118
|
<View style={{ margin: 15, borderRadius: 10, backgroundColor: '#fff', padding: 10 }}>
|
|
125
119
|
{
|
|
126
|
-
|
|
120
|
+
result?.tickets?.map((item: any, i: number) => {
|
|
127
121
|
return (
|
|
128
122
|
<View key={i} style={{ marginLeft: 14, marginBottom: 15, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
|
|
129
123
|
<View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
|
|
130
124
|
<Text allowFontScaling={false} style={{ marginRight: 6, fontFamily: "Arial", fontSize: 30, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{i + 1}.</Text>
|
|
131
125
|
<View style={{ flex: 1 }} >
|
|
132
126
|
<Text allowFontScaling={false} style={{ fontFamily: "Arial", marginTop: 10, fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3" }}>{esp.lang("event/order_detail", "buyer_name")}</Text>
|
|
133
|
-
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }} ellipsizeMode='tail'>{item
|
|
127
|
+
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }} ellipsizeMode='tail'>{item?.name}</Text>
|
|
134
128
|
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3", marginTop: 10 }}>{esp.lang("event/order_detail", "phone_number")}</Text>
|
|
135
|
-
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }}>{item
|
|
129
|
+
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }}>{item?.phone == "" ? "-" : item?.phone.trim()}</Text>
|
|
136
130
|
</View>
|
|
137
131
|
</View>
|
|
138
|
-
<View style={{
|
|
139
|
-
|
|
140
|
-
|
|
132
|
+
<View style={{ alignContent: 'center', alignItems: 'center' }}>
|
|
133
|
+
{
|
|
134
|
+
item.hasOwnProperty('seat_name') && item?.seat_name != "" &&
|
|
135
|
+
<View style={{ paddingVertical: 5, paddingHorizontal: 7, borderWidth: 1, borderColor: '#000', backgroundColor: '#fff', borderRadius: 5, marginRight: 7 }}>
|
|
136
|
+
<Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: '#000' }}>{item.seat_name}</Text>
|
|
137
|
+
</View>
|
|
138
|
+
}
|
|
141
139
|
</View>
|
|
142
140
|
</View>
|
|
143
141
|
)
|
|
144
142
|
})
|
|
145
143
|
}
|
|
146
|
-
|
|
147
|
-
{
|
|
148
|
-
result?.flag?.use_seat == 1 &&
|
|
149
|
-
<>
|
|
150
|
-
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail", "seat_number")}</Text>
|
|
151
|
-
<View style={{ flexDirection: 'row', flexWrap: 'wrap', marginLeft: -10, padding: 10 }}>
|
|
152
|
-
{
|
|
153
|
-
result?.tickets?.map((item: any, i: number) => {
|
|
154
|
-
return (
|
|
155
|
-
<View key={i} style={{ paddingVertical: 5, paddingHorizontal: 7, borderWidth: 1, borderColor: '#000', backgroundColor: '#fff', borderRadius: 5, marginRight: 7 }}>
|
|
156
|
-
<Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: '#000' }}>{item.seat_name}</Text>
|
|
157
|
-
</View>
|
|
158
|
-
)
|
|
159
|
-
})
|
|
160
|
-
}
|
|
161
|
-
</View>
|
|
162
|
-
</>
|
|
163
|
-
}
|
|
164
144
|
</View>
|
|
165
145
|
|
|
166
146
|
{
|
package/event/order_share_to.tsx
CHANGED
package/event/seat.tsx
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// // useLibs
|
|
2
|
+
|
|
3
|
+
// import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
4
|
+
// import { useEffect } from 'react';
|
|
5
|
+
// import { CaptureProtection } from 'react-native-capture-protection';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// export interface EventSecure_pageProps {
|
|
9
|
+
|
|
10
|
+
// }
|
|
11
|
+
// export default function m(): any {
|
|
12
|
+
// const can_screencapture = UserClass.state().get('config', 'can_screencapture')
|
|
13
|
+
// // const focus = useIsFocused()
|
|
14
|
+
|
|
15
|
+
// useEffect(() => {
|
|
16
|
+
// let subs: any
|
|
17
|
+
// if (!__DEV__)
|
|
18
|
+
// if (can_screencapture != 1) {
|
|
19
|
+
// CaptureProtection.prevent();
|
|
20
|
+
// // subs = RNPrevent?.addListener?.(() => { })
|
|
21
|
+
// }
|
|
22
|
+
// return () => {
|
|
23
|
+
// if (!__DEV__)
|
|
24
|
+
// if (can_screencapture != 1) {
|
|
25
|
+
// setTimeout(() => {
|
|
26
|
+
// CaptureProtection.allow();
|
|
27
|
+
// }, 500);
|
|
28
|
+
// // subs?.remove?.()
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
// }, [])
|
|
32
|
+
|
|
33
|
+
// return null
|
|
34
|
+
// }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// // useLibs
|
|
2
|
+
|
|
3
|
+
// import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
4
|
+
// import { useEffect } from 'react';
|
|
5
|
+
// import RNPrevent from "react-native-screenshot-prevent";
|
|
6
|
+
|
|
7
|
+
// export interface EventSecure_pageProps {
|
|
8
|
+
|
|
9
|
+
// }
|
|
10
|
+
// export default function m(): any {
|
|
11
|
+
// const can_screencapture = UserClass.state().get('config', 'can_screencapture')
|
|
12
|
+
// // const focus = useIsFocused()
|
|
13
|
+
|
|
14
|
+
// useEffect(() => {
|
|
15
|
+
// let subs: any
|
|
16
|
+
// if (!__DEV__)
|
|
17
|
+
// if (can_screencapture != 1) {
|
|
18
|
+
// RNPrevent?.enabled?.(true)
|
|
19
|
+
// RNPrevent?.enableSecureView?.()
|
|
20
|
+
// // subs = RNPrevent?.addListener?.(() => { })
|
|
21
|
+
// }
|
|
22
|
+
// return () => {
|
|
23
|
+
// if (!__DEV__)
|
|
24
|
+
// if (can_screencapture != 1) {
|
|
25
|
+
// setTimeout(() => {
|
|
26
|
+
// RNPrevent?.disableSecureView?.()
|
|
27
|
+
// RNPrevent?.enabled?.(false)
|
|
28
|
+
// }, 500)
|
|
29
|
+
// // subs?.remove?.()
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
// }, [])
|
|
33
|
+
|
|
34
|
+
// return null
|
|
35
|
+
// }
|
package/event/secure_page.tsx
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { CaptureProtection } from 'react-native-capture-protection';
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
export interface EventSecure_pageProps {
|
|
8
9
|
|
|
@@ -15,17 +16,15 @@ export default function m(): any {
|
|
|
15
16
|
let subs: any
|
|
16
17
|
if (!__DEV__)
|
|
17
18
|
if (can_screencapture != 1) {
|
|
18
|
-
|
|
19
|
-
RNPrevent?.enableSecureView?.()
|
|
19
|
+
CaptureProtection.prevent();
|
|
20
20
|
// subs = RNPrevent?.addListener?.(() => { })
|
|
21
21
|
}
|
|
22
22
|
return () => {
|
|
23
23
|
if (!__DEV__)
|
|
24
24
|
if (can_screencapture != 1) {
|
|
25
25
|
setTimeout(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, 500)
|
|
26
|
+
CaptureProtection.allow();
|
|
27
|
+
}, 500);
|
|
29
28
|
// subs?.remove?.()
|
|
30
29
|
}
|
|
31
30
|
}
|
package/event/ticket_list.tsx
CHANGED
|
@@ -580,6 +580,7 @@ export default function m(props: EventTicket_listProps): any {
|
|
|
580
580
|
</TouchableOpacity>
|
|
581
581
|
}
|
|
582
582
|
<View style={{ flex: 1 }}>
|
|
583
|
+
|
|
583
584
|
{
|
|
584
585
|
availableResult?.price_type?.map?.((item: any, i: number) => {
|
|
585
586
|
let textOpacity = item?.status == 1 ? 1 : 0.3
|
|
@@ -592,8 +593,8 @@ export default function m(props: EventTicket_listProps): any {
|
|
|
592
593
|
return (
|
|
593
594
|
<Pressable onPress={() => {
|
|
594
595
|
|
|
595
|
-
}} key={i} style={{ overflow: 'hidden', margin: 15, marginBottom: 5, backgroundColor: '#fff', borderRadius:
|
|
596
|
-
<View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius:
|
|
596
|
+
}} key={i} style={{ overflow: 'hidden', margin: 15, marginBottom: 5, backgroundColor: '#fff', borderRadius: 5, borderWidth: 1.5, borderColor: selTic ? LibStyle.colorBlue : LibStyle.colorBgGrey }}>
|
|
597
|
+
<View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius: 5, borderTopRightRadius: 5 }}>
|
|
597
598
|
<View style={{ alignContent: 'center', alignItems: 'center', flexDirection: 'row', justifyContent: 'space-between', }}>
|
|
598
599
|
<View>
|
|
599
600
|
<EventHtmltext allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold' }}>{item.type}
|
|
@@ -608,10 +609,6 @@ export default function m(props: EventTicket_listProps): any {
|
|
|
608
609
|
: null
|
|
609
610
|
}
|
|
610
611
|
</View>
|
|
611
|
-
{/* {
|
|
612
|
-
item.use_quota == true &&
|
|
613
|
-
<Text allowFontScaling={false} style={{ fontWeight: 'bold', color: LibStyle.colorRed, fontSize: 12 }}>{parseInt(item.quota) == item.quota_used ? esp.lang("event/ticket_list", "empty") : (esp.lang("event/ticket_list", "qty_left",LibUtils.number(parseInt(item.quota) - item.quota_used)))}</Text>
|
|
614
|
-
} */}
|
|
615
612
|
{
|
|
616
613
|
item?.status != 1 &&
|
|
617
614
|
<View style={applyStyle({ flexDirection: 'row' })}>
|
package/event/tms_in_failed.tsx
CHANGED
|
@@ -145,7 +145,7 @@ export default function m(props: EventTms_in_failedProps): any {
|
|
|
145
145
|
<View style={{ flex: 1.2, justifyContent: 'center', paddingVertical: 5 }}>
|
|
146
146
|
{
|
|
147
147
|
item.scanned != "0000-00-00 00:00:00" &&
|
|
148
|
-
<Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 12 }}>{LibUtils.moment(item.scanned).localeFormat("DD MMM H:mm:ss ") + item.timezone_locale != "" ? item.timezone_locale : ""}</Text>
|
|
148
|
+
<Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 12 }}>{LibUtils.moment(item.scanned).localeFormat("DD MMM H:mm:ss ") + (item.timezone_locale != "" ? item.timezone_locale : "")}</Text>
|
|
149
149
|
}
|
|
150
150
|
</View>
|
|
151
151
|
<View style={{ flex: 2, justifyContent: 'center', borderLeftWidth: 1, borderColor: LibStyle.colorBgGrey, paddingVertical: 5 }}>
|
package/event/tms_out_failed.tsx
CHANGED
|
@@ -104,7 +104,7 @@ export default function m(props: EventTms_out_failedProps): any {
|
|
|
104
104
|
<View style={{ flex: 1, justifyContent: 'center', paddingVertical: 5 }}>
|
|
105
105
|
{
|
|
106
106
|
item.scanned != "0000-00-00 00:00:00" &&
|
|
107
|
-
<Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 12 }}>{LibUtils.moment(item.hall_scanned).localeFormat("DD MMM H:mm:ss ")}</Text>
|
|
107
|
+
<Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 12 }}>{LibUtils.moment(item.hall_scanned).localeFormat("DD MMM H:mm:ss ") + (item.timezone_locale != "" ? item.timezone_locale : "")}</Text>
|
|
108
108
|
}
|
|
109
109
|
</View>
|
|
110
110
|
</View>
|
package/id.json
CHANGED
|
@@ -982,6 +982,7 @@
|
|
|
982
982
|
"share_ticket": "Bagikan Tiket ke Temanmu",
|
|
983
983
|
"share_title": "Informasi",
|
|
984
984
|
"shared": "Sudah dibagikan",
|
|
985
|
+
"subtitle_addons": "Biar pengalamanmu makin lengkap",
|
|
985
986
|
"success_copied": "Berhasil Disalin ",
|
|
986
987
|
"thanks": "Thank you for your suggestion!!",
|
|
987
988
|
"ticket": "TIKET ",
|
|
@@ -992,6 +993,7 @@
|
|
|
992
993
|
"used": "digunakan",
|
|
993
994
|
"used_today": "digunakan hari ini, akan direset kembali besok pukul 05:00 WIB",
|
|
994
995
|
"virtual_account_number": "No.Virtual Account",
|
|
996
|
+
"wait": "Mohon tunggu",
|
|
995
997
|
"warning": "Peringatan"
|
|
996
998
|
},
|
|
997
999
|
"event/order_detail_payment": {
|
package/package.json
CHANGED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
// // noPage
|
|
2
|
-
// // useLibs
|
|
3
|
-
|
|
4
|
-
// import { getAuth } from '@react-native-firebase/auth';
|
|
5
|
-
// import { get, getDatabase, onValue, ref, set } from '@react-native-firebase/database';
|
|
6
|
-
// import { collection, getCountFromServer, getDocs, getFirestore, orderBy, query, where } from '@react-native-firebase/firestore';
|
|
7
|
-
// import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
|
|
8
|
-
// import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
9
|
-
// import { LibObject } from 'esoftplay/cache/lib/object/import';
|
|
10
|
-
// import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
11
|
-
// import esp from 'esoftplay/esp';
|
|
12
|
-
// import useGlobalState from 'esoftplay/global';
|
|
13
|
-
// import { createTimeout } from 'esoftplay/timeout';
|
|
14
|
-
|
|
15
|
-
// function getEventPath() {
|
|
16
|
-
// return "event" + (esp.isDebug("cc") ? "BBT" : "BBO")
|
|
17
|
-
// }
|
|
18
|
-
// function getRandomSuffix(time: number): number {
|
|
19
|
-
// return Number(time + "" + (Math.floor(Math.random() * 9000) + 1000))
|
|
20
|
-
// }
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// export const eventIdQueue = useGlobalState(0)
|
|
24
|
-
// export const eventQueueConfig = useGlobalState<any>({})
|
|
25
|
-
// const state = useGlobalState(0)
|
|
26
|
-
// export const lastKeyInPages = useGlobalState<string[]>([])
|
|
27
|
-
// export const userIdKeyReplacer = useGlobalState<any>({})
|
|
28
|
-
|
|
29
|
-
// export default function useFirebaseSocket() {
|
|
30
|
-
// const [status] = state.useState()
|
|
31
|
-
// const isDirect = EventTms_homeProperty.state()
|
|
32
|
-
|
|
33
|
-
// function isInLocal(state: any[], code: string) {
|
|
34
|
-
// const encodedCode = encodeURIComponent(code)
|
|
35
|
-
// return state.findIndex(([url, post]) => (post.qr == encodedCode || post.user_qr == encodedCode)) == -1 ? false : true
|
|
36
|
-
// }
|
|
37
|
-
|
|
38
|
-
// const auth = () => {
|
|
39
|
-
// return getAuth()
|
|
40
|
-
// }
|
|
41
|
-
// const db = () => {
|
|
42
|
-
// return getDatabase()
|
|
43
|
-
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
// const signInAnonym = () => { }
|
|
47
|
-
|
|
48
|
-
// // ini get yang di live
|
|
49
|
-
// async function _get(path: string, gate_id: string, onDone: (res: any) => void) {
|
|
50
|
-
// let hasDone = false
|
|
51
|
-
// if (isDirect.get()) {
|
|
52
|
-
// new LibCurl('gate_check/' + path + '?t=' + new Date().getTime(), { gate_id }, (res) => {
|
|
53
|
-
// hasDone = true
|
|
54
|
-
// onDone(res)
|
|
55
|
-
// }, (res) => {
|
|
56
|
-
// onDone(res)
|
|
57
|
-
// hasDone = true
|
|
58
|
-
// }, 1)
|
|
59
|
-
// return
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
|
-
// get(ref(getDatabase(), path))
|
|
63
|
-
// .then((sn) => {
|
|
64
|
-
// hasDone = true
|
|
65
|
-
// if (sn.exists()) {
|
|
66
|
-
// onDone(sn.val())
|
|
67
|
-
// } else {
|
|
68
|
-
// onDone(null)
|
|
69
|
-
// }
|
|
70
|
-
// })
|
|
71
|
-
// .catch((e) => {
|
|
72
|
-
// // if (e && !hasDone) {
|
|
73
|
-
// // getBackup(path, (res) => {
|
|
74
|
-
// // if (res) {
|
|
75
|
-
// // onDone(res)
|
|
76
|
-
// // } else {
|
|
77
|
-
// // onDone(null)
|
|
78
|
-
// // }
|
|
79
|
-
// // })
|
|
80
|
-
// // }
|
|
81
|
-
// })
|
|
82
|
-
// }
|
|
83
|
-
|
|
84
|
-
// function listenChangeTime(merchant_id: string, callback: (params: any) => void): () => void {
|
|
85
|
-
// const onChildChange = onValue(ref(getDatabase(), 'merchant_offline/' + merchant_id), (sn) => {
|
|
86
|
-
// if (sn.exists()) {
|
|
87
|
-
// callback(sn.val());
|
|
88
|
-
// }
|
|
89
|
-
// })
|
|
90
|
-
// return () => onChildChange
|
|
91
|
-
// }
|
|
92
|
-
|
|
93
|
-
// async function _set(path: string, data: any, onDone?: (res: any) => void) {
|
|
94
|
-
// const timeout = createTimeout()
|
|
95
|
-
// if (state.get() == 1)
|
|
96
|
-
// set(ref(getDatabase(), path), data)
|
|
97
|
-
// else
|
|
98
|
-
// timeout.set(() => {
|
|
99
|
-
// _set(path, data,)
|
|
100
|
-
// timeout.clear()
|
|
101
|
-
// }, 300);
|
|
102
|
-
// }
|
|
103
|
-
|
|
104
|
-
// function path(...paths: any[]): string {
|
|
105
|
-
// return paths.join('/')
|
|
106
|
-
// }
|
|
107
|
-
|
|
108
|
-
// function addQueue(path: string, event_id: string, onSuccess?: () => void) {
|
|
109
|
-
// const instance: any = esp.mod("firestore/index")().instance()
|
|
110
|
-
// const db = getFirestore(instance)
|
|
111
|
-
|
|
112
|
-
// if (userIdKeyReplacer.get()?.priority == 1) {
|
|
113
|
-
// const coll = collection(db, [getEventPath(), path, event_id].join('/'));
|
|
114
|
-
// const q = query(coll, orderBy('t', 'asc'), where("t", "==", userIdKeyReplacer.get().t));
|
|
115
|
-
// getDocs(q).then((doc) => {
|
|
116
|
-
// if (doc.size == 0) {
|
|
117
|
-
// LibToastProperty.show(esp.lang("event/firebase_socket", "priority_queue_used"))
|
|
118
|
-
// userIdKeyReplacer.set(LibObject.set(userIdKeyReplacer.get(), 0)('priority'))
|
|
119
|
-
// addQueue(path, event_id, onSuccess)
|
|
120
|
-
// } else if (doc.size == 1) {
|
|
121
|
-
// // console.log("SIJI")
|
|
122
|
-
// doc.forEach((d) => {
|
|
123
|
-
// userIdKeyReplacer.set(LibObject.set(userIdKeyReplacer.get(), d.id)('id'))
|
|
124
|
-
// updateQueueExp(path, event_id)
|
|
125
|
-
// new LibCurl('event_booking_waiting_allotment_use', { event_id: event_id })
|
|
126
|
-
// if (onSuccess) onSuccess?.()
|
|
127
|
-
// })
|
|
128
|
-
// } else {
|
|
129
|
-
// LibToastProperty.show("Antrian lebih dari 1", doc.size)
|
|
130
|
-
// }
|
|
131
|
-
// // console.log("SIZE", doc.size)
|
|
132
|
-
// })
|
|
133
|
-
// } else {
|
|
134
|
-
// // console.log("ora")
|
|
135
|
-
// if (userIdKeyReplacer.get()?.id)
|
|
136
|
-
// esp.mod("firestore/index")().deleteDocument?.(instance, [getEventPath?.(), path, event_id, userIdKeyReplacer.get()?.id], () => { }, (e) => { })
|
|
137
|
-
// const ctime = getDateTimebyGmt7().getTime()
|
|
138
|
-
// const time = getRandomSuffix(ctime)
|
|
139
|
-
// const data = { t: ctime, s: time }
|
|
140
|
-
// // console.log(data)
|
|
141
|
-
// esp.mod("firestore/index")().addCollection?.(instance, [getEventPath?.(), path, event_id], data, (dt) => {
|
|
142
|
-
// // console.log("KENE",)
|
|
143
|
-
// userIdKeyReplacer.set?.({
|
|
144
|
-
// id: dt?.id,
|
|
145
|
-
// ...data
|
|
146
|
-
// })
|
|
147
|
-
// if (onSuccess) onSuccess?.()
|
|
148
|
-
// }, (err) => {
|
|
149
|
-
// // console.log(err)
|
|
150
|
-
// })
|
|
151
|
-
// }
|
|
152
|
-
// }
|
|
153
|
-
|
|
154
|
-
// function getDateTimebyGmt7() {
|
|
155
|
-
// const ori = new Date()
|
|
156
|
-
// // const gmt = setTimeOffset(ori)
|
|
157
|
-
// return ori
|
|
158
|
-
// }
|
|
159
|
-
|
|
160
|
-
// // get weather function
|
|
161
|
-
|
|
162
|
-
// function getQueue(path: string, event_id: string, _limit: number, cb: (idx: number, key: string) => void) {
|
|
163
|
-
// const instance: any = esp.mod("firestore/index")().instance()
|
|
164
|
-
// const db = getFirestore(instance)
|
|
165
|
-
// const coll = collection(db, [getEventPath(), path, event_id].join('/'));
|
|
166
|
-
// const q = query(coll, orderBy('s', 'asc'), where("s", "<", userIdKeyReplacer.get().s));
|
|
167
|
-
|
|
168
|
-
// getCountFromServer(q).then((v) => {
|
|
169
|
-
// cb(v.data().count, userIdKeyReplacer.get().id)
|
|
170
|
-
// }).catch((e) => {
|
|
171
|
-
// getQueue(path, event_id, _limit, cb)
|
|
172
|
-
// console.log({ e })
|
|
173
|
-
// })
|
|
174
|
-
// // /* cleanup */
|
|
175
|
-
// // const cdate = getDateTimebyGmt7().getTime()
|
|
176
|
-
// // if (!cdate) {
|
|
177
|
-
// // LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_1"))
|
|
178
|
-
// // return
|
|
179
|
-
// // }
|
|
180
|
-
// // if (!_limit) {
|
|
181
|
-
// // LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_2"))
|
|
182
|
-
// // return
|
|
183
|
-
// // }
|
|
184
|
-
// // if (!userIdKeyReplacer?.get()?.s) {
|
|
185
|
-
// // LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_3"))
|
|
186
|
-
// // return
|
|
187
|
-
// // }
|
|
188
|
-
// // const exp = query(collection(instance, [getEventPath(), path, event_id].join('/')), where("t", "<", cdate - _limit), orderBy('t', 'asc'), limit(10));
|
|
189
|
-
// // const batch = writeBatch(instance);
|
|
190
|
-
// // getDocs(exp).then((expd) => {
|
|
191
|
-
// // expd.forEach((doc) => {
|
|
192
|
-
// // if (Number(doc.data().s) < Number(userIdKeyReplacer.get().s))
|
|
193
|
-
// // batch.delete(doc.ref)
|
|
194
|
-
// // // console.log(doc.data().t < cdate - limit, doc.data().t, cdate - limit, cdate - limit - doc.data().t)
|
|
195
|
-
// // // console.log('->' + moment(new Date(Number(doc.data().t))).localeFormat('DD MMMM YYYY HH:mm:ss'))
|
|
196
|
-
// // // console.log('-->' + moment(new Date(cdate - limit)).localeFormat('DD MMMM YYYY HH:mm:ss') + '\n\n')
|
|
197
|
-
// // })
|
|
198
|
-
// // batch.commit()
|
|
199
|
-
// // })
|
|
200
|
-
// // /* end cleanup */
|
|
201
|
-
// }
|
|
202
|
-
|
|
203
|
-
// function updateQueueExp(path: string, event_id: string) {
|
|
204
|
-
// const instance: any = esp.mod("firestore/index")().instance()
|
|
205
|
-
// esp.mod("firestore/index")().updateDocument(instance, [getEventPath(), path, event_id, userIdKeyReplacer.get().id], [{ key: 't', value: getDateTimebyGmt7().getTime() }], () => { }, (e) => {
|
|
206
|
-
// // updateQueueExp(path, event_id, key)
|
|
207
|
-
// })
|
|
208
|
-
// }
|
|
209
|
-
|
|
210
|
-
// function doneQueue(path: string, event_id: string, key: string, cb: Function) {
|
|
211
|
-
// if (key) {
|
|
212
|
-
// const instance: any = esp.mod("firestore/index")().instance()
|
|
213
|
-
// esp.mod("firestore/index")().deleteDocument(instance, [getEventPath(), path, event_id, key], () => {
|
|
214
|
-
// cb()
|
|
215
|
-
// userIdKeyReplacer.reset()
|
|
216
|
-
// }, (e) => {
|
|
217
|
-
// console.warn(e)
|
|
218
|
-
// })
|
|
219
|
-
// }
|
|
220
|
-
// }
|
|
221
|
-
|
|
222
|
-
// function isInPricingQueueConfig(event_id: string) {
|
|
223
|
-
// return eventQueueConfig.get(event_id) && eventQueueConfig.get(event_id).limit > 0
|
|
224
|
-
// }
|
|
225
|
-
|
|
226
|
-
// function useQueueConfigListener() {
|
|
227
|
-
// function action() {
|
|
228
|
-
// fetch(esp.config("events", "queue") + "?t=" + new Date().getTime(), { "method": "GET" })
|
|
229
|
-
// .then(res => res.json())
|
|
230
|
-
// .then((re) => {
|
|
231
|
-
// eventQueueConfig.set(re)
|
|
232
|
-
// })
|
|
233
|
-
// setTimeout(() => {
|
|
234
|
-
// action()
|
|
235
|
-
// }, 10000);
|
|
236
|
-
|
|
237
|
-
// }
|
|
238
|
-
// action()
|
|
239
|
-
// }
|
|
240
|
-
|
|
241
|
-
// return {
|
|
242
|
-
// status,
|
|
243
|
-
// auth,
|
|
244
|
-
// db,
|
|
245
|
-
// signInAnonymously: signInAnonym,
|
|
246
|
-
// get: _get,
|
|
247
|
-
// set: _set,
|
|
248
|
-
// isInLocal,
|
|
249
|
-
// // getQueueConfig,
|
|
250
|
-
// isInPricingQueueConfig,
|
|
251
|
-
// useQueueConfigListener,
|
|
252
|
-
// // isInBookingQueueConfig,
|
|
253
|
-
// addQueue,
|
|
254
|
-
// getQueue,
|
|
255
|
-
// doneQueue,
|
|
256
|
-
// updateQueueExp,
|
|
257
|
-
// listenChangeTime,
|
|
258
|
-
// path
|
|
259
|
-
// }
|
|
260
|
-
// }
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
// noPage
|
|
2
|
-
// useLibs
|
|
3
|
-
|
|
4
|
-
import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
|
|
5
|
-
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
6
|
-
import { LibObject } from 'esoftplay/cache/lib/object/import';
|
|
7
|
-
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
8
|
-
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
9
|
-
import { UserClass } from 'esoftplay/cache/user/class/import';
|
|
10
|
-
import esp from 'esoftplay/esp';
|
|
11
|
-
import useGlobalState from 'esoftplay/global';
|
|
12
|
-
import { createTimeout } from 'esoftplay/timeout';
|
|
13
|
-
import { initializeApp } from 'firebase/app';
|
|
14
|
-
import { createUserWithEmailAndPassword, getAuth, signInWithEmailAndPassword } from 'firebase/auth';
|
|
15
|
-
import { get, getDatabase, onValue, ref, set } from 'firebase/database';
|
|
16
|
-
import { collection, getCountFromServer, getDocs, orderBy, query, where } from 'firebase/firestore';
|
|
17
|
-
import { useLayoutEffect, useRef } from "react";
|
|
18
|
-
|
|
19
|
-
function readDeepObj(obj: any) {
|
|
20
|
-
return function (param?: string, ...params: string[]): any {
|
|
21
|
-
let out: any = obj
|
|
22
|
-
if (param) {
|
|
23
|
-
var _params = [param, ...params]
|
|
24
|
-
if (_params.length > 0)
|
|
25
|
-
for (let i = 0; i < _params.length; i++) {
|
|
26
|
-
out = out?.[_params[i]];
|
|
27
|
-
if (out == undefined) {
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return out;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
function getBackup(path: string, onDone: (res: any) => void): any {
|
|
39
|
-
// let data = stateBackup.get();
|
|
40
|
-
// const paths = path.split('/');
|
|
41
|
-
// onDone(readDeepObj(data)(...paths))
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var _installationID: any;
|
|
45
|
-
(async () => {
|
|
46
|
-
_installationID = await LibUtils.getInstallationID()
|
|
47
|
-
})();
|
|
48
|
-
|
|
49
|
-
function getEventPath() {
|
|
50
|
-
return "event" + (esp.isDebug("cc") ? "BBT" : "BBO")
|
|
51
|
-
}
|
|
52
|
-
function getRandomSuffix(time: number): number {
|
|
53
|
-
return Number(time + "" + (Math.floor(Math.random() * 9000) + 1000))
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
export const eventIdQueue = useGlobalState(0)
|
|
58
|
-
export const eventQueueConfig = useGlobalState<any>({})
|
|
59
|
-
const state = useGlobalState(0)
|
|
60
|
-
export const lastKeyInPages = useGlobalState<string[]>([])
|
|
61
|
-
export const userIdKeyReplacer = useGlobalState<any>({})
|
|
62
|
-
|
|
63
|
-
export default function useFirebaseSocket() {
|
|
64
|
-
const [status] = state.useState()
|
|
65
|
-
const userEmail = UserClass.state().useSelector(t => t?.email)
|
|
66
|
-
const userId = UserClass.state().useSelector(t => t?.id)
|
|
67
|
-
const app = useRef(initializeApp(esp.config().firebase, "BBOGATEv")).current
|
|
68
|
-
const db = useRef(getDatabase(app)).current
|
|
69
|
-
const auth = useRef(getAuth(app)).current
|
|
70
|
-
const isDirect = EventTms_homeProperty.state()
|
|
71
|
-
|
|
72
|
-
function initAppCustom() {
|
|
73
|
-
return esp.mod("firestore/index")().init("CUSTOM", esp.config().firebase)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
useLayoutEffect(() => {
|
|
77
|
-
if (state.get() == 0 && userEmail && userId) {
|
|
78
|
-
signInAnonym()
|
|
79
|
-
initAppCustom()
|
|
80
|
-
}
|
|
81
|
-
}, [userEmail, userId])
|
|
82
|
-
|
|
83
|
-
function signInAnonym(cb?: () => void) {
|
|
84
|
-
const pass = LibUtils.shorten(userEmail + "" + userId)
|
|
85
|
-
const password = esp.mod("firestore/index")().generatePassword(pass, userEmail)
|
|
86
|
-
|
|
87
|
-
if (state.get() == 1) {
|
|
88
|
-
cb?.()
|
|
89
|
-
return
|
|
90
|
-
} else
|
|
91
|
-
doSign(userEmail, password, cb)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function doSign(email: string, password: string, cb?: () => void) {
|
|
95
|
-
signInWithEmailAndPassword(auth, email, password).then(() => {
|
|
96
|
-
state.set(1)
|
|
97
|
-
cb?.()
|
|
98
|
-
}).catch((err) => {
|
|
99
|
-
if (err.code == "auth/user-not-found") {
|
|
100
|
-
doRegisterFirebase(email, password, cb)
|
|
101
|
-
} else {
|
|
102
|
-
throw "ERROR : " + err.code
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function doRegisterFirebase(email: string, password: string, cb?: () => void) {
|
|
108
|
-
createUserWithEmailAndPassword(auth, email, password)
|
|
109
|
-
.then((userCredential) => {
|
|
110
|
-
state.set(1)
|
|
111
|
-
cb?.()
|
|
112
|
-
})
|
|
113
|
-
.catch((error) => {
|
|
114
|
-
if (error.code == "auth/email-already-in-use") {
|
|
115
|
-
doSign(email, password, cb)
|
|
116
|
-
} else {
|
|
117
|
-
throw "ERROR : " + error.code
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function isInLocal(state: any[], code: string) {
|
|
123
|
-
const encodedCode = encodeURIComponent(code)
|
|
124
|
-
return state.findIndex(([url, post]) => (post.qr == encodedCode || post.user_qr == encodedCode)) == -1 ? false : true
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// ini get yang di live
|
|
128
|
-
async function _get(path: string, gate_id: string, onDone: (res: any) => void) {
|
|
129
|
-
let hasDone = false
|
|
130
|
-
if (isDirect.get()) {
|
|
131
|
-
new LibCurl('gate_check/' + path + '?t=' + new Date().getTime(), { gate_id }, (res) => {
|
|
132
|
-
hasDone = true
|
|
133
|
-
onDone(res)
|
|
134
|
-
}, (res) => {
|
|
135
|
-
onDone(res)
|
|
136
|
-
hasDone = true
|
|
137
|
-
}, 1)
|
|
138
|
-
return
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
get(ref(db, path))
|
|
142
|
-
.then((sn) => {
|
|
143
|
-
hasDone = true
|
|
144
|
-
if (sn.exists()) {
|
|
145
|
-
onDone(sn.val())
|
|
146
|
-
} else {
|
|
147
|
-
onDone(null)
|
|
148
|
-
}
|
|
149
|
-
})
|
|
150
|
-
.catch((e) => {
|
|
151
|
-
// if (e && !hasDone) {
|
|
152
|
-
// getBackup(path, (res) => {
|
|
153
|
-
// if (res) {
|
|
154
|
-
// onDone(res)
|
|
155
|
-
// } else {
|
|
156
|
-
// onDone(null)
|
|
157
|
-
// }
|
|
158
|
-
// })
|
|
159
|
-
// }
|
|
160
|
-
})
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function listenChangeTime(merchant_id: string, callback: (params: any) => void): () => void {
|
|
164
|
-
const onChildChange = onValue(ref(db, 'merchant_offline/' + merchant_id), (sn) => {
|
|
165
|
-
if (sn.exists()) {
|
|
166
|
-
callback(sn.val());
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
return () => onChildChange
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
async function _set(path: string, data: any, onDone?: (res: any) => void) {
|
|
173
|
-
const timeout = createTimeout()
|
|
174
|
-
if (state.get() == 1)
|
|
175
|
-
set(ref(db, path), data)
|
|
176
|
-
else
|
|
177
|
-
timeout.set(() => {
|
|
178
|
-
_set(path, data,)
|
|
179
|
-
timeout.clear()
|
|
180
|
-
}, 300);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function path(...paths: any[]): string {
|
|
184
|
-
return paths.join('/')
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function addQueue(path: string, event_id: string, onSuccess?: () => void) {
|
|
188
|
-
const instance = initAppCustom()
|
|
189
|
-
if (userIdKeyReplacer.get()?.priority == 1) {
|
|
190
|
-
const coll = collection(instance.db, [getEventPath(), path, event_id].join('/'));
|
|
191
|
-
const q = query(coll, orderBy('t', 'asc'), where("t", "==", userIdKeyReplacer.get().t));
|
|
192
|
-
getDocs(q).then((doc) => {
|
|
193
|
-
if (doc.size == 0) {
|
|
194
|
-
LibToastProperty.show(esp.lang("lib/firebase_socket", "priority_queue_used"))
|
|
195
|
-
userIdKeyReplacer.set(LibObject.set(userIdKeyReplacer.get(), 0)('priority'))
|
|
196
|
-
addQueue(path, event_id, onSuccess)
|
|
197
|
-
} else if (doc.size == 1) {
|
|
198
|
-
// console.log("SIJI")
|
|
199
|
-
doc.forEach((d) => {
|
|
200
|
-
userIdKeyReplacer.set(LibObject.set(userIdKeyReplacer.get(), d.id)('id'))
|
|
201
|
-
updateQueueExp(path, event_id)
|
|
202
|
-
new LibCurl('event_booking_waiting_allotment_use', { event_id: event_id })
|
|
203
|
-
if (onSuccess) onSuccess?.()
|
|
204
|
-
})
|
|
205
|
-
} else {
|
|
206
|
-
LibToastProperty.show("Antrian lebih dari 1", doc.size)
|
|
207
|
-
}
|
|
208
|
-
// console.log("SIZE", doc.size)
|
|
209
|
-
})
|
|
210
|
-
} else {
|
|
211
|
-
// console.log("ora")
|
|
212
|
-
if (userIdKeyReplacer.get()?.id)
|
|
213
|
-
esp.mod("firestore/index")().deleteDocument?.(instance.db, [getEventPath?.(), path, event_id, userIdKeyReplacer.get()?.id], () => { }, (e) => { })
|
|
214
|
-
const ctime = getDateTimebyGmt7().getTime()
|
|
215
|
-
const time = getRandomSuffix(ctime)
|
|
216
|
-
const data = { t: ctime, s: time }
|
|
217
|
-
// console.log(data)
|
|
218
|
-
esp.mod("firestore/index")().addCollection?.(instance.db, [getEventPath?.(), path, event_id], data, (dt) => {
|
|
219
|
-
// console.log("KENE",)
|
|
220
|
-
userIdKeyReplacer.set?.({
|
|
221
|
-
id: dt.id,
|
|
222
|
-
...data
|
|
223
|
-
})
|
|
224
|
-
if (onSuccess) onSuccess?.()
|
|
225
|
-
}, (err) => {
|
|
226
|
-
// console.log(err)
|
|
227
|
-
})
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function getDateTimebyGmt7() {
|
|
232
|
-
const ori = new Date()
|
|
233
|
-
// const gmt = setTimeOffset(ori)
|
|
234
|
-
return ori
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// get weather function
|
|
238
|
-
|
|
239
|
-
function getQueue(path: string, event_id: string, _limit: number, cb: (idx: number, key: string) => void) {
|
|
240
|
-
const instance = initAppCustom()
|
|
241
|
-
const coll = collection(instance.db, [getEventPath(), path, event_id].join('/'));
|
|
242
|
-
const q = query(coll, orderBy('s', 'asc'), where("s", "<", userIdKeyReplacer.get().s));
|
|
243
|
-
|
|
244
|
-
getCountFromServer(q).then((v) => {
|
|
245
|
-
cb(v.data().count, userIdKeyReplacer.get().id)
|
|
246
|
-
}).catch((e) => {
|
|
247
|
-
getQueue(path, event_id, _limit, cb)
|
|
248
|
-
console.log({ e })
|
|
249
|
-
})
|
|
250
|
-
// /* cleanup */
|
|
251
|
-
// const cdate = getDateTimebyGmt7().getTime()
|
|
252
|
-
// if (!cdate) {
|
|
253
|
-
// LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_1"))
|
|
254
|
-
// return
|
|
255
|
-
// }
|
|
256
|
-
// if (!_limit) {
|
|
257
|
-
// LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_2"))
|
|
258
|
-
// return
|
|
259
|
-
// }
|
|
260
|
-
// if (!userIdKeyReplacer?.get()?.s) {
|
|
261
|
-
// LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_3"))
|
|
262
|
-
// return
|
|
263
|
-
// }
|
|
264
|
-
// const exp = query(collection(instance.db, [getEventPath(), path, event_id].join('/')), where("t", "<", cdate - _limit), orderBy('t', 'asc'), limit(10));
|
|
265
|
-
// const batch = writeBatch(instance.db);
|
|
266
|
-
// getDocs(exp).then((expd) => {
|
|
267
|
-
// expd.forEach((doc) => {
|
|
268
|
-
// if (Number(doc.data().s) < Number(userIdKeyReplacer.get().s))
|
|
269
|
-
// batch.delete(doc.ref)
|
|
270
|
-
// // console.log(doc.data().t < cdate - limit, doc.data().t, cdate - limit, cdate - limit - doc.data().t)
|
|
271
|
-
// // console.log('->' + moment(new Date(Number(doc.data().t))).localeFormat('DD MMMM YYYY HH:mm:ss'))
|
|
272
|
-
// // console.log('-->' + moment(new Date(cdate - limit)).localeFormat('DD MMMM YYYY HH:mm:ss') + '\n\n')
|
|
273
|
-
// })
|
|
274
|
-
// batch.commit()
|
|
275
|
-
// })
|
|
276
|
-
// /* end cleanup */
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function updateQueueExp(path: string, event_id: string) {
|
|
280
|
-
const instance = initAppCustom()
|
|
281
|
-
esp.mod("firestore/index")().updateDocument(instance.db, [getEventPath(), path, event_id, userIdKeyReplacer.get().id], [{ key: 't', value: getDateTimebyGmt7().getTime() }], () => { }, (e) => {
|
|
282
|
-
// updateQueueExp(path, event_id, key)
|
|
283
|
-
})
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function doneQueue(path: string, event_id: string, key: string, cb: Function) {
|
|
287
|
-
if (key) {
|
|
288
|
-
const instance = initAppCustom()
|
|
289
|
-
esp.mod("firestore/index")().deleteDocument(instance.db, [getEventPath(), path, event_id, key], () => {
|
|
290
|
-
cb()
|
|
291
|
-
userIdKeyReplacer.reset()
|
|
292
|
-
}, () => {
|
|
293
|
-
console.warn()
|
|
294
|
-
})
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function isInPricingQueueConfig(event_id: string) {
|
|
299
|
-
return eventQueueConfig.get(event_id) && eventQueueConfig.get(event_id).limit > 0
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function useQueueConfigListener() {
|
|
303
|
-
function action() {
|
|
304
|
-
fetch(esp.config("events", "queue") + "?t=" + new Date().getTime(), { "method": "GET" })
|
|
305
|
-
.then(res => res.json())
|
|
306
|
-
.then((re) => {
|
|
307
|
-
eventQueueConfig.set(re)
|
|
308
|
-
});
|
|
309
|
-
setTimeout(() => {
|
|
310
|
-
action()
|
|
311
|
-
}, 10000);
|
|
312
|
-
}
|
|
313
|
-
action()
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
return {
|
|
317
|
-
status,
|
|
318
|
-
auth,
|
|
319
|
-
db,
|
|
320
|
-
signInAnonymously: signInAnonym,
|
|
321
|
-
get: _get,
|
|
322
|
-
set: _set,
|
|
323
|
-
isInLocal,
|
|
324
|
-
// getQueueConfig,
|
|
325
|
-
isInPricingQueueConfig,
|
|
326
|
-
useQueueConfigListener,
|
|
327
|
-
// isInBookingQueueConfig,
|
|
328
|
-
addQueue,
|
|
329
|
-
getQueue,
|
|
330
|
-
doneQueue,
|
|
331
|
-
updateQueueExp,
|
|
332
|
-
listenChangeTime,
|
|
333
|
-
path
|
|
334
|
-
}
|
|
335
|
-
}
|