esoftplay-event 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/event/artist.tsx +11 -7
  2. package/event/artist_detail.tsx +3 -5
  3. package/event/artist_detailv2.tsx +386 -0
  4. package/event/artistv2.tsx +162 -0
  5. package/event/button_order_detail.tsx +43 -0
  6. package/event/countdown_base.tsx +16 -3
  7. package/event/countdown_event.tsx +47 -0
  8. package/event/detail.tsx +30 -37
  9. package/event/detail2.tsx +354 -0
  10. package/event/exchange_ticket.tsx +1 -1
  11. package/event/exchange_ticket_list.tsx +2 -3
  12. package/event/exchange_ticket_result.tsx +1 -1
  13. package/event/firebase_socket.ts +8 -0
  14. package/event/loading_page.tsx +4 -2
  15. package/event/order.tsx +23 -36
  16. package/event/order_detail.tsx +119 -41
  17. package/event/order_detail_upgrade.tsx +8 -5
  18. package/event/order_detail_upgrade_payment.tsx +17 -11
  19. package/event/order_detail_visitor.tsx +33 -33
  20. package/event/order_detail_waiting.tsx +45 -20
  21. package/event/order_item.tsx +1 -1
  22. package/event/order_lottery.tsx +48 -36
  23. package/event/order_reschedule.tsx +50 -52
  24. package/event/order_share_to.tsx +11 -24
  25. package/event/order_share_to_detail.tsx +8 -3
  26. package/event/order_waiting.tsx +1 -1
  27. package/event/queue_pricing.tsx +16 -3
  28. package/event/refresh_button.tsx +3 -5
  29. package/event/scan_item.tsx +2 -2
  30. package/event/seat.tsx +19 -11
  31. package/event/seat_map_new.tsx +313 -0
  32. package/event/secure_page.debug.tsx +34 -0
  33. package/event/secure_page.live.tsx +35 -0
  34. package/event/secure_page.tsx +6 -5
  35. package/event/test.tsx +240 -155
  36. package/event/ticket_list.tsx +49 -21
  37. package/event/ticket_list2.tsx +83 -34
  38. package/event/tms_check_code.tsx +6 -0
  39. package/event/tms_check_ticket_result.tsx +36 -7
  40. package/event/tms_dashboard.tsx +85 -3
  41. package/event/tms_gate.tsx +6 -0
  42. package/event/tms_home.tsx +1 -4
  43. package/event/tms_in_failed.tsx +1 -1
  44. package/event/tms_in_log.tsx +2 -0
  45. package/event/tms_in_success.tsx +1 -1
  46. package/event/tms_log.tsx +10 -25
  47. package/event/tms_out.tsx +1 -1
  48. package/event/tms_out_failed.tsx +1 -1
  49. package/event/visitor_input.tsx +23 -5
  50. package/event/visitor_inputv2.tsx +397 -0
  51. package/event/voucher.tsx +2 -0
  52. package/event/voucher2.tsx +14 -6
  53. package/id.json +25 -9
  54. package/package.json +1 -1
  55. package/event/entrance.tsx +0 -215
  56. package/event/entrance_again.tsx +0 -199
  57. package/event/entrance_failed.tsx +0 -190
  58. package/event/entrance_idcard.tsx +0 -199
  59. package/event/entrance_list.tsx +0 -264
  60. package/event/entrance_list_item.tsx +0 -88
  61. package/event/entrance_log.tsx +0 -130
  62. package/event/entrance_success.tsx +0 -153
  63. package/event/entrance_warning.tsx +0 -91
  64. package/event/exit.tsx +0 -91
  65. package/event/exit_failed.tsx +0 -135
  66. package/event/exit_list.tsx +0 -118
  67. package/event/exit_log.tsx +0 -130
  68. package/event/exit_success.tsx +0 -143
  69. package/event/exit_temporary.tsx +0 -226
  70. package/event/firebase_socket.debug.ts +0 -260
  71. package/event/firebase_socket.live.ts +0 -335
  72. package/event/hall_in.tsx +0 -148
  73. package/event/hall_in_failed.tsx +0 -270
  74. package/event/hall_in_list.tsx +0 -222
  75. package/event/hall_in_log.tsx +0 -134
  76. package/event/hall_in_success.tsx +0 -132
  77. package/event/hall_out.tsx +0 -143
  78. package/event/hall_out_failed.tsx +0 -133
  79. package/event/hall_out_list.tsx +0 -215
  80. package/event/hall_out_log.tsx +0 -133
  81. package/event/hall_out_success.tsx +0 -130
  82. package/event/log.tsx +0 -433
  83. package/event/seat_map_test.tsx +0 -401
@@ -1,190 +0,0 @@
1
- // withHooks
2
- import { applyStyle } from 'esoftplay';
3
- import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
4
- import { LibCurl } from 'esoftplay/cache/lib/curl/import';
5
- import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
6
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
7
- import { LibPicture } from 'esoftplay/cache/lib/picture/import';
8
- import { LibStatusbar } from 'esoftplay/cache/lib/statusbar/import';
9
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
10
- import { LibUtils } from 'esoftplay/cache/lib/utils/import';
11
- import { UserClass } from 'esoftplay/cache/user/class/import';
12
- import esp from 'esoftplay/esp';
13
- import useSafeState from 'esoftplay/state';
14
-
15
- import React, { useEffect } from 'react';
16
- import { Pressable, ScrollView, Text, View } from 'react-native';
17
-
18
-
19
- export interface EventTms_in_failedArgs {
20
-
21
- }
22
- export interface EventTms_in_failedProps {
23
-
24
- }
25
- export default function m(props: EventTms_in_failedProps): any {
26
- const { scan_type, ticketItem, text, url_ticket_update, url_ticket_detail, price_type, gate_type, qr_code, event_id, selectGate, typeScanner, event_title, configPriority }: any = LibNavigation.getArgsAll(props)
27
-
28
- const [result, setResult] = useSafeState<any>()
29
- const [error, setError] = useSafeState<any>()
30
-
31
- let url = url_ticket_detail + LibUtils.objectToUrlParam({
32
- is_turnstile: 0,
33
- price_id: ticketItem?.price_id == "staff" ? 0 : ticketItem?.price_id,
34
- qr: encodeURIComponent(qr_code),
35
- t: new Date().getTime()
36
- })
37
-
38
-
39
- useEffect(() => {
40
- EventTms_homeProperty.addCounterEntranceScanFailed(1, ticketItem?.price_id)
41
- if (ticketItem && url_ticket_detail) {
42
- getDetailDataTicket()
43
- }
44
- }, [])
45
-
46
- function getDetailDataTicket() {
47
- new LibCurl(url, null, (res, msg) => {
48
- setResult(res)
49
- }, (err) => {
50
- setError(err)
51
- }, 1)
52
- }
53
-
54
- function getBack() {
55
- LibNavigation.replace('component/scanner', {
56
- selectGate: selectGate,
57
- fromPage: 'event/tms_home',
58
- event_id: event_id,
59
- event_title: event_title,
60
- typeScanner: typeScanner,
61
- gate_type: gate_type,
62
- price_type: price_type,
63
- url_ticket_detail: url_ticket_detail,
64
- url_ticket_update: url_ticket_update,
65
- configPriority: configPriority,
66
- scan_type: scan_type
67
- })
68
- }
69
-
70
- function sendTelegram() {
71
- let data = {
72
- '#bbotms': ":",
73
- reporter: {
74
- email: UserClass.state().get().email,
75
- name: UserClass.state().get().name
76
- },
77
- "event/gate/type": event_id + "/" + selectGate?.id + "/" + (gate_type == 1 ? "in" : "out"),
78
- qr: qr_code,
79
- type_ticket: ticketItem?.price_id,
80
- qty: ticketItem?.qty,
81
- qty_used: ticketItem?.qty_used,
82
- qty_left: ticketItem?.qty_left,
83
- data: {
84
- res: result,
85
- url: url
86
- },
87
- error_msg: text,
88
- }
89
-
90
- let post = {
91
- text: String(JSON.stringify(data || {}, undefined, 2)).replace(/[\[\]\{\}\"]+/g, ''),
92
- chat_id: '-1001737180019',
93
- disable_web_page_preview: true
94
- }
95
-
96
- let _url = "https://api.telegram.org/bot923808407:AAEFBlllQNKCEn8E66fwEzCj5vs9qGwVGT4/sendMessage"
97
- new LibCurl().custom(_url, post, (res, msg) => { })
98
- }
99
-
100
- return (
101
- <View style={{ flex: 1 }}>
102
- <LibStatusbar style='light' />
103
- <View style={{ flex: 1 }}>
104
- <LibPicture source={esp.assets('failed.png')} style={{ flex: 1, height: LibStyle.height, width: LibStyle.width }} /* resizeMode={"stretch"} */ />
105
- </View>
106
-
107
- <View style={{ flex: 1, position: 'absolute', top: 50, left: 0, right: 0, bottom: 0, alignItems: 'center', alignContent: 'center' }} >
108
- <ScrollView>
109
- <View style={{ marginBottom: 20, alignSelf: 'center', borderRadius: LibStyle.width / 3, padding: 10, backgroundColor: '#fff' }}>
110
- <LibPicture
111
- source={esp.assets('failed_icon.png')}
112
- style={{ width: LibStyle.width / 3, height: LibStyle.width / 3 }}
113
- />
114
- </View>
115
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 25, color: '#fff', marginHorizontal: 20, textAlign: 'center', letterSpacing: 1 }}>{text ? text : esp.lang("event/tms_in_failed", "ticket_out")}</Text>
116
- {
117
- result &&
118
- <View style={[applyStyle({ marginTop: 10, padding: 10 }), { width: LibStyle.width }]}>
119
- {
120
- result?.length > 0 &&
121
- <>
122
- <Text allowFontScaling={false} style={{ fontSize: 20, color: '#fff', margin: 10, textAlign: 'center', letterSpacing: 1 }}>{esp.lang("event/tms_in_failed", "history")}</Text>
123
- <Text allowFontScaling={false} style={{ marginTop: 0, fontSize: 16, color: '#fff', margin: 10, textAlign: 'center', letterSpacing: 1, fontWeight: 'bold' }}>{result?.[0].price_name}</Text>
124
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', backgroundColor: '#37c2d0', borderTopLeftRadius: 10, borderTopRightRadius: 10 }}>
125
- <View style={{ flex: 1.5, justifyContent: 'center', borderRightWidth: 1, borderColor: LibStyle.colorBgGrey, paddingVertical: 5, padding: 5 }}>
126
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', textAlign: 'center', fontSize: 14 }}>{esp.lang("event/tms_in_failed", "code")}</Text>
127
- </View>
128
- <View style={{ flex: 1.2, justifyContent: 'center', paddingVertical: 5 }}>
129
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', textAlign: 'center', fontSize: 14 }}>{esp.lang("event/tms_in_failed", "used_time")}</Text>
130
- </View>
131
- <View style={{ flex: 2, justifyContent: 'center', borderLeftWidth: 1, borderColor: LibStyle.colorBgGrey, paddingVertical: 5 }}>
132
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', textAlign: 'center', fontSize: 14 }}>{esp.lang("event/tms_in_failed", "gate")}</Text>
133
- </View>
134
- </View>
135
- </>
136
- }
137
-
138
- {
139
- result && result?.map?.((item: any, i: number) => {
140
- return (
141
- <View key={i} style={{ backgroundColor: i % 2 ? '#fff' : LibStyle.colorGrey, flexDirection: 'row', justifyContent: 'space-between', borderBottomWidth: 1, borderBottomColor: LibStyle.colorBgGrey }}>
142
- <View style={{ flex: 1.5, justifyContent: 'center', borderRightWidth: 1, borderColor: LibStyle.colorBgGrey, paddingVertical: 5, padding: 5 }}>
143
- <Text allowFontScaling={false} numberOfLines={2} ellipsizeMode="tail" style={{ letterSpacing: 1, textAlign: 'center', fontSize: 12 }}>{item?.code}</Text>
144
- </View>
145
- <View style={{ flex: 1.2, justifyContent: 'center', paddingVertical: 5 }}>
146
- {
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 ")}</Text>
149
- }
150
- </View>
151
- <View style={{ flex: 2, justifyContent: 'center', borderLeftWidth: 1, borderColor: LibStyle.colorBgGrey, paddingVertical: 5 }}>
152
- {
153
- item.gate_name != null &&
154
- <Text allowFontScaling={false} style={{ letterSpacing: 1, textAlign: 'center', fontSize: 12, }}>{item.tms_email + "\n" + item.gate_name + " - " + item.turnstile_id}</Text>
155
- }
156
- </View>
157
- </View>
158
- )
159
- })
160
- }
161
- </View>
162
- }
163
- {
164
- error &&
165
- <View style={{ width: LibStyle.width - 40, justifyContent: 'center', alignItems: 'center', padding: 15, borderRadius: 10, marginTop: 100 }}>
166
- <Text allowFontScaling={false} style={{ flexWrap: 'wrap', fontSize: 14, lineHeight: 20, fontWeight: "bold", marginBottom: 5, color: "#fff", textAlign: "center" }}>{error?.message}</Text>
167
- </View>
168
- }
169
- </ScrollView>
170
- <View style={{ flexDirection: 'row', width: LibStyle.width - 40, marginVertical: 10, justifyContent: 'space-between' }}>
171
- <Pressable onPress={() => {
172
-
173
- 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"), () => {
174
- sendTelegram()
175
- }, esp.lang("event/tms_in_failed", "warn_no"), () => { })
176
-
177
- }} style={{ width: (LibStyle.width - 45) * 0.5, height: 43, borderRadius: 5, backgroundColor: LibStyle.colorRed, borderWidth: 3, borderColor: "#fff", justifyContent: 'center', alignContent: 'center', alignItems: 'center', ...LibStyle.elevation(10) }}>
178
- <Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 14, fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/tms_in_failed", "report")}</Text>
179
- </Pressable>
180
- <Pressable onPress={getBack} style={{ width: (LibStyle.width - 45) * 0.5, height: 43, borderRadius: 5, backgroundColor: LibStyle.colorGreen, justifyContent: 'center', alignContent: 'center', alignItems: 'center', ...LibStyle.elevation(10) }}>
181
- <Text allowFontScaling={false} style={{ fontSize: 14, fontWeight: 'bold', color: "#fff" }}>{esp.lang("event/tms_in_failed", "back")}</Text>
182
- </Pressable>
183
-
184
- </View>
185
- </View>
186
-
187
- </View>
188
- )
189
-
190
- }
@@ -1,199 +0,0 @@
1
- // withHooks
2
-
3
- import { EventButton } from 'esoftplay/cache/event/button/import';
4
- import { EventHeader } from 'esoftplay/cache/event/header/import';
5
- import { EventSheet } from 'esoftplay/cache/event/sheet/import';
6
- import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
7
- import { EventTms_in_successProperty } from 'esoftplay/cache/event/tms_in_success/import';
8
- import { LibCurl } from 'esoftplay/cache/lib/curl/import';
9
- import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
10
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
11
- import { LibObject } from 'esoftplay/cache/lib/object/import';
12
- import { LibPicture } from 'esoftplay/cache/lib/picture/import';
13
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
14
- import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
15
- import { UserClass } from 'esoftplay/cache/user/class/import';
16
- import esp from 'esoftplay/esp';
17
- import useSafeState from 'esoftplay/state';
18
- import React, { useEffect, useRef } from 'react';
19
- import { Text, View } from 'react-native';
20
-
21
-
22
- export interface EventTms_idcardArgs {
23
-
24
- }
25
- export interface EventTms_idcardProps {
26
-
27
- }
28
- export default function m(props: EventTms_idcardProps): any {
29
- const width = LibStyle.width
30
- const height = 12 / 9 * width
31
- const marginTop = 2.7 / 9 * width
32
- const photoHeight = 4 / 9 * width
33
- const photoWidth = 3 / 9 * width
34
- const photoMarginBot = 0.46 / 9 * width
35
-
36
- const menuRef = useRef<EventSheet>(null)
37
-
38
- const {
39
- hall,
40
- selectedTicket,
41
- event_id,
42
- selectGate,
43
- url_ticket_update,
44
- price_type,
45
- gate_type,
46
- event_title,
47
- typeScanner,
48
- url_ticket_detail,
49
- configPriority,
50
- scan_type
51
- } = LibNavigation.getArgsAll(props)
52
-
53
- const [result, setResult] = useSafeState<any>()
54
-
55
- function loadData() {
56
- // load data untuk ngambil background id card
57
- new LibCurl('event_tms_visitor?event_id=' + event_id, null, (res, message) => {
58
- setResult(res)
59
- }, (error) => {
60
- LibToastProperty?.show(error?.message)
61
- LibNavigation.back()
62
- }, 1)
63
- }
64
-
65
- useEffect(() => {
66
- loadData()
67
- if (hall && hall == "in") {
68
- entranceHall()
69
- } else if (hall && hall == "out") {
70
- exitHall()
71
- } else {
72
- entrance()
73
- }
74
- }, [])
75
-
76
- function entrance() {
77
- let url = url_ticket_update
78
- let post = {
79
- "target-url": `https://api.${esp.config().domain}/gate_checkin`,
80
- price_id: 0,
81
- qr: encodeURIComponent(selectedTicket?.key),
82
- trx_id: new Date().getTime() + "" + UserClass.state().get()?.id,
83
- event_id: event_id,
84
- gate_id: selectGate?.id,
85
- is_tms: 1,
86
- qty: selectedTicket?.qty,
87
- tms_id: UserClass.state().get()?.id
88
- }
89
-
90
- EventTms_homeProperty.addCounterEntranceOpenGateIdCard(1, selectedTicket?.price_id)
91
- EventTms_in_successProperty.syncUsedTiket().set(LibObject.push(EventTms_in_successProperty.syncUsedTiket().get(), [url, post])())
92
- EventTms_homeProperty.subscribeSync().trigger(EventTms_in_successProperty.syncUsedTiket().get())
93
- }
94
-
95
- function entranceHall() {
96
- let post = {
97
- event_id: event_id,
98
- hall_id: selectGate?.id,
99
- staff_id: selectedTicket?.id
100
- }
101
- new LibCurl('event_tms_hall_confirm_staff', post, (res, message) => {
102
- // setResult(res)
103
- EventTms_homeProperty.addCounterHallInGateIdcard(1, selectedTicket?.price_id)
104
- }, (error) => {
105
- }, 1)
106
- }
107
-
108
- function exitHall() {
109
- let post = {
110
- event_id: event_id,
111
- hall_id: selectGate?.id,
112
- id: selectedTicket?.id // ini id stafff
113
- }
114
- new LibCurl('event_tms_hall_out_confirm_staff', post, (res, message) => {
115
- // setResult(res)
116
- EventTms_homeProperty.addCounterHallOutOpenGateIdCard(1, selectedTicket?.price_id)
117
- }, (error) => {
118
- }, 1)
119
- }
120
-
121
-
122
- return (
123
- <View style={{ flex: 1 }}>
124
- <EventHeader
125
- title={esp.lang("event/tms_idcard", "header")}
126
- notif
127
- onPressMore={() => menuRef.current?.show()}
128
- more
129
- />
130
- <View style={{ backgroundColor: '#000', height: LibStyle.height, alignItems: 'center' }}>
131
- {/* ini id_card nya */}
132
- <LibPicture source={result?.event?.image_idcard == "" ? esp.assets('white_idcard.png') : { uri: result?.event?.image_idcard }} style={{ width: width, height: height, resizeMode: 'contain' }} />
133
- <View style={{ position: 'absolute' }}>
134
- <LibPicture source={{ uri: selectedTicket?.user_image != '' ? decodeURIComponent(selectedTicket?.user_image) : 'https://www.w3schools.com/howto/img_avatar.png' }} style={{ marginBottom: photoMarginBot, marginTop: marginTop, height: photoHeight, width: photoWidth, alignSelf: 'center', resizeMode: 'cover', }} />
135
- <View style={{ padding: 10, marginTop: 5 }} >
136
- {/* view nama */}
137
- <View style={{ flexDirection: 'row' }} >
138
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, color: "#4a4a4a", flex: 3 }} >{esp.lang("event/tms_idcard", "name")}</Text>
139
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, color: "#4a4a4a" }} > : </Text>
140
- <Text allowFontScaling={false} numberOfLines={1} ellipsizeMode={"tail"} style={{ fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, color: "#4a4a4a", flex: 5 }} >{selectedTicket ? decodeURIComponent((selectedTicket?.user_name))?.split("+").join(' ') : esp.lang("event/tms_idcard", "visitor")}</Text>
141
- </View>
142
- {/* view company */}
143
- <View style={{ flexDirection: 'row' }} >
144
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, color: "#4a4a4a", flex: 3 }} >{esp.lang("event/tms_idcard", "company")}</Text>
145
- <Text allowFontScaling={false} style={{ fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, color: "#4a4a4a" }} > : </Text>
146
- <Text allowFontScaling={false} numberOfLines={1} ellipsizeMode={"tail"} style={{ fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, color: "#4a4a4a", flex: 5 }} >{selectedTicket?.exhibitor_name?.split('-')[1]}</Text>
147
- </View>
148
-
149
- <View style={{ width: width - 20, alignSelf: 'center', backgroundColor: '#4a4a4a', height: 4, marginVertical: 4 }} />
150
- <Text allowFontScaling={false} style={{ marginTop: -5, fontSize: 20, fontWeight: "bold", fontStyle: "normal", lineHeight: 32, textAlign: 'center', letterSpacing: 0, color: "#4a4a4a" }} >{selectedTicket?.exhibitor_name?.split('-')[0]}</Text>
151
- </View>
152
-
153
- </View>
154
- <EventButton
155
- label={esp.lang("event/tms_idcard", "btn_back")}
156
- backgroundColor={LibStyle.colorPrimary}
157
- onPress={() => {
158
- // LibNavigation.back()
159
- LibNavigation.replace('component/scanner', {
160
- selectGate: selectGate,
161
- fromPage: 'event/tms_home',
162
- event_id: event_id,
163
- event_title: event_title,
164
- typeScanner: typeScanner,
165
- gate_type: gate_type,
166
- price_type: price_type,
167
- url_ticket_detail: url_ticket_detail,
168
- url_ticket_update: url_ticket_update,
169
- configPriority: configPriority,
170
- scan_type: scan_type
171
- })
172
- }}
173
- style={{ marginTop: 20, marginHorizontal: 15 }}
174
- />
175
- </View>
176
- <EventSheet
177
- _ref={menuRef}
178
- title={"ID CARD"}
179
- options={[
180
- {
181
- text: "Tahan ID CARD",
182
- textStyle: { color: "red" },
183
- onPress: () => {
184
- LibDialog.warningConfirm(esp.lang("event/tms_dashboard", "block_idcard_title"), esp.lang("event/tms_dashboard", "block_idcard_message"), esp.lang("event/tms_dashboard", "block_idcard_ok"), () => {
185
- new LibCurl("event_tms_staff_hold", { qr: encodeURIComponent(selectedTicket?.key) }, (result, message) => {
186
- LibDialog.info("Berhasil!", message)
187
- }, (error) => {
188
- LibDialog.warning("Oops!", error?.message)
189
- })
190
- }, esp.lang("event/tms_dashboard", "block_idcard_no"), () => {
191
- LibDialog.hide()
192
- })
193
- }
194
- }
195
- ]}
196
- />
197
- </View>
198
- )
199
- }
@@ -1,264 +0,0 @@
1
- // withHooks
2
- import { applyStyle } from 'esoftplay';
3
- import { EventTms_list_item } from 'esoftplay/cache/event/tms_list_item/import';
4
- import { LibIcon } from 'esoftplay/cache/lib/icon/import';
5
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
6
- import { LibObject } from 'esoftplay/cache/lib/object/import';
7
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
8
- import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
9
- import { LibUtils } from 'esoftplay/cache/lib/utils/import';
10
-
11
- import { EventButton } from 'esoftplay/cache/event/button/import';
12
- import { EventHeader } from 'esoftplay/cache/event/header/import';
13
- import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
14
- import esp from 'esoftplay/esp';
15
- import useSafeState from 'esoftplay/state';
16
- import React, { useEffect, useRef } from 'react';
17
- import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
18
-
19
-
20
- export interface EventEntrancre_listArgs {
21
-
22
- }
23
- export interface EventEntrancre_listProps {
24
-
25
- }
26
- export default function m(props: EventEntrancre_listProps): any {
27
- const {
28
- price_type,
29
- url_ticket_detail,
30
- url_ticket_update,
31
- tickets,
32
- gate_type,
33
- qr_code,
34
- event_id,
35
- selectGate,
36
- typeScanner,
37
- event_title,
38
- scan_type,
39
- configPriority, }: any = LibNavigation.getArgsAll(props)
40
-
41
- const [ticket, setTicket] = useSafeState<any>()
42
- const [list, setList] = useSafeState<any>()
43
- const [useAll, setUseAll] = useSafeState<boolean>(false)
44
- const dialogQty = useRef<LibSlidingup>(null)
45
-
46
- let args = {
47
- price_type: price_type,
48
- gate_type: gate_type,
49
- qr_code: qr_code,
50
- event_id: event_id,
51
- event_title: event_title,
52
- selectGate: selectGate,
53
- typeScanner: typeScanner,
54
- url_ticket_detail: url_ticket_detail,
55
- url_ticket_update: url_ticket_update,
56
- qty: 1,
57
- configPriority: configPriority,
58
- scan_type: scan_type
59
- }
60
-
61
- useEffect(() => {
62
- if (tickets?.length == 1) {
63
- let item = tickets?.[0]
64
- let a = new Array(Number(item?.qty_left)).fill({
65
- ...item,
66
- selected: 0
67
- })
68
-
69
- let b = a?.map((item: any, i: number) => {
70
- return { ...item, selected: i == 0 ? 1 : 0 }
71
- })
72
-
73
- setUseAll(false)
74
- setList(b)
75
- setTicket(item)
76
- LibUtils.debounce(() => {
77
- if (item.hasOwnProperty("exhibitor_name")) {
78
- LibNavigation.replace('event/tms_idcard', {
79
- selectedTicket: item,
80
- ...args
81
- })
82
- } else {
83
- dialogQty.current!.show()
84
- }
85
- }, 100)
86
- }
87
- }, [])
88
-
89
-
90
- useEffect(() => {
91
- setUseAll(list?.some((x: any) => x.selected == 0) ? false : true)
92
- }, [list])
93
-
94
- function useTicket() {
95
- // LibNavigation.back()
96
- let arg = {
97
- ...args,
98
- qty: list?.filter((it: any) => it.selected).length
99
- }
100
-
101
- if (tickets?.length == 1) {
102
- LibNavigation.replace('event/tms_in_success', {
103
- selectedTicket: ticket,
104
- ...arg
105
- })
106
- } else {
107
- if (configPriority) { // ini untuk memunculkan priority
108
- if (configPriority?.filter?.((item: any) => item.id == ticket.price_id).length > 0) {
109
- LibNavigation.replace('event/tms_in_success', {
110
- selectedTicket: ticket,
111
- ...arg
112
- })
113
- } else {
114
- LibNavigation.replace('event/tms_in_warning', {
115
- selectedTicket: ticket,
116
- is_from_list: 1, // digunakan untuk membedakan navigasi kalau scan QR Member
117
- ...arg
118
- })
119
- }
120
- } else {
121
- LibNavigation.replace('event/tms_in_success', {
122
- selectedTicket: ticket,
123
- ...arg
124
- })
125
- }
126
- }
127
-
128
- }
129
-
130
- function renderItem(item: any, i?: number) {
131
- return (
132
- <EventTms_list_item
133
- key={i}
134
- item={item}
135
- onPress={() => {
136
- if (item.text == "") {
137
- if (item.qty_left == 0) {
138
- LibNavigation.back()
139
- LibNavigation.navigate('event/tms_in_failed', {
140
- text: esp.lang("event/tms_in_list", "ticket_habis"),
141
- ticketItem: item,
142
- ...args
143
- })
144
- } else {
145
- let a = new Array(Number(item?.qty_left)).fill({
146
- ...item,
147
- selected: 0
148
- })
149
-
150
- let b = a?.map((item: any, i: number) => {
151
- return { ...item, selected: i == 0 ? 1 : 0 }
152
- })
153
-
154
- setUseAll(false)
155
- setList(b)
156
- setTicket(item)
157
- LibUtils.debounce(() => {
158
- if (item.hasOwnProperty("exhibitor_name")) {
159
- LibNavigation.replace('event/tms_idcard', {
160
- selectedTicket: item,
161
- ...args
162
- })
163
- } else {
164
- dialogQty.current!.show()
165
- }
166
- }, 100)
167
- }
168
- } else {
169
- LibNavigation.back()
170
- LibNavigation.navigate('event/tms_in_failed', {
171
- text: item.text,
172
- ...args
173
- })
174
- }
175
- }}
176
- />
177
- )
178
- }
179
-
180
- return (
181
- <View style={{ flex: 1, backgroundColor: '#fff' }}>
182
- <EventHeader title={esp.lang("event/tms_in_list", "header_title")} subtitle='TMS' />
183
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', paddingTop: 15, paddingBottom: 0 }}>
184
- <ScrollView style={{ flex: 1 }}>
185
- {
186
- tickets?.map(renderItem)
187
- }
188
- </ScrollView>
189
- </View>
190
-
191
- {/* dialog qty */}
192
- <LibSlidingup ref={dialogQty}>
193
- <View style={{ borderTopRightRadius: 20, borderTopLeftRadius: 20, padding: 20, paddingBottom: 0, backgroundColor: '#fff', maxHeight: LibStyle.height - (LibStyle.height / 3) }}>
194
- <Text allowFontScaling={false} style={applyStyle({ letterSpacing: 1, fontSize: 30, marginTop: 0, fontWeight: 'bold', textAlign: "center", textAlignVertical: 'center', color: '#000', margin: 15 })} >{esp.lang("event/tms_in_list", "total_ticket", list?.length)}</Text>
195
-
196
- <View style={{ flexDirection: 'row', alignItems: 'center', marginVertical: 20 }} >
197
- <TouchableOpacity
198
- onPress={() => {
199
- const index = findLastIndex(list, (x: any) => x.selected == 1)
200
- if (index > 0) {
201
- setList(LibObject.set(list, 0)(index, 'selected'))
202
- }
203
- }}
204
- style={{ height: 70, width: 70, borderRadius: 10, backgroundColor: '#c1c2c3', alignItems: 'center', justifyContent: 'center' }} >
205
- <LibIcon name='minus' size={50} />
206
- </TouchableOpacity>
207
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }} >
208
- <Text style={{ fontSize: 50 }} >{list?.filter?.((x: any) => x.selected == 1).length}</Text>
209
- </View>
210
- <TouchableOpacity
211
- onPress={() => {
212
- const index = list?.findIndex?.((x: any) => x.selected == 0)
213
- if (index > -1)
214
- setList(LibObject.set(list, 1)(index, 'selected'))
215
- }}
216
- style={{ height: 70, width: 70, borderRadius: 10, backgroundColor: '#c1c2c3', alignItems: 'center', justifyContent: 'center' }} >
217
- <LibIcon name='plus' size={50} />
218
- </TouchableOpacity>
219
- </View>
220
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', padding: 10, marginBottom: 20, alignContent: 'center', alignItems: 'center' }}>
221
- <Text allowFontScaling={false} numberOfLines={2} ellipsizeMode={'tail'} style={{ flex: 1, fontWeight: 'bold', fontSize: 14, letterSpacing: 1 }}>{esp.lang("event/tms_in_list", "total_ticket_use", list?.filter((it: any) => it.selected).length)}</Text>
222
- <TouchableOpacity onPress={() => {
223
- let a = list?.map((item: any, i: number) => {
224
- return { ...item, selected: useAll ? 0 : 1 }
225
- })
226
- setList(a)
227
- }} style={applyStyle({ paddingHorizontal: 10, borderWidth: 1, borderColor: 'rgba(0, 0, 0, 0)', height: 35, borderRadius: 16, backgroundColor: useAll ? LibStyle.colorRed : LibStyle.colorGreen, flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center' })} >
228
- <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: '#fff', marginRight: 15 })} >{useAll ? esp.lang("event/tms_in_list", "cancel_use") : esp.lang("event/tms_in_list", "use_all")}</Text>
229
- <LibIcon.Ionicons size={18} color="#fff" name={useAll ? "close" : "checkmark-done"} />
230
- </TouchableOpacity>
231
- </View>
232
-
233
- <EventButton
234
- label={esp.lang("event/tms_in_list", "btn_entrance")}
235
- style={{ borderRadius: 10, marginHorizontal: 5, marginBottom: 10 }}
236
- backgroundColor={list?.filter((it: any) => it.selected).length == 0 ? LibStyle.colorBgGrey : LibStyle.colorGreen}
237
- onPress={() => {
238
- if (list?.filter((it: any) => it.selected).length == 0) {
239
- LibToastProperty.show(esp.lang("event/tms_in_list", "ticket_not_select"))
240
- } else {
241
- useTicket()
242
- }
243
- }}
244
- />
245
- </View>
246
-
247
- </LibSlidingup >
248
-
249
-
250
- </View >
251
- )
252
- }
253
-
254
- function findLastIndex(arr: any[], condition: (value: any, index: number, obj: any[]) => unknown) {
255
- const reversedArray = arr.slice().reverse();
256
- const indexInReversedArray = reversedArray.findIndex(condition);
257
-
258
- if (indexInReversedArray === -1) {
259
- return -1; // No matching element found
260
- }
261
-
262
- const lastIndex = arr.length - 1 - indexInReversedArray;
263
- return lastIndex;
264
- }