esoftplay-event 0.0.1-p → 0.0.1-q

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/event/detail.tsx CHANGED
@@ -17,6 +17,7 @@ import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
17
17
  import { EventSlider } from 'esoftplay/cache/event/slider/import';
18
18
  import { UseCondition } from 'esoftplay/cache/use/condition/import';
19
19
  import { UseDeeplinkProperty } from 'esoftplay/cache/use/deeplink/import';
20
+ import { UserClass } from 'esoftplay/cache/user/class/import';
20
21
  import esp from 'esoftplay/esp';
21
22
  import moment from 'esoftplay/moment';
22
23
  import useSafeState from 'esoftplay/state';
@@ -34,12 +35,12 @@ export default function m(props: EventDetailProps): any {
34
35
  const url = LibNavigation.getArgs(props, 'url')
35
36
  const [deeplinkParams] = UseDeeplinkProperty.params.useState()
36
37
  const [priority, setPriority] = useSafeState(false)
38
+ const user = UserClass.state().get()
37
39
 
38
40
  moment().locale('id')
39
41
  function loadData(): void {
40
42
  // CacheHit.doHit(url)
41
43
  new LibCurl(url, null, (res, msg) => {
42
- esp.log(res);
43
44
  EventFirebase_socketProperty.eventIdQueue.set(res.id)
44
45
  setResult(res)
45
46
  if (res.allotment) {
@@ -274,19 +275,25 @@ export default function m(props: EventDetailProps): any {
274
275
  if (isInPricingQueueConfig(result.id)) {
275
276
  await LibNavigation.navigateForResult('event/queue_pricing', { event_id: result?.id })
276
277
  }
277
- LibNavigation.navigate(result?.config?.hasOwnProperty('multiprice') && result?.config?.multiprice == 1 ? 'event/ticket_list2' : 'event/ticket_list', {
278
- url: result.url_price,
279
- fee_platform: {
280
- fee_platform_amount: result?.fee_platform_amount,
281
- fee_platform_type: result?.fee_platform_type,
282
- },
283
- subscribed: {
284
- is_subscribed: result?.config?.is_subscribed,
285
- is_subscribed_default: result?.config?.is_subscribed_default,
286
- is_subscribed_label: result?.config?.is_subscribed_label
287
- },
288
- show_fee_percentage: result?.config?.show_fee_percentage
289
- })
278
+ LibNavigation.navigate(
279
+ user?.config?.tester == 1 ?
280
+ 'event/ticket_list2'
281
+ :
282
+ (result?.config?.hasOwnProperty('multiprice') && result?.config?.multiprice == 1 ? 'event/ticket_list2' : 'event/ticket_list'),
283
+ {
284
+ url: result.url_price,
285
+ fee_platform: {
286
+ fee_platform_amount: result?.fee_platform_amount,
287
+ fee_platform_type: result?.fee_platform_type,
288
+ },
289
+ subscribed: {
290
+ is_subscribed: result?.config?.is_subscribed,
291
+ is_subscribed_default: result?.config?.is_subscribed_default,
292
+ is_subscribed_label: result?.config?.is_subscribed_label
293
+ },
294
+ show_fee_percentage: result?.config?.show_fee_percentage,
295
+ is_multiprice: result?.config?.multiprice == 1 ? 1 : 0,
296
+ })
290
297
 
291
298
  })
292
299
  }} style={applyStyle({ width: result?.url_artist != "" ? (LibStyle.width - 30) * 0.5 : LibStyle.width - 20, borderWidth: 2, borderColor: LibStyle.colorGreen, height: 40, borderRadius: 16, backgroundColor: LibStyle.colorGreen, flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
@@ -151,7 +151,7 @@ export default function m(props: EventExchange_ticketProps): any {
151
151
  <EventHeader title={esp.lang("event/exchange_ticket", "header")} subtitle={dataEvent?.name} />
152
152
  <ScrollView style={{ flex: 1 }} refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />}>
153
153
  <Pressable onPress={() => {
154
- LibNavigation.navigate('event/exchange_ticket_list', { dataEvent: dataEvent })
154
+ LibNavigation.navigate('event/exchange_ticket_list')
155
155
  }} style={{ margin: 15, marginBottom: 0, padding: 10, borderWidth: 1, backgroundColor: '#fff', borderColor: LibStyle.colorRed, flex: 1, borderRadius: 10, flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center' }}>
156
156
  <Text allowFontScaling={false}>{esp.lang("event/exchange_ticket", "exchange_history")}</Text>
157
157
  <LibIcon name='chevron-right' />
@@ -5,11 +5,11 @@ import { EventButton } from 'esoftplay/cache/event/button/import';
5
5
  import { EventExchange_ticketProperty } from 'esoftplay/cache/event/exchange_ticket/import';
6
6
  import { EventExchange_ticket_resultProperty } from 'esoftplay/cache/event/exchange_ticket_result/import';
7
7
  import { EventHeader } from 'esoftplay/cache/event/header/import';
8
+ import { EventTms_dashboardProperty } from 'esoftplay/cache/event/tms_dashboard/import';
8
9
  import { LibCollaps } from 'esoftplay/cache/lib/collaps/import';
9
10
  import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
10
11
  import { LibIcon } from 'esoftplay/cache/lib/icon/import';
11
12
  import { LibList } from 'esoftplay/cache/lib/list/import';
12
- import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
13
13
  import { LibProgress } from 'esoftplay/cache/lib/progress/import';
14
14
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
15
15
  import { LibStyle } from 'esoftplay/cache/lib/style/import';
@@ -32,7 +32,6 @@ export interface EventExchange_ticket_listProps {
32
32
  }
33
33
 
34
34
  export default function m(props: EventExchange_ticket_listProps): any {
35
- const { dataEvent } = LibNavigation.getArgsAll(props)
36
35
  const log = EventExchange_ticketProperty.stateExchangeLog.useSelector(s => s)
37
36
  const backup = EventExchange_ticket_resultProperty.stateListConfirm().useSelector(s => s)
38
37
  const selectedRef = useRef<LibSlidingup>(null)
@@ -163,7 +162,7 @@ export default function m(props: EventExchange_ticket_listProps): any {
163
162
  domain: esp.config('domain'),
164
163
  tms_name: UserClass.state().get('name'),
165
164
  email: UserClass.state().get('email'),
166
- event_name: dataEvent?.name,
165
+ event_name: EventTms_dashboardProperty.closingDataState()?.get()?.event_name,
167
166
  data: EventExchange_ticketProperty.stateExchangeLog.get()
168
167
  }, undefined, 2), '-1001737180019', undefined, () => {
169
168
  EventExchange_ticketProperty.stateExchangeLog.reset()
@@ -26,6 +26,10 @@ const state = useGlobalState(0)
26
26
  export const lastKeyInPages = useGlobalState<string[]>([])
27
27
  export const userIdKeyReplacer = useGlobalState<any>({})
28
28
 
29
+ function isValidEventId(event_id: string): boolean {
30
+ return !!event_id && event_id !== "undefined"
31
+ }
32
+
29
33
  export default function useFirebaseSocket() {
30
34
  const [status] = state.useState()
31
35
  const isDirect = EventTms_homeProperty.state()
@@ -109,6 +113,10 @@ export default function useFirebaseSocket() {
109
113
  const instance: any = esp.mod("firestore/index")().instance()
110
114
  const db = getFirestore(instance)
111
115
 
116
+ if (!isValidEventId(event_id)) {
117
+ return
118
+ }
119
+
112
120
  if (userIdKeyReplacer.get()?.priority == 1) {
113
121
  const coll = collection(db, [getEventPath(), path, event_id].join('/'));
114
122
  const q = query(coll, orderBy('t', 'asc'), where("t", "==", userIdKeyReplacer.get().t));
package/event/order.tsx CHANGED
@@ -157,41 +157,27 @@ export default function m(props: EventOrderProps): any {
157
157
  return (
158
158
  <View style={{ backgroundColor: LibStyle.colorBgGrey, flex: 1 }}>
159
159
  <EventHeader title={esp.lang("event/order", "my_order")} />
160
- {
161
- esp.isDebug('filter_order_status') ?
162
- <View style={{ minHeight: 50 }} >
163
- <LibScroll
164
- initialNumToRender={20}
165
- horizontal
166
- >
167
- <View style={{ width: 10 }} />
168
- <Pressable
169
- onPress={() => { statusRef.current?.show() }}
170
- style={applyStyle({ height: 30, marginVertical: 10, marginRight: 10, borderRadius: 12, backgroundColor: 'white', borderColor: '#ccc', borderWidth: 1, paddingHorizontal: 10, justifyContent: 'center', flexDirection: 'row', alignItems: 'center' })} >
171
- <LibTextstyle textStyle='footnote' text={allStatus[allStatus.findIndex((x) => String(x.code) == status)]?.text || esp.lang("event/order", "all_statis")} style={applyStyle({ fontSize: 11, color: "#4E4E4E", marginRight: 5 })} />
172
- <LibIcon name='chevron-down' style={applyStyle({ color: "#4E4E4E" })} />
173
- </Pressable>
174
- <Pressable
175
- onPress={() => { dialogFilterDate?.current?.show() }}
176
- style={applyStyle({ height: 30, marginVertical: 10, marginRight: 10, borderRadius: 12, backgroundColor: 'white', borderColor: '#ccc', borderWidth: 1, paddingHorizontal: 10, justifyContent: 'center', flexDirection: 'row', alignItems: 'center' })} >
177
- <LibTextstyle textStyle='footnote' text={selectedDate.id == 4 ? LibUtils.getDateRange(selectedDate?.date_start, selectedDate?.date_end) : selectedDate?.title} style={applyStyle({ fontSize: 11, color: "#4E4E4E", marginRight: 5 })} />
178
- <LibIcon name='calendar' size={14} style={applyStyle({ color: "#4E4E4E" })} />
179
- </Pressable>
180
- </LibScroll>
181
- <EventSection_menu size='line' />
182
- </View>
183
- :
184
- <View style={{ margin: 15, marginBottom: 0, flexDirection: 'row', justifyContent: 'space-between' }}>
185
- <View style={{ flex: 10 }}>
186
- <Status status={status} onChangeStatus={setStatus} />
187
- </View>
188
- <TouchableOpacity onPress={() => {
189
- dialogFilterDate.current!.show()
190
- }} style={{ flex: 1, marginLeft: 15 }}>
191
- <LibIcon name="calendar" />
192
- </TouchableOpacity>
193
- </View>
194
- }
160
+ <View style={{ minHeight: 50 }} >
161
+ <LibScroll
162
+ initialNumToRender={20}
163
+ horizontal
164
+ >
165
+ <View style={{ width: 10 }} />
166
+ <Pressable
167
+ onPress={() => { statusRef.current?.show() }}
168
+ style={applyStyle({ height: 30, marginVertical: 10, marginRight: 10, borderRadius: 12, backgroundColor: 'white', borderColor: '#ccc', borderWidth: 1, paddingHorizontal: 10, justifyContent: 'center', flexDirection: 'row', alignItems: 'center' })} >
169
+ <LibTextstyle textStyle='footnote' text={allStatus[allStatus.findIndex((x) => String(x.code) == status)]?.text || esp.lang("event/order", "all_statis")} style={applyStyle({ fontSize: 11, color: "#4E4E4E", marginRight: 5 })} />
170
+ <LibIcon name='chevron-down' style={applyStyle({ color: "#4E4E4E" })} />
171
+ </Pressable>
172
+ <Pressable
173
+ onPress={() => { dialogFilterDate?.current?.show() }}
174
+ style={applyStyle({ height: 30, marginVertical: 10, marginRight: 10, borderRadius: 12, backgroundColor: 'white', borderColor: '#ccc', borderWidth: 1, paddingHorizontal: 10, justifyContent: 'center', flexDirection: 'row', alignItems: 'center' })} >
175
+ <LibTextstyle textStyle='footnote' text={selectedDate.id == 4 ? LibUtils.getDateRange(selectedDate?.date_start, selectedDate?.date_end) : selectedDate?.title} style={applyStyle({ fontSize: 11, color: "#4E4E4E", marginRight: 5 })} />
176
+ <LibIcon name='calendar' size={14} style={applyStyle({ color: "#4E4E4E" })} />
177
+ </Pressable>
178
+ </LibScroll>
179
+ <EventSection_menu size='line' />
180
+ </View>
195
181
 
196
182
  <LibInfinite
197
183
  url={buildUrl(url) + "&t=" + new Date().getTime()}
@@ -401,7 +401,7 @@ export default function m(props: EventOrder_detailProps): any {
401
401
  <EventHtmltext allowFontScaling={false} numberOfLines={3} ellipsizeMode="tail" style={{ color: EventOrder_itemProperty.textColor(result?.color), alignSelf: 'center', textAlign: 'center', fontSize: 20, fontWeight: 'bold' }}> {result?.price_name}</EventHtmltext>
402
402
  {
403
403
  result?.ondate != "0000-00-00" &&
404
- <Text allowFontScaling={false} style={{ flex: 1, marginRight: 10, marginLeft: 6, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{moment(result?.ondate).localeFormat("DD MMMM YYYY")}</Text>
404
+ <Text allowFontScaling={false} style={{ flex: 1, marginRight: 10, marginLeft: 6, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: EventOrder_itemProperty.textColor(result?.color) }}>{moment(result?.ondate).localeFormat("DD MMMM YYYY")}</Text>
405
405
  }
406
406
 
407
407
  </View>
@@ -120,7 +120,10 @@ export default function m(props: EventOrder_detail_upgradeProps): any {
120
120
  } else {
121
121
  LibDialog.warning(esp.lang("event/order_detail_upgrade", "oops"), item.message_error)
122
122
  }
123
- }} key={i} style={{ ...LibStyle.elevation(2), marginHorizontal: 15, marginTop: 2.5, marginBottom: 10, borderRadius: 10, backgroundColor: item.status == 0 ? LibStyle.colorBgGrey : selectedTicket?.selected_ticket?.id == item.id ? LibStyle.colorGreen : "#fff", padding: 10, alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
123
+ }} key={i} style={{
124
+ ...LibStyle.elevation(2), marginHorizontal: 15, marginTop: 2.5, marginBottom: 10, borderRadius: 10,
125
+ backgroundColor: item.status == 0 ? LibStyle.colorBgGrey : selectedTicket?.selected_ticket?.id == item.id ? LibStyle.colorGreen : "#fff", padding: 10, alignContent: 'center', alignItems: 'center', justifyContent: 'center'
126
+ }}>
124
127
  <EventHtmltext allowFontScaling={false} style={{ marginHorizontal: 5, fontSize: 16, color: item.status == 0 ? "#c9c9c9" : selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#000", textAlign: 'center', fontWeight: 'bold' }} numberOfLines={2} ellipsizeMode={'tail'}>{item?.price_name_to}</EventHtmltext>
125
128
  <Text allowFontScaling={false} style={{ fontSize: 14, fontWeight: 'bold', marginTop: 5, color: item.status == 0 ? "#c9c9c9" : selectedTicket?.selected_ticket?.id == item.id ? "#fff" : "#000" }}>{"+ " + LibUtils.money(Number(dataTicket?.qty_upgrade) * Number(item?.amount), item?.currency)}</Text>
126
129
 
@@ -37,6 +37,8 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
37
37
  const scrollYRef = useRef(0)
38
38
  const dialogSeat = useRef<LibSlidingup>(null)
39
39
 
40
+ esp.log({ dataTicket, selectedTicket });
41
+
40
42
  function doUpgrade(pin?: any) {
41
43
  const LibToastProperty = esp.modProp("lib/toast")
42
44
  if (!selectedPayment) {
@@ -54,9 +56,7 @@ export default function m(props: EventOrder_detail_upgrade_paymentProps): any {
54
56
  }
55
57
 
56
58
  if (selectedTicket?.selected_ticket?.use_seat == 1) {
57
- post.row_id = selectedTicket?.row_id
58
- post.column_id = selectedTicket?.column_id
59
- post.seat_name = selectedTicket?.seat_name
59
+ post.seat_label = selectedTicket?.seat_label.join('|')
60
60
  }
61
61
 
62
62
  if (selectedTicket?.selected_ticket?.seat_autopick == 1) {
@@ -33,6 +33,7 @@ export default function m(props: EventOrder_detail_visitorProps): any {
33
33
  function loadData() {
34
34
  new LibCurl(url, null, (res, msg) => {
35
35
  setResult(res)
36
+ esp.log(res);
36
37
  }, (err) => {
37
38
  setError(err)
38
39
  })
@@ -122,11 +123,30 @@ export default function m(props: EventOrder_detail_visitorProps): any {
122
123
  <View key={i} style={{ marginLeft: 14, marginBottom: 15, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'space-between' }}>
123
124
  <View style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
124
125
  <Text allowFontScaling={false} style={{ marginRight: 6, fontFamily: "Arial", fontSize: 30, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#484848" }}>{i + 1}.</Text>
125
- <View style={{ flex: 1 }} >
126
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", marginTop: 10, fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3" }}>{esp.lang("event/order_detail", "buyer_name")}</Text>
127
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }} ellipsizeMode='tail'>{item?.name}</Text>
128
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3", marginTop: 10 }}>{esp.lang("event/order_detail", "phone_number")}</Text>
129
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }}>{item?.phone == "" ? "-" : item?.phone.trim()}</Text>
126
+ <View >
127
+ <View style={{ flex: 1 }}>
128
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", marginTop: 10, fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3" }}>{esp.lang("event/order_detail", "buyer_name")}</Text>
129
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }} ellipsizeMode='tail'>{item?.name}</Text>
130
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3", marginTop: 10 }}>{esp.lang("event/order_detail", "phone_number")}</Text>
131
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a", marginTop: 4 }}>{item?.phone == "" ? "-" : item?.phone.trim()}</Text>
132
+ </View>
133
+ {
134
+ item?.redemption?.length > 0 &&
135
+ <View style={{ marginTop: 3 }}>
136
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 10, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#c3c3c3", marginTop: 7 }}>{"Item Redemption"}</Text>
137
+ <View style={{ flexDirection: 'row', flex: 1, flexWrap: 'wrap', justifyContent: 'space-around' }}>
138
+ {
139
+ item?.redemption?.map((x: any, ii: number) => {
140
+ return (
141
+ <View key={ii} style={{ borderRadius: 3, marginRight: 6, backgroundColor: LibStyle.colorPrimary, padding: 5 }}>
142
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#fff" }}>{x}</Text>
143
+ </View>
144
+ )
145
+ })
146
+ }
147
+ </View>
148
+ </View>
149
+ }
130
150
  </View>
131
151
  </View>
132
152
  <View style={{ alignContent: 'center', alignItems: 'center' }}>
@@ -47,7 +47,7 @@ export default function m(props: EventQueueProps): any {
47
47
  event_id = String(event_id)
48
48
  const [number, setNumber, getNumber] = useSafeState(esp.lang("event/queue_pricing", "info"))
49
49
  const animation = useRef<LottieView>(null)
50
- let refTimeout = useRef<any>()
50
+ let refTimeout = useRef<any>(null)
51
51
  const pathQueue = EVENT_PRICING_QUEUE
52
52
 
53
53
  const timeout = useTimeout()
@@ -49,11 +49,11 @@ export default function m(props: EventScan_itemProps): any {
49
49
  <View style={{}}>
50
50
  {
51
51
  props?.item?.hall_scanned && props?.item?.hall_scanned != "0000-00-00 00:00:00" &&
52
- <Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#c9c9c9", marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.hall_scanned).serverFormat("DD MMMM YYYY H:m:s ", props?.item?.scanned_detail?.timezone) + props.item?.scanned_detail?.timezone_locale || ""}</Text>
52
+ <Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: "#c9c9c9", marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.hall_scanned).serverFormat("DD MMMM YYYY H:m:s ", props?.item?.scanned_detail?.timezone) /* + props.item?.scanned_detail?.timezone_locale || "" */}</Text>
53
53
  }
54
54
  {
55
55
  !Array.isArray(props?.item?.scanned_detail) && props?.item?.scanned_detail?.scanned != "" && props?.item?.scanned_detail?.scanned != "0000-00-00 00:00:00" &&
56
- <Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: LibStyle.colorRed, marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.scanned_detail?.scanned).serverFormat("DD MMMM YYYY H:m:s ", props?.item?.scanned_detail?.timezone) + props.item?.scanned_detail?.timezone_locale || ""}</Text>
56
+ <Text allowFontScaling={false} ellipsizeMode={'tail'} numberOfLines={2} style={applyStyle({ color: LibStyle.colorRed, marginBottom: 4, fontSize: 14, letterSpacing: 1.5 })}>{esp.lang("event/scan_item", "scan_on") + LibUtils.moment(props?.item?.scanned_detail?.scanned).serverFormat("DD MMMM YYYY H:m:s ", props?.item?.scanned_detail?.timezone) /* + props.item?.scanned_detail?.timezone_locale || "" */}</Text>
57
57
  }
58
58
  {
59
59
  props.item?.status == 1 &&
@@ -26,6 +26,7 @@ import { EventFirebase_socket, EventFirebase_socketProperty } from 'esoftplay/ca
26
26
  import { EventLoading_pageProperty } from 'esoftplay/cache/event/loading_page/import';
27
27
  import { EventQueue_pricingProperty } from 'esoftplay/cache/event/queue_pricing/import';
28
28
  import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
29
+ import { UseCondition } from 'esoftplay/cache/use/condition/import';
29
30
  import { UseTasks } from 'esoftplay/cache/use/tasks/import';
30
31
  import moment from 'esoftplay/moment';
31
32
  import React from 'react';
@@ -135,7 +136,7 @@ export default function m(props: EventTicket_list2Props): any {
135
136
 
136
137
  const [pendingData] = EventLoading_pageProperty.state().useState()
137
138
 
138
- const { url, fee_platform, subscribed, show_fee_percentage }: any = useRef(LibNavigation.getArgsAll(props)).current
139
+ const { url, is_multiprice, fee_platform, subscribed, show_fee_percentage }: any = useRef(LibNavigation.getArgsAll(props)).current
139
140
 
140
141
  const [deeplinkParams] = UseDeeplinkProperty.params.useState()
141
142
  const [timer] = EventCountdownProperty.countdownTime.useState()
@@ -148,7 +149,6 @@ export default function m(props: EventTicket_list2Props): any {
148
149
  const [showAll, setShowAll] = useSafeState<any>({});
149
150
  const [urlPayment, setUrlPayment] = useLazyState<any>()
150
151
 
151
- // esp.log(availableResult);
152
152
 
153
153
  let dataEvent: any = {
154
154
  event_id: availableResult?.id,
@@ -160,7 +160,7 @@ export default function m(props: EventTicket_list2Props): any {
160
160
 
161
161
  const [ticketSeat, resetTicketSeat] = taskSeat((item: any) => new Promise((next) => {
162
162
  if (item.use_seat == 1) {
163
- if (item.adjacent_seats == 0) {
163
+ if (item.adjacent_seats == undefined || item.adjacent_seats == 0) {
164
164
  LibNavigation.navigateForResult('event/seat_map_new', {
165
165
  url: 'event_seat',
166
166
  dataTicket: {
@@ -327,6 +327,7 @@ export default function m(props: EventTicket_list2Props): any {
327
327
  }
328
328
 
329
329
 
330
+
330
331
  function checkSeatMap() {
331
332
  let newResult: any[] = [];
332
333
 
@@ -338,7 +339,9 @@ export default function m(props: EventTicket_list2Props): any {
338
339
  tax: priceType?.tax,
339
340
  term: priceType?.term,
340
341
  has_addition: priceType?.has_addition,
341
- image_map: priceType?.image_map
342
+ image_map: priceType?.image_map,
343
+ use_seat: priceType?.use_seat,
344
+ adjacent_seats: priceType?.config?.seat_autopick,
342
345
  }))
343
346
 
344
347
  newResult = newResult.concat(filteredList);
@@ -348,9 +351,39 @@ export default function m(props: EventTicket_list2Props): any {
348
351
  setDataPostBooking(newResult)
349
352
  resetTicketSeat()
350
353
  ticketSeat(newResult.filter((x: any) => x.selected == 1))
351
- // esp.log(newResult.filter((x: any) => x.selected == 1));
352
354
  }
353
355
 
356
+ function selectSinglePrice(priceTypes: any, selectedItem: any) {
357
+ return priceTypes.map((priceType: any) => {
358
+ // reset parent
359
+ let updated = {
360
+ ...priceType,
361
+ selected: 0,
362
+ qty: 0,
363
+ list: priceType.list.map((child: any) => ({
364
+ ...child,
365
+ selected: 0,
366
+ qty: 0
367
+ }))
368
+ };
369
+
370
+ // kalau cocok, aktifkan parent & child
371
+ if (priceType.price_id === selectedItem.price_id) {
372
+ updated.selected = 1;
373
+ updated.qty = selectedItem.qty_min;
374
+
375
+ updated.list = updated.list.map((child: any) => ({
376
+ ...child,
377
+ selected: 1,
378
+ qty: selectedItem.qty_min
379
+ }));
380
+ }
381
+
382
+ return updated;
383
+ });
384
+ }
385
+
386
+ // contoh penggunaan:
354
387
 
355
388
  function renderItem(itemC: any, iC: number, item: any, i: number) {
356
389
  // itemC adalah item yang ada diindex list, kalo item itu adalah item yang ada diindex price_type
@@ -377,23 +410,34 @@ export default function m(props: EventTicket_list2Props): any {
377
410
  }
378
411
  // let msg = item.status == 0 ? esp.lang("event/ticket_list", "sold_out") : esp.lang("event/ticket_list", "coming_soon")
379
412
  if (itemC.status == 1 && item.status == 1) {
380
- const data = new LibObject(getAvailableResult())
381
- .update((itemList) => {
382
- itemList.selected = itemList.selected == 1 ? 0 : 1
383
- itemList.qty = itemList.selected == 1 ? item.qty_min : 0
384
- itemList.adjacent_seats = item.config?.seat_autopick
385
- itemList.use_seat = item.use_seat
386
- return itemList
387
- })('price_type', i, 'list', iC)
388
- .update((priceTypeItem) => {
389
- return ({
390
- ...priceTypeItem,
391
- selected: priceTypeItem.list.some((item: any) => item.selected == 1) ? 1 : 0
392
- })
393
- })('price_type', i)
394
- .value()
413
+ if (is_multiprice) {
414
+ const data = new LibObject(getAvailableResult())
415
+ .update((itemList) => {
416
+ itemList.selected = itemList.selected == 1 ? 0 : 1
417
+ itemList.qty = itemList.selected == 1 ? item.qty_min : 0
418
+ itemList.adjacent_seats = item.config?.seat_autopick
419
+ itemList.use_seat = item.use_seat
420
+ return itemList
421
+ })('price_type', i, 'list', iC)
422
+ .update((priceTypeItem) => {
423
+ return ({
424
+ ...priceTypeItem,
425
+ selected: priceTypeItem.list.some((item: any) => item.selected == 1) ? 1 : 0
426
+ })
427
+ })('price_type', i)
428
+ .value()
429
+
430
+ setAvailableResult(data)
431
+ } else {
432
+ const updatedData = selectSinglePrice(availableResult?.price_type, { price_id: item?.price_id, qty_min: item?.qty_min });
433
+ const data = {
434
+ ...getAvailableResult(),
435
+ price_type: updatedData
436
+ }
437
+
438
+ setAvailableResult(data)
439
+ }
395
440
 
396
- setAvailableResult(data)
397
441
  } else if (itemC.status == 0) {
398
442
  LibToastProperty.show(msg)
399
443
  } else if (itemC.status == 2) {
@@ -564,12 +608,14 @@ export default function m(props: EventTicket_list2Props): any {
564
608
  }
565
609
 
566
610
  <ScrollView refreshControl={<RefreshControl refreshing={false} onRefresh={onRefresh} />}>
567
- <EventAlert
568
- color={LibStyle.colorPrimary}
569
- msg={esp.lang("event/ticket_list2", "u_can_choose_multiple")}
570
- style={{ marginHorizontal: 15 }}
571
- useIcon
572
- />
611
+ <UseCondition if={is_multiprice == 1} >
612
+ <EventAlert
613
+ color={LibStyle.colorPrimary}
614
+ msg={esp.lang("event/ticket_list2", "u_can_choose_multiple")}
615
+ style={{ marginHorizontal: 15 }}
616
+ useIcon
617
+ />
618
+ </UseCondition>
573
619
  {
574
620
  availableResult?.image_map != "" &&
575
621
  <TouchableOpacity onPress={() => {
@@ -222,10 +222,10 @@ export default function m(props: EventTms_check_ticket_resultProps): any {
222
222
  <View style={{ marginBottom: 10, flexDirection: 'row', flexWrap: 'wrap', marginLeft: -10 }}>
223
223
  {
224
224
  item?.tickets?.map((x: any, i: number) => {
225
- if (x.seat_name != "") {
225
+ if (x.seat_label != "") {
226
226
  return (
227
227
  <View key={i} style={{ marginLeft: 10, paddingVertical: 5, marginBottom: 7, paddingHorizontal: 7, borderWidth: 1, borderColor: '#000', backgroundColor: '#fff', borderRadius: 5 }}>
228
- <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: '#000' }}>{x.seat_name}</Text>
228
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 20, color: '#000' }}>{x.seat_label}</Text>
229
229
  </View>
230
230
 
231
231
  )
@@ -1,10 +1,15 @@
1
1
  // withHooks
2
2
  import { EventHeader } from 'esoftplay/cache/event/header/import';
3
3
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
4
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
4
5
  import { LibPicture } from 'esoftplay/cache/lib/picture/import';
6
+ import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
5
7
  import { LibStyle } from 'esoftplay/cache/lib/style/import';
8
+ import { LibTextstyle } from 'esoftplay/cache/lib/textstyle/import';
6
9
  import { UserClass } from 'esoftplay/cache/user/class/import';
7
10
  import esp from 'esoftplay/esp';
11
+ import useGlobalState, { useGlobalReturn } from 'esoftplay/global';
12
+ import { useRef } from 'react';
8
13
 
9
14
  import React from 'react';
10
15
  import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
@@ -16,8 +21,25 @@ export interface EventTms_dashboardArgs {
16
21
  export interface EventTms_dashboardProps {
17
22
 
18
23
  }
24
+
25
+
26
+ const stateClosingData = useGlobalState({
27
+ event_id: 0,
28
+ event_name: '',
29
+ gate_id: 0,
30
+ }, {
31
+ persistKey: 'event/tms_dashboard',
32
+ loadOnInit: true
33
+ })
34
+
35
+ export function closingDataState(): useGlobalReturn<any> {
36
+ return stateClosingData
37
+ }
38
+
19
39
  export default function m(props: EventTms_dashboardProps): any {
20
40
  const [user] = UserClass.state().useState()
41
+ const dialogClosing = useRef<LibSlidingup>(null)
42
+
21
43
  let menus = [
22
44
  {
23
45
  id: 1,
@@ -27,6 +49,9 @@ export default function m(props: EventTms_dashboardProps): any {
27
49
  color_accent: '#FFC523',
28
50
  onPress: () => {
29
51
  LibNavigation.navigateForResult('event/tms_event_list', { data: user?.is_tms }).then((value) => {
52
+ let a = LibObject.set(stateClosingData?.get(), value?.id)('event_id')
53
+ let b = LibObject.set(a, value?.name)('event_name')
54
+ stateClosingData?.set(b)
30
55
  LibNavigation.navigate('event/tms_gate', { is_scanner: value, typeScanner: 'tms' })
31
56
  })
32
57
  }
@@ -48,13 +73,41 @@ export default function m(props: EventTms_dashboardProps): any {
48
73
  title: esp.lang("user/profile", "exchange"),
49
74
  icon: 'menu/ic_redempt.png',
50
75
  active: 1,
51
- color_accent: '#D0004F',
76
+ color_accent: '#800020',
52
77
  onPress: () => {
53
78
  LibNavigation.navigateForResult('event/tms_event_list', { data: user?.is_tms }).then((value) => {
54
79
  LibNavigation.navigate('event/exchange_ticket', { dataEvent: value })
55
80
  })
56
81
  }
57
82
  },
83
+ {
84
+ id: 4,
85
+ title: esp.lang("event/tms_dashboard", "closing_tms"),
86
+ icon: 'failed_icon.png',
87
+ active: 1,
88
+ color_accent: '#D0004F',
89
+ onPress: () => {
90
+ dialogClosing.current?.show()
91
+ }
92
+ },
93
+ ]
94
+
95
+ const options = [
96
+ {
97
+ id: 1,
98
+ title: esp.lang("event/tms_dashboard", "log_tms"),
99
+ onPress: () => {
100
+ LibNavigation.navigate('event/tms_log')
101
+ dialogClosing.current?.show()
102
+ }
103
+ },
104
+ {
105
+ id: 2,
106
+ title: esp.lang("event/tms_dashboard", "log_exchange"),
107
+ onPress: () => {
108
+ dialogClosing.current?.show()
109
+ }
110
+ },
58
111
  ]
59
112
 
60
113
  function renderMenu(item: any, i: number) {
@@ -80,10 +133,39 @@ export default function m(props: EventTms_dashboardProps): any {
80
133
 
81
134
  <ScrollView>
82
135
  {
83
- menus?.map(renderMenu)
136
+ menus?.filter((x: any) => x.active == 1).map(renderMenu)
84
137
  }
85
138
  </ScrollView>
86
-
139
+ <LibSlidingup ref={dialogClosing}>
140
+ <View style={{ alignItems: 'center', marginBottom: 17 }} >
141
+ <View style={{ width: LibStyle.width - 30, borderRadius: 13, overflow: 'hidden', }} >
142
+ <ScrollView showsVerticalScrollIndicator={false} style={{ borderRadius: 13, overflow: 'hidden', backgroundColor: "white", maxHeight: LibStyle.height * 0.5 }} >
143
+ <View style={{ marginVertical: 17 }} >
144
+ <LibTextstyle textStyle="caption1" text={esp.lang("event/tms_dashboard", "closing_tms")} style={{ textAlign: 'center', fontWeight: "bold", color: "#888" }} />
145
+ </View>
146
+ {
147
+ options.map((opt, i) => (
148
+ <TouchableOpacity
149
+ key={i}
150
+ style={{ paddingHorizontal: 17, paddingVertical: 15, alignItems: 'center', borderTopWidth: 1, borderTopColor: "#f4f4f4" }}
151
+ onPress={opt.onPress} >
152
+ <LibTextstyle text={opt.title} textStyle="body" />
153
+ </TouchableOpacity>
154
+ ))
155
+ }
156
+ </ScrollView>
157
+ <View style={{ borderRadius: 13, marginTop: 10, backgroundColor: "white" }} >
158
+ <TouchableOpacity
159
+ style={{ paddingHorizontal: 17, paddingVertical: 15, alignItems: 'center' }}
160
+ onPress={() => {
161
+ dialogClosing.current?.hide()
162
+ }} >
163
+ <LibTextstyle text={esp.lang("event/tms_dashboard", "cancel")} textStyle="body" style={{ fontWeight: "bold", color: LibStyle.colorBlue }} />
164
+ </TouchableOpacity>
165
+ </View>
166
+ </View>
167
+ </View>
168
+ </LibSlidingup>
87
169
  </View>
88
170
  )
89
171
  }
@@ -9,6 +9,8 @@ import { LibStyle } from 'esoftplay/cache/lib/style/import';
9
9
  import esp from 'esoftplay/esp';
10
10
  import useSafeState from 'esoftplay/state';
11
11
 
12
+ import { EventTms_dashboardProperty } from 'esoftplay/cache/event/tms_dashboard/import';
13
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
12
14
  import React, { useEffect } from 'react';
13
15
  import { Pressable, ScrollView, Text, View } from 'react-native';
14
16
 
@@ -40,6 +42,8 @@ export default function m(props: EventTms_gateProps): any {
40
42
  new LibCurl('event_gate', post, (res, msg) => {
41
43
  setGates(res)
42
44
  if (res.length == 1) {
45
+ let a = LibObject.set(EventTms_dashboardProperty.closingDataState().get(), res[0].id)('gate_id')
46
+ EventTms_dashboardProperty.closingDataState().set(a)
43
47
  LibNavigation.back()
44
48
  LibNavigation.navigate('event/tms_home', { is_scanner: is_scanner, selectedGate: res[0], typeScanner: typeScanner })
45
49
  }
@@ -70,6 +74,8 @@ export default function m(props: EventTms_gateProps): any {
70
74
  return (
71
75
  <Pressable key={i} onPress={() => {
72
76
  setSelectGate(item)
77
+ let a = LibObject.set(EventTms_dashboardProperty.closingDataState().get(), item?.id)('gate_id')
78
+ EventTms_dashboardProperty.closingDataState().set(a)
73
79
  LibNavigation.navigate('event/tms_home', { is_scanner: is_scanner, selectedGate: item, typeScanner: typeScanner })
74
80
  }} style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', backgroundColor: _selectGate ? LibStyle.colorGrey : '#fff', ...LibStyle.elevation(2), padding: 16, marginBottom: 10, marginHorizontal: 15, borderRadius: 5, flex: 1 }}>
75
81
  <LibIcon name={_selectGate ? "radiobox-marked" : "radiobox-blank"} size={18} color={_selectGate ? "#3ea4dc" : "#434343"} />
@@ -491,10 +491,7 @@ export default function m(props: EventTms_homeProps): any {
491
491
  <View style={{ margin: 15, flexDirection: 'row', alignContent: 'center', alignItems: 'center' }}>
492
492
  {
493
493
  <TouchableOpacity onPress={() => {
494
- LibNavigation.navigate('event/tms_log', {
495
- event_id: is_scanner?.id,
496
- gate: selectedGate
497
- })
494
+ LibNavigation.navigate('event/tms_log')
498
495
  }} style={{ padding: 10, backgroundColor: "#000", borderRadius: 10, ...LibStyle.elevation(2) }}>
499
496
  <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: '#fff' })} >{esp.lang("event/tms_home", "tms_close")}</Text>
500
497
  </TouchableOpacity>
@@ -49,6 +49,8 @@ export default function m(props: EventTms_in_logProps): any {
49
49
  const [loading, setLoading] = useSafeState<boolean>(true)
50
50
  const timeout = useTimeout()
51
51
 
52
+ esp.log({ log });
53
+
52
54
  function syncData() {
53
55
  EventTms_homeProperty.subscribeSync().trigger(EventTms_in_successProperty.syncUsedTiket().get())
54
56
  timeout(() => {
package/event/tms_log.tsx CHANGED
@@ -3,6 +3,7 @@ import { useEffect, useRef } from 'react';
3
3
 
4
4
  import { EventButton } from 'esoftplay/cache/event/button/import';
5
5
  import { EventHeader } from 'esoftplay/cache/event/header/import';
6
+ import { EventTms_dashboardProperty } from 'esoftplay/cache/event/tms_dashboard/import';
6
7
  import { EventTms_homeProperty } from 'esoftplay/cache/event/tms_home/import';
7
8
  import { EventTms_in_hall_log } from 'esoftplay/cache/event/tms_in_hall_log/import';
8
9
  import { EventTms_in_hall_successProperty } from 'esoftplay/cache/event/tms_in_hall_success/import';
@@ -48,17 +49,6 @@ export interface LogItem {
48
49
  valuecolor?: string
49
50
  }
50
51
 
51
- function Item(props: LogItem) {
52
- return (
53
- <Pressable
54
- onPress={() => {
55
- props.onPress()
56
- }} style={{ flexDirection: 'row', justifyContent: 'space-between', alignContent: 'center', alignItems: 'center', marginHorizontal: 15, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: LibStyle.colorLightGrey }}>
57
- <LibTextstyle text={props.text} textStyle="subhead" />
58
- <LibTextstyle text={LibUtils.number(props.value)} style={{ color: props.valuecolor ? props.valuecolor : "#000" }} textStyle="title2" />
59
- </Pressable>
60
- )
61
- }
62
52
 
63
53
  // Fungsi untuk menjumlahkan nilai per kategori
64
54
  export function sumValuesPerCategory(data: any) {
@@ -105,12 +95,15 @@ const useDetectStateChange = (state: any, duration: number) => {
105
95
 
106
96
  export default function m(props: EventTms_logProps): any {
107
97
  const selectedRef = useRef<LibSlidingup>(null)
108
- const { event_id, gate, fromPage }: any = LibNavigation.getArgsAll(props)
98
+ // const { event_id, gate }: any = LibNavigation.getArgsAll(props)
109
99
  const [, setSelectedData, getSelectedData] = useSafeState<any[]>([])
110
100
  const [titleSliding, setTitleSliding] = useSafeState()
111
101
  let counter = useRef(0).current
112
102
  let counterDone = useRef(0).current
113
103
 
104
+ const event_id = EventTms_dashboardProperty?.closingDataState()?.get().event_id
105
+ const gate_id = EventTms_dashboardProperty?.closingDataState()?.get().gate_id
106
+
114
107
  const backupEntrance = EventTms_in_successProperty.syncUsedTiket().useSelector(s => s)
115
108
  const isStuckEntrance = useDetectStateChange(backupEntrance, 10000)
116
109
 
@@ -147,7 +140,7 @@ export default function m(props: EventTms_logProps): any {
147
140
 
148
141
  function closing() {
149
142
  const counter = EventTms_homeProperty.getDataByDate()
150
- let url = 'event_tms_closing' + LibUtils.objectToUrlParam({ event_id: event_id, gate_id: gate?.id })
143
+ let url = 'event_tms_closing' + LibUtils.objectToUrlParam({ event_id: event_id, gate_id: gate_id })
151
144
  let post = {
152
145
  closing: JSON.stringify(counter)
153
146
  }
@@ -285,9 +278,7 @@ export default function m(props: EventTms_logProps): any {
285
278
  sendFileTelegram('event/tms_in_log_copy_scanned', () => {
286
279
  counterDone = counterDone + 1
287
280
  if (counter == counterDone) {
288
- if (!fromPage) {
289
- closing()
290
- }
281
+ closing()
291
282
  }
292
283
  })
293
284
  })
@@ -299,9 +290,7 @@ export default function m(props: EventTms_logProps): any {
299
290
  sendFileTelegram('event/tms_out_log_copy_scanned', () => {
300
291
  counterDone = counterDone + 1
301
292
  if (counter == counterDone) {
302
- if (!fromPage) {
303
- closing()
304
- }
293
+ closing()
305
294
  }
306
295
  })
307
296
  })
@@ -313,9 +302,7 @@ export default function m(props: EventTms_logProps): any {
313
302
  sendFileTelegram('event/hall_log_copy_scanned', () => {
314
303
  counterDone = counterDone + 1
315
304
  if (counter == counterDone) {
316
- if (!fromPage) {
317
- closing()
318
- }
305
+ closing()
319
306
  }
320
307
  })
321
308
  })
@@ -327,9 +314,7 @@ export default function m(props: EventTms_logProps): any {
327
314
  sendFileTelegram('event/hallout_log_copy_scanned', () => {
328
315
  counterDone = counterDone + 1
329
316
  if (counter == counterDone) {
330
- if (!fromPage) {
331
- closing()
332
- }
317
+ closing()
333
318
  }
334
319
  })
335
320
  })
package/id.json CHANGED
@@ -1455,7 +1455,11 @@
1455
1455
  "block_idcard_no": "BATAL",
1456
1456
  "block_idcard_ok": "TAHAN",
1457
1457
  "block_idcard_title": "Tahan ID CARD?",
1458
+ "cancel": "Batal",
1459
+ "closing_tms": "Closing TMS",
1458
1460
  "gate_scanner": "Gate Scanner",
1461
+ "log_exchange": "Log Penukaran Tiket",
1462
+ "log_tms": "Log TMS (Gate + Hall)",
1459
1463
  "qc_idcard": "QC ID Card (Print)"
1460
1464
  },
1461
1465
  "event/tms_event_list": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay-event",
3
- "version": "0.0.1-p",
3
+ "version": "0.0.1-q",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {