esoftplay-event 0.0.2-y → 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.
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 {
@@ -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-y",
3
+ "version": "0.0.2-z",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {