esoftplay-event 0.0.2-b → 0.0.2-c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/config.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "fonts": {
3
- "mono": "mono.ttf",
4
3
  "Arial": "Arial.ttf",
5
4
  "ArialBold": "ArialBold.ttf",
6
5
  "SFProText": "SFProText.ttf",
6
+ "mono": "mono.ttf",
7
7
  "MonoSpace": "MonoSpace.ttf",
8
8
  "DecoNumbers": "DecoNumbers.ttf",
9
9
  "digital": "digital.ttf"
@@ -1,7 +1,6 @@
1
1
  // withHooks
2
-
2
+ // noPage
3
3
  import esp from 'esoftplay/esp';
4
- import moment from 'esoftplay/moment';
5
4
  import React, { useEffect, useRef } from 'react';
6
5
  import { TextInput, View } from 'react-native';
7
6
 
@@ -11,6 +10,7 @@ export interface EventCountdown_baseArgs {
11
10
  }
12
11
  export interface EventCountdown_baseProps {
13
12
  expired: string,
13
+ timezone?: string,
14
14
  expiredText?: string,
15
15
  style?: any,
16
16
  containerStyle?: any,
@@ -22,68 +22,108 @@ export interface EventCountdown_baseProps {
22
22
 
23
23
  const fixSingleNumber = (number: number) => number < 10 ? '0' + number : number
24
24
 
25
+ function parseTimezone(tz: string): string {
26
+ if (!tz) return '+00:00';
27
+ const lower = tz.toLowerCase().trim();
28
+
29
+ const match = lower.match(/gmt([+-]\d{1,2})(?::?(\d{1,2}))?(\.\d+)?/);
30
+ if (!match) return '+00:00';
31
+
32
+ const sign = match[1].startsWith('-') ? '-' : '+';
33
+ let hours = Math.abs(parseInt(match[1], 10));
34
+ let minutes = 0;
35
+
36
+ if (match[2]) {
37
+ minutes = parseInt(match[2], 10);
38
+ } else if (match[3]) {
39
+ minutes = Math.round(parseFloat(match[3]) * 60);
40
+ }
41
+
42
+ const hh = hours.toString().padStart(2, '0');
43
+ const mm = minutes.toString().padStart(2, '0');
44
+ return `${sign}${hh}:${mm}`;
45
+ }
46
+
25
47
  export default function m(props: EventCountdown_baseProps): any {
26
48
  const ref = useRef<TextInput>(null)
27
- let timmer = useRef<any>(undefined).current
49
+ let timmerRef = useRef<any>(undefined)
28
50
 
29
51
  useEffect(() => {
30
52
  countDown()
31
53
  return () => {
32
- clearTimeout(timmer)
33
- timmer = undefined
54
+ clearTimeout(timmerRef.current)
55
+ timmerRef.current = undefined
34
56
  }
35
57
  }, [])
36
58
 
37
59
  function countDown(): any {
38
60
  let expired = false
39
61
  function loop() {
40
- const t = [esp.lang("market/countdown", "day"), esp.lang("market/countdown", "hour"), esp.lang("market/countdown", "minutes"), esp.lang("market/countdown", "second")]
41
- const diffr = moment(props.expired).duration(moment().toDate());
42
- const text = [
43
- parseInt(diffr.asDays().toString()),
44
- fixSingleNumber(parseInt(diffr.hours().toString())),
45
- fixSingleNumber(parseInt(diffr.minutes().toString())),
46
- fixSingleNumber(parseInt(diffr.seconds().toString()))
47
- ]
48
-
49
- if (text.every((x) => (Number(x) < 1 || isNaN(Number(x))))) {
50
- expired = true
51
- props.onExpired && props.onExpired()
52
- ref?.current?.setNativeProps({ text: props.expiredText || esp.lang("market/countdown", "expired") })
53
- } else if (text.length == 4 && text[0] != 0 && props.onlyDay) {
54
- ref?.current?.setNativeProps({ text: text[0] + esp.lang("market/countdown", "days") })
55
- } else if (text[0] == 0) {
56
- text.splice(0, 1)
57
- t.splice(0, 1)
58
- if (text[0].toString() == '00') {
59
- text.splice(0, 1)
60
- t.splice(0, 1)
61
- if (text[0].toString() == '00') {
62
- text.splice(0, 1)
63
- t.splice(0, 1)
64
- }
62
+ const labels = [esp.lang("market/countdown", "day"), esp.lang("market/countdown", "hour"), esp.lang("market/countdown", "minutes"), esp.lang("market/countdown", "second")]
63
+
64
+ // @ts-ignore
65
+ const configGMT = esp.config("forcedGMT+") ? `GMT+${esp.config("forcedGMT+")}` : "GMT+7" // set default to GMT+7 Jakarta
66
+ const tzOffset = parseTimezone(props?.timezone || configGMT);
67
+ const serverDate = new Date(props.expired.replace(' ', 'T') + tzOffset);
68
+ const now = new Date();
69
+
70
+ const diffMs = serverDate.getTime() - now.getTime();
71
+
72
+ if (diffMs <= 0) {
73
+ expired = true;
74
+ props.onExpired?.();
75
+ ref.current?.setNativeProps({
76
+ text: props.expiredText || esp.lang('market/countdown', 'expired'),
77
+ });
78
+ return;
79
+ }
80
+
81
+ const totalSeconds = Math.floor(diffMs / 1000);
82
+ const days = Math.floor(totalSeconds / 86400);
83
+ const hours = Math.floor((totalSeconds % 86400) / 3600);
84
+ const minutes = Math.floor((totalSeconds % 3600) / 60);
85
+ const seconds = totalSeconds % 60;
86
+
87
+ const parts = [
88
+ days,
89
+ fixSingleNumber(hours),
90
+ fixSingleNumber(minutes),
91
+ fixSingleNumber(seconds),
92
+ ];
93
+
94
+ if (parts[0] != 0 && props.onlyDay) {
95
+ ref.current?.setNativeProps({
96
+ text: parts[0] + esp.lang('market/countdown', 'days'),
97
+ });
98
+ } else if (parts[0] == 0) {
99
+ const filteredParts = [...parts];
100
+ while (filteredParts.length > 1 && (filteredParts[0] === 0 || filteredParts[0] === "00")) {
101
+ filteredParts.splice(0, 1);
65
102
  }
66
- ref?.current?.setNativeProps({ text: text.filter((x, i) => !isNaN(Number(x))).map((d, id) => d + (props?.hideTimeUnit ? '' : ' ' + t[id])).join(" : ") })
103
+
104
+ const filtered = filteredParts.map((d, i) =>
105
+ `${d}${props?.hideTimeUnit ? '' : ' ' + labels[parts.length - filteredParts.length + i]}`
106
+ );
107
+
108
+ ref.current?.setNativeProps({ text: filtered.join(' : ') });
67
109
  } else if (props?.showDayUnit && props?.hideTimeUnit) {
68
- const data = text
69
- .filter((x, i) => !isNaN(Number(x)))
70
- .map((d, id) => {
71
- return (d + (id == 0 ? " " + t[0] + " " : ""))
72
- })
73
- const firstData = data[0]
74
- data.splice(0, 1)
75
-
76
- ref?.current?.setNativeProps({
77
- text: firstData + " " + data.join(" : ")
78
- })
110
+ const data = parts.map(
111
+ (d, i) => d + (i === 0 ? ' ' + labels[0] + ' ' : '')
112
+ );
113
+
114
+ const first = data[0];
115
+ ref.current?.setNativeProps({
116
+ text: first + ' ' + data.slice(1).join(' : '),
117
+ });
79
118
  } else {
80
- ref?.current?.setNativeProps({ text: text.filter((x, i) => !isNaN(Number(x))).map((d, id) => d + (props?.hideTimeUnit ? '' : ' ' + t[id])).join(" : ") })
81
- }
82
- if (!expired) {
83
- timmer = setTimeout(() => {
84
- loop()
85
- }, 1000);
119
+ const filtered = parts.map(
120
+ (d, i) => `${d}${props?.hideTimeUnit ? '' : ' ' + labels[i]}`
121
+ );
122
+ ref.current?.setNativeProps({ text: filtered.join(' : ') });
86
123
  }
124
+
125
+ if (!expired) timmerRef.current = setTimeout(loop, 1000);
126
+
87
127
  };
88
128
  loop()
89
129
  }
@@ -14,6 +14,7 @@ export interface EventCountdown_eventArgs {
14
14
  }
15
15
  export interface EventCountdown_eventProps {
16
16
  date: string,
17
+ timezone?: string,
17
18
  containerStyle?: StyleProp<ViewStyle>
18
19
  bulletStyle?: StyleProp<ViewStyle>,
19
20
  style?: StyleProp<TextStyle>
@@ -41,6 +42,7 @@ export default function m(props: EventCountdown_eventProps): any {
41
42
  expired={props.date}
42
43
  showDayUnit
43
44
  hideTimeUnit
45
+ timezone={props?.timezone}
44
46
  style={[{ fontFamily: "Arial", fontSize: 11, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }, props?.style]}
45
47
  />
46
48
  </View>
package/event/detail.tsx CHANGED
@@ -61,12 +61,12 @@ export default function m(props: EventDetailProps): any {
61
61
  }
62
62
 
63
63
  useEffect(() => {
64
- if (esp.isDebug("") && user?.email == "bagus@fisip.net") {
65
- LibNavigation.replace('event/detail2', { url: url })
66
- } else {
67
- loadData()
68
- }
69
- // loadData()
64
+ // if (esp.isDebug("") && user?.email == "bagus@fisip.net") {
65
+ // LibNavigation.replace('event/detail2', { url: url })
66
+ // } else {
67
+ // loadData()
68
+ // }
69
+ loadData()
70
70
  }, [])
71
71
 
72
72
  if (!result) {
@@ -142,6 +142,7 @@ export default function m(props: EventDetailProps): any {
142
142
  esp.isDebug("show_countdown") && result?.countdown_booking == 1 && result?.start_date != "0000-00-00" && result.end_date != '0000-00-00' &&
143
143
  <EventCountdown_event
144
144
  date={(result?.end_date + " " + result?.end_time)}
145
+ timezone={result?.timezone}
145
146
  style={{ fontSize: 12 }}
146
147
  bulletStyle={{ width: 14, height: 14, borderRadius: 7, marginRight: 10 }}
147
148
  containerStyle={{ marginHorizontal: 20, marginBottom: 10 }}
@@ -5,7 +5,7 @@ import { Text, View } from 'react-native';
5
5
 
6
6
 
7
7
  export interface EventLabel_inputArgs {
8
-
8
+
9
9
  }
10
10
  export interface EventLabel_inputProps {
11
11
  mandatory?: boolean,
@@ -16,7 +16,7 @@ export interface EventLabel_inputProps {
16
16
  export default function m(props: EventLabel_inputProps): any {
17
17
  return (
18
18
  <View style={{ flexDirection: 'row', marginTop: 16 }}>
19
- <Text allowFontScaling={false} style={{ fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: props.labelColor ? props.labelColor : "#9b9b9b", }}>{props.label}</Text>
19
+ <Text allowFontScaling={false} numberOfLines={1} style={{ fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: props.labelColor ? props.labelColor : "#9b9b9b", }}>{props.label}</Text>
20
20
  {props.mandatory && <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: props.mandatoryColor ? props.mandatoryColor : "#d0021b" }}> *</Text>}
21
21
  </View>
22
22
  )
@@ -385,7 +385,7 @@ export default function m(props: EventOrder_detailProps): any {
385
385
 
386
386
  const termData = result?.term ? Object.values(result?.term) : []
387
387
 
388
- // esp.log(getGroupAddon());
388
+ esp.log(result);
389
389
 
390
390
  return (
391
391
  <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
@@ -313,7 +313,7 @@ export default function m(props: EventOrder_waitingProps): any {
313
313
  result?.status == 0 &&
314
314
  <View style={{ alignItems: 'center', justifyContent: 'space-between', flexDirection: 'row', marginTop: 5 }}>
315
315
  <Text allowFontScaling={false} style={{ fontWeight: 'bold', flex: 1, flexWrap: 'wrap', fontSize: 14, fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail_waiting", "expired_payment")}</Text>
316
- <EventCountdown_base expired={moment(result?.exp_payment).serverFormat("YYYY-MM-DD HH:mm:ss", result?.timezone)} style={{ flex: 1, marginLeft: 15, fontSize: 14, color: LibStyle.colorRed, fontFamily: "ArialBold" }} />
316
+ <EventCountdown_base expired={moment(result?.exp_payment).serverFormat("YYYY-MM-DD HH:mm:ss", result?.timezone)} timezone={result?.timezone} style={{ flex: 1, marginLeft: 15, fontSize: 14, color: LibStyle.colorRed, fontFamily: "ArialBold" }} />
317
317
  </View>
318
318
  }
319
319
 
@@ -68,7 +68,7 @@ export default function m(props: EventOrder_historyProps): any {
68
68
  {
69
69
  item.status == 0 ?
70
70
  <View style={applyStyle({ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', alignContent: 'center', paddingHorizontal: 15 })}>
71
- <EventCountdown_base expired={moment(item.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss')} style={applyStyle({ flex: 1, fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
71
+ <EventCountdown_base expired={moment(item.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss')} timezone={item?.timezone} style={applyStyle({ flex: 1, fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
72
72
  <Text allowFontScaling={false} style={applyStyle({ flex: 1, flexWrap: 'wrap', padding: 10, paddingHorizontal: 0, textAlign: 'right', fontFamily: "ArialBold", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorRed })}>{item.booking_code}</Text>
73
73
  </View>
74
74
  :
@@ -97,7 +97,7 @@ export default function m(props: EventOrder_itemProps): any {
97
97
  item?.status == 0 ?
98
98
  <View style={applyStyle({ flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', alignContent: 'center', paddingHorizontal: 15 })}>
99
99
  <View style={{ flex: 1 }}>
100
- <EventCountdown_base expired={LibUtils.moment(item?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss', item?.timezone)} style={applyStyle({ fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
100
+ <EventCountdown_base expired={LibUtils.moment(item?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss', item?.timezone)} timezone={item?.timezone} style={applyStyle({ fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
101
101
  </View>
102
102
  {
103
103
  !!item?.booking_code &&
@@ -86,7 +86,7 @@ export default function m(props: EventOrder_waitingProps): any {
86
86
  item?.status == 0 ?
87
87
  <View style={applyStyle({ marginHorizontal: 25, marginBottom: 10, flex: 1, borderTopColor: "#000", borderTopWidth: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', alignContent: 'center' })}>
88
88
  <View style={{ flex: 1 }}>
89
- <EventCountdown_base expired={LibUtils.moment(item?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss', item?.timezone)} style={applyStyle({ fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
89
+ <EventCountdown_base expired={LibUtils.moment(item?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss', item?.timezone)} timezone={item?.timezone} style={applyStyle({ fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
90
90
  </View>
91
91
  {
92
92
  !!item?.booking_code &&
@@ -106,6 +106,7 @@ export default function m(props: EventTms_dashboardProps): any {
106
106
  title: esp.lang("event/tms_dashboard", "log_exchange"),
107
107
  onPress: () => {
108
108
  dialogClosing.current?.show()
109
+ LibNavigation.navigate('event/exchange_ticket_list')
109
110
  }
110
111
  },
111
112
  ]
@@ -448,7 +448,7 @@ export default function m(props: EventTms_homeProps): any {
448
448
  function renderViewTms(item: any, i: number) {
449
449
  let percentages = item?.quota_visitor == 0 && item?.visitor == 0 ? 0 : item?.visitor > 0 && item?.quota_visitor == 0 ? 5 : (item?.visitor / item?.quota_visitor) * 100
450
450
  return (
451
- <View key={i} style={applyStyle({ marginLeft: 7, marginRight: 7, marginBottom: 10, borderRadius: 10, borderWidth: 2, padding: 10, borderColor: "#f1f1f1" })}>
451
+ <View key={i} style={applyStyle({ marginRight: 7, marginBottom: 10, borderRadius: 10, borderWidth: 2, padding: 10, borderColor: "#f1f1f1" })}>
452
452
  {progressBar(percentages, 'small')}
453
453
  <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: 8 }} >
454
454
  <Text allowFontScaling={false} style={applyStyle({ textAlign: 'left', fontSize: 14, color: '#000', fontWeight: 'bold', marginRight: 10, flex: 1 })}>{item.type}</Text>
@@ -461,7 +461,7 @@ export default function m(props: EventTms_homeProps): any {
461
461
  function renderViewHall(item: any, i: number) {
462
462
  let percentages = item?.quota_visitor == 0 && item?.visitor == 0 ? 0 : item?.visitor > 0 && item?.quota_visitor == 0 ? 5 : (item?.visitor / item?.quota_visitor) * 100
463
463
  return (
464
- <View key={i} style={applyStyle({ marginLeft: 7, marginRight: 7, marginBottom: 10, borderRadius: 10, borderWidth: 2, padding: 10, borderColor: "#f1f1f1" })}>
464
+ <View key={i} style={applyStyle({ marginRight: 7, marginBottom: 10, borderRadius: 10, borderWidth: 2, padding: 10, borderColor: "#f1f1f1" })}>
465
465
  {/* <ComponentCircural_progress size={60} strokeWidth={7} percentage={percentages} color={setColorProg(percentages)} /> */}
466
466
  {progressBar(percentages, 'small')}
467
467
  <View style={{ flexDirection: 'row', alignItems: 'center', marginTop: 8 }} >
@@ -1,6 +1,5 @@
1
1
  // withHooks
2
2
 
3
- import { EventButton } from 'esoftplay/cache/event/button/import';
4
3
  import { EventHeader } from 'esoftplay/cache/event/header/import';
5
4
  import { EventSheet } from 'esoftplay/cache/event/sheet/import';
6
5
  import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
@@ -16,7 +15,7 @@ import { UserClass } from 'esoftplay/cache/user/class/import';
16
15
  import esp from 'esoftplay/esp';
17
16
  import useSafeState from 'esoftplay/state';
18
17
  import React, { useEffect, useRef } from 'react';
19
- import { Text, View } from 'react-native';
18
+ import { Text, TouchableOpacity, View } from 'react-native';
20
19
 
21
20
 
22
21
  export interface EventTms_idcardArgs {
@@ -28,7 +27,7 @@ export interface EventTms_idcardProps {
28
27
  export default function m(props: EventTms_idcardProps): any {
29
28
  const width = LibStyle.width
30
29
  const height = 12 / 9 * width
31
- const marginTop = 2.7 / 9 * width
30
+ const marginTop = 3 / 9 * width
32
31
  const photoHeight = 4 / 9 * width
33
32
  const photoWidth = 3 / 9 * width
34
33
  const photoMarginBot = 0.46 / 9 * width
@@ -119,6 +118,7 @@ export default function m(props: EventTms_idcardProps): any {
119
118
  }, 1)
120
119
  }
121
120
 
121
+ // esp.log({ result });
122
122
 
123
123
  return (
124
124
  <View style={{ flex: 1 }}>
@@ -128,12 +128,13 @@ export default function m(props: EventTms_idcardProps): any {
128
128
  onPressMore={() => menuRef.current?.show()}
129
129
  more
130
130
  />
131
+
131
132
  <View style={{ backgroundColor: '#000', height: LibStyle.height, alignItems: 'center' }}>
132
133
  {/* ini id_card nya */}
133
134
  <LibPicture source={result?.event?.image_idcard == "" ? esp.assets('white_idcard.png') : { uri: result?.event?.image_idcard }} style={{ width: width, height: height, resizeMode: 'contain' }} />
134
135
  <View style={{ position: 'absolute' }}>
135
136
  <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', }} />
136
- <View style={{ padding: 10, marginTop: 5 }} >
137
+ <View style={{ padding: 10, marginTop: -10 }} >
137
138
  {/* view nama */}
138
139
  <View style={{ flexDirection: 'row' }} >
139
140
  <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>
@@ -150,13 +151,17 @@ export default function m(props: EventTms_idcardProps): any {
150
151
  <View style={{ width: width - 20, alignSelf: 'center', backgroundColor: '#4a4a4a', height: 4, marginVertical: 4 }} />
151
152
  <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>
152
153
  </View>
153
-
154
154
  </View>
155
- <EventButton
156
- label={esp.lang("event/tms_idcard", "btn_back")}
157
- backgroundColor={LibStyle.colorPrimary}
158
- onPress={() => {
159
- // LibNavigation.back()
155
+
156
+ <View style={{ padding: 5, flexDirection: 'row', backgroundColor: LibStyle.colorPrimary, margin: 10, borderRadius: 10 }}>
157
+ {
158
+ esp.isDebug("") &&
159
+ <View style={{ padding: 5, paddingHorizontal: 35, alignContent: 'center', alignItems: 'center', borderRadius: 10, backgroundColor: '#fff' }}>
160
+ <Text allowFontScaling={false} style={{ fontSize: 12, color: '#000', fontWeight: 'bold' }}>{esp.lang("event/tms_idcard", "token")}</Text>
161
+ <Text allowFontScaling={false} style={{ fontSize: 35, color: '#000', lineHeight: 35, fontWeight: 'bold' }} >10</Text>
162
+ </View>
163
+ }
164
+ <TouchableOpacity onPress={() => {
160
165
  LibNavigation.replace('component/scanner', {
161
166
  selectGate: selectGate,
162
167
  fromPage: 'event/tms_home',
@@ -170,21 +175,24 @@ export default function m(props: EventTms_idcardProps): any {
170
175
  configPriority: configPriority,
171
176
  scan_type: scan_type
172
177
  })
173
- }}
174
- style={{ marginTop: 20, marginHorizontal: 15 }}
175
- />
178
+ }} style={{ flex: 1, marginLeft: 10, justifyContent: 'center', alignContent: 'center', alignItems: 'center' }}>
179
+ <Text allowFontScaling={false} style={{ fontSize: 25, fontWeight: 'bold', color: '#fff' }}>{esp.lang("event/tms_idcard", "backk")}</Text>
180
+ </TouchableOpacity>
181
+
182
+ </View>
183
+
176
184
  </View>
177
185
  <EventSheet
178
186
  _ref={menuRef}
179
187
  title={"ID CARD"}
180
188
  options={[
181
189
  {
182
- text: "Tahan ID CARD",
190
+ text: esp.lang("event/tms_idcard", "hold_idcard"),
183
191
  textStyle: { color: "red" },
184
192
  onPress: () => {
185
193
  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"), () => {
186
194
  new LibCurl("event_tms_staff_hold", { qr: encodeURIComponent(selectedTicket?.key) }, (result, message) => {
187
- LibDialog.info("Berhasil!", message)
195
+ LibDialog.info(esp.lang("event/tms_idcard", "success"), message)
188
196
  }, (error) => {
189
197
  LibDialog.warning("Oops!", error?.message)
190
198
  })
package/event/tms_in.tsx CHANGED
@@ -131,7 +131,8 @@ export default function m(props: EventTms_inProps): any {
131
131
  qty: item[0],
132
132
  qty_used: item[2],
133
133
  qty_left: Number(item[0]) - (Number(item[2]) || 0),
134
- text: item[6] || "",
134
+ text: item[7] || "",
135
+ token: item[6]
135
136
  }
136
137
  tikets.push(x)
137
138
  })
@@ -162,7 +162,7 @@ export default function m(props: EventTms_in_failedProps): any {
162
162
  }
163
163
  {
164
164
  error &&
165
- <View style={{ width: LibStyle.width - 40, justifyContent: 'center', alignItems: 'center', padding: 15, borderRadius: 10, marginTop: 100 }}>
165
+ <View style={{ width: LibStyle.width - 40, alignSelf: 'center', justifyContent: 'center', alignItems: 'center', padding: 15, borderRadius: 10, marginTop: 100 }}>
166
166
  <Text allowFontScaling={false} style={{ flexWrap: 'wrap', fontSize: 14, lineHeight: 20, fontWeight: "bold", marginBottom: 5, color: "#fff", textAlign: "center" }}>{error?.message}</Text>
167
167
  </View>
168
168
  }
@@ -12,12 +12,11 @@ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
12
12
  import { applyStyle } from 'esoftplay';
13
13
  import { EventButton } from 'esoftplay/cache/event/button/import';
14
14
  import { EventHeader } from 'esoftplay/cache/event/header/import';
15
- import { LibIcon } from 'esoftplay/cache/lib/icon/import';
16
15
  import { LibPicture } from 'esoftplay/cache/lib/picture/import';
17
16
  import esp from 'esoftplay/esp';
18
17
  import useSafeState from 'esoftplay/state';
19
18
  import React, { useEffect } from 'react';
20
- import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
19
+ import { ScrollView, Text, View } from 'react-native';
21
20
 
22
21
 
23
22
  export interface EventTms_out_temporaryArgs {
@@ -231,7 +230,7 @@ export default function m(props: EventTms_out_temporaryProps): any {
231
230
  </View>
232
231
  </ScrollView>
233
232
  <View style={{ padding: 10, backgroundColor: '#fff' }}>
234
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 10, alignContent: 'center', alignItems: 'center' }}>
233
+ {/* <View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 10, alignContent: 'center', alignItems: 'center' }}>
235
234
  <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", result?.list?.filter((it: any) => it.checked == 1).length)}</Text>
236
235
  <TouchableOpacity onPress={() => {
237
236
  toggleCheckedAll()
@@ -239,7 +238,7 @@ export default function m(props: EventTms_out_temporaryProps): any {
239
238
  <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>
240
239
  <LibIcon.Ionicons size={18} color="#fff" name={useAll ? "close" : "checkmark-done"} />
241
240
  </TouchableOpacity>
242
- </View>
241
+ </View> */}
243
242
 
244
243
  <EventButton
245
244
  label={esp.lang("event/tms_out_temporary", "btn_exit")}
@@ -7,7 +7,6 @@ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
7
7
  import { LibInfinite } from 'esoftplay/cache/lib/infinite/import';
8
8
  import { LibKeyboard_avoid } from 'esoftplay/cache/lib/keyboard_avoid/import';
9
9
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
10
- import { LibObject } from 'esoftplay/cache/lib/object/import';
11
10
  import { LibPicture } from 'esoftplay/cache/lib/picture/import';
12
11
  import { LibProgress } from 'esoftplay/cache/lib/progress/import';
13
12
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
@@ -16,7 +15,6 @@ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
16
15
  import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
17
16
  import { LibUtils } from 'esoftplay/cache/lib/utils/import';
18
17
  import esp from 'esoftplay/esp';
19
- import useGlobalState from 'esoftplay/global';
20
18
  import useSafeState from 'esoftplay/state';
21
19
  import { useRef } from 'react';
22
20
 
@@ -33,8 +31,6 @@ export interface EventVisitor_inputv2Props {
33
31
  navigation: any
34
32
  }
35
33
 
36
- const inputsState = useGlobalState<any>({})
37
-
38
34
  export default function m(props: EventVisitor_inputv2Props): any {
39
35
  let _data: any = LibNavigation.getArgs(props, 'data')
40
36
  const { msg, url } = LibNavigation.getArgsAll(props)
@@ -55,9 +51,6 @@ export default function m(props: EventVisitor_inputv2Props): any {
55
51
 
56
52
 
57
53
  let _tabs: any = getData()?.list
58
- function setText(list_id: string): (name: string) => void {
59
- return (name) => inputsState.set(LibObject.set(inputsState.get(), name)(list_id))
60
- }
61
54
 
62
55
  useEffect(() => {
63
56
  loadData()
@@ -90,41 +83,21 @@ export default function m(props: EventVisitor_inputv2Props): any {
90
83
  }
91
84
  }
92
85
 
93
- function send(): void {
94
- var post: any = undefined
95
- const inputs = inputsState.get()
96
- post = {
97
- name: Object.values(inputs).join("|"),
98
- list_id: Object.keys(inputs).join("|")
99
- }
100
- LibDialog.confirm(esp.lang("event/visitor_input", "confirm_title"), esp.lang("event/visitor_input", "confirm_msg"), esp.lang("event/visitor_input", "confirm_ok"), () => {
101
- LibProgress.show(esp.lang("event/visitor_input", "confirm_wait"))
102
- new LibCurl('event_exhibitor_staff?contact_id=' + data.contact_id, post, (res, msg) => {
103
- LibProgress.hide()
104
- LibDialog.info(esp.lang("event/visitor_input", "confirm_success"), msg);
105
- LibNavigation.reset()
106
- // BigbangIndexProperty.setTab(0)
107
- // LibNavigation.navigate('bigbang/notif_index', { tabIndex: 0 }) // ini notifnya di perbarui
108
- }, (error) => {
109
- LibProgress.hide()
110
- LibDialog.warning(esp.lang("event/visitor_input", "confirm_failed"), error?.message)
111
- })
112
- }, esp.lang("event/visitor_input", "confirm_cancel"), () => { })
113
- }
114
-
115
86
  function assignToken() {
116
-
117
- if (token && token != 0 && token > getData()?.token_remaining) {
87
+ if (selectedCode?.use_token == 1 && token != 0 && token > getData()?.token_remaining) {
118
88
  LibToastProperty?.show(esp.lang("event/visitor_inputv2", "max_token_is") + getData()?.token_remaining)
119
89
  return
120
90
  }
121
91
 
122
- let post = {
92
+ let post: any = {
123
93
  name: inputName?.current?.getText(),
124
- token: inputToken?.current?.getText() == "" ? 0 : inputToken?.current?.getText(),
125
94
  code: selectedCode?.access_code
126
95
  }
127
96
 
97
+ if (selectedCode?.use_token == 1) {
98
+ post.token = inputToken?.current?.getText()
99
+ }
100
+
128
101
  LibDialog.confirm(esp.lang("event/visitor_input", "confirm_title"), esp.lang("event/visitor_inputv2", "confirm_input_token"), esp.lang("event/visitor_inputv2", "yes"), () => {
129
102
  LibProgress.show(esp.lang("event/visitor_inputv2", "please_wait"))
130
103
  new LibCurl('event_exhibitor_staff_token', post, (res, msg) => {
@@ -142,7 +115,31 @@ export default function m(props: EventVisitor_inputv2Props): any {
142
115
  }, esp.lang("event/visitor_inputv2", "no"), () => { })
143
116
  }
144
117
 
145
- esp.log(selectedCode);
118
+ function withdrawToken() {
119
+ LibDialog.warningConfirm(esp.lang("event/visitor_inputv2", "warning"), esp.lang("event/visitor_inputv2", "confirm_withdraw_token"), esp.lang("event/visitor_inputv2", "yes"), () => {
120
+ let post = {
121
+ token: inputToken?.current?.getText(),
122
+ code: selectedCode?.access_code
123
+ }
124
+ LibProgress.show(esp.lang("event/visitor_inputv2", "please_wait"))
125
+ esp.log({ post });
126
+ new LibCurl('event_exhibitor_staff_token_withdraw', post, (res, msg) => {
127
+ LibProgress.hide()
128
+ LibDialog.info(esp.lang("event/visitor_input", "confirm_success"), msg);
129
+ loadData()
130
+ setCounter(counter + 1)
131
+ dialogClaim?.current?.hide()
132
+ }, (error) => {
133
+ dialogClaim?.current?.hide()
134
+ LibProgress.hide()
135
+ LibDialog.warning(esp.lang("event/visitor_input", "confirm_failed"), error?.message)
136
+ })
137
+
138
+
139
+ }, esp.lang("event/visitor_inputv2", "no"), () => {
140
+
141
+ })
142
+ }
146
143
 
147
144
  function renderTabs(item: any, i: number) {
148
145
  return (
@@ -242,20 +239,23 @@ export default function m(props: EventVisitor_inputv2Props): any {
242
239
  <View style={{ padding: 5, borderWidth: 1, borderColor: LibStyle.colorBgGrey, borderRadius: 5, marginTop: 5 }}>
243
240
  <Text allowFontScaling={false} style={{ fontSize: 10, color: '#9b9b9b' }}>{esp.lang("event/visitor_inputv2", "name")}</Text>
244
241
  <Text allowFontScaling={false} style={{ fontSize: 14 }}>{item.name == null ? "-" : item.name}</Text>
245
- <View style={{ marginTop: 5, flexDirection: 'row', justifyContent: 'space-between' }}>
246
- <View style={{ flex: 1 }}>
247
- <Text allowFontScaling={false} style={{ fontSize: 10, color: '#9b9b9b' }}>{esp.lang("event/visitor_inputv2", "total_token")}</Text>
248
- <Text allowFontScaling={false} style={{ fontSize: 14 }}>{Number(item?.token)}</Text>
249
- </View>
250
- <View style={{ flex: 1 }}>
251
- <Text allowFontScaling={false} style={{ fontSize: 10, color: '#9b9b9b' }}>{esp.lang("event/visitor_inputv2", "token_used")}</Text>
252
- <Text allowFontScaling={false} style={{ fontSize: 14 }}>{Number(item?.token_used)}</Text>
253
- </View>
254
- <View style={{ flex: 1 }}>
255
- <Text allowFontScaling={false} style={{ fontSize: 10, color: '#9b9b9b' }}>{esp.lang("event/visitor_inputv2", "token_left")}</Text>
256
- <Text allowFontScaling={false} style={{ fontSize: 14 }}>{Number(item?.token_remaining)}</Text>
242
+ {
243
+ item?.use_token == 1 &&
244
+ <View style={{ marginTop: 5, flexDirection: 'row', justifyContent: 'space-between' }}>
245
+ <View style={{ flex: 1 }}>
246
+ <Text allowFontScaling={false} style={{ fontSize: 10, color: '#9b9b9b' }}>{esp.lang("event/visitor_inputv2", "total_token")}</Text>
247
+ <Text allowFontScaling={false} style={{ fontSize: 14 }}>{Number(item?.token)}</Text>
248
+ </View>
249
+ <View style={{ flex: 1 }}>
250
+ <Text allowFontScaling={false} style={{ fontSize: 10, color: '#9b9b9b' }}>{esp.lang("event/visitor_inputv2", "token_used")}</Text>
251
+ <Text allowFontScaling={false} style={{ fontSize: 14 }}>{Number(item?.token_used)}</Text>
252
+ </View>
253
+ <View style={{ flex: 1 }}>
254
+ <Text allowFontScaling={false} style={{ fontSize: 10, color: '#9b9b9b' }}>{esp.lang("event/visitor_inputv2", "token_left")}</Text>
255
+ <Text allowFontScaling={false} style={{ fontSize: 14 }}>{Number(item?.token_remaining)}</Text>
256
+ </View>
257
257
  </View>
258
- </View>
258
+ }
259
259
  </View>
260
260
  </View>
261
261
  )
@@ -311,13 +311,15 @@ export default function m(props: EventVisitor_inputv2Props): any {
311
311
  },
312
312
  ]
313
313
 
314
+ esp.log({ selectedCode });
315
+
314
316
  return (
315
317
  <View style={{ flex: 1 }}>
316
318
  <EventHeader title={esp.lang("event/visitor_input", "title_input_exhibitor")} subtitle={esp.lang("event/visitor_input", "total_staff", LibUtils.number(data.qty))} />
317
319
  <LibKeyboard_avoid style={{ flex: 1 }}>
318
320
  <>
319
321
  {
320
- activeTab?.type == "STAFF" &&
322
+ activeTab?.type == "STAFF" && data?.use_token == 1 &&
321
323
  <View style={{ padding: 10, paddingBottom: 0, flexDirection: 'row', justifyContent: 'space-between', flexWrap: 'wrap' }}>
322
324
  {
323
325
  menuHeader?.map((item, i) => {
@@ -408,46 +410,73 @@ export default function m(props: EventVisitor_inputv2Props): any {
408
410
  editable={selectedCode?.is_used == "1" ? false : true}
409
411
  />
410
412
 
413
+
411
414
  <View style={{ flexDirection: 'row', justifyContent: 'flex-end', alignContent: 'center', alignItems: 'center' }}>
412
- <View style={{ flex: 2 }}>
413
- <EventLabel_input label={esp.lang("event/visitor_inputv2", "input_token")} mandatory />
414
- <EventInput_rectangle
415
- ref={inputToken}
416
- keyboardType='phone-pad'
417
- returnKeyType="done"
418
- style={applyStyle({ borderRadius: 4, borderColor: '#c4c4c4', marginTop: 8, backgroundColor: '#fff' })}
419
- placeholder={esp.lang("event/visitor_inputv2", "input_token")}
420
- onChangeText={(t) => setToken(t)}
421
- onSubmitEditing={assignToken}
422
- defaultValue={selectedCode?.token != "0" ? selectedCode?.token : ''}
423
- />
424
- </View>
425
415
  {
426
- selectedCode?.token != "0" &&
427
- <View style={{ flex: 1, justifyContent: 'flex-end', marginLeft: 10, marginTop: 5 }}>
428
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4b4b4b" }}>{esp.lang("event/visitor_inputv2", "token_used")}</Text>
429
- <View style={{ marginTop: 12, alignContent: 'center', alignItems: 'center', backgroundColor: "#ec7463", paddingHorizontal: 7, paddingVertical: 3, borderRadius: 5 }}>
430
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{LibUtils.number(selectedCode?.token_used)}</Text>
416
+ selectedCode?.use_token == 1 &&
417
+ <View style={{ flex: 2 }}>
418
+ <EventLabel_input label={esp.lang("event/visitor_inputv2", "input_token")} mandatory />
419
+ <EventInput_rectangle
420
+ ref={inputToken}
421
+ keyboardType='phone-pad'
422
+ returnKeyType="done"
423
+ style={applyStyle({ borderRadius: 4, borderColor: '#c4c4c4', marginTop: 8, backgroundColor: '#fff' })}
424
+ placeholder={esp.lang("event/visitor_inputv2", "input_token")}
425
+ onChangeText={(t) => setToken(t)}
426
+ onSubmitEditing={assignToken}
427
+ defaultValue={selectedCode?.token != "0" ? selectedCode?.token : ''}
428
+ />
429
+ </View>
430
+ }
431
+ {
432
+ selectedCode?.use_token == 1 &&
433
+ <View style={{ flex: 1, justifyContent: 'flex-end', marginLeft: 10, }}>
434
+ <EventLabel_input label={esp.lang("event/visitor_inputv2", "token_used")} />
435
+ <View style={{ height: 35, marginTop: 8, alignContent: 'center', justifyContent: 'center' }}>
436
+ <Text allowFontScaling={false} style={{ fontSize: 14 }}>{LibUtils.number(selectedCode?.token_used)}</Text>
431
437
  </View>
432
438
  </View>
433
439
  }
434
440
  {
435
- selectedCode?.token != "0" &&
436
- <View style={{ flex: 1, justifyContent: 'flex-end', marginLeft: 10, marginTop: 5 }}>
437
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4b4b4b" }}>{esp.lang("event/visitor_inputv2", "token_left")}</Text>
438
- <View style={{ marginTop: 12, alignContent: 'center', alignItems: 'center', backgroundColor: "#f6c67f", paddingHorizontal: 7, paddingVertical: 3, borderRadius: 5 }}>
439
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{LibUtils.number(selectedCode?.token_remaining)}</Text>
441
+ selectedCode?.use_token == 1 &&
442
+ <View style={{ flex: 1, justifyContent: 'flex-end', marginLeft: 10 }}>
443
+ <EventLabel_input label={esp.lang("event/visitor_inputv2", "token_left")} />
444
+ <View style={{ height: 35, marginTop: 8, alignContent: 'center', justifyContent: 'center' }}>
445
+ <Text allowFontScaling={false} style={{ fontSize: 14 }}>{LibUtils.number(selectedCode?.token_remaining)}</Text>
440
446
  </View>
441
447
  </View>
442
448
  }
443
449
  </View>
444
450
 
445
- <EventButton style={{ backgroundColor: '#00b894', marginTop: 15, borderRadius: 5 }} label={esp.lang("event/visitor_input", "save_btn")} onPress={() => {
446
- assignToken()
447
- }} />
451
+ <View style={{ marginTop: 15, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
452
+ {
453
+ selectedCode?.use_token == 1 && selectedCode?.token_remaining != 0 &&
454
+ <View style={{ marginRight: 5, flex: 1 }}>
455
+ <EventButton
456
+ label={esp.lang("event/visitor_inputv2", "withdraw_token")}
457
+ onPress={() => {
458
+ withdrawToken()
459
+ }}
460
+ backgroundColor='#fff'
461
+ borderColor={LibStyle.colorRed}
462
+ fontColor={LibStyle.colorRed}
463
+ style={{ borderRadius: 5 }}
464
+ />
465
+ </View>
466
+ }
448
467
 
468
+ <View style={{ marginLeft: (selectedCode?.token != "0" && selectedCode?.token_remaining != 0) ? 5 : 0, flex: 1 }}>
469
+ <EventButton
470
+ style={{ backgroundColor: '#00b894', borderRadius: 5 }}
471
+ label={esp.lang("event/visitor_input", "save_btn")}
472
+ onPress={() => {
473
+ assignToken()
474
+ }} />
475
+ </View>
476
+ </View>
449
477
  </View>
450
478
  </LibSlidingup>
479
+
451
480
  </View>
452
481
  )
453
482
  }
package/id.json CHANGED
@@ -1508,10 +1508,14 @@
1508
1508
  "warning_load": "Oops"
1509
1509
  },
1510
1510
  "event/tms_idcard": {
1511
+ "backk": "KEMBALI",
1511
1512
  "btn_back": "Kembali",
1512
1513
  "company": "Perusahaan",
1513
1514
  "header": "ID CARD",
1515
+ "hold_idcard": "Tahan ID CARD",
1514
1516
  "name": "Nama",
1517
+ "success": "Berhasil!",
1518
+ "token": "TOKEN",
1515
1519
  "visitor": "Pengunjung"
1516
1520
  },
1517
1521
  "event/tms_in": {
@@ -1859,7 +1863,7 @@
1859
1863
  "not_claimed": "Belum diklaim",
1860
1864
  "placeholder_input_name": "Masukkan Nama #%s",
1861
1865
  "resend": "Ulangi",
1862
- "save_btn": "Simpan",
1866
+ "save_btn": "Tambah",
1863
1867
  "see_list_claimed": "Lihat daftar klaim",
1864
1868
  "subtitle_exhibitor": "%s staf",
1865
1869
  "subtitle_total_exhibitor": "Total %s",
@@ -1872,6 +1876,7 @@
1872
1876
  "event/visitor_inputv2": {
1873
1877
  "code": "Kode",
1874
1878
  "confirm_input_token": "Apakah data yang anda masukkan sudah benar?",
1879
+ "confirm_withdraw_token": "Apakah anda ingin menarik token dari ID Card ini ?",
1875
1880
  "esp.lang(\"event/visitor_input\", \"confirm_title\")": "Info",
1876
1881
  "input_name": "Masukkan nama",
1877
1882
  "input_token": "Masukkan token",
@@ -1884,6 +1889,8 @@
1884
1889
  "token_shared": "Token dialokasikan",
1885
1890
  "token_used": "Total terpakai",
1886
1891
  "total_token": "Total token",
1892
+ "warning": "Peringatan",
1893
+ "withdraw_token": "Tarik Token",
1887
1894
  "yes": "Ya"
1888
1895
  },
1889
1896
  "event/voucher": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay-event",
3
- "version": "0.0.2-b",
3
+ "version": "0.0.2-c",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {