esoftplay-event 0.0.0-a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/config.json +11 -0
  2. package/event/additional.tsx +188 -0
  3. package/event/additional_input.tsx +316 -0
  4. package/event/block_invitation.tsx +48 -0
  5. package/event/countdown.tsx +72 -0
  6. package/event/counter_cashier.tsx +180 -0
  7. package/event/counter_cashier_report.tsx +114 -0
  8. package/event/counter_cashier_sell.tsx +135 -0
  9. package/event/counter_eo.tsx +451 -0
  10. package/event/counter_history.tsx +74 -0
  11. package/event/counter_history_item.tsx +48 -0
  12. package/event/counter_info.tsx +96 -0
  13. package/event/counter_lm.tsx +273 -0
  14. package/event/counter_menu.tsx +85 -0
  15. package/event/counter_report.tsx +105 -0
  16. package/event/counter_report_breakdown.tsx +93 -0
  17. package/event/counter_report_detail.tsx +238 -0
  18. package/event/counter_report_detail_list.tsx +56 -0
  19. package/event/counter_request.tsx +136 -0
  20. package/event/counter_request_detail.tsx +211 -0
  21. package/event/counter_section.tsx +32 -0
  22. package/event/counter_send.tsx +277 -0
  23. package/event/counter_status.tsx +32 -0
  24. package/event/counter_type.tsx +23 -0
  25. package/event/counter_user_list.tsx +197 -0
  26. package/event/counter_user_list_item.tsx +143 -0
  27. package/event/coupon.tsx +124 -0
  28. package/event/coupon_claim.tsx +198 -0
  29. package/event/coupon_claim_detail.tsx +175 -0
  30. package/event/coupon_claim_history.tsx +279 -0
  31. package/event/coupon_claim_reimburse.tsx +111 -0
  32. package/event/coupon_claim_reimburse_history.tsx +72 -0
  33. package/event/coupon_claim_reimburse_history_detail.tsx +117 -0
  34. package/event/coupon_claim_staff.tsx +256 -0
  35. package/event/coupon_detail.tsx +98 -0
  36. package/event/coupon_event_list.tsx +77 -0
  37. package/event/coupon_generate.tsx +258 -0
  38. package/event/coupon_generate_event.tsx +79 -0
  39. package/event/coupon_generate_list.tsx +56 -0
  40. package/event/date_picker.tsx +152 -0
  41. package/event/detail.tsx +352 -0
  42. package/event/entrance.tsx +215 -0
  43. package/event/entrance_again.tsx +200 -0
  44. package/event/entrance_failed.tsx +190 -0
  45. package/event/entrance_idcard.tsx +203 -0
  46. package/event/entrance_list.tsx +264 -0
  47. package/event/entrance_list_item.tsx +88 -0
  48. package/event/entrance_log.tsx +130 -0
  49. package/event/entrance_success.tsx +155 -0
  50. package/event/entrance_warning.tsx +91 -0
  51. package/event/exchange_reward.tsx +31 -0
  52. package/event/exchange_reward_result.tsx +137 -0
  53. package/event/exchange_ticket.tsx +234 -0
  54. package/event/exchange_ticket_list.tsx +191 -0
  55. package/event/exchange_ticket_result.tsx +211 -0
  56. package/event/exit.tsx +91 -0
  57. package/event/exit_failed.tsx +135 -0
  58. package/event/exit_list.tsx +118 -0
  59. package/event/exit_log.tsx +131 -0
  60. package/event/exit_success.tsx +143 -0
  61. package/event/exit_temporary.tsx +226 -0
  62. package/event/hall_in.tsx +148 -0
  63. package/event/hall_in_failed.tsx +270 -0
  64. package/event/hall_in_list.tsx +222 -0
  65. package/event/hall_in_log.tsx +134 -0
  66. package/event/hall_in_success.tsx +132 -0
  67. package/event/hall_out.tsx +143 -0
  68. package/event/hall_out_failed.tsx +133 -0
  69. package/event/hall_out_list.tsx +215 -0
  70. package/event/hall_out_log.tsx +133 -0
  71. package/event/hall_out_success.tsx +130 -0
  72. package/event/list.tsx +219 -0
  73. package/event/list_filter.tsx +124 -0
  74. package/event/log.tsx +435 -0
  75. package/event/qc_idcard.tsx +209 -0
  76. package/event/qc_idcard_failed.tsx +78 -0
  77. package/event/qc_idcard_success.tsx +68 -0
  78. package/event/queue_out.tsx +186 -0
  79. package/event/queue_pricing.tsx +152 -0
  80. package/event/randomseat.tsx +33 -0
  81. package/event/review.tsx +117 -0
  82. package/event/review_add.tsx +342 -0
  83. package/event/review_detail.tsx +67 -0
  84. package/event/review_item.tsx +76 -0
  85. package/event/scan_item.tsx +66 -0
  86. package/event/schedule.tsx +135 -0
  87. package/event/seat.tsx +628 -0
  88. package/event/seat_autopick.tsx +120 -0
  89. package/event/seat_map.tsx +408 -0
  90. package/event/seat_map_matrix.tsx +94 -0
  91. package/event/seat_map_test.tsx +401 -0
  92. package/event/ticket_list.tsx +722 -0
  93. package/event/ticket_list2.tsx +680 -0
  94. package/event/timer.tsx +58 -0
  95. package/event/tms.tsx +103 -0
  96. package/event/tms_add.tsx +94 -0
  97. package/event/tms_add_result.tsx +175 -0
  98. package/event/tms_dashboard.tsx +89 -0
  99. package/event/tms_event_list.tsx +66 -0
  100. package/event/turnstile_event_gate.tsx +74 -0
  101. package/event/turnstile_event_item.tsx +41 -0
  102. package/event/turnstile_event_list.tsx +69 -0
  103. package/event/turnstile_event_ticket.tsx +95 -0
  104. package/event/turnstile_settings.tsx +327 -0
  105. package/event/turnstile_settings_otp.tsx +58 -0
  106. package/event/turnstile_settings_status.tsx +50 -0
  107. package/event/voucher.tsx +149 -0
  108. package/event/voucher_multi.tsx +181 -0
  109. package/fonts/Arial.ttf +0 -0
  110. package/fonts/ArialBold.ttf +0 -0
  111. package/fonts/DecoNumbers.ttf +0 -0
  112. package/fonts/MonoSpace.ttf +0 -0
  113. package/fonts/SFProText.ttf +0 -0
  114. package/fonts/digital.ttf +0 -0
  115. package/fonts/mono.ttf +0 -0
  116. package/id.json +1113 -0
  117. package/index.js +2 -0
  118. package/libs.json +1 -0
  119. package/mover.js +0 -0
  120. package/package.json +16 -0
  121. package/publisher.js +84 -0
@@ -0,0 +1,91 @@
1
+ // withHooks
2
+
3
+ import { applyStyle } from 'esoftplay';
4
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
5
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
6
+ import { TicketItemProperty } from 'esoftplay/cache/ticket/item/import';
7
+ import esp from 'esoftplay/esp';
8
+ import React from 'react';
9
+ import { Text, TouchableOpacity, View } from 'react-native';
10
+
11
+
12
+ export interface EventEntrance_warningArgs {
13
+
14
+ }
15
+ export interface EventEntrance_warningProps {
16
+
17
+ }
18
+ export default function m(props: EventEntrance_warningProps): any {
19
+ const {
20
+ url_ticket_update,
21
+ url_ticket_detail,
22
+ price_type,
23
+ selectedTicket,
24
+ gate_type,
25
+ qr_code,
26
+ event_id,
27
+ selectGate,
28
+ typeScanner,
29
+ event_title,
30
+ qty,
31
+ configPriority,
32
+ scan_type,
33
+ is_from_list } = LibNavigation.getArgsAll<any>(props)
34
+
35
+
36
+ let args = {
37
+ price_type: price_type,
38
+ gate_type: gate_type,
39
+ qr_code: qr_code,
40
+ event_id: event_id,
41
+ event_title: event_title,
42
+ selectGate: selectGate,
43
+ typeScanner: typeScanner,
44
+ url_ticket_detail: url_ticket_detail,
45
+ url_ticket_update: url_ticket_update,
46
+ qty: qty,
47
+ configPriority: configPriority,
48
+ scan_type: scan_type
49
+ }
50
+
51
+ return (
52
+ <View style={{ flex: 1, backgroundColor: selectedTicket?.color }}>
53
+ <View style={{ padding: 15, flex: 4, alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
54
+ <Text allowFontScaling={false} style={{ color: TicketItemProperty.textColor(selectedTicket?.color), letterSpacing: 1, fontSize: 20, textAlign: 'center', fontWeight: 'normal' }}>{esp.lang("event/entrance_warning", "your_ticket")}</Text>
55
+ <Text allowFontScaling={false} numberOfLines={5} ellipsizeMode="tail" style={{ marginVertical: 15, letterSpacing: 2, color: TicketItemProperty.textColor(selectedTicket?.color), fontSize: 32, textAlign: 'center', fontWeight: 'bold' }}>{selectedTicket?.title}</Text>
56
+ <Text allowFontScaling={false} style={{ paddingHorizontal: 20, color: TicketItemProperty.textColor(selectedTicket?.color), letterSpacing: 1, fontSize: 20, textAlign: 'center', fontWeight: 'normal' }}>{esp.lang("event/entrance_warning", "confirm")}</Text>
57
+ </View>
58
+ <View style={{ flex: 1, padding: 15, justifyContent: 'flex-end' }}>
59
+ <TouchableOpacity onPress={() => {
60
+ if (is_from_list == 1) {
61
+ LibNavigation.replace('event/entrance_success', {
62
+ selectedTicket: selectedTicket,
63
+ ...args
64
+ })
65
+ } else {
66
+ if (selectedTicket?.qty > 1) {
67
+ let tikets = [selectedTicket]
68
+ LibNavigation.replace('event/entrance_list', {
69
+ tickets: tikets,
70
+ ...args
71
+ })
72
+ } else {
73
+ LibNavigation.replace('event/entrance_success', {
74
+ selectedTicket: selectedTicket,
75
+ ...args
76
+ })
77
+ }
78
+ }
79
+ }} style={applyStyle({ marginBottom: 20, width: LibStyle.width - 30, height: 40, borderRadius: 16, backgroundColor: TicketItemProperty.textColor(selectedTicket?.color), flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
80
+ <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: selectedTicket?.color, marginRight: 15 })} >{esp.lang("event/entrance_warning", "process")}</Text>
81
+ </TouchableOpacity>
82
+ <TouchableOpacity onPress={() => {
83
+ LibNavigation.back()
84
+ }} style={applyStyle({ width: LibStyle.width - 30, borderWidth: 1, borderColor: TicketItemProperty.textColor(selectedTicket?.color), height: 40, borderRadius: 16, backgroundColor: selectedTicket?.color, flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
85
+ <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: TicketItemProperty.textColor(selectedTicket?.color), marginRight: 15 })} >{esp.lang("event/entrance_warning", "cancel")}</Text>
86
+ </TouchableOpacity>
87
+ </View>
88
+
89
+ </View>
90
+ )
91
+ }
@@ -0,0 +1,31 @@
1
+ // withHooks
2
+
3
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
4
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
5
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
6
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
7
+ import esp from 'esoftplay/esp';
8
+ import React from 'react';
9
+ import { Pressable, View } from 'react-native';
10
+
11
+
12
+ export interface EventExchange_rewardArgs {
13
+
14
+ }
15
+ export interface EventExchange_rewardProps {
16
+
17
+ }
18
+ export default function m(props: EventExchange_rewardProps): any {
19
+ const { dataEvent }: any = LibNavigation.getArgsAll(props)
20
+
21
+ return (
22
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
23
+ <ComponentHeader title={esp.lang("event/exchange_reward", "header_title")} subtitle={dataEvent?.name} />
24
+ <Pressable onPress={() => {
25
+ LibNavigation.navigate('component/scanner', { event_title: dataEvent?.name, event_id: dataEvent?.id, fromPage: "event/exchange_reward" })
26
+ }} style={{ flex: 1, overflow: 'hidden', margin: 15, backgroundColor: '#fff', borderRadius: 10, ...LibStyle.elevation(2) }}>
27
+ <LibPicture source={{ uri: 'https://static.vecteezy.com/system/resources/previews/005/594/108/non_2x/mobile-application-for-scanning-qr-code-hand-holding-smartphone-scan-qr-code-icon-phone-app-barcode-scanner-vector.jpg' }} style={{ flex: 1, opacity: 0.7, resizeMode: 'cover' }} />
28
+ </Pressable >
29
+ </View>
30
+ )
31
+ }
@@ -0,0 +1,137 @@
1
+ // withHooks
2
+
3
+ import { applyStyle } from 'esoftplay';
4
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
5
+ import { ComponentTouchable } from 'esoftplay/cache/component/touchable/import';
6
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
7
+ import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
8
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
9
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
10
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
11
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
12
+ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
13
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
14
+ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
15
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
16
+ import esp from 'esoftplay/esp';
17
+ import useSafeState from 'esoftplay/state';
18
+ import React, { useEffect } from 'react';
19
+ import { Pressable, ScrollView, Text, View } from 'react-native';
20
+
21
+
22
+ export interface EventExchange_reward_resultArgs {
23
+
24
+ }
25
+ export interface EventExchange_reward_resultProps {
26
+
27
+ }
28
+ export default function m(props: EventExchange_reward_resultProps): any {
29
+ const { qr, event_id, event_title }: any = LibNavigation.getArgsAll(props)
30
+
31
+ const [result, setResult] = useSafeState<any>()
32
+
33
+ function loadData() {
34
+ let post = {
35
+ event_id: event_id,
36
+ qr: qr
37
+ }
38
+ new LibCurl('event_tms_order_review', post, (res, msg) => {
39
+ setResult(res)
40
+ }, (err) => {
41
+ LibDialog.warning(esp.lang("event/exchange_reward_result", "oops"), err?.message)
42
+ LibNavigation.back()
43
+ })
44
+ }
45
+
46
+ function submitSign() {
47
+ let post = {
48
+ booking_id: result?.booking?.id,
49
+ event_id: event_id,
50
+ }
51
+ LibProgress.show("Mohon Tunggu")
52
+ new LibCurl('event_tms_order_review_sign', post, (res, msg) => {
53
+ LibProgress.hide()
54
+ LibToastProperty.show(msg)
55
+ LibNavigation.back()
56
+ LibNavigation.navigate('component/scanner', { event_title: event_title, event_id: event_id, fromPage: "event/exchange_reward" })
57
+
58
+ }, (err) => {
59
+ LibProgress.hide()
60
+ LibDialog.warning(esp.lang("event/exchange_reward_result", "oops"), err?.message)
61
+ }, 1)
62
+ }
63
+
64
+ useEffect(() => {
65
+ loadData()
66
+ }, [])
67
+
68
+ if (!result) {
69
+ return <LibLoading />
70
+ }
71
+
72
+ return (
73
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
74
+ <ComponentHeader title={esp.lang("event/exchange_reward_result", "header_title")} subtitle={event_title} />
75
+ <ScrollView>
76
+ <Pressable onPress={() => { }} style={{ backgroundColor: '#fff', borderRadius: 5, overflow: 'hidden', width: LibStyle.width - 30, margin: 15, marginBottom: 0 }}>
77
+ <View style={{ alignContent: 'center', borderBottomWidth: 1, borderBottomColor: "#c9c9c9", alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorPrimary, padding: 10 }}>
78
+ <Text allowFontScaling={false} numberOfLines={1} ellipsizeMode="tail" style={{ color: "#fff", alignSelf: 'center', textAlign: 'center', fontSize: 16, fontWeight: 'bold' }}> {result?.booking?.price_name}</Text>
79
+ </View>
80
+ <View style={{ padding: 10, backgroundColor: '#fff', flex: 1 }}>
81
+ <Text allowFontScaling={false} style={applyStyle({ marginHorizontal: 15, fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" })}>{result?.booking?.event_name}</Text>
82
+
83
+ <View style={applyStyle({ marginHorizontal: 15, borderBottomWidth: 1, marginTop: 15, borderBottomColor: '#9b9b9b' })}>
84
+ <View style={{ flexDirection: 'row', marginBottom: 10 }}>
85
+ <View style={applyStyle({ width: 60, height: 60, borderRadius: 5, backgroundColor: LibStyle.colorBgGrey, ...LibStyle.elevation(2) })}>
86
+ <LibPicture style={applyStyle({ width: 60, height: 60, resizeMode: 'cover', borderRadius: 5, })} source={{ uri: result?.event?.image }} />
87
+ </View>
88
+ <View style={applyStyle({ flexDirection: 'row', justifyContent: 'space-between', marginLeft: 14, flex: 1 })}>
89
+ <View style={{ flex: 2, marginRight: 5, }}>
90
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', marginBottom: 4 }}>
91
+ <LibIcon name='ticket' size={20} color="#9b9b9b" />
92
+ <Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 16, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{LibUtils.number(result?.booking?.qty)} Tiket</Text>
93
+ </View>
94
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', marginBottom: 4 }}>
95
+ <LibIcon name='cash' size={20} color="#9b9b9b" />
96
+ <Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{LibUtils.money(result?.booking?.total)}</Text>
97
+ </View>
98
+
99
+ {
100
+ result?.booking?.ondate == "0000-00-00" &&
101
+ <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', marginBottom: 4 }}>
102
+ <LibIcon name='calendar' size={18} color="#9b9b9b" />
103
+ <Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{LibUtils.getDateRange(result?.booking?.start_date, result?.booking?.end_date)}</Text>
104
+ </View>
105
+ }
106
+ </View>
107
+ {
108
+ result?.booking?.ondate != "0000-00-00" &&
109
+ <View style={{ flex: 1, marginLeft: 15, alignContent: 'flex-end', alignItems: 'flex-end' }}>
110
+ <Text allowFontScaling={false} style={{ fontSize: 30, fontWeight: 'bold' }}>{LibUtils.moment(result?.booking?.ondate).localeFormat("DD")}</Text>
111
+ <Text allowFontScaling={false} style={{ fontSize: 20, fontWeight: 'bold', marginTop: -5, }}>{LibUtils.moment(result?.booking?.ondate).localeFormat("MMM")}</Text>
112
+ </View>
113
+ }
114
+ </View>
115
+ </View>
116
+
117
+ </View>
118
+ <Text allowFontScaling={false} style={applyStyle({ padding: 10, paddingBottom: 0, textAlign: 'center', textAlignVertical: 'center', fontFamily: "ArialBold", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 4, color: '#70472b' })}>{result?.booking?.booking_code}</Text>
119
+ <View style={applyStyle({ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 })}>
120
+ <View style={applyStyle({ width: 25, height: 25, borderRadius: 12.5, backgroundColor: LibStyle.colorBgGrey, marginLeft: -12.5 })} />
121
+ <View style={applyStyle({ flex: 1 })} />
122
+ <View style={applyStyle({ width: 25, height: 25, borderRadius: 12.5, backgroundColor: LibStyle.colorBgGrey, marginRight: -12.5 })} />
123
+ </View>
124
+ </View>
125
+ </Pressable>
126
+ </ScrollView>
127
+
128
+ <ComponentTouchable onPress={() => {
129
+ submitSign()
130
+ }}>
131
+ <View style={{ margin: 15, marginTop: 20, height: 35, borderRadius: 5, backgroundColor: LibStyle.colorRed, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 9 }} >
132
+ <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", textAlign: "center", textAlignVertical: 'center', color: 'white', marginRight: 13, marginLeft: 10 }} >{esp.lang("event/exchange_reward_result", "submit")}</Text>
133
+ </View>
134
+ </ComponentTouchable>
135
+ </View>
136
+ )
137
+ }
@@ -0,0 +1,234 @@
1
+ // withHooks
2
+
3
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
4
+ import { ComponentSlidingup } from 'esoftplay/cache/component/slidingup/import';
5
+ import { ComponentTouchable } from 'esoftplay/cache/component/touchable/import';
6
+ import { EventExchange_ticket_resultProperty } from 'esoftplay/cache/event/exchange_ticket_result/import';
7
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
8
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
9
+ import { LibInput_circle2 } from 'esoftplay/cache/lib/input_circle2/import';
10
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
11
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
12
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
13
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
14
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
15
+ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
16
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
17
+ import { UseTasks } from 'esoftplay/cache/use/tasks/import';
18
+ import esp from 'esoftplay/esp';
19
+ import useGlobalState from 'esoftplay/global';
20
+ import useSafeState from 'esoftplay/state';
21
+ import useGlobalSubscriber, { useGlobalSubscriberReturn } from 'esoftplay/subscribe';
22
+ import { useTimeout } from 'esoftplay/timeout';
23
+ import React, { useEffect, useRef } from 'react';
24
+ import isEqual from 'react-fast-compare';
25
+ import { Pressable, RefreshControl, ScrollView, Text, View } from 'react-native';
26
+
27
+
28
+ export interface EventExchange_ticketArgs {
29
+
30
+ }
31
+ export interface EventExchange_ticketProps {
32
+
33
+ }
34
+
35
+
36
+ // new
37
+ export const stateExchangeLog = useGlobalState({}, {
38
+ persistKey: 'event/exchange_ticket_log',
39
+ inFile: true,
40
+ loadOnInit: true
41
+ })
42
+
43
+ function addCounter(counter: number, type: string) {
44
+ const cdate = LibUtils.moment().localeFormat('YYYY-MM-DD HH')
45
+ stateExchangeLog.set((old: any) => {
46
+ if (!old[type]) { old[type] = {} }
47
+ return LibObject.update(old, (c) => (c || 0) + counter)(type, cdate)
48
+ })
49
+ }
50
+
51
+ export function getDataByDate(): any {
52
+ return stateExchangeLog.get()
53
+ }
54
+
55
+ export function addCounterScan(counter: number) {
56
+ addCounter(counter, 'scan')
57
+ }
58
+ export function addCounterScanNo(counter: number) {
59
+ addCounter(counter, 'scan_failed')
60
+ }
61
+ export function addCounterSend(counter: number) {
62
+ addCounter(counter, 'send')
63
+ }
64
+ export function addCounterResponseOK(counter: number) {
65
+ addCounter(counter, 'api_ok')
66
+ }
67
+ export function addCounterResponseNo(counter: number) {
68
+ addCounter(counter, 'api_no')
69
+ }
70
+ export function addCounterResponseTimeout(counter: number) {
71
+ addCounter(counter, 'timeout')
72
+ }
73
+ export function addCounterGiftBy(title: string, counter: number) {
74
+ addCounter(counter, `gift_${title}`)
75
+ }
76
+
77
+ const subscriber = useGlobalSubscriber()
78
+ export function subscribeSync(): useGlobalSubscriberReturn {
79
+ return subscriber
80
+ }
81
+
82
+ const useTasks1 = UseTasks()
83
+
84
+ export default function m(props: EventExchange_ticketProps): any {
85
+ const { dataEvent }: any = LibNavigation.getArgsAll(props)
86
+ const dialogInput = useRef<ComponentSlidingup>(null)
87
+
88
+ const [dataConfig, setDataConfig] = useSafeState<any>()
89
+ const [error, setError] = useSafeState<string>()
90
+ const [refreshing, setRefreshing] = useSafeState<boolean>(false);
91
+
92
+ let inputAccessCode = React.useRef<LibInput_circle2>(null)
93
+
94
+ const timeoutSync = useRef<any>()
95
+ const timeout = useTimeout()
96
+ const [syncTicketExchange] = useTasks1((item: any) => new Promise((next) => {
97
+ clearTimeout?.(timeoutSync.current)
98
+ timeoutSync.current = timeout(() => {
99
+ next()
100
+ }, 10000);
101
+ new LibCurl(item?.url, item?.post, (res, msg) => {
102
+ addCounterResponseOK(1)
103
+ let a = EventExchange_ticket_resultProperty.stateListConfirm().get().filter((x: any) => !isEqual(item, x))
104
+ EventExchange_ticket_resultProperty.stateListConfirm().set(a)
105
+ next()
106
+ }, (err) => {
107
+ addCounterResponseNo(1)
108
+ next()
109
+ })
110
+ }))
111
+
112
+ subscriber.useSubscribe(() => {
113
+ syncTicketExchange(subscriber.getValue())
114
+ })
115
+
116
+ useEffect(() => {
117
+ subscriber.trigger(EventExchange_ticket_resultProperty.stateListConfirm().get())
118
+ loadDataConfig()
119
+ }, [])
120
+
121
+
122
+ function loadDataConfig() {
123
+ new LibCurl('event_booking_exchange_config?event_id=' + dataEvent?.id, null, (res, msg) => {
124
+ setDataConfig(res)
125
+ setRefreshing(false)
126
+ }, (err) => {
127
+ setRefreshing(false)
128
+ setError(err?.message)
129
+ // LibToastProperty.show(err?.message)
130
+ }, 1)
131
+ }
132
+
133
+ function doSubmit() {
134
+ inputAccessCode.current?.blur()
135
+ if (inputAccessCode.current?.getText() == '') {
136
+ LibToastProperty.show(esp.lang("visitor/index", "alert_error_not_empty_code"))
137
+ inputAccessCode.current?.focus()
138
+ return
139
+ }
140
+ dialogInput.current?.hide()
141
+ LibNavigation.navigate('event/exchange_ticket_result', { event_title: dataEvent?.name, event_id: dataEvent?.id, qr: inputAccessCode.current?.getText().toUpperCase() })
142
+ }
143
+
144
+ function onRefresh() {
145
+ setRefreshing(true)
146
+ loadDataConfig()
147
+ }
148
+
149
+
150
+ return (
151
+ <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
152
+ <ComponentHeader title={esp.lang("event/exchange_ticket", "header")} subtitle={dataEvent?.name} />
153
+ <ScrollView style={{ flex: 1 }} refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />}>
154
+ <Pressable onPress={() => {
155
+ LibNavigation.navigate('event/exchange_ticket_list', { dataEvent: dataEvent })
156
+ }} style={{ margin: 15, marginBottom: 0, padding: 10, borderWidth: 1, backgroundColor: '#fff', borderColor: LibStyle.colorRed, flex: 1, borderRadius: 10, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' }}>
157
+ <Text allowFontScaling={false}>{esp.lang("event/exchange_ticket", "exchange_history")}</Text>
158
+ <LibIcon name='chevron-right' />
159
+ </Pressable >
160
+ <View style={{ flex: 1, margin: 15, backgroundColor: '#fff', borderRadius: 10, ...LibStyle.elevation(2) }}>
161
+ <ComponentTouchable onPress={() => {
162
+ if (dataConfig) {
163
+ LibNavigation.navigate('component/scanner', { event_title: dataEvent?.name, event_id: dataEvent?.id, fromPage: "event/exchange_ticket" })
164
+ }
165
+ }}>
166
+ <View style={{ width: LibStyle.width - 30, overflow: 'hidden', borderTopLeftRadius: 10, borderTopRightRadius: 10, height: LibStyle.height * 0.5, backgroundColor: '#b8b7bf', justifyContent: 'center', alignContent: 'center', alignItems: 'center' }}>
167
+ <LibPicture source={esp.assets('icons/ic_barcode_white.png')} style={{ height: 250, width: 250 }} />
168
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "center", marginTop: 10, color: '#fff' }}>{esp.lang("transfer/index", "klik_here")}</Text>
169
+ </View>
170
+ </ComponentTouchable>
171
+
172
+ {
173
+ (dataConfig || error) ?
174
+ <View style={{ marginTop: 20, margin: 10 }}>
175
+ {
176
+ dataConfig &&
177
+ <Text allowFontScaling={false} style={{ fontFamily: 'MonoSpace', letterSpacing: 1 }}>{esp.lang("event/exchange_ticket", "type_can_scan")}</Text>
178
+ }
179
+
180
+ {
181
+ dataConfig && dataConfig?.map((item: any, i: number) => {
182
+ return (
183
+ <Text key={i} allowFontScaling={false} style={{ marginTop: 4, fontFamily: 'MonoSpace', letterSpacing: 1 }}>{(i + 1) + "."} {item?.type}</Text>
184
+ )
185
+ })
186
+ }
187
+ {
188
+ error &&
189
+ <Text allowFontScaling={false} style={{ color: LibStyle.colorRed, fontWeight: 'bold', fontFamily: 'MonoSpace', letterSpacing: 1 }}>{error}</Text>
190
+ }
191
+ </View>
192
+ :
193
+ <View style={{ marginTop: 30, marginBottom: 20 }}>
194
+ <LibLoading />
195
+ </View>
196
+ }
197
+
198
+ </View >
199
+ </ScrollView>
200
+
201
+ <Pressable onPress={() => {
202
+ if (dataConfig) {
203
+ dialogInput.current?.show()
204
+ }
205
+ }} style={{ ...LibStyle.elevation(2), alignContent: 'center', alignItems: 'center', justifyContent: 'center', position: 'absolute', width: 50, height: 50, borderRadius: 25, backgroundColor: LibStyle.colorRed, bottom: 20, right: 15 }}>
206
+ <LibIcon.Ionicons name='terminal-outline' color='#fff' />
207
+ </Pressable>
208
+
209
+ <ComponentSlidingup ref={dialogInput}>
210
+ <View style={{ backgroundColor: '#f6f6f6', borderTopRightRadius: 20, borderTopLeftRadius: 20, paddingHorizontal: 19, }}>
211
+ <Text allowFontScaling={false} style={{ marginTop: 26, marginBottom: 23, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, textAlign: "center", color: "#34495e" }}>{esp.lang("event/exchange_ticket", "input_qr")}</Text>
212
+ <LibInput_circle2
213
+ ref={inputAccessCode}
214
+ onSubmitEditing={() => doSubmit()}
215
+ blurOnSubmit
216
+ returnKeyType="done"
217
+ autoCapitalize='characters'
218
+ style={{ borderColor: '#c4c4c4', height: 35, margin: 15, borderRadius: 5 }}
219
+ placeholder={esp.lang("event/exchange_ticket", "placeholder_code")}
220
+ />
221
+
222
+ <ComponentTouchable onPress={() => { doSubmit() }}>
223
+ <View style={{ margin: 15, marginTop: 20, height: 35, borderRadius: 5, backgroundColor: "#6c432c", justifyContent: 'center', alignItems: 'center', paddingHorizontal: 9 }} >
224
+ <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 12, textAlign: "center", textAlignVertical: 'center', color: 'white', marginRight: 13, marginLeft: 10 }} >{esp.lang("visitor/index", "submit")}</Text>
225
+ </View>
226
+ </ComponentTouchable>
227
+
228
+ </View>
229
+ </ComponentSlidingup>
230
+
231
+
232
+ </View>
233
+ )
234
+ }