esoftplay-event 0.0.2-x → 0.0.2-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.
@@ -1,8 +1,8 @@
1
1
  // withHooks
2
- import { ComponentMessage } from 'esoftplay/cache/component/message/import';
3
2
  import { EventButton } from 'esoftplay/cache/event/button/import';
4
3
  import { EventHeader } from 'esoftplay/cache/event/header/import';
5
4
  import { EventInput_rectangle } from 'esoftplay/cache/event/input_rectangle/import';
5
+ import { EventMessage } from 'esoftplay/cache/event/message/import';
6
6
  import { LibCollaps } from 'esoftplay/cache/lib/collaps/import';
7
7
  import { LibCurl } from 'esoftplay/cache/lib/curl/import';
8
8
  import { LibDatepicker } from 'esoftplay/cache/lib/datepicker/import';
@@ -453,7 +453,7 @@ export default function m(props: EventAdditional_newProps): any {
453
453
  {
454
454
  form?.error &&
455
455
  <>
456
- <ComponentMessage message={form?.message || "Gagal memuat data"}
456
+ <EventMessage message={form?.message || "Gagal memuat data"}
457
457
  children={
458
458
  <EventButton label='Coba lagi' onPress={() => {
459
459
  setReload(reload + 1)()
@@ -0,0 +1,67 @@
1
+ // withHooks
2
+
3
+ import { EventCountdown_timestamp } from 'esoftplay/cache/event/countdown_timestamp/import';
4
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
5
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
6
+ import esp from 'esoftplay/esp';
7
+ import useSafeState from 'esoftplay/state';
8
+ import React from 'react';
9
+ import { Pressable, Text, View } from 'react-native';
10
+
11
+
12
+ export interface EventDialog_customArgs {
13
+
14
+ }
15
+ export interface EventDialog_customProps {
16
+ icon: any,
17
+ msg: string,
18
+ color: any
19
+ showCountdown?: boolean
20
+ onPressCancel: () => void,
21
+ onPressOK: () => void
22
+ }
23
+
24
+ export default function m(props: EventDialog_customProps): any {
25
+ const expTimestamp = Date.now() + 1000 * 60
26
+ const [timer] = useSafeState<number>(expTimestamp)
27
+ const [show, setShow] = useSafeState<boolean>(props?.showCountdown || false)
28
+
29
+ return (
30
+ <View style={{}}>
31
+ <View style={{ marginTop: 16, marginHorizontal: 10 }} >
32
+ <View style={{ alignItems: 'center', justifyContent: 'center' }} >
33
+ {props.icon && <View style={{ marginBottom: 30 }} ><LibIcon name={props.icon} size={70} color={props.color} /></View>}
34
+ {props.msg && <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "normal", fontStyle: "normal", lineHeight: 19, letterSpacing: 0, textAlign: "center", color: "#4a4a4a" }}>{props.msg || ''}</Text>}
35
+ </View>
36
+ </View>
37
+ <View style={{ flexDirection: 'row', marginTop: 30, paddingHorizontal: 10 }} >
38
+ <Pressable onPress={props.onPressCancel} style={{ flex: 1, height: 40, alignItems: 'center', justifyContent: 'center' }} >
39
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 15 }}>{esp.lang("event/randomseat", "back")}</Text>
40
+ {/* <LibTextstyle textStyle="body" text={esp.lang("event/randomseat", "back")} /> */}
41
+ </Pressable>
42
+ <Pressable onPress={() => {
43
+ if (!show) {
44
+ props?.onPressOK?.()
45
+ setShow(x => !x)
46
+ }
47
+ }} style={{ flex: 1, height: 40, backgroundColor: LibStyle.colorRed, opacity: show ? 0.8 : 1, borderRadius: 25, alignItems: 'center', justifyContent: 'center', flexDirection: "row" }} >
48
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 15, color: '#fff' }}>{esp.lang("component/dialog_custom", "try_again")}</Text>
49
+
50
+ {
51
+ show &&
52
+ <>
53
+ <Text style={{ fontWeight: 'bold', fontSize: 15, color: '#fff' }}>{" ("}</Text>
54
+ <EventCountdown_timestamp
55
+ onExpired={() => {
56
+ setShow(x => !x)
57
+ }}
58
+ expiredTimestamp={timer}
59
+ style={{ color: "#fff", fontWeight: 'bold' }} />
60
+ <Text style={{ fontWeight: 'bold', fontSize: 15, color: '#fff' }}>{")"}</Text>
61
+ </>
62
+ }
63
+ </Pressable>
64
+ </View>
65
+ </View>
66
+ )
67
+ }
package/event/index.tsx CHANGED
@@ -74,12 +74,18 @@ export function isLogin(isLogin: () => void, isLogout?: () => void): void {
74
74
  }
