esoftplay-event 0.0.1-c → 0.0.1-e

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 (44) hide show
  1. package/config.json +1 -1
  2. package/event/artist.tsx +3 -6
  3. package/event/detail.tsx +0 -44
  4. package/event/order.tsx +2 -1
  5. package/event/order_detail.tsx +2 -4
  6. package/event/order_detail_upgrade_payment.tsx +13 -7
  7. package/event/order_detail_waiting.tsx +21 -9
  8. package/event/order_share_to.tsx +2 -2
  9. package/event/scan_item.tsx +2 -2
  10. package/event/seat_map_new.tsx +313 -0
  11. package/event/test.tsx +240 -155
  12. package/event/ticket_list.tsx +8 -5
  13. package/event/ticket_list2.tsx +1 -1
  14. package/event/tms_check_ticket_result.tsx +5 -5
  15. package/event/tms_in_failed.tsx +1 -1
  16. package/id.json +5 -4
  17. package/package.json +1 -1
  18. package/event/entrance.tsx +0 -215
  19. package/event/entrance_again.tsx +0 -199
  20. package/event/entrance_failed.tsx +0 -190
  21. package/event/entrance_idcard.tsx +0 -199
  22. package/event/entrance_list.tsx +0 -264
  23. package/event/entrance_list_item.tsx +0 -88
  24. package/event/entrance_log.tsx +0 -130
  25. package/event/entrance_success.tsx +0 -153
  26. package/event/entrance_warning.tsx +0 -91
  27. package/event/exit.tsx +0 -91
  28. package/event/exit_failed.tsx +0 -135
  29. package/event/exit_list.tsx +0 -118
  30. package/event/exit_log.tsx +0 -130
  31. package/event/exit_success.tsx +0 -143
  32. package/event/exit_temporary.tsx +0 -226
  33. package/event/hall_in.tsx +0 -148
  34. package/event/hall_in_failed.tsx +0 -270
  35. package/event/hall_in_list.tsx +0 -222
  36. package/event/hall_in_log.tsx +0 -134
  37. package/event/hall_in_success.tsx +0 -132
  38. package/event/hall_out.tsx +0 -143
  39. package/event/hall_out_failed.tsx +0 -133
  40. package/event/hall_out_list.tsx +0 -215
  41. package/event/hall_out_log.tsx +0 -133
  42. package/event/hall_out_success.tsx +0 -130
  43. package/event/log.tsx +0 -433
  44. package/event/seat_map_test.tsx +0 -401
@@ -1,118 +0,0 @@
1
- // withHooks
2
-
3
- import { applyStyle } from 'esoftplay';
4
- import { EventButton } from 'esoftplay/cache/event/button/import';
5
- import { EventHeader } from 'esoftplay/cache/event/header/import';
6
- import { LibIcon } from 'esoftplay/cache/lib/icon/import';
7
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
8
- import { LibObject } from 'esoftplay/cache/lib/object/import';
9
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
10
- import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
11
- import { LibUtils } from 'esoftplay/cache/lib/utils/import';
12
- import { EventOrder_itemProperty } from 'esoftplay/cache/event/order_item/import';
13
- import { UserClass } from 'esoftplay/cache/user/class/import';
14
- import esp from 'esoftplay/esp';
15
- import useSafeState from 'esoftplay/state';
16
- import React from 'react';
17
- import { Platform, Pressable, ScrollView, Text, TouchableOpacity, View } from 'react-native';
18
-
19
-
20
- export interface EventTms_out_listArgs {
21
-
22
- }
23
- export interface EventTms_out_listProps {
24
-
25
- }
26
- export default function m(props: EventTms_out_listProps): any {
27
- const { data, scan_type, url_ticket_update, url_ticket_detail, price_type, gate_type, event_id, selectGate, typeScanner, event_title, configPriority }: any = LibNavigation.getArgsAll<any>(props)
28
- const [result, setResult] = useSafeState<any>(data)
29
- const [useAll, setUseAll] = useSafeState<boolean>(true)
30
-
31
- const transformStyle = Platform.OS == "ios" ? { transform: [{ scaleY: - 1 }] } : { transform: [{ rotateX: '180deg' }] }
32
- function renderItem(item: any, i: number) {
33
- return (
34
- <Pressable onPress={() => {
35
- setResult(LibObject.set(result, item?.checked == 0 ? 1 : 0)('list', i, 'checked'))
36
- setUseAll(false)
37
- }} key={i} style={{ margin: 10, marginBottom: 10, marginTop: 5, padding: 10, borderRadius: 10, backgroundColor: LibStyle.colorPrimary, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
38
- <Text allowFontScaling={false} numberOfLines={2} ellipsizeMode='tail' style={{ fontSize: 20, fontWeight: 'bold', flexWrap: 'wrap', color: EventOrder_itemProperty.textColor(item?.color), marginRight: 10 }}>{item?.price_name}</Text>
39
- <LibIcon.Ionicons name={item?.checked == 1 ? 'checkmark-circle' : 'radio-button-off-outline'} size={26} color={EventOrder_itemProperty.textColor(item?.color)} />
40
- </Pressable>
41
- )
42
- }
43
-
44
- let args = {
45
- selectGate: selectGate,
46
- fromPage: 'event/tms_home',
47
- event_id: event_id,
48
- event_title: event_title,
49
- typeScanner: typeScanner,
50
- gate_type: gate_type,
51
- price_type: price_type,
52
- url_ticket_detail: url_ticket_detail,
53
- url_ticket_update: url_ticket_update,
54
- configPriority: configPriority,
55
- data: result,
56
- scan_type: scan_type
57
- }
58
-
59
- function quit(): void {
60
- let a = result?.list?.filter((item: any) => item.checked == 1).map((it: any) => it.id)
61
- if (a.length == 0) {
62
- LibToastProperty.show(esp.lang("event/tms_out_list", "select_ticket"))
63
- return
64
- } else {
65
- let url = "event_tms_out_confirm"
66
- let post = {
67
- event_id: event_id,
68
- ids: JSON.stringify(a),
69
- gate_id: selectGate?.id,
70
- trx_id: new Date().getTime() + "" + UserClass.state().get()?.id,
71
- price_id: result?.list?.filter((item: any) => item.checked == 1).map((it: any) => it.price_id),
72
- scanned_out: LibUtils.moment().format('YYYY-MM-DD HH:mm:ss'),
73
- }
74
-
75
- LibNavigation.replace('event/tms_out_success', { ...args, url, post })
76
- }
77
- }
78
-
79
- return (
80
- <View style={{ flex: 1, backgroundColor: '#fff' }}>
81
- <EventHeader title={esp.lang("event/tms_out_list", "header_title")} subtitle={esp.lang("event/tms_out_list", "exit_gate", data?.event_name)} />
82
- <ScrollView style={{ marginTop: 20 }}>
83
- {
84
- result?.list?.map(renderItem)
85
- }
86
- </ScrollView>
87
- <View style={{ padding: 10 }}>
88
- <View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
89
- <Text allowFontScaling={false} numberOfLines={2} ellipsizeMode={'tail'} style={{ fontWeight: 'bold', fontSize: 14, letterSpacing: 1 }}>{result?.list?.filter((item: any) => item.checked == 1).length + " Tiket digunakan"}</Text>
90
- <TouchableOpacity onPress={() => {
91
- let a = result?.list?.map((item: any, i: number) => {
92
- return { ...item, checked: useAll ? 0 : 1 }
93
- })
94
- let b = {
95
- ...result,
96
- list: a
97
- }
98
- setResult(b)
99
- setUseAll(useAll ? false : true)
100
- }} style={applyStyle({ paddingHorizontal: 15, borderWidth: 1, borderColor: 'rgba(0, 0, 0, 0)', height: 35, borderRadius: 16, backgroundColor: useAll ? LibStyle.colorRed : LibStyle.colorGreen, flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center' })} >
101
- <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>
102
- <LibIcon.Ionicons size={18} color="#fff" name={useAll ? "close" : "checkmark-done"} />
103
- </TouchableOpacity>
104
- </View>
105
-
106
- <EventButton
107
- label={esp.lang("event/tms_out_list", "exit")}
108
- backgroundColor={LibStyle.colorRed}
109
- onPress={() => {
110
- quit()
111
- }}
112
- style={{ marginTop: 30 }}
113
- />
114
-
115
- </View>
116
- </View>
117
- )
118
- }
@@ -1,130 +0,0 @@
1
- // withHooks
2
- import { useEffect } from 'react';
3
-
4
- import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
5
- import { EventTms_logProperty } from 'esoftplay/cache/event/tms_log/import';
6
- import { EventTms_out_successProperty } from 'esoftplay/cache/event/tms_out_success/import';
7
- import { LibLoading } from 'esoftplay/cache/lib/loading/import';
8
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
9
- import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
10
- import { LibUtils } from 'esoftplay/cache/lib/utils/import';
11
- import { UseCondition } from 'esoftplay/cache/use/condition/import';
12
- import esp from 'esoftplay/esp';
13
- import useSafeState from 'esoftplay/state';
14
- import { useTimeout } from 'esoftplay/timeout';
15
- import React from 'react';
16
- import { Pressable, Text, View } from 'react-native';
17
-
18
-
19
- export interface EventTms_out_logArgs {
20
-
21
- }
22
- export interface EventTms_out_logProps {
23
- onPress: (type: string, title: string) => void
24
- }
25
-
26
- export interface ExitLogItem {
27
- text: string
28
- subtitle: string
29
- value: string
30
- onPress: () => void
31
- valuecolor?: string
32
- }
33
-
34
- function Item(props: ExitLogItem) {
35
- return (
36
- <Pressable
37
- onPress={() => {
38
- props.onPress()
39
- }} style={{ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginHorizontal: 15, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: LibStyle.colorLightGrey }}>
40
- <View>
41
- <LibTextstyle text={props.text} textStyle="subhead" />
42
- <Text style={{ marginTop: 3, fontSize: 12, color: LibStyle.colorBrown }}>{props.subtitle}</Text>
43
- </View>
44
- <LibTextstyle text={LibUtils.number(props.value)} style={{ color: props.valuecolor ? props.valuecolor : "#000" }} textStyle="title2" />
45
- </Pressable>
46
- )
47
- }
48
-
49
-
50
- export default function m(props: EventTms_out_logProps): any {
51
-
52
- const logExit = EventTms_homeProperty.counterState().useSelector(s => s)
53
- const backupExit = EventTms_out_successProperty.syncTicketExit().useSelector(s => s)
54
- const [loading, setLoading] = useSafeState<boolean>(true)
55
- const timeout = useTimeout()
56
-
57
- function syncExitData() {
58
- EventTms_homeProperty.subscribeSyncExit().trigger(EventTms_out_successProperty.syncTicketExit().get())
59
- timeout(() => {
60
- setLoading(false)
61
- }, 1000)
62
- }
63
-
64
- function forceSyncExitData() {
65
- EventTms_homeProperty.subscribeSyncExitReset().trigger(EventTms_out_successProperty.syncTicketExit().get())
66
- timeout(() => {
67
- setLoading(false)
68
- }, 1000)
69
- }
70
-
71
- useEffect(() => {
72
- syncExitData()
73
- }, [])
74
-
75
-
76
- if (loading) {
77
- return <LibLoading />
78
- }
79
-
80
- const sumValue = EventTms_logProperty.sumValuesPerCategory(logExit)
81
-
82
- return (
83
- <View style={{ flex: 1, backgroundColor: '#fff', margin: 17, marginTop: 0, paddingBottom: 10, marginBottom: 0, borderBottomRightRadius: 10, borderBottomLeftRadius: 10, ...LibStyle.elevation(2) }}>
84
- <Item subtitle={esp.lang("event/tms_out_log", "ticket_scan_out")} text={esp.lang("event/tms_out_log", "scan_out")} value={sumValue?.out_scan} onPress={() => {
85
- if (sumValue?.out_scan) {
86
- props.onPress("out_scan", esp.lang("event/tms_out_log", "scan_out"))
87
- }
88
-
89
- }} />
90
- <Item subtitle={esp.lang("event/tms_out_log", "qty_scanned_out")} text={esp.lang("event/tms_out_log", "qty_ticket_scan_out")} value={sumValue?.out_ticket} onPress={() => {
91
- if (sumValue?.out_ticket) {
92
- props.onPress("out_ticket", esp.lang("event/tms_out_log", "qty_ticket_scan_out"))
93
- }
94
-
95
- }} />
96
- <Item subtitle={esp.lang("event/tms_out_log", "ticket_scanned_out")} text={esp.lang("event/tms_out_log", "opengate_out")} value={sumValue?.out_opengate} onPress={() => {
97
- if (sumValue?.out_opengate) {
98
- props.onPress("out_opengate", esp.lang("event/tms_out_log", "opengate_out"))
99
- }
100
-
101
- }} />
102
- <Item subtitle={esp.lang("event/tms_out_log", "data_send_to_server")} text={esp.lang("event/tms_out_log", "data_send")} value={sumValue?.out_send} onPress={() => {
103
- if (sumValue?.out_send) {
104
- props.onPress("out_send", esp.lang("event/tms_out_log", "data_send"))
105
- }
106
-
107
- }} />
108
- <Item subtitle={esp.lang("event/tms_out_log", "data_not_send_to_server")} text={esp.lang("event/tms_out_log", "data_not_send")} value={backupExit.length} valuecolor={LibStyle.colorRed} onPress={() => {
109
-
110
- }} />
111
-
112
- <View style={{ marginHorizontal: 15 }} >
113
- <UseCondition
114
- if={backupExit.length == 0}
115
- fallback={
116
- <Pressable onPress={() => {
117
- setLoading(true)
118
- forceSyncExitData()
119
- }}>
120
- <Text allowFontScaling={false} style={{ textAlign: 'center' }}>{esp.lang("event/tms_out_log", "waiting")}<Text style={{ color: LibStyle.colorBlue, textDecorationStyle: 'solid', textDecorationLine: 'underline' }}>{esp.lang("event/tms_out_log", "click")}</Text> {esp.lang("event/tms_out_log", "re_try")}</Text>
121
- </Pressable>
122
- } >
123
- <LibTextstyle textStyle='callout'
124
- style={{ textAlign: 'center', marginTop: 15 }}
125
- text={esp.lang("event/tms_out_log", "all_data_send")} />
126
- </UseCondition>
127
- </View>
128
- </View >
129
- )
130
- }
@@ -1,143 +0,0 @@
1
- // withHooks
2
- import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
3
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
4
- import { LibObject } from 'esoftplay/cache/lib/object/import';
5
- import { LibPicture } from 'esoftplay/cache/lib/picture/import';
6
- import { LibStatusbar } from 'esoftplay/cache/lib/statusbar/import';
7
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
8
- import useGlobalState, { useGlobalReturn } from 'esoftplay/global';
9
- import { LinearGradient } from 'expo-linear-gradient';
10
- import { useEffect, useRef } from 'react';
11
-
12
- import esp from 'esoftplay/esp';
13
- import useSafeState from 'esoftplay/state';
14
- import React from 'react';
15
- import { Animated, Easing, Pressable, Text, View } from 'react-native';
16
-
17
-
18
- export interface EventTms_out_successArgs {
19
-
20
- }
21
- export interface EventTms_out_successProps {
22
-
23
- }
24
-
25
- const dataListTicketExit = useGlobalState<any[]>([], { persistKey: 'event_exit_tiket_sync', loadOnInit: true, inFastStorage: true })
26
- export function syncTicketExit(): useGlobalReturn<any[]> {
27
- return dataListTicketExit
28
- }
29
-
30
-
31
- export default function m(props: EventTms_out_successProps): any {
32
- const { scan_type, data, url, post, url_ticket_update, url_ticket_detail, price_type, gate_type, event_id, selectGate, typeScanner, event_title, configPriority }: any = LibNavigation.getArgsAll<any>(props)
33
-
34
- const [isPaused, setIsPaused] = useSafeState<boolean>(false)
35
- const progress = useRef(new Animated.Value(0)).current;
36
- const animation = useRef<Animated.CompositeAnimation | null>(null);
37
- const [pausedValue, setPausedValue] = useSafeState(0);
38
-
39
- function animateProgressBar() {
40
- const duration = 1000; // Ubah durasi animasi sesuai kebutuhan Anda
41
-
42
- if (!isPaused) {
43
- animation.current = Animated.timing(progress, {
44
- toValue: 1,
45
- duration: duration - duration * pausedValue,
46
- easing: Easing.linear,
47
- useNativeDriver: false,
48
- });
49
-
50
- animation.current.start(({ finished }) => {
51
- if (finished) {
52
- setIsPaused(false);
53
- setPausedValue(0);
54
-
55
- // script next nya disini
56
- LibNavigation.replace('component/scanner', {
57
- selectGate: selectGate,
58
- fromPage: 'event/tms_home',
59
- event_id: event_id,
60
- event_title: event_title,
61
- typeScanner: typeScanner,
62
- gate_type: gate_type,
63
- price_type: price_type,
64
- url_ticket_detail: url_ticket_detail,
65
- url_ticket_update: url_ticket_update,
66
- configPriority: configPriority,
67
- scan_type: scan_type
68
- })
69
- }
70
- });
71
- } else {
72
- if (animation.current) {
73
- animation.current.stop(); // Hentikan animasi
74
- animation.current = null;
75
- }
76
- setPausedValue(progress._value);
77
- }
78
-
79
- setIsPaused(!isPaused);
80
- }
81
-
82
- useEffect(() => {
83
- // sementara price_id tak jupuk index 0
84
- EventTms_homeProperty.addCounterOutOpenGate(1, post?.price_id?.[0])
85
- dataListTicketExit?.get()
86
- createDataExit()
87
- animateProgressBar()
88
- }, [])
89
-
90
- function createDataExit() {
91
- dataListTicketExit.set(LibObject.push(dataListTicketExit.get(), [url, post])())
92
- EventTms_homeProperty.subscribeSyncExit().trigger(dataListTicketExit.get())
93
- }
94
-
95
- let uniquePrices: any = {};
96
-
97
- data?.list?.filter((entry: any) => {
98
- return entry.checked == 1;
99
- }).forEach((entry: any) => {
100
- uniquePrices[entry.price_name] = true;
101
- });
102
-
103
- let uniquePriceNames = Object.keys(uniquePrices);
104
-
105
- const widthInterpolate = progress.interpolate({
106
- inputRange: [0, 1],
107
- outputRange: ['0%', '100%'],
108
- });
109
-
110
- return (
111
- <View style={{ flex: 1 }}>
112
- <LibStatusbar style='light' />
113
- <Pressable
114
- onPressIn={animateProgressBar}
115
- onPressOut={animateProgressBar}
116
- style={{ backgroundColor: '#000', height: LibStyle.height }}>
117
- <LibPicture source={{ uri: 'https://www.w3schools.com/howto/img_avatar.png' }} style={{ width: LibStyle.width, height: LibStyle.height - (LibStyle.height / 4) }} resizeMode={"cover"} />
118
-
119
- <View style={{ marginTop: LibStyle.STATUSBAR_HEIGHT + 5, alignSelf: 'center', height: 5, width: LibStyle.width - 20, backgroundColor: 'rgba(255,255,255,0.3)', borderRadius: 10, position: 'absolute', top: 5, }}>
120
- <Animated.View style={{ width: widthInterpolate, height: 5, backgroundColor: LibStyle.colorPrimary, borderRadius: 10, }} />
121
- </View>
122
-
123
- <LinearGradient
124
- // Background Linear Gradient
125
- style={{
126
- height: LibStyle.height - (LibStyle.height / 3),
127
- width: LibStyle.width,
128
- position: 'absolute',
129
- left: 0,
130
- right: 0,
131
- bottom: 0,
132
- }}
133
- colors={['rgba(255,255,255,0)', 'rgba(0,0,0,0.55)', 'rgba(0,0,0,1)', 'rgba(0,0,0,1)']}>
134
- <View style={{ flex: 1, padding: 15, justifyContent: 'flex-end', paddingBottom: 100, alignContent: 'center', alignItems: 'center' }}>
135
- <Text allowFontScaling={false} style={{ textAlign: 'center', flexWrap: 'wrap', fontSize: 35, letterSpacing: 2, fontWeight: '900', color: '#fff' }}>{uniquePriceNames.join(',')}</Text>
136
- <Text allowFontScaling={false} style={{ textAlign: 'center', fontSize: 26, marginTop: 20, color: LibStyle.colorRed }}>{esp.lang("event/tms_out_success", "exit")}</Text>
137
- </View>
138
-
139
- </LinearGradient>
140
- </Pressable>
141
- </View>
142
- )
143
- }
@@ -1,226 +0,0 @@
1
- // withHooks
2
- import { EventScan_item } from 'esoftplay/cache/event/scan_item/import';
3
- import { LibCurl } from 'esoftplay/cache/lib/curl/import';
4
- import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
5
- import { LibLoading } from 'esoftplay/cache/lib/loading/import';
6
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
7
- import { LibObject } from 'esoftplay/cache/lib/object/import';
8
- import { LibProgress } from 'esoftplay/cache/lib/progress/import';
9
- import { LibStyle } from 'esoftplay/cache/lib/style/import';
10
- import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
11
-
12
- import { applyStyle } from 'esoftplay';
13
- import { EventButton } from 'esoftplay/cache/event/button/import';
14
- import { EventHeader } from 'esoftplay/cache/event/header/import';
15
- import { LibPicture } from 'esoftplay/cache/lib/picture/import';
16
- import esp from 'esoftplay/esp';
17
- import useSafeState from 'esoftplay/state';
18
- import React, { useEffect } from 'react';
19
- import { ScrollView, Text, View } from 'react-native';
20
-
21
-
22
- export interface EventTms_out_temporaryArgs {
23
-
24
- }
25
- export interface EventTms_out_temporaryProps {
26
-
27
- }
28
- export default function m(props: EventTms_out_temporaryProps): any {
29
- const user_qr = LibNavigation.getArgs(props, 'qr_code')
30
- const { scan_type, event_id, selectGate, typeScanner }: any = LibNavigation.getArgsAll(props)
31
- const [result, setResult] = useSafeState<any>(undefined)
32
-
33
- useEffect(() => {
34
- loadData()
35
- }, [])
36
-
37
- function loadData() {
38
- var post = {
39
- event_id: event_id,
40
- // event_id: "264",
41
- user_qr: encodeURIComponent(user_qr),
42
- gate_id: selectGate.id
43
- // user_qr: encodeURIComponent("BBO-H6851"),
44
- }
45
- new LibCurl('event_tms_out_temporary', post, (res) => {
46
- let a = res?.list?.length > 0 && res.list.map((item: any, i: number) => {
47
- return ({
48
- ...item,
49
- checked: 0
50
- })
51
- })
52
- let b = res?.staff?.length > 0 && res.staff.map((item: any, i: number) => {
53
- return ({
54
- ...item,
55
- checked: 0
56
- })
57
- })
58
-
59
- let c = {
60
- ...res,
61
- list: res?.list?.length == 0 ? [] : a,
62
- staff: res?.staff?.length == 0 ? [] : b
63
- }
64
- esp.log({ res, c });
65
- setResult(c)
66
-
67
- }, (error) => {
68
- LibDialog.warningConfirm(esp.lang("event/tms_out_temporary", "fault"), error?.message, esp.lang("event/tms_out_temporary", "back"), () => LibNavigation.back(), "", () => { })
69
- }, 1)
70
- }
71
-
72
- function quitTemporary(): void {
73
- let list = [...result?.list, ...result.staff]
74
- let a = list.filter((item: any) => item.checked == 1).map((it: any) => it.id)
75
-
76
- if (a.length == 0) {
77
- LibToastProperty.show(esp.lang("event/tms_out_temporary", "select_ticket"))
78
- return
79
- }
80
- var post = {
81
- event_id: event_id,
82
- ids: JSON.stringify(a),
83
- gate_id: selectGate.id
84
- }
85
-
86
- LibProgress.show(esp.lang("event/tms_out_temporary", "wait"))
87
- new LibCurl('event_tms_out_temporary_confirm', post, (result, msg) => {
88
- LibProgress.hide()
89
- LibDialog.confirm(esp.lang("event/tms_out_temporary", "info"), msg, esp.lang("event/tms_out_temporary", "ok"), () => {
90
- LibNavigation.replace('component/scanner', {
91
- fromPage: 'event/tms_home',
92
- isTemporaryExit: true,
93
- event_id: event_id,
94
- selectGate: selectGate,
95
- typeScanner: typeScanner,
96
- scan_type: scan_type
97
- })
98
- }, "", () => { })
99
- }, (error) => {
100
- LibDialog.warning(esp.lang("event/tms_out_temporary", "oops"), error?.message)
101
- LibProgress.hide()
102
- }, 1)
103
- }
104
-
105
- if (!result) return <LibLoading />
106
-
107
- let lastStatusScanned = ''
108
- function renderTicketTemporary(item: any, i: number) {
109
- const showStatusScanned = lastStatusScanned != item?.status_label
110
- lastStatusScanned = item?.status_label
111
- return (
112
- <View key={i}>
113
- {
114
- showStatusScanned &&
115
- <View style={{ backgroundColor: item?.status == 1 ? '#fff' : "#c5c5c5", padding: 10, borderBottomWidth: 2, borderBottomColor: LibStyle.colorBgGrey }} >
116
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: item?.status == 1 ? item?.status_background : "#fff" }}>{(item?.status_label).toUpperCase()}</Text>
117
- </View>
118
- }
119
- <EventScan_item
120
- key={i}
121
- item={item}
122
- colorFont={"#fff"}
123
- style={{ backgroundColor: item?.status == 1 ? "#fff" : "#c5c5c5" }}
124
- event_image={result?.event_image}
125
- event_name={result?.event_name}
126
- event_ondate={result?.event_ondate}
127
- colorText={item?.status == 1 ? "#000" : LibStyle.colorBgGrey}
128
- label={
129
- item.status == 0 ?
130
- esp.lang("event/tms_out_temporary", "used") :
131
- item.checked == 0 ?
132
- esp.lang("event/tms_out_temporary", "use") :
133
- esp.lang("event/tms_out_temporary", "cancel")
134
- }
135
- onPress={() => {
136
- if (item?.status == 1 && item?.is_limit == 0) {
137
- let a = LibObject.set(result, item.checked == 1 ? 0 : 1)('list', i, 'checked')
138
- setResult(a)
139
- }
140
- }}
141
- colorBackground={(item.status == 0 || item.is_limit == 1) ? LibStyle.colorLightGrey : (item.checked == 0) ? LibStyle.colorGreen : LibStyle.colorRed}
142
- />
143
- </View>
144
- )
145
- }
146
-
147
- let lastStatusStaff = ''
148
- function renderStaff(item: any, i: number) {
149
- const showStatusScanned = lastStatusStaff != item?.status_label
150
- lastStatusStaff = item?.status_label
151
-
152
- return (
153
- <View key={i}>
154
- {
155
- showStatusScanned &&
156
- <View style={{ backgroundColor: item?.status == 1 ? '#fff' : "#c5c5c5", padding: 10, borderBottomWidth: 2, borderBottomColor: LibStyle.colorBgGrey }} >
157
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: item?.status == 1 ? item?.status_background : "#fff" }}>{(item?.status_label).toUpperCase()}</Text>
158
- </View>
159
- }
160
- <View style={{ padding: 10, overflow: 'hidden', flex: 1, flexDirection: 'row', backgroundColor: '#fff', borderBottomColor: LibStyle.colorGrey, borderBottomWidth: 1.5 }}>
161
- <LibPicture style={applyStyle({ borderRadius: 5, width: LibStyle.width / 4.5, height: LibStyle.width / 4.5, backgroundColor: LibStyle.colorBgGrey })} source={{ uri: item?.image }} />
162
- <View style={{ marginLeft: 10, flex: 1 }}>
163
- <Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#000", marginBottom: 4, fontSize: 18, fontWeight: 'bold' })}>{item.name}</Text>
164
- <Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#000", marginBottom: 4, fontSize: 14 })}>{item.department_name}</Text>
165
- <Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#000", marginBottom: 4, fontSize: 16 })}>{item.exhibitor_name}</Text>
166
- {
167
- item.status == 1 &&
168
- <EventButton style={applyStyle({ marginTop: 10, alignSelf: 'flex-end', width: LibStyle.width / 3, backgroundColor: (item.status == 0 || item.is_limit == 1) ? LibStyle.colorLightGrey : (item.checked == 0) ? LibStyle.colorGreen : LibStyle.colorRed })} label={
169
- item.status == 0 ?
170
- esp.lang("event/tms_out_temporary", "used") :
171
- item.hasOwnProperty("checked") && item.checked == 0 ?
172
- esp.lang("event/tms_out_temporary", "use") :
173
- esp.lang("event/tms_out_temporary", "cancel")
174
- } fontColor={"#fff"} onPress={() => {
175
- let a = LibObject.set(result, item.checked == 1 ? 0 : 1)('staff', i, 'checked')
176
- setResult(a)
177
- }} />
178
- }
179
- </View>
180
- <View pointerEvents='none' style={{ position: 'absolute', justifyContent: 'center', transform: [{ rotate: '45deg' }], margin: 1, ...LibStyle.elevation(2), height: 20, width: 170, backgroundColor: LibStyle.colorPrimary, right: -50, top: 25 }} >
181
- <Text style={{ color: 'white', alignSelf: 'center', fontWeight: 'bold' }} >ID CARD</Text>
182
- </View>
183
- </View>
184
- </View>
185
- )
186
- }
187
-
188
- const sortedData = result?.list?.length > 0 && result?.list.sort((a: any, b: any) => {
189
- if (a.is_limit == 0 && b.is_limit != 0) {
190
- return -1; // a di atas b
191
- } else if (a.is_limit != 0 && b.is_limit == 0) {
192
- return 1; // b di atas a
193
- } else {
194
- return 0; // urutan relatif tidak berubah
195
- }
196
- });
197
-
198
- return (
199
- <View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey }}>
200
- <EventHeader title={esp.lang("event/tms_out_temporary", "temp_out")} />
201
-
202
- <ScrollView>
203
- <View style={{ margin: 15, marginBottom: 0, borderRadius: 7, overflow: 'hidden' }}>
204
- {
205
- result?.staff?.length > 0 && result?.staff?.map(renderStaff)
206
- }
207
- </View>
208
- <View style={{ margin: 15, borderRadius: 7, overflow: 'hidden' }}>
209
- {
210
- sortedData?.length > 0 && sortedData?.map(renderTicketTemporary)
211
- }
212
- </View>
213
- </ScrollView>
214
- <View style={{ padding: 10, backgroundColor: '#fff' }}>
215
- <EventButton
216
- label={esp.lang("event/tms_out_temporary", "btn_exit")}
217
- backgroundColor={LibStyle.colorRed}
218
- onPress={() => {
219
- quitTemporary()
220
- }}
221
- // style={{ marginTop: 20 }}
222
- />
223
- </View>
224
- </View>
225
- )
226
- }