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,143 @@
1
+ // withHooks
2
+ // noPage
3
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
4
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
5
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
6
+ import esp from 'esoftplay/esp';
7
+
8
+ import React from 'react';
9
+ import { Pressable, Text, TouchableOpacity, View } from 'react-native';
10
+
11
+
12
+ export interface EventCounter_user_list_itemArgs {
13
+
14
+ }
15
+ export interface EventCounter_user_list_itemProps {
16
+ email: string,
17
+ user_id: string,
18
+ image: string,
19
+ name: string,
20
+ showType?: boolean,
21
+ type?: any,
22
+ showIcon?: boolean,
23
+ onSelect?: () => void,
24
+ showDelete?: boolean,
25
+ onDelete?: () => void,
26
+ selectedUserId?: any,
27
+ showChange?: boolean,
28
+ onChange?: () => void,
29
+ style?: any,
30
+ sellers?: any,
31
+ showSellers?: boolean,
32
+ showDeleteSellers?: boolean,
33
+ onDeleteSellers?: (email?: string) => void,
34
+ is_digital?: any
35
+ }
36
+ export default function m(props: EventCounter_user_list_itemProps): any {
37
+
38
+ function renderSellers(item: any, i: number) {
39
+ return (
40
+ <View key={i} style={styleId_ZuJdEN}>
41
+ <View style={styleId_Z1IS0fI}>
42
+ <View style={styleId_1C9dY0}>
43
+ <LibPicture source={{ uri: item.image }} style={styleId_1XoYWW} resizeMode="cover" />
44
+ </View>
45
+ <View style={styleId_Zkxxg6}>
46
+ <View style={styleId_Z1IS0fI}>
47
+ <View style={{ marginTop: 4, padding: 5, borderRadius: 5, backgroundColor: '#6A0740' }}>
48
+ <Text allowFontScaling={false} style={styleId_Z1tkqXS}>{item.is_digital == "1" ? esp.lang("event/counter_user_list_item", "ticket_online") : esp.lang("event/counter_user_list_item", "ticket_fisik")}</Text>
49
+ </View>
50
+ </View>
51
+ <Text allowFontScaling={false} style={styleId_1KmPaS}>{item.name}</Text>
52
+ <Text allowFontScaling={false} style={styleId_Z15uvuH}>{item.email}</Text>
53
+
54
+ </View>
55
+ </View>
56
+ {
57
+ props.showDeleteSellers &&
58
+ <TouchableOpacity onPress={() => { props.onDeleteSellers && props.onDeleteSellers(item.email) }} style={styleId_ZkUJq} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }} >
59
+ <LibIcon name={"trash-can-outline"} size={18} color={LibStyle.colorRed} />
60
+ </TouchableOpacity>
61
+ }
62
+ </View>
63
+ )
64
+ }
65
+
66
+ const styleId_ZVzM0y: any = { justifyContent: 'center', alignContent: 'center', alignItems: 'center', backgroundColor: props.type == 1 ? "#009AE4" : props.type == 2 ? "#00AA43" : "#6A0740", marginTop: 5, padding: 2, borderRadius: 3 }
67
+
68
+ return (
69
+ <View>
70
+ <Pressable onPress={() => { props.onSelect && props.onSelect() }} style={[{ margin: 15, marginBottom: 10, marginTop: 0, backgroundColor: '#fff', padding: 10, borderRadius: 15, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' }, props.style]}>
71
+ <View style={styleId_2vi46p}>
72
+ <View style={styleId_1C9dY0}>
73
+ <LibPicture source={{ uri: props.image }} style={styleId_1XoYWW} resizeMode="cover" />
74
+ </View>
75
+
76
+ <View style={styleId_Zkxxg6}>
77
+
78
+ {
79
+ props.showType &&
80
+ <View style={styleId_Z1IS0fI}>
81
+ <View style={styleId_ZVzM0y}>
82
+ <Text allowFontScaling={false} style={styleId_Z7sv3V}>{props.type == 1 ? esp.lang("event/counter_user_list_item", "text_eo") : props.type == 2 ? esp.lang("event/counter_user_list_item", "text_lm") : esp.lang("event/counter_user_list_item", "text_cashier")}</Text>
83
+ </View>
84
+ </View>
85
+ }
86
+ {
87
+ props.is_digital &&
88
+ <View style={styleId_Z1IS0fI}>
89
+ <View style={{ marginTop: 4, padding: 5, borderRadius: 5, backgroundColor: '#6A0740' }}>
90
+ <Text allowFontScaling={false} style={styleId_Z1tkqXS}>{props.is_digital == "1" ? esp.lang("event/counter_user_list_item", "ticket_online") : esp.lang("event/counter_user_list_item", "ticket_fisik")}</Text>
91
+ </View>
92
+ </View>
93
+ }
94
+ <Text allowFontScaling={false} style={styleId_Z2nlhWI}>{props.name}</Text>
95
+ <Text allowFontScaling={false} style={styleId_Z15uvuH}>{props.email}</Text>
96
+ </View>
97
+ </View>
98
+ {
99
+ props.showIcon &&
100
+ <TouchableOpacity onPress={() => { props.onSelect && props.onSelect() }} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }} >
101
+ <LibIcon name={props.selectedUserId == props.user_id ? "radiobox-marked" : "radiobox-blank"} color={props.selectedUserId == props.user_id ? "#009AE4" : "#000"} />
102
+ </TouchableOpacity>
103
+ }
104
+ {
105
+ props.showDelete &&
106
+ <TouchableOpacity onPress={() => { props.onDelete && props.onDelete() }} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }} >
107
+ <LibIcon name={"trash-can-outline"} color={LibStyle.colorRed} />
108
+ </TouchableOpacity>
109
+ }
110
+ {
111
+ props.showChange &&
112
+ <TouchableOpacity onPress={() => { props.onChange && props.onChange() }} hitSlop={{ top: 10, left: 10, right: 10, bottom: 10 }} style={styleId_Z56B3G} >
113
+ <Text allowFontScaling={false} style={{ color: LibStyle.colorGreen }} >{esp.lang("event/counter_user_list_item", "edit")}</Text>
114
+ </TouchableOpacity>
115
+ }
116
+ </Pressable>
117
+ {
118
+ props.showSellers && props.sellers && props.sellers?.length > 0 &&
119
+ <View style={styleId_Z2iLXe1}>
120
+ <Text allowFontScaling={false} style={styleId_ZeUrgO}>{esp.lang("event/counter_user_list_item", "cashier_list")}</Text>
121
+ {
122
+ props.sellers?.map?.(renderSellers)
123
+ }
124
+ </View>
125
+ }
126
+ </View>
127
+ )
128
+ }
129
+ const styleId_ZuJdEN: any = { flexDirection: 'row', justifyContent: 'space-between', padding: 10, borderBottomColor: "#EEF1F8", borderBottomWidth: 1, alignContent: 'center', alignItems: 'center' }
130
+ const styleId_Z1IS0fI: any = { flexDirection: 'row' }
131
+ const styleId_1C9dY0: any = { height: 50, width: 50, borderRadius: 10, backgroundColor: '#fff', ...LibStyle.elevation(10) }
132
+ const styleId_1XoYWW: any = { height: 50, width: 50, borderRadius: 10, }
133
+ const styleId_Zkxxg6: any = { marginLeft: 10 }
134
+ const styleId_Z1tkqXS: any = { fontWeight: 'normal', fontSize: 10, color: '#fff' }
135
+ const styleId_1KmPaS: any = { fontSize: 14, flexWrap: 'wrap', fontFamily: 'SFProText', fontWeight: 'bold' }
136
+ const styleId_Z15uvuH: any = { flexWrap: 'wrap', fontWeight: 'normal', fontSize: 10 }
137
+ const styleId_ZkUJq: any = { padding: 7, borderRadius: 5, backgroundColor: "#fff", ...LibStyle.elevation(2) }
138
+ const styleId_2vi46p: any = { flex: 2, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }
139
+ const styleId_Z7sv3V: any = { textAlign: 'center', fontFamily: "Arial", fontSize: 8, fontWeight: "normal", fontStyle: "normal", letterSpacing: 1, color: "#fff" }
140
+ const styleId_Z2nlhWI: any = { flexWrap: 'wrap', fontFamily: 'SFProText', fontWeight: 'bold' }
141
+ const styleId_Z56B3G: any = { marginRight: 10, padding: 2, paddingHorizontal: 10, borderRadius: 5, borderWidth: 1, borderColor: LibStyle.colorGreen }
142
+ const styleId_Z2iLXe1: any = { margin: 20, marginTop: -8, borderBottomLeftRadius: 15, borderBottomRightRadius: 15, backgroundColor: '#fff' }
143
+ const styleId_ZeUrgO: any = { marginTop: 5, alignSelf: 'center', flexWrap: 'wrap', fontFamily: 'SFProText', fontWeight: 'bold' }
@@ -0,0 +1,124 @@
1
+ // withHooks
2
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
3
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
4
+ import { LibInfinite } from 'esoftplay/cache/lib/infinite/import';
5
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
6
+ import esp from 'esoftplay/esp';
7
+ import useSafeState from 'esoftplay/state';
8
+
9
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
10
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
11
+ import React from 'react';
12
+ import { Pressable, Text, TouchableOpacity, View } from 'react-native';
13
+
14
+
15
+ export interface EventCouponArgs {
16
+
17
+ }
18
+ export interface EventCouponProps {
19
+
20
+ }
21
+
22
+ export function getCouponDetail(url: string) {
23
+ const curl = esp.mod("lib/curl")
24
+ esp.mod("lib/progress").show("Mohon tunggu..")
25
+ new curl(url, null, (result) => {
26
+ const item = result?.list
27
+ esp.mod("lib/progress").hide()
28
+ if (item?.length > 0) {
29
+ esp.mod("lib/navigation").navigate("event/coupon_detail", { ...item[0] })
30
+ }
31
+ }, (err) => {
32
+ esp.mod("lib/progress").hide()
33
+ esp.modProp("lib/toast").show(err?.message)
34
+ }, 1)
35
+ }
36
+
37
+ export default function m(props: EventCouponProps): any {
38
+ const [tab, setTab] = useSafeState(0)
39
+ const tabs = [
40
+ { id: 1, title: esp.lang("event/coupon", "unused") },
41
+ { id: 2, title: esp.lang("event/coupon", "used") },
42
+ { id: 3, title: esp.lang("event/coupon", "expired") }
43
+ ]
44
+
45
+ function buildUrl(url: string) {
46
+ url += url.includes('?') ? '&' : '?'
47
+ url += 'status=' + tab
48
+ return url
49
+ }
50
+
51
+ return (
52
+ <View style={{ flex: 1 }}>
53
+ <ComponentHeader title={esp.lang("event/coupon", "header")} />
54
+ <View style={{ height: 43, marginBottom: 2, flexDirection: 'row', backgroundColor: '#fff', borderBottomWidth: 1, borderBottomColor: '#f2f2f2' }} >
55
+ {
56
+ tabs.map((item: any, i: number) => (
57
+ <Pressable key={i} onPress={() => {
58
+ setTab(i)
59
+ }}>
60
+ <View style={{ height: 43, width: LibStyle.width / tabs.length, alignItems: 'center', overflow: 'visible', justifyContent: 'center', backgroundColor: '#fff' }}>
61
+ <Text style={{
62
+ width: LibStyle.width / tabs.length, fontSize: tab == i ? 13 : 12,
63
+ fontWeight: tab == i ? "bold" : "normal",
64
+ fontStyle: "normal", letterSpacing: 0, textAlign: "center",
65
+ color: tab == i ? LibStyle.colorPrimary : "#c5c5c5"
66
+ }}>{item.title}</Text>
67
+ <View style={{ marginTop: 2, width: 5, height: 5, borderRadius: 2.5, alignItems: 'center', justifyContent: 'center', backgroundColor: LibStyle.colorRed, opacity: item.total > 0 ? 1 : 0 }} />
68
+ <View style={{ width: (LibStyle.width / tabs.length) - 20, height: 3, backgroundColor: tab == i ? LibStyle.colorPrimary : "#fff", position: 'absolute', bottom: 0 }} />
69
+ </View>
70
+ </Pressable>
71
+ ))
72
+ }
73
+ </View>
74
+ <LibInfinite
75
+ key={buildUrl("event_coupon")}
76
+ url={buildUrl("event_coupon")}
77
+ isDebug={1}
78
+ errorView={(e: string) =>
79
+ <ComponentMessage message={e} />
80
+ }
81
+ renderItem={(item, index) => (
82
+ <View style={{ flex: 1 }} key={index}>
83
+ <TouchableOpacity onPress={() => {
84
+ if (item?.status == 0) {
85
+ esp.mod("lib/navigation").navigate("event/coupon_detail", { ...item })
86
+ }
87
+ }} style={[{ marginBottom: 4, margin: 15, borderRadius: 10, backgroundColor: '#fff' }, LibStyle.elevation(2)]}>
88
+ <LibPicture source={{ uri: item?.image }} resizeMode="cover" style={{ height: (LibStyle.width - 30) * 0.43, width: LibStyle.width - 30, borderTopLeftRadius: 10, borderTopRightRadius: 10 }} />
89
+ <View style={{ position: 'absolute', top: (((LibStyle.width - 60) * 0.43) / 2) - 10, marginBottom: 15, flexDirection: 'row', justifyContent: 'space-between' }} >
90
+ <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginLeft: -9.5 }} />
91
+ <View style={{ flex: 1 }} />
92
+ <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginRight: -9.5 }} />
93
+ </View>
94
+
95
+ <View style={{ paddingHorizontal: 15, paddingVertical: 10, borderTopWidth: 1, borderTopColor: "#e6e6e6", borderStyle: "dashed" }}>
96
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#000", marginBottom: 3 }}>{item?.event_name}</Text>
97
+ <View style={{ flexDirection: "row", alignItems: "center", justifyContent: "space-between" }}>
98
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{item?.title}</Text>
99
+ {item?.amount && item?.amount != "" && item?.amount != 0 &&
100
+ <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 14, fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{LibUtils.money(item?.amount)}</Text>
101
+ }
102
+ </View>
103
+ </View>
104
+
105
+ </TouchableOpacity>
106
+ {
107
+ (item?.status == 1 || item?.status == 2) &&
108
+ <View style={{ position: "absolute", left: 0, right: 0, top: 15, bottom: 4, backgroundColor: 'rgba(0, 0, 0, 0.15)', borderRadius: 10, alignItems: "center", justifyContent: "center", marginHorizontal: 15 }}>
109
+ <View style={{ paddingHorizontal: 20, paddingVertical: 10, borderWidth: 3, borderColor: LibStyle.colorRed, transform: [{ rotate: '-20deg' }] }}>
110
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: item?.status == 1 ? 24 : 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorRed }}>{item?.status == 1 ? esp.lang("event/coupon", "voucher_used") : esp.lang("event/coupon", "voucher_expired")}</Text>
111
+ </View>
112
+ <View style={{ position: 'absolute', top: (((LibStyle.width - 60) * 0.43) / 2) - 10, marginBottom: 15, flexDirection: 'row', justifyContent: 'space-between' }} >
113
+ <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginLeft: -9.5 }} />
114
+ <View style={{ flex: 1 }} />
115
+ <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "white", marginRight: -9.5 }} />
116
+ </View>
117
+ </View>
118
+ }
119
+ </View>
120
+ )}
121
+ />
122
+ </View>
123
+ )
124
+ }
@@ -0,0 +1,198 @@
1
+ // withHooks
2
+
3
+ import { applyStyle } from 'esoftplay';
4
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
5
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
6
+ import { EventCoupon_claim_history } from 'esoftplay/cache/event/coupon_claim_history/import';
7
+ import { LibCarrousel } from 'esoftplay/cache/lib/carrousel/import';
8
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
9
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
10
+ import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
11
+ import { LibSkeleton } from 'esoftplay/cache/lib/skeleton/import';
12
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
13
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
14
+ import esp from 'esoftplay/esp';
15
+ import useLazyState from 'esoftplay/lazy';
16
+ import useSafeState from 'esoftplay/state';
17
+ import useGlobalSubscriber from 'esoftplay/subscribe';
18
+ import React, { useEffect } from 'react';
19
+ import { Text, TouchableOpacity, View } from 'react-native';
20
+
21
+
22
+ export interface EventCoupon_claimArgs {
23
+
24
+ }
25
+ export interface EventCoupon_claimProps {
26
+
27
+ }
28
+
29
+ export const subscribe = useGlobalSubscriber()
30
+
31
+ export default function m(props: EventCoupon_claimProps): any {
32
+ const { event_id, event_name } = esp.mod("lib/navigation").getArgsAll(props)
33
+ const [tenant, setTenant] = useLazyState<any>()
34
+ const [errorTenant, setErrorTenant] = useLazyState<string>("")
35
+ const [redeemed, setRedeemed] = useLazyState<any>()
36
+ const [errorRedeemed, setErrorRedeemed] = useSafeState<string>("")
37
+ const [key, setKey] = useSafeState<number>(1)
38
+
39
+ useEffect(() => {
40
+ loadAll()
41
+ }, [])
42
+
43
+ subscribe.useSubscribe(() => {
44
+ loadAll()
45
+ setKey(k => k + 1)
46
+ })
47
+
48
+ const loadAll = () => {
49
+ loadDataTenant()
50
+ }
51
+
52
+ function loadDataTenant() {
53
+ const curl = esp.mod("lib/curl")
54
+ new curl("event_coupon_tenant?event_id=" + event_id, null, (result, message) => {
55
+ esp.log(result);
56
+ setTenant(result)()
57
+ if (result?.is_parent == 1) {
58
+ loadRedeemedCoupon(result?.tenant_id)
59
+ }
60
+ }, (err) => {
61
+ setErrorTenant(err?.message)
62
+ }, 1)
63
+ }
64
+
65
+ function loadRedeemedCoupon(tenant_id: string) {
66
+ setRedeemed(undefined)
67
+ const curl = esp.mod("lib/curl")
68
+ new curl("event_coupon_tenant_redeemed?event_id=" + event_id + "&tenant_id=" + tenant_id, null, (result, message) => {
69
+ setRedeemed(result)()
70
+ }, (error) => {
71
+ setErrorRedeemed(error?.message)
72
+ }, 1)
73
+ }
74
+
75
+ function RenderMenu(props: any) {
76
+ return (
77
+ <TouchableOpacity onPress={props.onPress} style={applyStyle({ flex: 1, alignContent: 'center', alignItems: 'center', justifyContent: 'center' })}>
78
+ <View style={applyStyle({ backgroundColor: 'rgba( 255, 255, 255, 0.40 )', padding: 15, borderRadius: 10 })}>
79
+ <LibIcon name={props?.icon} style={applyStyle({ opacity: 1 })} color="#fff" />
80
+ </View>
81
+ <Text allowFontScaling={false} style={applyStyle({ height: 30, textAlign: 'center', fontFamily: 'SFProText', margin: 10, marginTop: 5, color: '#fff', marginBottom: 0, fontSize: 10 })}>{props?.title}</Text>
82
+ </TouchableOpacity>
83
+ )
84
+ }
85
+
86
+ return (
87
+ <View style={{ flex: 1 }}>
88
+ <ComponentHeader title={tenant?.is_parent == 1 ? esp.lang("event/coupon_claim", "manage_coupon") : esp.lang("event/coupon_claim", "header_title")} subtitle={tenant?.is_parent == 1 ? esp.lang("event/coupon_claim", "manage_coupon_sub", event_name) : esp.lang("event/coupon_claim", "header_sub")} bgColor={"#95a5a6"} titleColor="#fff" notif />
89
+ {
90
+ (!tenant && errorTenant == "") ?
91
+ <LibSkeleton>
92
+ <View style={{ flexDirection: "row", alignItems: "center" }}>
93
+ <LibSkeleton.BoxFlex size={80} />
94
+ <LibSkeleton.BoxFlex size={80} />
95
+ <LibSkeleton.BoxFlex size={80} />
96
+ <LibSkeleton.BoxFlex size={80} />
97
+ </View>
98
+ <LibSkeleton.BoxFull size={(LibStyle.width - 60) * 0.43} />
99
+ <View style={{ flexDirection: "row", alignItems: "center" }}>
100
+ <LibSkeleton.BoxFlex size={80} />
101
+ <LibSkeleton.BoxFlex size={80} />
102
+ </View>
103
+ </LibSkeleton>
104
+ :
105
+ errorTenant != "" ? <ComponentMessage message={errorTenant} />
106
+ :
107
+ <>
108
+ <View style={applyStyle({ paddingBottom: 30, padding: 15, backgroundColor: "#95a5a6", flexDirection: 'row', justifyContent: 'space-between' })}>
109
+ {
110
+ tenant?.is_parent == 1 &&
111
+ <>
112
+ <RenderMenu title={esp.lang("event/coupon_claim", "withdraw")} icon="currency-usd" onPress={() => {
113
+ esp.mod("lib/navigation").navigate("event/coupon_claim_reimburse", { event_id, tenant_id: tenant?.tenant_id })
114
+ }} />
115
+ <RenderMenu title={"Pegawai"} icon="account" onPress={() => {
116
+ esp.mod("lib/navigation").navigate("event/coupon_claim_staff", { event_id, tenant_id: tenant?.tenant_id })
117
+ }} />
118
+ </>
119
+ }
120
+ <RenderMenu title={esp.lang("event/coupon_claim", "claim_report")} icon="history" onPress={() => {
121
+ esp.mod("lib/navigation").navigate("event/coupon_claim_history", { event_id, config: tenant })
122
+ }} />
123
+ <RenderMenu title={esp.lang("event/coupon_claim", "scan_voucher")} icon="qrcode-scan" onPress={() => {
124
+ esp.mod("lib/navigation").navigateForResult("component/scanner", null, 989348).then((value) => {
125
+ esp.mod("lib/navigation").navigate("event/coupon_claim_detail", { code: value, staff_id: tenant?.staff_id })
126
+ })
127
+ }} />
128
+ </View>
129
+
130
+ <LibScroll style={{ marginTop: -20, backgroundColor: "#EEF1F8", borderTopLeftRadius: 15, borderTopRightRadius: 15 }} onRefresh={loadAll} >
131
+
132
+ {
133
+ tenant?.is_parent == 1 &&
134
+ <>
135
+ {
136
+ tenant?.images && tenant?.images.length > 0 &&
137
+ <LibCarrousel
138
+ delay={3000}
139
+ style={{ height: (LibStyle.width - 30) * 0.43, width: LibStyle.width, marginTop: 17 }}
140
+ autoplay
141
+ bullets
142
+ bulletStyle={{ width: 7, height: 7, backgroundColor: "#fff", borderRadius: 3.5, borderWidth: 0, marginHorizontal: 2 }}
143
+ chosenBulletStyle={{ width: 7, height: 7, backgroundColor: "#f4e31b", borderRadius: 3.5, borderWidth: 0, marginHorizontal: 2 }}
144
+ bulletsContainerStyle={{ marginBottom: -10 }}>
145
+ {
146
+ tenant?.images?.map((item: any, index: number) => (
147
+ <View key={index} style={[{ borderRadius: 15, backgroundColor: '#fff', marginHorizontal: 15 }, LibStyle.elevation(2)]}>
148
+ <LibPicture source={{ uri: item?.image }} resizeMode="cover" style={{ height: (LibStyle.width - 30) * 0.43, width: LibStyle.width - 30, borderRadius: 5 }} />
149
+ <View style={{ position: 'absolute', top: (((LibStyle.width - 30) * 0.43) / 2) - 10, marginBottom: 15, flexDirection: 'row', justifyContent: 'space-between' }} >
150
+ <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "#EEF1F8", marginLeft: -9.5 }} />
151
+ <View style={{ flex: 1 }} />
152
+ <View style={{ width: 23, height: 23, borderRadius: 11.5, backgroundColor: "#EEF1F8", marginRight: -9.5 }} />
153
+ </View>
154
+ </View>
155
+
156
+ ))
157
+ }
158
+ </LibCarrousel>
159
+ }
160
+ {
161
+ (!redeemed && errorRedeemed == "") ?
162
+ <View style={{ marginHorizontal: 15, marginVertical: 10, height: 70, flex: 1 }}>
163
+ <LibSkeleton>
164
+ <View style={{ flexDirection: "row", justifyContent: "space-between" }}>
165
+ <View style={{ width: (LibStyle.width - 45) * 0.5, height: 60, borderRadius: 15, backgroundColor: "white" }} />
166
+ <View style={{ width: (LibStyle.width - 45) * 0.5, height: 60, borderRadius: 15, backgroundColor: "white" }} />
167
+ </View>
168
+ </LibSkeleton>
169
+ </View>
170
+ :
171
+ <View style={{ margin: 5, marginBottom: 10, marginTop: 10, borderRadius: 15, padding: 10 }}>
172
+ <View style={{ flexDirection: "row", justifyContent: "space-between" }}>
173
+ <TouchableOpacity onPress={() => { }} style={{ padding: 15, borderRadius: 15, backgroundColor: "white", width: (LibStyle.width - 45) * 0.5 }}>
174
+ <Text allowFontScaling={false} style={{ fontSize: 10, color: "#000" }}>{esp.lang("event/coupon_claim", "total_coupon")}</Text>
175
+ <Text allowFontScaling={false} style={{ flex: 1, flexWrap: 'wrap', fontSize: 16, fontWeight: 'bold', color: "#000" }}>{LibUtils.number(redeemed?.qty)}</Text>
176
+ </TouchableOpacity>
177
+ <TouchableOpacity onPress={() => { }} style={{ padding: 15, borderRadius: 15, backgroundColor: "white", width: (LibStyle.width - 45) * 0.5 }}>
178
+ <Text allowFontScaling={false} style={{ fontSize: 10, color: "#000" }}>{esp.lang("event/coupon_claim", "amount_coupon")}</Text>
179
+ <Text allowFontScaling={false} style={{ flex: 1, flexWrap: 'wrap', fontSize: 16, fontWeight: 'bold', color: "#000" }}>{LibUtils.money(redeemed?.amount)}</Text>
180
+ </TouchableOpacity>
181
+ </View>
182
+ </View>
183
+ }
184
+ </>
185
+ }
186
+
187
+ {
188
+ tenant && tenant?.is_parent && tenant?.is_parent == 0 &&
189
+ <EventCoupon_claim_history hideHeader={true} config={tenant} event_id={event_id} key={key} />
190
+ }
191
+
192
+ </LibScroll>
193
+ </>
194
+
195
+ }
196
+ </View >
197
+ )
198
+ }
@@ -0,0 +1,175 @@
1
+ // withHooks
2
+ import { ComponentButton } from 'esoftplay/cache/component/button/import';
3
+ import { ComponentHeader } from 'esoftplay/cache/component/header/import';
4
+ import { ComponentMessage } from 'esoftplay/cache/component/message/import';
5
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
6
+ import { LibInput } from 'esoftplay/cache/lib/input/import';
7
+ import { LibLoading } from 'esoftplay/cache/lib/loading/import';
8
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
9
+ import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
10
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
11
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
12
+ import esp from 'esoftplay/esp';
13
+ import useLazyState from 'esoftplay/lazy';
14
+ import useSafeState from 'esoftplay/state';
15
+ import { useEffect, useRef } from 'react';
16
+
17
+ import React from 'react';
18
+ import { Text, TouchableOpacity, View } from 'react-native';
19
+
20
+
21
+ export interface EventCoupon_claim_detailArgs {
22
+ code: string
23
+ }
24
+ export interface EventCoupon_claim_detailProps {
25
+
26
+ }
27
+ export default function m(props: EventCoupon_claim_detailProps): any {
28
+ const code = LibNavigation.getArgs(props, "code")
29
+ const staff_id = LibNavigation.getArgs(props, "staff_id")
30
+ const [data, setData] = useSafeState<any>()
31
+ const [error, setError] = useSafeState<string>('')
32
+ const [qty, setQty, getQty] = useLazyState<number>(1)
33
+ const inputRef = useRef<LibInput>(null)
34
+
35
+ useEffect(() => {
36
+ loadData()
37
+ }, [])
38
+
39
+ function loadData() {
40
+ const curl = esp.mod("lib/curl")
41
+ new curl("event_coupon_redeem", { code, staff_id }, (result, message) => {
42
+ setQty(1)
43
+ setData(result)
44
+ }, (error) => {
45
+ setError(error?.message)
46
+ }, 1)
47
+ }
48
+
49
+ function doRedeem() {
50
+ const post = { id: data?.id, staff_id, qty: getQty() }
51
+
52
+ const curl = esp.mod("lib/curl")
53
+ esp.mod("lib/progress").show(esp.lang("event/coupon_claim_detail", "please_wait"))
54
+ new curl("event_coupon_redeem_submit", post, (result, message) => {
55
+ esp.modProp("event/coupon_claim").subscribe.trigger()
56
+ esp.mod("lib/progress").hide()
57
+ esp.modProp("lib/toast").show(message)
58
+ esp.mod("lib/navigation").back()
59
+ }, (error) => {
60
+ esp.mod("lib/progress").hide()
61
+ esp.mod("lib/dialog").warning(esp.lang("event/coupon_claim_detail", "warning"), error?.message)
62
+ }, 1)
63
+ }
64
+
65
+ function addQTY() {
66
+ if (getQty() < Number(data?.qty)) {
67
+ setQty(x => x + 1)()
68
+ inputRef.current?.setText(String(getQty()))
69
+ }
70
+ }
71
+
72
+ function subQTY() {
73
+ if (getQty() != 1) {
74
+ setQty(x => x - 1)()
75
+ inputRef.current?.setText(String(getQty()))
76
+ }
77
+ }
78
+
79
+ return (
80
+ <View style={{ flex: 1, backgroundColor: "#e6e6e6" }}>
81
+ <ComponentHeader title={esp.lang("event/coupon_claim_detail", "header")} />
82
+ {
83
+ (!data && error == "") ? <LibLoading /> : error != "" ?
84
+ <>
85
+ <ComponentMessage message={error} />
86
+ <ComponentButton label={esp.lang("event/coupon_claim_detail", "rescan")} style={{ marginHorizontal: 20 }} onPress={() => {
87
+ esp.mod("lib/navigation").navigateForResult("component/scanner", null, 238).then((value) => {
88
+ esp.mod("lib/navigation").replace("event/coupon_claim_detail", { code: value, staff_id: staff_id })
89
+ })
90
+ }} />
91
+ </>
92
+ :
93
+ <>
94
+ <LibScroll>
95
+
96
+ <View>
97
+ <View style={{ backgroundColor: "white", margin: 20, borderRadius: 20 }}>
98
+ <Text allowFontScaling={false} numberOfLines={2} style={{ marginTop: 10, fontFamily: "ArialBold", fontSize: 18, fontWeight: "bold", letterSpacing: 3.5, color: "#aeacb2", textAlign: 'center' }}>{data?.code}</Text>
99
+ <View style={{ padding: 15, paddingBottom: 20, marginTop: 20 }}>
100
+ {
101
+ data?.event_name && data?.event_name != "" &&
102
+ <>
103
+ <Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 12, letterSpacing: 1, color: "#555555" }}>{esp.lang("event/coupon_detail", "event_name")}</Text>
104
+ <Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 18, letterSpacing: 0, color: "#333333" }}>{data?.event_name}</Text>
105
+ </>
106
+ }
107
+ {
108
+ data?.title && data?.title != "" &&
109
+ <>
110
+ <Text allowFontScaling={false} style={{ marginTop: 8, fontFamily: "SFProText", fontSize: 12, letterSpacing: 1, color: "#555555" }}>{esp.lang("event/coupon_detail", "coupon_name")}</Text>
111
+ <Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 18, letterSpacing: 0, color: "#333333" }}>{data?.title}</Text>
112
+ </>
113
+ }
114
+ {
115
+ data?.amount && data?.amount != "" && data?.amount != 0 &&
116
+ <>
117
+ <Text allowFontScaling={false} style={{ marginTop: 8, fontFamily: "SFProText", fontSize: 12, letterSpacing: 1, color: "#555555" }}>{esp.lang("event/coupon_detail", "amount")}</Text>
118
+ <Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 18, letterSpacing: 0, color: "#333333" }}>{LibUtils.money(data?.amount)}</Text>
119
+ </>
120
+ }
121
+ {
122
+ data?.qty && data?.qty != "" &&
123
+ <>
124
+ <Text allowFontScaling={false} style={{ marginTop: 8, fontFamily: "SFProText", fontSize: 12, letterSpacing: 1, color: "#555555" }}>{"Qty Kupon"}</Text>
125
+ <Text allowFontScaling={false} style={{ fontFamily: "SFProText", fontSize: 18, letterSpacing: 0, color: "#333333" }}>{LibUtils.number(data?.qty)}</Text>
126
+ </>
127
+ }
128
+
129
+ {
130
+ data?.qty && data?.qty > 1 &&
131
+ <View style={{ flexDirection: "row", alignItems: "center", justifyContent: "center", marginTop: 20 }}>
132
+ <TouchableOpacity onPress={subQTY} style={{ borderRadius: 10, width: 40, height: 40, alignItems: "center", justifyContent: "center", backgroundColor: "#f1f1f1" }}>
133
+ <LibIcon name='minus' size={24} color={LibStyle.colorRed} />
134
+ </TouchableOpacity>
135
+ <View style={{ marginHorizontal: 5, width: 60, height: 40, borderRadius: 10, backgroundColor: "#f1f1f1" }}>
136
+ <LibInput
137
+ ref={inputRef}
138
+ base
139
+ defaultValue={String(qty)}
140
+ onChangeText={(x) => {
141
+ if (Number(x) > Number(data?.qty)) {
142
+ setQty(data?.qty)()
143
+ inputRef.current?.setText(String(data?.qty))
144
+ }
145
+ }}
146
+ keyboardType='numeric'
147
+ style={{ flex: 1, fontFamily: "ArialBold", fontSize: 28, textAlign: "center", paddingHorizontal: 10 }}
148
+ />
149
+ </View>
150
+ <TouchableOpacity onPress={addQTY} style={{ borderRadius: 10, width: 40, height: 40, alignItems: "center", justifyContent: "center", backgroundColor: "#f1f1f1" }}>
151
+ <LibIcon name='plus' size={24} color={LibStyle.colorGreen} />
152
+ </TouchableOpacity>
153
+ </View>
154
+ }
155
+
156
+
157
+ </View>
158
+ </View>
159
+ <View style={{ backgroundColor: "#e6e6e6", width: 30, height: 30, borderRadius: 15, position: "absolute", left: 8, top: 60 }} />
160
+ <View style={{ backgroundColor: "#e6e6e6", width: 30, height: 30, borderRadius: 15, position: "absolute", right: 8, top: 60 }} />
161
+ <View style={{ borderTopWidth: 1, borderColor: "#908d94", borderStyle: "dashed", height: 0, position: "absolute", top: 75, left: 37, right: 37 }} />
162
+ </View>
163
+
164
+ <View />
165
+ </LibScroll>
166
+ <ComponentButton label={esp.lang("event/coupon_claim_detail", "redeem")} onPress={() => {
167
+ esp.mod("lib/dialog").warningConfirm(esp.lang("event/coupon_claim_detail", "redeem_confirm"), esp.lang("event/coupon_claim_detail", "redeem_message"), esp.lang("event/coupon_claim_detail", "redeem_ok"), () => {
168
+ doRedeem()
169
+ }, esp.lang("event/coupon_claim_detail", "redeem_cancel"), () => { })
170
+ }} style={{ margin: 15 }} />
171
+ </>
172
+ }
173
+ </View >
174
+ )
175
+ }