75
75
 
76
76
  const ticketState = useGlobalState<any>(undefined, { persistKey: 'bigbang_card_tiket_cache1', isUserData: true, inFile: true, loadOnInit: true })
77
- export const reload = useGlobalSubscriber()
78
-
79
77
  export function stateTicketCache(): useGlobalReturn<any> {
80
78
  return ticketState
81
79
  }
82
80
 
81
+ const bookedAddons = useGlobalState<any>({}, { persistKey: 'event_detail_addons_booked2', isUserData: true, inFile: true, loadOnInit: true })
82
+ export function stateBookedAddonsCache(): useGlobalReturn<any> {
83
+ return bookedAddons
84
+ }
85
+
86
+ export const reload = useGlobalSubscriber()
87
+
88
+
83
89
  const state = useGlobalState<any>(undefined, { persistKey: 'bigbang/event', inFile: true })
84
90
 
85
91
  export default function m(props: EventIndexProps): any {
@@ -1,6 +1,6 @@
1
1
  // withHooks
2
2
 
3
- import { ComponentDialog_custom } from 'esoftplay/cache/component/dialog_custom/import';
3
+ import { EventDialog_custom } from 'esoftplay/cache/event/dialog_custom/import';
4
4
  import { EventDistribution_lock } from 'esoftplay/cache/event/distribution_lock/import';
5
5
  import { EventHeader } from 'esoftplay/cache/event/header/import';
6
6
  import { EventPayment_subscribeProperty } from 'esoftplay/cache/event/payment_subscribe/import';
@@ -120,7 +120,7 @@ export default function m(props: EventLoading_pageProps): any {
120
120
  // )
121
121
  } else if (error?.status_code == "PY0254") {
122
122
  LibDialog.custom(
123
- <ComponentDialog_custom
123
+ <EventDialog_custom
124
124
  showCountdown
125
125
  icon={"close-circle"}
126
126
  color={LibStyle.colorRed}
@@ -36,7 +36,6 @@ import { LibObject } from 'esoftplay/cache/lib/object/import';
36
36
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
37
37
  import { UseCondition } from 'esoftplay/cache/use/condition/import';
38
38
  import esp from 'esoftplay/esp';
39
- import useGlobalState from 'esoftplay/global';
40
39
  import moment from 'esoftplay/moment';
41
40
  import useSafeState from 'esoftplay/state';
42
41
  import useGlobalSubscriber, { useGlobalSubscriberReturn } from 'esoftplay/subscribe';
@@ -55,8 +54,6 @@ export function subscribe(): useGlobalSubscriberReturn {
55
54
  return subs
56
55
  }
57
56
 
58
- const bookedAddons = useGlobalState<any>(undefined, { persistKey: 'event_detail_addons_booked', isUserData: true, inFile: true, loadOnInit: true })
59
-
60
57
  export default function m(props: EventOrder_detailProps): any {
61
58
  const LibCurl = esp.mod("lib/curl")
62
59
 
@@ -71,6 +68,8 @@ export default function m(props: EventOrder_detailProps): any {
71
68
 
72
69
  const [, setGroupAddon, getGroupAddon] = useSafeState()
73
70
  const [, setSelectedAddon, getSelectedAddon] = useSafeState()
71
+ const [addonsCacheBooked, setAddOnsCacheBooked] = EventIndexProperty?.stateBookedAddonsCache()?.useState()
72
+ const [addonsBooked, setAddOnsBooked] = useSafeState(addonsCacheBooked[result?.id])
74
73
  const [errorAddonsBooked, setErrorddOnsBooked] = useSafeState()
75
74
 
76
75
  const dataOfflineReview = EventReview_addProperty.state().get()
@@ -98,10 +97,8 @@ export default function m(props: EventOrder_detailProps): any {
98
97
  sendReview(availableOfflineReview[0])
99
98
  }
100
99
 
101
- if (res?.hasOwnProperty('url_addons_booked') && res?.url_addons_booked != "") {
102
- loadDataAddonsBooked(res?.url_addons_booked)
103
- }
104
- // loadDataTicket(res?.id)
100
+ if (res?.url_addons_booked == "") return;
101
+ loadDataAddonsBooked(res?.url_addons_booked, res.id);
105
102
 
106
103
  }, (error: any) => {
107
104
  const transformedUrl = url?.includes("?id=") ? url?.replace(/\?id=/, '/') : url
@@ -157,15 +154,15 @@ export default function m(props: EventOrder_detailProps): any {
157
154
  }
158
155
 
159
156
 
160
- function loadDataAddonsBooked(url: string) {
161
- new LibCurl(url, null, (ress: any) => {
162
- bookedAddons?.set(ress)
157
+ function loadDataAddonsBooked(url: string, bookingId: any) {
158
+ new LibCurl(url, null, (ress) => {
159
+ setAddOnsCacheBooked(LibObject.set(EventIndexProperty?.stateBookedAddonsCache().get(), ress)(bookingId))
160
+ setAddOnsBooked(ress)
163
161
  setErrorddOnsBooked(undefined)
164
- }, (error: any) => {
165
- bookedAddons?.set(undefined)
162
+ }, (error) => {
163
+ setAddOnsCacheBooked(LibObject.removeKeys(EventIndexProperty?.stateBookedAddonsCache().get(), bookingId)())
166
164
  setErrorddOnsBooked(error)
167
- })
168
-
165
+ });
169
166
  }
170
167
 
171
168
  useEffect(() => {
@@ -432,7 +429,7 @@ export default function m(props: EventOrder_detailProps): any {
432
429
  </View>
433
430
  {
434
431
  result?.hasOwnProperty('url_addons_booked') && result?.url_addons_booked != "" &&
435
- <EventOrder_detail_addons_booked addonsBooked={bookedAddons?.get()} errorAddonsBooked={errorAddonsBooked} onPress={loadData} />
432
+ <EventOrder_detail_addons_booked addonsBooked={addonsBooked} errorAddonsBooked={errorAddonsBooked} onPress={loadData} />
436
433
  }
437
434
  </View>
438
435
 
@@ -27,7 +27,7 @@ export default function m(props: EventOrder_detail_addons_bookedProps): any {
27
27
  <View style={{ marginLeft: 10 }}>
28
28
  <Text allowFontScaling={false} style={{ color: '#484848', fontSize: 14, fontWeight: 'bold', fontFamily: "Arial" }}>
29
29
  {x.price_name}
30
- {x?.list?.length == 1 ? " (" + Number(x?.list?.[0]?.qty) + " Tiket)" : ""}
30
+ {x?.list?.length == 1 && x?.list?.[0]?.ondate == "0000-00-00" ? " (" + Number(x?.list?.[0]?.qty) + " Tiket)" : ""}
31
31
  </Text>
32
32
  {
33
33
  x?.list?.length > 0 && x?.list?.map((z: any, i: number) => {
@@ -73,8 +73,8 @@ export default function m(props: EventPoint_redemptionProps): any {
73
73
  </View>
74
74
  <EventButton style={{ margin: 10 }} label='Scan QR Member' backgroundColor='#001B3C' onPress={() => {
75
75
  LibNavigation.navigateForResult('component/scanner').then((value) => {
76
- // LibNavigation.navigate('event/point_redemption_input', { qr: value })
77
- LibNavigation.navigate('event/point_redemption_exchange', { qr: value })
76
+ LibNavigation.navigate('event/point_redemption_input', { qr: value })
77
+ // LibNavigation.navigate('event/point_redemption_exchange', { qr: value })
78
78
  })
79
79
  }} />
80
80
  </TouchableOpacity>
@@ -25,7 +25,7 @@ export default function m(props: EventPoint_summaryProps): any {
25
25
  <LibIcon name='star-circle' size={150} color='#fff' />
26
26
  </View>
27
27
  <Text allowFontScaling={false} style={{ color: '#fff', fontFamily: LibFont('SFProText'), letterSpacing: 1, fontSize: 12 }}>{"POINT SAAT INI"}</Text>
28
- <Text allowFontScaling={false} style={{ color: '#fff', fontFamily: LibFont('SFProText'), fontWeight: 'bold', fontSize: 36, letterSpacing: 1.5 }}>{"1000"}<Text style={{ fontSize: 14, fontWeight: 'normal' }}>{" POINT"}</Text> </Text>
28
+ <Text allowFontScaling={false} style={{ color: '#fff', marginTop: 5, fontFamily: LibFont('DecoNumbers'), fontSize: 40, letterSpacing: 1.5 }}>{"1000"}<Text style={{ fontSize: 14, fontWeight: 'normal' }}>{" POINT"}</Text> </Text>
29
29
  </View>
30
30
 
31
31
  <View style={{ margin: 15, marginBottom: 0,backgroundColor:'#E1E3E4', borderWidth: 1, borderColor: '#C5C7C8', borderRadius: 10, padding: 10, flexDirection: 'row' }}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay-event",
3
- "version": "0.0.2-x",
3
+ "version": "0.0.2-z",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {