esoftplay-event 0.0.0-x → 0.0.0-z

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/artist.tsx CHANGED
@@ -94,7 +94,7 @@ export default function m(props: BigbangArtistProps): any {
94
94
  ...item,
95
95
  }
96
96
  if (item.book_available == 1) {
97
- if (isInPricingQueueConfig(result.id)) {
97
+ if (isInPricingQueueConfig(item.event_id)) {
98
98
  LibNavigation.navigateForResult('event/queue_pricing', { event_id: event_id, autoPass: false }).then((v) => {
99
99
  EventCountdownProperty.countdownTime.set(moment().add(EventFirebase_socketProperty.eventQueueConfig.get(event_id).time, 'seconds').localeFormat('YYYY-MM-DD HH:mm:ss'))
100
100
  if (item?.config?.hasOwnProperty('multiprice') && item?.config?.multiprice == 1) {
package/event/detail.tsx CHANGED
@@ -256,10 +256,7 @@ export default function m(props: EventDetailProps): any {
256
256
  <View style={{ height: 35, borderRadius: 17, backgroundColor: LibStyle.colorLightGrey, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 9 }} >
257
257
  <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 12, textAlign: "center", textAlignVertical: 'center', color: 'black', marginHorizontal: 10 }} >
258
258
  {
259
- diffDays <= 3 ?
260
- esp.lang("event/detail", "text_book_on", moment(result.start_booking).serverFormat('DD MMMM YYYY'))
261
- :
262
- esp.lang("event/detail", "booking_not_yet")
259
+ esp.lang("event/detail", "text_book_on", moment(result.start_booking).serverFormat('DD MMMM YYYY H:mm:ss'))
263
260
  }
264
261
  </Text>
265
262
  </View>
@@ -10,7 +10,7 @@
10
10
  // import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
11
11
  // import esp from 'esoftplay/esp';
12
12
  // import useGlobalState from 'esoftplay/global';
13
- // import { createTimeout, useInterval } from 'esoftplay/timeout';
13
+ // import { createTimeout } from 'esoftplay/timeout';
14
14
 
15
15
  // function getEventPath() {
16
16
  // return "event" + (esp.isDebug("cc") ? "BBT" : "BBO")
@@ -230,13 +230,12 @@
230
230
  // .then((re) => {
231
231
  // eventQueueConfig.set(re)
232
232
  // })
233
+ // setTimeout(() => {
234
+ // action()
235
+ // }, 10000);
233
236
 
234
237
  // }
235
- // const timeout = useInterval()
236
238
  // action()
237
- // timeout(() => {
238
- // action()
239
- // }, 10000)
240
239
  // }
241
240
 
242
241
  // return {
@@ -9,7 +9,7 @@ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
9
9
  import { UserClass } from 'esoftplay/cache/user/class/import';
10
10
  import esp from 'esoftplay/esp';
11
11
  import useGlobalState from 'esoftplay/global';
12
- import { createTimeout, useInterval } from 'esoftplay/timeout';
12
+ import { createTimeout } from 'esoftplay/timeout';
13
13
  import { initializeApp } from 'firebase/app';
14
14
  import { createUserWithEmailAndPassword, getAuth, signInWithEmailAndPassword } from 'firebase/auth';
15
15
  import { get, getDatabase, onValue, ref, set } from 'firebase/database';
@@ -306,13 +306,11 @@ export default function useFirebaseSocket() {
306
306
  .then((re) => {
307
307
  eventQueueConfig.set(re)
308
308
  });
309
-
309
+ setTimeout(() => {
310
+ action()
311
+ }, 10000);
310
312
  }
311
- const timeout = useInterval()
312
313
  action()
313
- timeout(() => {
314
- action()
315
- }, 10000)
316
314
  }
317
315
 
318
316
  return {
@@ -10,7 +10,7 @@ import { LibObject } from 'esoftplay/cache/lib/object/import';
10
10
  import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
11
11
  import esp from 'esoftplay/esp';
12
12
  import useGlobalState from 'esoftplay/global';
13
- import { createTimeout, useInterval } from 'esoftplay/timeout';
13
+ import { createTimeout } from 'esoftplay/timeout';
14
14
 
15
15
  function getEventPath() {
16
16
  return "event" + (esp.isDebug("cc") ? "BBT" : "BBO")
@@ -230,13 +230,12 @@ export default function useFirebaseSocket() {
230
230
  .then((re) => {
231
231
  eventQueueConfig.set(re)
232
232
  })
233
+ setTimeout(() => {
234
+ action()
235
+ }, 10000);
233
236
 
234
237
  }
235
- const timeout = useInterval()
236
238
  action()
237
- timeout(() => {
238
- action()
239
- }, 10000)
240
239
  }
241
240
 
242
241
  return {
package/event/index.tsx CHANGED
@@ -96,7 +96,17 @@ export default function m(props: EventIndexProps): any {
96
96
  }, [isFocus])
97
97
 
98
98
  function loadData() {
99
- new LibCurl(esp.config("events", "home"), null, (res) => {
99
+ const langData = esp.mod("lib/locale").stateLang().get() || {}
100
+ const currentLanguage = Object.keys(langData).length == 0 ? 'id' : esp.mod("lib/locale").state().get()
101
+ const selectedLang = esp.modProp("user/language_list").allLanguage()?.filter?.((x: any) => x?.name == currentLanguage)?.[0] || {}
102
+
103
+ const baseURL: string = esp.config("events", "home")
104
+ let homeURL =
105
+ baseURL.includes(".json") ?
106
+ baseURL :
107
+ baseURL + "-" + selectedLang.code + ".json"
108
+
109
+ new LibCurl(homeURL, null, (res) => {
100
110
  setData(res)
101
111
  }, msg => setError(msg))
102
112
  }
package/event/test.tsx ADDED
@@ -0,0 +1,155 @@
1
+ // // withHooks
2
+ // import { Canvas, Group, RoundedRect, Text, useFont } from '@shopify/react-native-skia';
3
+ // import { LibCurl } from 'esoftplay/cache/lib/curl/import';
4
+ // import { LibIcon } from 'esoftplay/cache/lib/icon/import';
5
+ // import useSafeState from 'esoftplay/state';
6
+ // import React, { useCallback, useEffect, useState } from 'react';
7
+ // import { Dimensions, Pressable, ScrollView, View } from 'react-native';
8
+ // import { TapGestureHandler, TapGestureHandlerStateChangeEvent } from 'react-native-gesture-handler';
9
+
10
+
11
+ // export interface EventSeat_map_matrixArgs {
12
+
13
+ // }
14
+ // export interface EventSeat_map_matrixProps {
15
+
16
+ // }
17
+ // export default function m(props: any): any {
18
+ // const deviceWidth = Dimensions.get('window').width;
19
+ // const [selectedIdx, setSelectedIdx] = useState<number | null>(null);
20
+ // const [scale, setScale] = useState(1);
21
+ // const [boundingBox, setBoundingBox] = useSafeState({ "x1": 1, "x2": 2, "y1": 1, "y2": 2 })
22
+ // const [data, setData] = useSafeState<[number, number, string, number][]>([])
23
+ // const initialBoxSize = 30;
24
+ // const contentWidth = (boundingBox.x2 - (boundingBox.x1 - 1.1)) * initialBoxSize
25
+
26
+ // // Scale boxSize so that contentWidth fits deviceWidth
27
+ // const scaleToFit = deviceWidth / contentWidth;
28
+ // const boxSize = initialBoxSize * scaleToFit;
29
+
30
+ // // Recalculate xs, ys, width, height with scaled boxSize
31
+ // const xsScaled = data.map(([x]) => isNaN(x) ? 0 : (boxSize) + (x * boxSize));
32
+ // const ysScaled = data.map(([_, y]) => isNaN(y) ? 0 : (boxSize) + (y * boxSize));
33
+
34
+ // const width = Math.max(deviceWidth, xsScaled.length && xsScaled.every(v => !isNaN(v)) ? Math.max(...xsScaled) + boxSize : boxSize * 2);
35
+ // const height = ysScaled.length && ysScaled.every(v => !isNaN(v)) ? Math.max(...ysScaled) + boxSize : boxSize * 2;
36
+
37
+ // const fontSize: any = {
38
+ // 1: useFont(require('../../assets/fonts/MonoSpace.ttf'), boxSize * 0.3),
39
+ // 2: useFont(require('../../assets/fonts/MonoSpace.ttf'), boxSize * 0.3),
40
+ // 3: useFont(require('../../assets/fonts/MonoSpace.ttf'), boxSize * 0.25),
41
+ // 4: useFont(require('../../assets/fonts/MonoSpace.ttf'), boxSize * 0.2),
42
+ // 5: useFont(require('../../assets/fonts/MonoSpace.ttf'), boxSize * 0.2),
43
+ // 6: useFont(require('../../assets/fonts/MonoSpace.ttf'), boxSize * 0.15),
44
+ // }
45
+ // const handleTap = useCallback((event: TapGestureHandlerStateChangeEvent) => {
46
+ // if (event.nativeEvent.state !== 5) return;
47
+ // // Adjust tap coordinates for scale
48
+ // const x = event.nativeEvent.x / scale;
49
+ // const y = event.nativeEvent.y / scale;
50
+ // for (let i = 0; i < data.length; i++) {
51
+ // const [sx, sy, seatName] = data[i];
52
+ // const xSize = (boxSize / 2) + (sx * boxSize);
53
+ // const ySize = (boxSize / 2) + (sy * boxSize);
54
+ // if (x >= xSize && x <= xSize + boxSize && y >= ySize && y <= ySize + boxSize) {
55
+ // setSelectedIdx(i);
56
+ // return;
57
+ // }
58
+ // }
59
+ // setSelectedIdx(null);
60
+ // }, [data, boxSize, scale]);
61
+
62
+
63
+ // useEffect(() => {
64
+ // new LibCurl("v3/event_seat", {
65
+ // event_id: 398,
66
+ // price_id: 1922,
67
+ // ondate: "0000-00-00"
68
+ // }, (res, msg) => {
69
+ // setBoundingBox(res.metadata.bounding_box)
70
+ // console.log(JSON.stringify(res, undefined, 2))
71
+ // setData(res.layout.split(';').map((item) => item.split(',')).map(([x, y, seatName, status]) => [Number(x), Number(y), seatName, Number(status)]))
72
+ // })
73
+ // }, [])
74
+
75
+ // return (
76
+ // <View key={scale} style={{ flex: 1 }} >
77
+ // <ScrollView horizontal style={{ flex: 1 }}>
78
+ // <ScrollView style={{ flex: 1 }}>
79
+ // <TapGestureHandler onHandlerStateChange={handleTap}>
80
+ // <View>
81
+ // <Canvas
82
+ // style={{
83
+ // width: width * scale,
84
+ // height: height * scale,
85
+ // padding: 10,
86
+ // backgroundColor: "#f1f2f3",
87
+ // }}>
88
+ // {
89
+ // data.map(([x, y, name, status], i) => {
90
+ // const color = selectedIdx == i ? "lime" : getColorByStatus(status)
91
+ // const xSize = (boxSize / 2) + (x * boxSize)
92
+ // const ySize = (boxSize / 2) + (y * boxSize)
93
+ // return (
94
+ // <Group key={i}>
95
+ // <RoundedRect
96
+ // x={xSize - 1}
97
+ // r={(boxSize + 2) * 0.34}
98
+ // y={ySize - 1}
99
+ // width={boxSize + 2}
100
+ // transform={[{ scale }]}
101
+ // height={boxSize + 2}
102
+ // color={"#999"} />
103
+ // <RoundedRect
104
+ // x={xSize}
105
+ // r={boxSize * 0.32}
106
+ // y={ySize}
107
+ // width={boxSize}
108
+ // transform={[{ scale }]}
109
+ // height={boxSize}
110
+ // color={color} />
111
+ // {name && fontSize[name.length] && (
112
+ // <Text
113
+ // x={(xSize) + boxSize * (5 - name.length) * 0.1}
114
+ // y={(ySize) + boxSize * 0.60}
115
+ // color="#020202"
116
+ // text={name}
117
+ // transform={[{ scale }]}
118
+ // font={fontSize[name.length]} />
119
+ // )}
120
+ // </Group>
121
+ // )
122
+ // })
123
+ // }
124
+ // </Canvas>
125
+ // </View>
126
+ // </TapGestureHandler>
127
+ // </ScrollView>
128
+ // </ScrollView>
129
+ // <View style={{ flexDirection: "row" }} >
130
+ // <Pressable onPress={() => setScale((x) => x - 0.3)} >
131
+ // <LibIcon.AntDesign name='minuscircleo' />
132
+ // </Pressable>
133
+ // <Pressable onPress={() => setScale((x) => x + 0.3)} >
134
+ // <LibIcon.AntDesign name='pluscircleo' />
135
+ // </Pressable>
136
+ // </View>
137
+ // </View>
138
+ // )
139
+ // }
140
+
141
+
142
+ // function getColorByStatus(statuses: number) {
143
+ // const colors: any = {
144
+ // 8: 'purple',
145
+ // 0: "white",
146
+ // 1: "#9FA1A4",
147
+ // 2: "#6B71E6",
148
+ // 3: "#2EBBE8",
149
+ // 4: "#FFA601",
150
+ // 5: "#fff",
151
+ // 6: "#FF4866",
152
+ // 7: "#6C432C"
153
+ // }
154
+ // return colors[statuses]
155
+ // }
@@ -252,8 +252,6 @@ export default function m(props: EventTicket_list2Props): any {
252
252
  dataEvent.addition = dataAddition
253
253
  }
254
254
 
255
- esp.log(dataAddition);
256
-
257
255
  LibNavigation.navigate('payment/ticket_multi', {
258
256
  order_type: EventConfigProperty?.state()?.get()?.order_type?.ticket,
259
257
  fee_platform: fee_platform,
@@ -365,7 +363,15 @@ export default function m(props: EventTicket_list2Props): any {
365
363
 
366
364
  return (
367
365
  <TouchableOpacity key={iC} onPress={() => {
368
- let msg = item.status == 0 ? esp.lang("event/ticket_list", "sold_out") : esp.lang("event/ticket_list", "coming_soon")
366
+ let msg = ""
367
+ if (item?.status == 1) {
368
+ if (itemC?.status != 1) {
369
+ msg = itemC?.status == 2 ? esp.lang("event/ticket_list", "coming_soon") : esp.lang("event/ticket_list", "sold_out")
370
+ }
371
+ } else {
372
+ msg = item?.status == 2 ? esp.lang("event/ticket_list", "coming_soon") : esp.lang("event/ticket_list", "sold_out")
373
+ }
374
+ // let msg = item.status == 0 ? esp.lang("event/ticket_list", "sold_out") : esp.lang("event/ticket_list", "coming_soon")
369
375
  if (itemC.status == 1 && item.status == 1) {
370
376
  const data = new LibObject(getAvailableResult())
371
377
  .update((itemList) => {
@@ -0,0 +1,133 @@
1
+ // withHooks
2
+ import { EventHeader } from 'esoftplay/cache/event/header/import';
3
+ import { EventLabel_input } from 'esoftplay/cache/event/label_input/import';
4
+ import { LibCurl } from 'esoftplay/cache/lib/curl/import';
5
+ import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
6
+ import { LibInput } from 'esoftplay/cache/lib/input/import';
7
+ import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
8
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
9
+ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
10
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
11
+ import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
12
+ import { UseTasks } from 'esoftplay/cache/use/tasks/import';
13
+ import esp from 'esoftplay/esp';
14
+ import useSafeState from 'esoftplay/state';
15
+ import { useEffect } from 'react';
16
+
17
+ import React from 'react';
18
+ import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
19
+
20
+
21
+ export interface EventVoucher2Args {
22
+
23
+ }
24
+ export interface EventVoucher2Props {
25
+
26
+ }
27
+
28
+ const useTasks = UseTasks()
29
+
30
+ export default function m(props: EventVoucher2Props): any {
31
+ let { event_id, dataTicket }: any = LibNavigation.getArgsAll(props)
32
+ let voucherCode = React.useRef<LibInput>(null)
33
+ let [, setData, getData] = useSafeState<any>(dataTicket)
34
+
35
+ const [, setCounterNo, getCounterNo] = useSafeState(0)
36
+
37
+ useEffect(() => {
38
+ let a = dataTicket?.length > 0 && dataTicket?.map((item: any, i: number) => {
39
+ return ({
40
+ ...item,
41
+ index: i
42
+ })
43
+ })
44
+ setData(a)
45
+ // dialogInput.current?.show()
46
+ return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
47
+ }, [])
48
+
49
+ const [checkVoucers, resetCheckVoucers] = useTasks((item: any) => new Promise((next) => {
50
+ curlVoucher(item, () => {
51
+ next()
52
+ })
53
+ }), () => {
54
+ LibProgress.hide()
55
+ if (getCounterNo() == getData()?.length) {
56
+
57
+ } else {
58
+ LibNavigation.sendBackResult(getData())
59
+ }
60
+ })
61
+
62
+
63
+ function curlVoucher(item: any, cb: () => void) {
64
+ let post = {
65
+ voucher_code: voucherCode.current!.getText(),
66
+ event_id: event_id,
67
+ price_id: item?.price_id,
68
+ ondate: item?.ondate,
69
+ qty: item?.qty
70
+ }
71
+
72
+
73
+ let url = "event_booking_voucher_check"
74
+ LibProgress.show(esp.lang("event/voucher", "check_wait"))
75
+ new LibCurl(url, post, (res, msg) => {
76
+ let newRes = {
77
+ voucher_code: post?.voucher_code,
78
+ ...res
79
+ }
80
+ let a = LibObject.set(getData(), newRes)(item.index, 'voucher')
81
+ setData(a)
82
+
83
+ cb()
84
+ LibProgress.hide()
85
+ LibToastProperty.show(msg)
86
+ }, (error) => {
87
+ setCounterNo(getCounterNo() + 1)
88
+ cb()
89
+ if (getCounterNo() == getData()?.length) {
90
+ LibDialog.warning("Oops", error?.message)
91
+ }
92
+ LibProgress.hide()
93
+
94
+ }, 1)
95
+ }
96
+
97
+
98
+ return (
99
+ <View style={{ flex: 1, backgroundColor: '#fff' }}>
100
+ <EventHeader title={esp.lang("event/voucher", "header")} />
101
+ <ScrollView>
102
+ <View style={{ margin: 15, marginTop: 0 }}>
103
+ <EventLabel_input label={esp.lang("event/voucher", "voucher_or_referral_code")} mandatory />
104
+ </View>
105
+ <View testID='input_voucher'>
106
+ <LibInput
107
+ ref={voucherCode}
108
+ label=""
109
+ editable={true}
110
+ autoCapitalize={"characters"}
111
+ returnKeyType="go"
112
+ onSubmitEditing={() => {
113
+ resetCheckVoucers()
114
+ setCounterNo(0)
115
+ checkVoucers(getData())
116
+ }}
117
+ style={{ marginTop: -20, backgroundColor: LibStyle.colorGrey, letterSpacing: 0, fontSize: 30, textAlign: 'center' }} />
118
+ </View>
119
+ <TouchableOpacity testID='use_voucher' onPress={() => {
120
+ resetCheckVoucers()
121
+ setCounterNo(0)
122
+ checkVoucers(getData())
123
+ }}>
124
+ <View style={{ alignSelf: 'flex-end', marginRight: 15, marginBottom: 10, marginLeft: 10, width: 68, height: 35, borderRadius: 3, backgroundColor: LibStyle.colorGreen, alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
125
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "center", color: '#fff' }}>{esp.lang("bigbang/payment", "button_use")}</Text>
126
+ </View>
127
+ </TouchableOpacity>
128
+
129
+ </ScrollView>
130
+
131
+ </View>
132
+ )
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay-event",
3
- "version": "0.0.0-x",
3
+ "version": "0.0.0-z",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {