esoftplay-event 0.0.1 → 0.0.2-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 +1 -1
- package/event/artist.tsx +11 -7
- package/event/artist_detail.tsx +3 -5
- package/event/artist_detailv2.tsx +386 -0
- package/event/artistv2.tsx +162 -0
- package/event/button_order_detail.tsx +43 -0
- package/event/countdown_base.tsx +16 -3
- package/event/countdown_event.tsx +48 -0
- package/event/detail.tsx +30 -37
- package/event/detail2.tsx +354 -0
- package/event/exchange_ticket.tsx +1 -1
- package/event/exchange_ticket_list.tsx +2 -3
- package/event/exchange_ticket_result.tsx +1 -1
- package/event/firebase_socket.ts +8 -0
- package/event/loading_page.tsx +4 -2
- package/event/order.tsx +23 -36
- package/event/order_detail.tsx +204 -61
- package/event/order_detail_upgrade.tsx +8 -5
- package/event/order_detail_upgrade_payment.tsx +17 -11
- package/event/order_detail_visitor.tsx +33 -33
- package/event/order_detail_waiting.tsx +45 -20
- package/event/order_item.tsx +1 -1
- package/event/order_lottery.tsx +49 -37
- package/event/order_reschedule.tsx +50 -52
- package/event/order_share_to.tsx +11 -24
- package/event/order_share_to_detail.tsx +8 -3
- package/event/order_waiting.tsx +1 -1
- package/event/queue_pricing.tsx +16 -3
- package/event/refresh_button.tsx +3 -5
- package/event/scan_item.tsx +2 -2
- package/event/seat.tsx +34 -13
- package/event/seat_map_new.tsx +316 -0
- package/event/secure_page.debug.tsx +34 -0
- package/event/secure_page.live.tsx +35 -0
- package/event/secure_page.tsx +6 -5
- package/event/test.tsx +240 -155
- package/event/ticket_list.tsx +48 -20
- package/event/ticket_list2.tsx +112 -39
- package/event/tms_check_code.tsx +6 -0
- package/event/tms_check_ticket_result.tsx +51 -13
- package/event/tms_dashboard.tsx +85 -3
- package/event/tms_gate.tsx +6 -0
- package/event/tms_home.tsx +1 -4
- package/event/tms_in_failed.tsx +1 -1
- package/event/tms_in_hall.tsx +4 -1
- package/event/tms_in_hall_failed.tsx +8 -10
- package/event/tms_in_log.tsx +2 -0
- package/event/tms_in_success.tsx +1 -1
- package/event/tms_log.tsx +10 -25
- package/event/tms_out.tsx +1 -1
- package/event/tms_out_failed.tsx +1 -1
- package/event/visitor_input.tsx +22 -5
- package/event/visitor_inputv2.tsx +453 -0
- package/event/voucher.tsx +2 -0
- package/event/voucher2.tsx +14 -6
- package/id.json +43 -9
- package/package.json +1 -1
- package/event/entrance.tsx +0 -215
- package/event/entrance_again.tsx +0 -199
- package/event/entrance_failed.tsx +0 -190
- package/event/entrance_idcard.tsx +0 -199
- package/event/entrance_list.tsx +0 -264
- package/event/entrance_list_item.tsx +0 -88
- package/event/entrance_log.tsx +0 -130
- package/event/entrance_success.tsx +0 -153
- package/event/entrance_warning.tsx +0 -91
- package/event/exit.tsx +0 -91
- package/event/exit_failed.tsx +0 -135
- package/event/exit_list.tsx +0 -118
- package/event/exit_log.tsx +0 -130
- package/event/exit_success.tsx +0 -143
- package/event/exit_temporary.tsx +0 -226
- package/event/firebase_socket.debug.ts +0 -260
- package/event/firebase_socket.live.ts +0 -335
- package/event/hall_in.tsx +0 -148
- package/event/hall_in_failed.tsx +0 -270
- package/event/hall_in_list.tsx +0 -222
- package/event/hall_in_log.tsx +0 -134
- package/event/hall_in_success.tsx +0 -132
- package/event/hall_out.tsx +0 -143
- package/event/hall_out_failed.tsx +0 -133
- package/event/hall_out_list.tsx +0 -215
- package/event/hall_out_log.tsx +0 -133
- package/event/hall_out_success.tsx +0 -130
- package/event/log.tsx +0 -433
- package/event/seat_map_test.tsx +0 -401
package/event/exit_temporary.tsx
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
// withHooks
|
|
2
|
-
import { EventScan_item } from 'esoftplay/cache/event/scan_item/import';
|
|
3
|
-
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
4
|
-
import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
|
|
5
|
-
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
6
|
-
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
7
|
-
import { LibObject } from 'esoftplay/cache/lib/object/import';
|
|
8
|
-
import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
9
|
-
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
10
|
-
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
11
|
-
|
|
12
|
-
import { applyStyle } from 'esoftplay';
|
|
13
|
-
import { EventButton } from 'esoftplay/cache/event/button/import';
|
|
14
|
-
import { EventHeader } from 'esoftplay/cache/event/header/import';
|
|
15
|
-
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
|
|
16
|
-
import esp from 'esoftplay/esp';
|
|
17
|
-
import useSafeState from 'esoftplay/state';
|
|
18
|
-
import React, { useEffect } from 'react';
|
|
19
|
-
import { ScrollView, Text, View } from 'react-native';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export interface EventTms_out_temporaryArgs {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
export interface EventTms_out_temporaryProps {
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
export default function m(props: EventTms_out_temporaryProps): any {
|
|
29
|
-
const user_qr = LibNavigation.getArgs(props, 'qr_code')
|
|
30
|
-
const { scan_type, event_id, selectGate, typeScanner }: any = LibNavigation.getArgsAll(props)
|
|
31
|
-
const [result, setResult] = useSafeState<any>(undefined)
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
loadData()
|
|
35
|
-
}, [])
|
|
36
|
-
|
|
37
|
-
function loadData() {
|
|
38
|
-
var post = {
|
|
39
|
-
event_id: event_id,
|
|
40
|
-
// event_id: "264",
|
|
41
|
-
user_qr: encodeURIComponent(user_qr),
|
|
42
|
-
gate_id: selectGate.id
|
|
43
|
-
// user_qr: encodeURIComponent("BBO-H6851"),
|
|
44
|
-
}
|
|
45
|
-
new LibCurl('event_tms_out_temporary', post, (res) => {
|
|
46
|
-
let a = res?.list?.length > 0 && res.list.map((item: any, i: number) => {
|
|
47
|
-
return ({
|
|
48
|
-
...item,
|
|
49
|
-
checked: 0
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
let b = res?.staff?.length > 0 && res.staff.map((item: any, i: number) => {
|
|
53
|
-
return ({
|
|
54
|
-
...item,
|
|
55
|
-
checked: 0
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
let c = {
|
|
60
|
-
...res,
|
|
61
|
-
list: res?.list?.length == 0 ? [] : a,
|
|
62
|
-
staff: res?.staff?.length == 0 ? [] : b
|
|
63
|
-
}
|
|
64
|
-
esp.log({ res, c });
|
|
65
|
-
setResult(c)
|
|
66
|
-
|
|
67
|
-
}, (error) => {
|
|
68
|
-
LibDialog.warningConfirm(esp.lang("event/tms_out_temporary", "fault"), error?.message, esp.lang("event/tms_out_temporary", "back"), () => LibNavigation.back(), "", () => { })
|
|
69
|
-
}, 1)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function quitTemporary(): void {
|
|
73
|
-
let list = [...result?.list, ...result.staff]
|
|
74
|
-
let a = list.filter((item: any) => item.checked == 1).map((it: any) => it.id)
|
|
75
|
-
|
|
76
|
-
if (a.length == 0) {
|
|
77
|
-
LibToastProperty.show(esp.lang("event/tms_out_temporary", "select_ticket"))
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
var post = {
|
|
81
|
-
event_id: event_id,
|
|
82
|
-
ids: JSON.stringify(a),
|
|
83
|
-
gate_id: selectGate.id
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
LibProgress.show(esp.lang("event/tms_out_temporary", "wait"))
|
|
87
|
-
new LibCurl('event_tms_out_temporary_confirm', post, (result, msg) => {
|
|
88
|
-
LibProgress.hide()
|
|
89
|
-
LibDialog.confirm(esp.lang("event/tms_out_temporary", "info"), msg, esp.lang("event/tms_out_temporary", "ok"), () => {
|
|
90
|
-
LibNavigation.replace('component/scanner', {
|
|
91
|
-
fromPage: 'event/tms_home',
|
|
92
|
-
isTemporaryExit: true,
|
|
93
|
-
event_id: event_id,
|
|
94
|
-
selectGate: selectGate,
|
|
95
|
-
typeScanner: typeScanner,
|
|
96
|
-
scan_type: scan_type
|
|
97
|
-
})
|
|
98
|
-
}, "", () => { })
|
|
99
|
-
}, (error) => {
|
|
100
|
-
LibDialog.warning(esp.lang("event/tms_out_temporary", "oops"), error?.message)
|
|
101
|
-
LibProgress.hide()
|
|
102
|
-
}, 1)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (!result) return <LibLoading />
|
|
106
|
-
|
|
107
|
-
let lastStatusScanned = ''
|
|
108
|
-
function renderTicketTemporary(item: any, i: number) {
|
|
109
|
-
const showStatusScanned = lastStatusScanned != item?.status_label
|
|
110
|
-
lastStatusScanned = item?.status_label
|
|
111
|
-
return (
|
|
112
|
-
<View key={i}>
|
|
113
|
-
{
|
|
114
|
-
showStatusScanned &&
|
|
115
|
-
<View style={{ backgroundColor: item?.status == 1 ? '#fff' : "#c5c5c5", padding: 10, borderBottomWidth: 2, borderBottomColor: LibStyle.colorBgGrey }} >
|
|
116
|
-
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: item?.status == 1 ? item?.status_background : "#fff" }}>{(item?.status_label).toUpperCase()}</Text>
|
|
117
|
-
</View>
|
|
118
|
-
}
|
|
119
|
-
<EventScan_item
|
|
120
|
-
key={i}
|
|
121
|
-
item={item}
|
|
122
|
-
colorFont={"#fff"}
|
|
123
|
-
style={{ backgroundColor: item?.status == 1 ? "#fff" : "#c5c5c5" }}
|
|
124
|
-
event_image={result?.event_image}
|
|
125
|
-
event_name={result?.event_name}
|
|
126
|
-
event_ondate={result?.event_ondate}
|
|
127
|
-
colorText={item?.status == 1 ? "#000" : LibStyle.colorBgGrey}
|
|
128
|
-
label={
|
|
129
|
-
item.status == 0 ?
|
|
130
|
-
esp.lang("event/tms_out_temporary", "used") :
|
|
131
|
-
item.checked == 0 ?
|
|
132
|
-
esp.lang("event/tms_out_temporary", "use") :
|
|
133
|
-
esp.lang("event/tms_out_temporary", "cancel")
|
|
134
|
-
}
|
|
135
|
-
onPress={() => {
|
|
136
|
-
if (item?.status == 1 && item?.is_limit == 0) {
|
|
137
|
-
let a = LibObject.set(result, item.checked == 1 ? 0 : 1)('list', i, 'checked')
|
|
138
|
-
setResult(a)
|
|
139
|
-
}
|
|
140
|
-
}}
|
|
141
|
-
colorBackground={(item.status == 0 || item.is_limit == 1) ? LibStyle.colorLightGrey : (item.checked == 0) ? LibStyle.colorGreen : LibStyle.colorRed}
|
|
142
|
-
/>
|
|
143
|
-
</View>
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
let lastStatusStaff = ''
|
|
148
|
-
function renderStaff(item: any, i: number) {
|
|
149
|
-
const showStatusScanned = lastStatusStaff != item?.status_label
|
|
150
|
-
lastStatusStaff = item?.status_label
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<View key={i}>
|
|
154
|
-
{
|
|
155
|
-
showStatusScanned &&
|
|
156
|
-
<View style={{ backgroundColor: item?.status == 1 ? '#fff' : "#c5c5c5", padding: 10, borderBottomWidth: 2, borderBottomColor: LibStyle.colorBgGrey }} >
|
|
157
|
-
<Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: item?.status == 1 ? item?.status_background : "#fff" }}>{(item?.status_label).toUpperCase()}</Text>
|
|
158
|
-
</View>
|
|
159
|
-
}
|
|
160
|
-
<View style={{ padding: 10, overflow: 'hidden', flex: 1, flexDirection: 'row', backgroundColor: '#fff', borderBottomColor: LibStyle.colorGrey, borderBottomWidth: 1.5 }}>
|
|
161
|
-
<LibPicture style={applyStyle({ borderRadius: 5, width: LibStyle.width / 4.5, height: LibStyle.width / 4.5, backgroundColor: LibStyle.colorBgGrey })} source={{ uri: item?.image }} />
|
|
162
|
-
<View style={{ marginLeft: 10, flex: 1 }}>
|
|
163
|
-
<Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#000", marginBottom: 4, fontSize: 18, fontWeight: 'bold' })}>{item.name}</Text>
|
|
164
|
-
<Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#000", marginBottom: 4, fontSize: 14 })}>{item.department_name}</Text>
|
|
165
|
-
<Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#000", marginBottom: 4, fontSize: 16 })}>{item.exhibitor_name}</Text>
|
|
166
|
-
{
|
|
167
|
-
item.status == 1 &&
|
|
168
|
-
<EventButton style={applyStyle({ marginTop: 10, alignSelf: 'flex-end', width: LibStyle.width / 3, backgroundColor: (item.status == 0 || item.is_limit == 1) ? LibStyle.colorLightGrey : (item.checked == 0) ? LibStyle.colorGreen : LibStyle.colorRed })} label={
|
|
169
|
-
item.status == 0 ?
|
|
170
|
-
esp.lang("event/tms_out_temporary", "used") :
|
|
171
|
-
item.hasOwnProperty("checked") && item.checked == 0 ?
|
|
172
|
-
esp.lang("event/tms_out_temporary", "use") :
|
|
173
|
-
esp.lang("event/tms_out_temporary", "cancel")
|
|
174
|
-
} fontColor={"#fff"} onPress={() => {
|
|
175
|
-
let a = LibObject.set(result, item.checked == 1 ? 0 : 1)('staff', i, 'checked')
|
|
176
|
-
setResult(a)
|
|
177
|
-
}} />
|
|
178
|
-
}
|
|
179
|
-
</View>
|
|
180
|
-
<View pointerEvents='none' style={{ position: 'absolute', justifyContent: 'center', transform: [{ rotate: '45deg' }], margin: 1, ...LibStyle.elevation(2), height: 20, width: 170, backgroundColor: LibStyle.colorPrimary, right: -50, top: 25 }} >
|
|
181
|
-
<Text style={{ color: 'white', alignSelf: 'center', fontWeight: 'bold' }} >ID CARD</Text>
|
|
182
|
-
</View>
|
|
183
|
-
</View>
|
|
184
|
-
</View>
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const sortedData = result?.list?.length > 0 && result?.list.sort((a: any, b: any) => {
|
|
189
|
-
if (a.is_limit == 0 && b.is_limit != 0) {
|
|
190
|
-
return -1; // a di atas b
|
|
191
|
-
} else if (a.is_limit != 0 && b.is_limit == 0) {
|
|
192
|
-
return 1; // b di atas a
|
|
193
|
-
} else {
|
|
194
|
-
return 0; // urutan relatif tidak berubah
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
|
|
200
|
-
<EventHeader title={esp.lang("event/tms_out_temporary", "temp_out")} />
|
|
201
|
-
|
|
202
|
-
<ScrollView>
|
|
203
|
-
<View style={{ margin: 15, marginBottom: 0, borderRadius: 7, overflow: 'hidden' }}>
|
|
204
|
-
{
|
|
205
|
-
result?.staff?.length > 0 && result?.staff?.map(renderStaff)
|
|
206
|
-
}
|
|
207
|
-
</View>
|
|
208
|
-
<View style={{ margin: 15, borderRadius: 7, overflow: 'hidden' }}>
|
|
209
|
-
{
|
|
210
|
-
sortedData?.length > 0 && sortedData?.map(renderTicketTemporary)
|
|
211
|
-
}
|
|
212
|
-
</View>
|
|
213
|
-
</ScrollView>
|
|
214
|
-
<View style={{ padding: 10, backgroundColor: '#fff' }}>
|
|
215
|
-
<EventButton
|
|
216
|
-
label={esp.lang("event/tms_out_temporary", "btn_exit")}
|
|
217
|
-
backgroundColor={LibStyle.colorRed}
|
|
218
|
-
onPress={() => {
|
|
219
|
-
quitTemporary()
|
|
220
|
-
}}
|
|
221
|
-
// style={{ marginTop: 20 }}
|
|
222
|
-
/>
|
|
223
|
-
</View>
|
|
224
|
-
</View>
|
|
225
|
-
)
|
|
226
|
-
}
|
|
@@ -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
|
-
// }
|