esoftplay-event 0.0.0-a → 0.0.0-c
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/event/additional.tsx +4 -4
- package/event/additional_input.tsx +15 -15
- package/event/alert.tsx +32 -0
- package/event/artist.tsx +166 -0
- package/event/artist_detail.tsx +521 -0
- package/event/artist_detail_multi.tsx +548 -0
- package/event/badge.tsx +22 -0
- package/event/button.tsx +40 -0
- package/event/config.ts +4 -0
- package/event/countdown.tsx +5 -5
- package/event/countdown_base.tsx +83 -0
- package/event/counter_cashier.tsx +13 -13
- package/event/counter_cashier_report.tsx +6 -6
- package/event/counter_cashier_sell.tsx +7 -7
- package/event/counter_eo.tsx +21 -21
- package/event/counter_history.tsx +4 -4
- package/event/counter_lm.tsx +18 -18
- package/event/counter_report.tsx +4 -4
- package/event/counter_report_breakdown.tsx +2 -2
- package/event/counter_report_detail.tsx +15 -15
- package/event/counter_report_detail_list.tsx +4 -4
- package/event/counter_request.tsx +4 -4
- package/event/counter_request_detail.tsx +6 -6
- package/event/counter_send.tsx +9 -9
- package/event/counter_user_list.tsx +15 -15
- package/event/coupon.tsx +4 -4
- package/event/coupon_claim.tsx +4 -4
- package/event/coupon_claim_detail.tsx +8 -7
- package/event/coupon_claim_history.tsx +9 -9
- package/event/coupon_claim_reimburse.tsx +7 -8
- package/event/coupon_claim_reimburse_history.tsx +4 -4
- package/event/coupon_claim_reimburse_history_detail.tsx +4 -4
- package/event/coupon_claim_staff.tsx +10 -10
- package/event/coupon_detail.tsx +3 -3
- package/event/coupon_event_list.tsx +4 -4
- package/event/coupon_generate.tsx +4 -4
- package/event/coupon_generate_event.tsx +4 -4
- package/event/coupon_generate_list.tsx +2 -2
- package/event/date_picker.tsx +5 -5
- package/event/detail.tsx +12 -15
- package/event/entrance.tsx +17 -17
- package/event/entrance_again.tsx +22 -23
- package/event/entrance_failed.tsx +15 -15
- package/event/entrance_idcard.tsx +23 -23
- package/event/entrance_list.tsx +24 -24
- package/event/entrance_list_item.tsx +6 -6
- package/event/entrance_log.tsx +24 -24
- package/event/entrance_success.tsx +8 -8
- package/event/entrance_warning.tsx +14 -14
- package/event/exchange_reward.tsx +2 -2
- package/event/exchange_reward_result.tsx +7 -8
- package/event/exchange_ticket.tsx +11 -12
- package/event/exchange_ticket_list.tsx +10 -12
- package/event/exchange_ticket_result.tsx +11 -12
- package/event/exit.tsx +9 -9
- package/event/exit_failed.tsx +12 -12
- package/event/exit_list.tsx +15 -15
- package/event/exit_log.tsx +22 -22
- package/event/exit_success.tsx +8 -8
- package/event/exit_temporary.tsx +21 -21
- package/event/expander.tsx +36 -0
- package/event/fab.tsx +24 -0
- package/event/firebase_socket.ts +365 -0
- package/event/hall_in.tsx +13 -13
- package/event/hall_in_failed.tsx +22 -22
- package/event/hall_in_list.tsx +17 -17
- package/event/hall_in_log.tsx +24 -24
- package/event/hall_in_success.tsx +8 -8
- package/event/hall_out.tsx +13 -13
- package/event/hall_out_failed.tsx +11 -11
- package/event/hall_out_list.tsx +17 -17
- package/event/hall_out_log.tsx +24 -24
- package/event/hall_out_success.tsx +8 -8
- package/event/header.tsx +119 -0
- package/event/header_home.tsx +108 -0
- package/event/index.tsx +270 -0
- package/event/input_rectangle.tsx +208 -0
- package/event/item.tsx +40 -0
- package/event/label_input.tsx +23 -0
- package/event/list.tsx +20 -21
- package/event/list_filter.tsx +12 -13
- package/event/list_item.tsx +76 -0
- package/event/list_item2.tsx +78 -0
- package/event/loading_page.tsx +248 -0
- package/event/log.tsx +54 -54
- package/event/message.tsx +32 -0
- package/event/notice.tsx +41 -0
- package/event/order.tsx +323 -0
- package/event/order_detail.tsx +813 -0
- package/event/order_detail_payment.tsx +153 -0
- package/event/order_detail_upgrade.tsx +164 -0
- package/event/order_detail_upgrade_button.tsx +60 -0
- package/event/order_detail_upgrade_payment.tsx +221 -0
- package/event/order_detail_visitor.tsx +196 -0
- package/event/order_detail_waiting.tsx +520 -0
- package/event/order_history.tsx +101 -0
- package/event/order_item.tsx +118 -0
- package/event/order_lottery.tsx +172 -0
- package/event/order_reschedule.tsx +439 -0
- package/event/order_reschedule_list.tsx +85 -0
- package/event/order_share_to.tsx +219 -0
- package/event/order_share_to_detail.tsx +181 -0
- package/event/order_status.tsx +66 -0
- package/event/order_waiting.tsx +143 -0
- package/event/pending_trx.tsx +50 -0
- package/event/qc_idcard.tsx +12 -12
- package/event/qc_idcard_failed.tsx +4 -4
- package/event/qc_idcard_success.tsx +4 -4
- package/event/qr_bg.tsx +22 -0
- package/event/queue_out.tsx +3 -3
- package/event/queue_pricing.tsx +2 -3
- package/event/rating.tsx +49 -0
- package/event/rating_mini.tsx +35 -0
- package/event/refresh_button.tsx +40 -0
- package/event/review.tsx +3 -3
- package/event/review_add.tsx +8 -8
- package/event/review_detail.tsx +4 -4
- package/event/review_item.tsx +4 -4
- package/event/scan_item.tsx +2 -2
- package/event/schedule.tsx +8 -9
- package/event/seat.tsx +16 -18
- package/event/seat_autopick.tsx +4 -4
- package/event/seat_map.tsx +4 -4
- package/event/seat_map_test.tsx +2 -2
- package/event/section.tsx +35 -0
- package/event/section_menu.tsx +40 -0
- package/event/sheet.tsx +73 -0
- package/event/slider.tsx +46 -0
- package/event/step.tsx +29 -0
- package/event/ticket_list.tsx +15 -16
- package/event/ticket_list2.tsx +16 -17
- package/event/tms.tsx +4 -4
- package/event/tms_add.tsx +7 -8
- package/event/tms_add_result.tsx +4 -4
- package/event/tms_check_code.tsx +160 -0
- package/event/tms_check_ticket.tsx +72 -0
- package/event/tms_check_ticket_result.tsx +384 -0
- package/event/tms_dashboard.tsx +7 -7
- package/event/tms_event_list.tsx +46 -43
- package/event/tms_gate.tsx +96 -0
- package/event/tms_home.tsx +639 -0
- package/event/tms_idcard.tsx +203 -0
- package/event/tms_in.tsx +215 -0
- package/event/tms_in_again.tsx +199 -0
- package/event/tms_in_failed.tsx +190 -0
- package/event/tms_in_hall.tsx +148 -0
- package/event/tms_in_hall_failed.tsx +270 -0
- package/event/tms_in_hall_list.tsx +222 -0
- package/event/tms_in_hall_log.tsx +134 -0
- package/event/tms_in_hall_success.tsx +132 -0
- package/event/tms_in_list.tsx +264 -0
- package/event/tms_in_log.tsx +130 -0
- package/event/tms_in_success.tsx +155 -0
- package/event/tms_in_warning.tsx +91 -0
- package/event/tms_list_item.tsx +88 -0
- package/event/tms_log.tsx +435 -0
- package/event/tms_out.tsx +91 -0
- package/event/tms_out_failed.tsx +135 -0
- package/event/tms_out_hall.tsx +143 -0
- package/event/tms_out_hall_failed.tsx +133 -0
- package/event/tms_out_hall_list.tsx +215 -0
- package/event/tms_out_hall_log.tsx +133 -0
- package/event/tms_out_hall_success.tsx +130 -0
- package/event/tms_out_list.tsx +118 -0
- package/event/tms_out_log.tsx +131 -0
- package/event/tms_out_success.tsx +143 -0
- package/event/tms_out_temporary.tsx +226 -0
- package/event/toggle.tsx +30 -0
- package/event/transaction.ts +34 -0
- package/event/turnstile_event_gate.tsx +2 -2
- package/event/turnstile_event_list.tsx +4 -4
- package/event/turnstile_event_ticket.tsx +4 -4
- package/event/turnstile_settings.tsx +11 -11
- package/event/turnstile_settings_otp.tsx +4 -4
- package/event/turnstile_settings_status.tsx +2 -2
- package/event/voucher.tsx +9 -10
- package/event/voucher_multi.tsx +4 -5
- package/id.json +644 -0
- package/package.json +1 -1
|
@@ -0,0 +1,365 @@
|
|
|
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, useInterval } 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
|
+
let firebaseConfig = () => {
|
|
20
|
+
return esp.isDebug("") ?
|
|
21
|
+
/* test */{
|
|
22
|
+
apiKey: "AIzaSyD9CeY0yS2e3fZy-mp3A326HWMtqL-VbW8",
|
|
23
|
+
authDomain: "bbo-gate.firebaseapp.com",
|
|
24
|
+
databaseURL: "https://bbo-gate-default-rtdb.asia-southeast1.firebasedatabase.app/",
|
|
25
|
+
|
|
26
|
+
// apiKey: "AIzaSyB25Sbrf3Q4ysDyx95I65ibZLw47kz3_sc",
|
|
27
|
+
// authDomain: "bigbang-online.firebaseapp.com",
|
|
28
|
+
// databaseURL: "https://bigbang-online.firebaseio.com/",
|
|
29
|
+
}
|
|
30
|
+
:
|
|
31
|
+
/* live */{
|
|
32
|
+
apiKey: "AIzaSyB25Sbrf3Q4ysDyx95I65ibZLw47kz3_sc",
|
|
33
|
+
authDomain: "bigbang-online.firebaseapp.com",
|
|
34
|
+
databaseURL: "https://bigbang-online.firebaseio.com/",
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
function readDeepObj(obj: any) {
|
|
40
|
+
return function (param?: string, ...params: string[]): any {
|
|
41
|
+
let out: any = obj
|
|
42
|
+
if (param) {
|
|
43
|
+
var _params = [param, ...params]
|
|
44
|
+
if (_params.length > 0)
|
|
45
|
+
for (let i = 0; i < _params.length; i++) {
|
|
46
|
+
out = out?.[_params[i]];
|
|
47
|
+
if (out == undefined) {
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
function getBackup(path: string, onDone: (res: any) => void): any {
|
|
59
|
+
// let data = stateBackup.get();
|
|
60
|
+
// const paths = path.split('/');
|
|
61
|
+
// onDone(readDeepObj(data)(...paths))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var _installationID: any;
|
|
65
|
+
(async () => {
|
|
66
|
+
_installationID = await LibUtils.getInstallationID()
|
|
67
|
+
})();
|
|
68
|
+
|
|
69
|
+
function getEventPath() {
|
|
70
|
+
return "event" + (esp.isDebug("cc") ? "BBT" : "BBO")
|
|
71
|
+
}
|
|
72
|
+
function getRandomSuffix(time: number): number {
|
|
73
|
+
return Number(time + "" + (Math.floor(Math.random() * 9000) + 1000))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
export const eventIdQueue = useGlobalState(0)
|
|
78
|
+
export const eventQueueConfig = useGlobalState<any>({})
|
|
79
|
+
const state = useGlobalState(0)
|
|
80
|
+
export const lastKeyInPages = useGlobalState<string[]>([])
|
|
81
|
+
export const userIdKeyReplacer = useGlobalState<any>({})
|
|
82
|
+
|
|
83
|
+
export default function useFirebaseSocket() {
|
|
84
|
+
const [status] = state.useState()
|
|
85
|
+
const userEmail = UserClass.state().useSelector(t => t?.email)
|
|
86
|
+
const userId = UserClass.state().useSelector(t => t?.id)
|
|
87
|
+
const app = useRef(initializeApp(firebaseConfig(), "BBOGATEv")).current
|
|
88
|
+
const db = useRef(getDatabase(app)).current
|
|
89
|
+
const auth = useRef(getAuth(app)).current
|
|
90
|
+
const isDirect = EventTms_homeProperty.state()
|
|
91
|
+
|
|
92
|
+
function initAppCustom() {
|
|
93
|
+
return esp.mod("firestore/index")().init("CUSTOM", {
|
|
94
|
+
"apiKey": "AIzaSyB04JT4JJfFsArIccAjBEn1nwIlg8EVWx4",
|
|
95
|
+
"authDomain": "bigbang-online.firebaseapp.com",
|
|
96
|
+
"databaseURL": "https://bigbang-online.firebaseio.com/",
|
|
97
|
+
"storageBucket": "gs://bigbang-online.appspot.com/",
|
|
98
|
+
"projectId": "bigbang-online"
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
useLayoutEffect(() => {
|
|
103
|
+
if (state.get() == 0 && userEmail && userId) {
|
|
104
|
+
signInAnonym()
|
|
105
|
+
initAppCustom()
|
|
106
|
+
}
|
|
107
|
+
}, [userEmail, userId])
|
|
108
|
+
|
|
109
|
+
function signInAnonym(cb?: () => void) {
|
|
110
|
+
const pass = LibUtils.shorten(userEmail + "" + userId)
|
|
111
|
+
const password = esp.mod("firestore/index")().generatePassword(pass, userEmail)
|
|
112
|
+
|
|
113
|
+
if (state.get() == 1) {
|
|
114
|
+
cb?.()
|
|
115
|
+
return
|
|
116
|
+
} else
|
|
117
|
+
doSign(userEmail, password, cb)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function doSign(email: string, password: string, cb?: () => void) {
|
|
121
|
+
signInWithEmailAndPassword(auth, email, password).then(() => {
|
|
122
|
+
state.set(1)
|
|
123
|
+
cb?.()
|
|
124
|
+
}).catch((err) => {
|
|
125
|
+
if (err.code == "auth/user-not-found") {
|
|
126
|
+
doRegisterFirebase(email, password, cb)
|
|
127
|
+
} else {
|
|
128
|
+
throw "ERROR : " + err.code
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function doRegisterFirebase(email: string, password: string, cb?: () => void) {
|
|
134
|
+
createUserWithEmailAndPassword(auth, email, password)
|
|
135
|
+
.then((userCredential) => {
|
|
136
|
+
state.set(1)
|
|
137
|
+
cb?.()
|
|
138
|
+
})
|
|
139
|
+
.catch((error) => {
|
|
140
|
+
if (error.code == "auth/email-already-in-use") {
|
|
141
|
+
doSign(email, password, cb)
|
|
142
|
+
} else {
|
|
143
|
+
throw "ERROR : " + error.code
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function isInLocal(state: any[], code: string) {
|
|
149
|
+
const encodedCode = encodeURIComponent(code)
|
|
150
|
+
return state.findIndex(([url, post]) => (post.qr == encodedCode || post.user_qr == encodedCode)) == -1 ? false : true
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ini get yang di live
|
|
154
|
+
async function _get(path: string, gate_id: string, onDone: (res: any) => void) {
|
|
155
|
+
let hasDone = false
|
|
156
|
+
if (isDirect.get()) {
|
|
157
|
+
new LibCurl('gate_check/' + path + '?t=' + new Date().getTime(), { gate_id }, (res) => {
|
|
158
|
+
hasDone = true
|
|
159
|
+
onDone(res)
|
|
160
|
+
}, (res) => {
|
|
161
|
+
onDone(res)
|
|
162
|
+
hasDone = true
|
|
163
|
+
}, 1)
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
get(ref(db, path))
|
|
168
|
+
.then((sn) => {
|
|
169
|
+
hasDone = true
|
|
170
|
+
if (sn.exists()) {
|
|
171
|
+
onDone(sn.val())
|
|
172
|
+
} else {
|
|
173
|
+
onDone(null)
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
.catch((e) => {
|
|
177
|
+
// if (e && !hasDone) {
|
|
178
|
+
// getBackup(path, (res) => {
|
|
179
|
+
// if (res) {
|
|
180
|
+
// onDone(res)
|
|
181
|
+
// } else {
|
|
182
|
+
// onDone(null)
|
|
183
|
+
// }
|
|
184
|
+
// })
|
|
185
|
+
// }
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function listenChangeTime(merchant_id: string, callback: (params: any) => void): () => void {
|
|
190
|
+
const onChildChange = onValue(ref(db, 'merchant_offline/' + merchant_id), (sn) => {
|
|
191
|
+
if (sn.exists()) {
|
|
192
|
+
callback(sn.val());
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
return () => onChildChange
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async function _set(path: string, data: any, onDone?: (res: any) => void) {
|
|
199
|
+
const timeout = createTimeout()
|
|
200
|
+
if (state.get() == 1)
|
|
201
|
+
set(ref(db, path), data)
|
|
202
|
+
else
|
|
203
|
+
timeout.set(() => {
|
|
204
|
+
_set(path, data,)
|
|
205
|
+
timeout.clear()
|
|
206
|
+
}, 300);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function path(...paths: any[]): string {
|
|
210
|
+
return paths.join('/')
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function addQueue(path: string, event_id: string, onSuccess?: () => void) {
|
|
214
|
+
const instance = initAppCustom()
|
|
215
|
+
if (userIdKeyReplacer.get()?.priority == 1) {
|
|
216
|
+
const coll = collection(instance.db, [getEventPath(), path, event_id].join('/'));
|
|
217
|
+
const q = query(coll, orderBy('t', 'asc'), where("t", "==", userIdKeyReplacer.get().t));
|
|
218
|
+
getDocs(q).then((doc) => {
|
|
219
|
+
if (doc.size == 0) {
|
|
220
|
+
LibToastProperty.show(esp.lang("lib/firebase_socket", "priority_queue_used"))
|
|
221
|
+
userIdKeyReplacer.set(LibObject.set(userIdKeyReplacer.get(), 0)('priority'))
|
|
222
|
+
addQueue(path, event_id, onSuccess)
|
|
223
|
+
} else if (doc.size == 1) {
|
|
224
|
+
// console.log("SIJI")
|
|
225
|
+
doc.forEach((d) => {
|
|
226
|
+
userIdKeyReplacer.set(LibObject.set(userIdKeyReplacer.get(), d.id)('id'))
|
|
227
|
+
updateQueueExp(path, event_id)
|
|
228
|
+
new LibCurl('event_booking_waiting_allotment_use', { event_id: event_id })
|
|
229
|
+
if (onSuccess) onSuccess?.()
|
|
230
|
+
})
|
|
231
|
+
} else {
|
|
232
|
+
LibToastProperty.show("Antrian lebih dari 1", doc.size)
|
|
233
|
+
}
|
|
234
|
+
// console.log("SIZE", doc.size)
|
|
235
|
+
})
|
|
236
|
+
} else {
|
|
237
|
+
// console.log("ora")
|
|
238
|
+
if (userIdKeyReplacer.get()?.id)
|
|
239
|
+
esp.mod("firestore/index")().deleteDocument?.(instance.db, [getEventPath?.(), path, event_id, userIdKeyReplacer.get()?.id], () => { }, (e) => { })
|
|
240
|
+
const ctime = getDateTimebyGmt7().getTime()
|
|
241
|
+
const time = getRandomSuffix(ctime)
|
|
242
|
+
const data = { t: ctime, s: time }
|
|
243
|
+
// console.log(data)
|
|
244
|
+
esp.mod("firestore/index")().addCollection?.(instance.db, [getEventPath?.(), path, event_id], data, (dt) => {
|
|
245
|
+
// console.log("KENE",)
|
|
246
|
+
userIdKeyReplacer.set?.({
|
|
247
|
+
id: dt.id,
|
|
248
|
+
...data
|
|
249
|
+
})
|
|
250
|
+
if (onSuccess) onSuccess?.()
|
|
251
|
+
}, (err) => {
|
|
252
|
+
// console.log(err)
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function getDateTimebyGmt7() {
|
|
258
|
+
const ori = new Date()
|
|
259
|
+
// const gmt = setTimeOffset(ori)
|
|
260
|
+
return ori
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// get weather function
|
|
264
|
+
|
|
265
|
+
function getQueue(path: string, event_id: string, _limit: number, cb: (idx: number, key: string) => void) {
|
|
266
|
+
const instance = initAppCustom()
|
|
267
|
+
const coll = collection(instance.db, [getEventPath(), path, event_id].join('/'));
|
|
268
|
+
const q = query(coll, orderBy('s', 'asc'), where("s", "<", userIdKeyReplacer.get().s));
|
|
269
|
+
|
|
270
|
+
getCountFromServer(q).then((v) => {
|
|
271
|
+
cb(v.data().count, userIdKeyReplacer.get().id)
|
|
272
|
+
}).catch((e) => {
|
|
273
|
+
getQueue(path, event_id, _limit, cb)
|
|
274
|
+
console.log({ e })
|
|
275
|
+
})
|
|
276
|
+
// /* cleanup */
|
|
277
|
+
// const cdate = getDateTimebyGmt7().getTime()
|
|
278
|
+
// if (!cdate) {
|
|
279
|
+
// LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_1"))
|
|
280
|
+
// return
|
|
281
|
+
// }
|
|
282
|
+
// if (!_limit) {
|
|
283
|
+
// LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_2"))
|
|
284
|
+
// return
|
|
285
|
+
// }
|
|
286
|
+
// if (!userIdKeyReplacer?.get()?.s) {
|
|
287
|
+
// LibToastProperty.show(esp.lang("lib/firebase_socket", "something_wrong_3"))
|
|
288
|
+
// return
|
|
289
|
+
// }
|
|
290
|
+
// const exp = query(collection(instance.db, [getEventPath(), path, event_id].join('/')), where("t", "<", cdate - _limit), orderBy('t', 'asc'), limit(10));
|
|
291
|
+
// const batch = writeBatch(instance.db);
|
|
292
|
+
// getDocs(exp).then((expd) => {
|
|
293
|
+
// expd.forEach((doc) => {
|
|
294
|
+
// if (Number(doc.data().s) < Number(userIdKeyReplacer.get().s))
|
|
295
|
+
// batch.delete(doc.ref)
|
|
296
|
+
// // console.log(doc.data().t < cdate - limit, doc.data().t, cdate - limit, cdate - limit - doc.data().t)
|
|
297
|
+
// // console.log('->' + moment(new Date(Number(doc.data().t))).localeFormat('DD MMMM YYYY HH:mm:ss'))
|
|
298
|
+
// // console.log('-->' + moment(new Date(cdate - limit)).localeFormat('DD MMMM YYYY HH:mm:ss') + '\n\n')
|
|
299
|
+
// })
|
|
300
|
+
// batch.commit()
|
|
301
|
+
// })
|
|
302
|
+
// /* end cleanup */
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function updateQueueExp(path: string, event_id: string) {
|
|
306
|
+
const instance = initAppCustom()
|
|
307
|
+
esp.mod("firestore/index")().updateDocument(instance.db, [getEventPath(), path, event_id, userIdKeyReplacer.get().id], [{ key: 't', value: getDateTimebyGmt7().getTime() }], () => { }, (e) => {
|
|
308
|
+
// updateQueueExp(path, event_id, key)
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function doneQueue(path: string, event_id: string, key: string, cb: Function) {
|
|
313
|
+
if (key) {
|
|
314
|
+
const instance = initAppCustom()
|
|
315
|
+
esp.mod("firestore/index")().deleteDocument(instance.db, [getEventPath(), path, event_id, key], () => {
|
|
316
|
+
cb()
|
|
317
|
+
userIdKeyReplacer.reset()
|
|
318
|
+
}, () => {
|
|
319
|
+
console.warn()
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function isInPricingQueueConfig(event_id: string) {
|
|
325
|
+
return eventQueueConfig.get(event_id) && eventQueueConfig.get(event_id).limit > 0
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function useQueueConfigListener() {
|
|
329
|
+
function action() {
|
|
330
|
+
fetch(esp.isDebug("") ?
|
|
331
|
+
"https://storage.googleapis.com/bbo-images/images/modules/api/event_queue.json" + "?t=" + new Date().getTime() :
|
|
332
|
+
"https://storage.googleapis.com/bbo-images/bbo.co.id/images/modules/api/event_queue.json" + "?t=" + new Date().getTime(), { "method": "GET" })
|
|
333
|
+
.then(res => res.json())
|
|
334
|
+
.then((re) => {
|
|
335
|
+
eventQueueConfig.set(re)
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
}
|
|
339
|
+
const timeout = useInterval()
|
|
340
|
+
action()
|
|
341
|
+
timeout(() => {
|
|
342
|
+
action()
|
|
343
|
+
}, 10000)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return {
|
|
347
|
+
status,
|
|
348
|
+
auth,
|
|
349
|
+
db,
|
|
350
|
+
signInAnonymously: signInAnonym,
|
|
351
|
+
get: _get,
|
|
352
|
+
set: _set,
|
|
353
|
+
isInLocal,
|
|
354
|
+
// getQueueConfig,
|
|
355
|
+
isInPricingQueueConfig,
|
|
356
|
+
useQueueConfigListener,
|
|
357
|
+
// isInBookingQueueConfig,
|
|
358
|
+
addQueue,
|
|
359
|
+
getQueue,
|
|
360
|
+
doneQueue,
|
|
361
|
+
updateQueueExp,
|
|
362
|
+
listenChangeTime,
|
|
363
|
+
path
|
|
364
|
+
}
|
|
365
|
+
}
|
package/event/hall_in.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
|
|
5
5
|
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
6
6
|
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
7
7
|
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
@@ -12,18 +12,18 @@ import React from 'react';
|
|
|
12
12
|
import { View } from 'react-native';
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
export interface
|
|
15
|
+
export interface EventTms_in_hallArgs {
|
|
16
16
|
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface EventTms_in_hallProps {
|
|
19
19
|
|
|
20
20
|
}
|
|
21
|
-
export default function m(props:
|
|
21
|
+
export default function m(props: EventTms_in_hallProps): any {
|
|
22
22
|
const { scan_type, url_ticket_update, url_ticket_detail, price_type, gate_type, qr_code, event_id, selectGate, typeScanner, event_title, configPriority }: any = LibNavigation.getArgsAll<any>(props)
|
|
23
23
|
|
|
24
24
|
let args = {
|
|
25
25
|
selectGate: selectGate,
|
|
26
|
-
fromPage: '
|
|
26
|
+
fromPage: 'event/tms_home',
|
|
27
27
|
event_id: event_id,
|
|
28
28
|
event_title: event_title,
|
|
29
29
|
typeScanner: typeScanner,
|
|
@@ -39,7 +39,7 @@ export default function m(props: EventHall_inProps): any {
|
|
|
39
39
|
}, [])
|
|
40
40
|
|
|
41
41
|
function loadData() {
|
|
42
|
-
|
|
42
|
+
EventTms_homeProperty.addCounterHallInScan(1, "0")
|
|
43
43
|
|
|
44
44
|
var post = {
|
|
45
45
|
event_id: event_id,
|
|
@@ -92,7 +92,7 @@ export default function m(props: EventHall_inProps): any {
|
|
|
92
92
|
if (tiket.price_id == "staff") { // jika itu adalah id card
|
|
93
93
|
if (tiket.status_scanned == 2) {
|
|
94
94
|
/* 0 tidak diperbolehkan, 1 sudah didalam, 2 available */
|
|
95
|
-
LibNavigation.replace('event/
|
|
95
|
+
LibNavigation.replace('event/tms_idcard', {
|
|
96
96
|
selectedTicket: { ...tiket, key: qr_code },
|
|
97
97
|
hall: "in",
|
|
98
98
|
...args
|
|
@@ -102,11 +102,11 @@ export default function m(props: EventHall_inProps): any {
|
|
|
102
102
|
message: tiket.status_label,
|
|
103
103
|
result: tiket.scanned_detail
|
|
104
104
|
}
|
|
105
|
-
LibNavigation.replace('event/
|
|
105
|
+
LibNavigation.replace('event/tms_in_hall_failed', { msgError: err, ...args, postGetData: post })
|
|
106
106
|
}
|
|
107
107
|
} else { // jika itu adalah tiket
|
|
108
108
|
if (tiket.list?.length > 1) { // jika tiket itu mempunyai banyak qty
|
|
109
|
-
LibNavigation.replace('event/
|
|
109
|
+
LibNavigation.replace('event/tms_in_hall_list', { data: ticketsData, ...args })
|
|
110
110
|
} else { // jika tiket itu cuma 1 qty
|
|
111
111
|
let defaultUse = LibObject.set(tiket?.list, tiket?.list?.[0]?.status_scanned != 2 ? 1 : 0)(0, 'checked')
|
|
112
112
|
let a = defaultUse?.filter((item: any) => item.checked == 1 && item.status_scanned != 2).map((it: any) => it.id)
|
|
@@ -119,23 +119,23 @@ export default function m(props: EventHall_inProps): any {
|
|
|
119
119
|
}
|
|
120
120
|
if (a.length > 0) { // jika tiket itu bisa di pakai
|
|
121
121
|
let urlOut = "event_tms_hall_confirm"
|
|
122
|
-
LibNavigation.replace('event/
|
|
122
|
+
LibNavigation.replace('event/tms_in_hall_success', { data: [tiket], ...args, url: urlOut, post: postOut })
|
|
123
123
|
} else { // jika tiket itu tidak bisa dipakai
|
|
124
124
|
let err = {
|
|
125
125
|
message: tiket?.list?.[0]?.status_label,
|
|
126
126
|
}
|
|
127
|
-
LibNavigation.replace('event/
|
|
127
|
+
LibNavigation.replace('event/tms_in_hall_failed', { msgError: err, ...args, postGetData: post })
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
} else { // jika punya tiket banyak
|
|
132
|
-
LibNavigation.replace('event/
|
|
132
|
+
LibNavigation.replace('event/tms_in_hall_list', { data: ticketsData, ...args })
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
}, (error) => { // jika tidak punya tiket
|
|
136
136
|
esp.log({ error });
|
|
137
137
|
|
|
138
|
-
LibNavigation.replace('event/
|
|
138
|
+
LibNavigation.replace('event/tms_in_hall_failed', { msgError: error, ...args, postGetData: post })
|
|
139
139
|
}, 1)
|
|
140
140
|
}
|
|
141
141
|
|
package/event/hall_in_failed.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// withHooks
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
|
|
5
|
+
import { EventButton } from 'esoftplay/cache/event/button/import';
|
|
6
6
|
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
7
7
|
import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
|
|
8
8
|
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
@@ -21,29 +21,29 @@ import React from 'react';
|
|
|
21
21
|
import { Alert, Pressable, ScrollView, Text, View } from 'react-native';
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
export interface
|
|
24
|
+
export interface EventTms_in_hall_failedArgs {
|
|
25
25
|
|
|
26
26
|
}
|
|
27
|
-
export interface
|
|
27
|
+
export interface EventTms_in_hall_failedProps {
|
|
28
28
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export default function m(props:
|
|
31
|
+
export default function m(props: EventTms_in_hall_failedProps): any {
|
|
32
32
|
const { scan_type, msgError, postGetData, url_ticket_update, url_ticket_detail, price_type, gate_type, event_id, selectGate, typeScanner, event_title, configPriority }: any = LibNavigation.getArgsAll<any>(props)
|
|
33
33
|
|
|
34
|
-
const [
|
|
34
|
+
const [, setData, getData] = useSafeState()
|
|
35
35
|
const [qty, setQty, getQty] = useSafeState(1)
|
|
36
36
|
|
|
37
37
|
const qtyRef = React.useRef<LibSlidingup>(null)
|
|
38
38
|
|
|
39
39
|
useEffect(() => {
|
|
40
|
-
|
|
40
|
+
EventTms_homeProperty.addCounterHallInScanFailed(1, "0")
|
|
41
41
|
}, [])
|
|
42
42
|
|
|
43
43
|
function getBack() {
|
|
44
44
|
LibNavigation.replace('component/scanner', {
|
|
45
45
|
selectGate: selectGate,
|
|
46
|
-
fromPage: '
|
|
46
|
+
fromPage: 'event/tms_home',
|
|
47
47
|
event_id: event_id,
|
|
48
48
|
event_title: event_title,
|
|
49
49
|
typeScanner: typeScanner,
|
|
@@ -91,7 +91,7 @@ export default function m(props: EventHall_in_failedProps): any {
|
|
|
91
91
|
Alert.alert("Berhasil masuk ke Gate!", "Silahkan lanjutkan proses masuk ke hall", [
|
|
92
92
|
{
|
|
93
93
|
text: "OK", onPress: () => {
|
|
94
|
-
LibNavigation.replace("event/
|
|
94
|
+
LibNavigation.replace("event/tms_in_hall", { scan_type, url_ticket_update, url_ticket_detail, price_type, gate_type, qr_code: postGetData.user_qr, event_id, selectGate, typeScanner, event_title, configPriority })
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
])
|
|
@@ -119,11 +119,11 @@ export default function m(props: EventHall_in_failedProps): any {
|
|
|
119
119
|
Alert.alert("Berhasil masuk ke Gate!", "Silahkan lanjutkan proses masuk ke hall", [
|
|
120
120
|
{
|
|
121
121
|
text: "OK", onPress: () => {
|
|
122
|
-
LibNavigation.replace("event/
|
|
122
|
+
LibNavigation.replace("event/tms_in_hall", { scan_type, url_ticket_update, url_ticket_detail, price_type, gate_type, qr_code: postGetData.user_qr, event_id, selectGate, typeScanner, event_title, configPriority })
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
])
|
|
126
|
-
// LibNavigation.replace("event/
|
|
126
|
+
// LibNavigation.replace("event/tms_in_hall", { scan_type, url_ticket_update, url_ticket_detail, price_type, gate_type, qr_code: postGetData.user_qr, event_id, selectGate, typeScanner, event_title, configPriority })
|
|
127
127
|
}
|
|
128
128
|
}, (error) => {
|
|
129
129
|
doneEntrance += 1
|
|
@@ -175,7 +175,7 @@ export default function m(props: EventHall_in_failedProps): any {
|
|
|
175
175
|
<View style={{ minHeight: LibStyle.height * 0.4, marginTop: 30 }}>
|
|
176
176
|
{
|
|
177
177
|
msgError?.result?.length > 0 &&
|
|
178
|
-
<Text allowFontScaling={false} style={{ textAlign: 'center', marginBottom: 10, fontSize: 18, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: "#fff" }}>{esp.lang("event/
|
|
178
|
+
<Text allowFontScaling={false} style={{ textAlign: 'center', marginBottom: 10, fontSize: 18, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: "#fff" }}>{esp.lang("event/tms_in_hall_failed", "history_used")}</Text>
|
|
179
179
|
}
|
|
180
180
|
{
|
|
181
181
|
msgError?.result?.length > 0 && msgError?.result?.map((item: any, i: number) => {
|
|
@@ -189,11 +189,11 @@ export default function m(props: EventHall_in_failedProps): any {
|
|
|
189
189
|
}
|
|
190
190
|
<View style={{ padding: 10, flexDirection: 'row', justifyContent: 'space-between', }}>
|
|
191
191
|
<View style={{ flex: 1 }}>
|
|
192
|
-
<Text allowFontScaling={false} style={{ marginBottom: 5, fontWeight: 'bold', fontSize: 14 }}>{esp.lang("event/
|
|
192
|
+
<Text allowFontScaling={false} style={{ marginBottom: 5, fontWeight: 'bold', fontSize: 14 }}>{esp.lang("event/tms_in_hall_failed", "type")}</Text>
|
|
193
193
|
<Text allowFontScaling={false} numberOfLines={2} ellipsizeMode="tail" style={{ letterSpacing: 1, fontSize: 12 }}>{item?.price_name}</Text>
|
|
194
194
|
</View>
|
|
195
195
|
<View style={{ flex: 2 }}>
|
|
196
|
-
<Text allowFontScaling={false} style={{ marginBottom: 5, fontWeight: 'bold', textAlign: 'center', fontSize: 14 }}>{esp.lang("event/
|
|
196
|
+
<Text allowFontScaling={false} style={{ marginBottom: 5, fontWeight: 'bold', textAlign: 'center', fontSize: 14 }}>{esp.lang("event/tms_in_hall_failed", "time")}</Text>
|
|
197
197
|
{
|
|
198
198
|
item?.hall_scanned != "0000-00-00 00:00:00" &&
|
|
199
199
|
<Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 12 }}>{LibUtils.moment(item?.hall_scanned).localeFormat("DD MMM H:mm:ss ")}</Text>
|
|
@@ -218,10 +218,10 @@ export default function m(props: EventHall_in_failedProps): any {
|
|
|
218
218
|
<UseCondition if={msgError?.status_code == 'EV043'}>
|
|
219
219
|
<View style={{ flexDirection: 'row' }} >
|
|
220
220
|
<Pressable onPress={() => {
|
|
221
|
-
LibNavigation.navigateForResult("
|
|
221
|
+
LibNavigation.navigateForResult("event/tms_gate_result", { type: "gate", event_id: event_id }, 2123).then((gate) => {
|
|
222
222
|
const ticket = msgError.result[0]
|
|
223
223
|
setData({ gate, ticket })
|
|
224
|
-
const validDataLength = msgError.result?.filter?.((x) => (x?.status_scanned == 2 || x?.status_scanned == 5))?.length
|
|
224
|
+
const validDataLength = msgError.result?.filter?.((x: any) => (x?.status_scanned == 2 || x?.status_scanned == 5))?.length
|
|
225
225
|
if (validDataLength > 1) {
|
|
226
226
|
qtyRef.current?.show()
|
|
227
227
|
} else if (validDataLength == 1) {
|
|
@@ -237,16 +237,16 @@ export default function m(props: EventHall_in_failedProps): any {
|
|
|
237
237
|
<View style={{ flexDirection: 'row', width: LibStyle.width - 40, alignItems: 'center', marginVertical: 10, justifyContent: 'center' }}>
|
|
238
238
|
<UseCondition if={msgError?.status_code != 'EV043'}>
|
|
239
239
|
<Pressable onPress={() => {
|
|
240
|
-
LibDialog.warningConfirm(esp.lang("event/
|
|
240
|
+
LibDialog.warningConfirm(esp.lang("event/tms_in_failed", "warn_title"), esp.lang("event/tms_in_failed", "warn_msg"), esp.lang("event/tms_in_failed", "warn_ok"), () => {
|
|
241
241
|
sendTelegram()
|
|
242
|
-
}, esp.lang("event/
|
|
242
|
+
}, esp.lang("event/tms_in_failed", "warn_no"), () => { })
|
|
243
243
|
|
|
244
244
|
}} style={{ width: (LibStyle.width - 45) * 0.5, height: 40, borderRadius: 5, backgroundColor: LibStyle.colorRed, borderWidth: 3, borderColor: "#fff", justifyContent: 'center', alignContent: 'center', alignItems: 'center', ...LibStyle.elevation(10) }}>
|
|
245
|
-
<Text allowFontScaling={false} style={{ textAlign: 'center', fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/
|
|
245
|
+
<Text allowFontScaling={false} style={{ textAlign: 'center', fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/tms_in_hall_failed", "report_error")}</Text>
|
|
246
246
|
</Pressable>
|
|
247
247
|
</UseCondition>
|
|
248
248
|
<Pressable onPress={getBack} style={{ width: (LibStyle.width - 45) * 0.5, height: 40, borderRadius: 5, borderWidth: 5, borderColor: LibStyle.colorGreen, justifyContent: 'center', alignContent: 'center', alignItems: 'center', ...LibStyle.elevation(10) }}>
|
|
249
|
-
<Text allowFontScaling={false} style={{ fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/
|
|
249
|
+
<Text allowFontScaling={false} style={{ fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/tms_in_hall_failed", "back")}</Text>
|
|
250
250
|
</Pressable>
|
|
251
251
|
|
|
252
252
|
</View>
|
|
@@ -258,11 +258,11 @@ export default function m(props: EventHall_in_failedProps): any {
|
|
|
258
258
|
<LibIcon.SimpleLineIcons size={40} name='minus' />
|
|
259
259
|
</Pressable>
|
|
260
260
|
<Text allowFontScaling={false} style={{ fontSize: 50, fontWeight: 'bold', textAlign: 'center', flex: 1 }}>{qty}</Text>
|
|
261
|
-
<Pressable onPress={() => { setQty(Math.min(msgError.result?.filter?.((x) => (x?.status_scanned == 2 || x?.status_scanned == 5))?.length, qty + 1)) }} >
|
|
261
|
+
<Pressable onPress={() => { setQty(Math.min(msgError.result?.filter?.((x: any) => (x?.status_scanned == 2 || x?.status_scanned == 5))?.length, qty + 1)) }} >
|
|
262
262
|
<LibIcon.SimpleLineIcons size={40} name='plus' />
|
|
263
263
|
</Pressable>
|
|
264
264
|
</View>
|
|
265
|
-
<
|
|
265
|
+
<EventButton label='Force Entrance' onPress={() => { forceEntrance() }} />
|
|
266
266
|
</View>
|
|
267
267
|
</LibSlidingup >
|
|
268
268
|
</View >
|