esoftplay-event 0.0.2-w → 0.0.2-x

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.
@@ -11,7 +11,6 @@ import { LibCarrousel } from 'esoftplay/cache/lib/carrousel/import';
11
11
  import { LibCurl } from 'esoftplay/cache/lib/curl/import';
12
12
  import { LibIcon } from 'esoftplay/cache/lib/icon/import';
13
13
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
14
- import { LibObject } from 'esoftplay/cache/lib/object/import';
15
14
  import { LibPicture } from 'esoftplay/cache/lib/picture/import';
16
15
  import { LibProgress } from 'esoftplay/cache/lib/progress/import';
17
16
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
@@ -38,7 +37,7 @@ export default function m(props: EventArtist_detailv2Props): any {
38
37
  const [detailArtist, setDetailArtist] = useSafeState<any>()
39
38
 
40
39
  let showSchedule = React.useRef<LibSlidingup>(null)
41
- const [selectedTicket, setSelectedTicket, getSelectedTicket] = useSafeState<any>()
40
+ const [, setSelectedTicket, getSelectedTicket] = useSafeState<any[]>([])
42
41
  const [showAll, setShowAll] = useSafeState<any>({});
43
42
  const [qty, setQty] = useSafeState<any>(1)
44
43
  const [refreshing, setRefreshing] = useSafeState<boolean>(false);
@@ -47,10 +46,11 @@ export default function m(props: EventArtist_detailv2Props): any {
47
46
  loadDataArtist()
48
47
  }, [])
49
48
 
50
- esp.log({ priceList, detailArtist });
49
+ // esp.log({ priceList, detailArtist });
51
50
 
52
51
  function loadDataArtist(): void {
53
52
  new LibCurl(url, null, (res) => {
53
+ esp.log({ res, url });
54
54
  setRefreshing(false)
55
55
  setDetailArtist(res)
56
56
  loadDataPrice(res?.url_price)
@@ -81,7 +81,7 @@ export default function m(props: EventArtist_detailv2Props): any {
81
81
 
82
82
  function loadDataPriceConfig(url: string) {
83
83
  let post = {
84
- price_ids: selectedTicket?.price_id,
84
+ price_ids: "1",
85
85
  event_id: 443
86
86
  }
87
87
  LibProgress.show("Mohon tunggu")
@@ -104,77 +104,136 @@ export default function m(props: EventArtist_detailv2Props): any {
104
104
  };
105
105
 
106
106
 
107
- function add(): void {
108
- let hasQuota = getSelectedTicket().quota > 0
109
- const min = hasQuota ? Number(getSelectedTicket()?.quota) - Number(getSelectedTicket()?.quota_used) : Number(getSelectedTicket()?.qty_max)
110
- if (qty < Math.min(min, Number(getSelectedTicket()?.qty_max))) {
111
- setQty(Number(qty) + 1)
112
- }
113
- }
107
+ // function add(): void {
108
+ // let hasQuota = getSelectedTicket().quota > 0
109
+ // const min = hasQuota ? Number(getSelectedTicket()?.quota) - Number(getSelectedTicket()?.quota_used) : Number(getSelectedTicket()?.qty_max)
110
+ // if (qty < Math.min(min, Number(getSelectedTicket()?.qty_max))) {
111
+ // setQty(Number(qty) + 1)
112
+ // }
113
+ // }
114
114
 
115
- function min(): void {
116
- if (qty <= getSelectedTicket()?.qty_min) {
117
- setQty(Number(getSelectedTicket()?.qty_min))
118
- } else {
119
- setQty(qty == 1 ? 1 : qty - 1)
120
- }
121
- }
115
+ // function min(): void {
116
+ // if (qty <= getSelectedTicket()?.qty_min) {
117
+ // setQty(Number(getSelectedTicket()?.qty_min))
118
+ // } else {
119
+ // setQty(qty == 1 ? 1 : qty - 1)
120
+ // }
121
+ // }
122
122
 
123
123
  function onRefresh() {
124
124
  setRefreshing(true)
125
125
  loadDataArtist()
126
126
  }
127
127
 
128
- function renderItem(item: any, itemT: any, iT: number) {
128
+ function selectTicket(priceTypeItem: any, ticket: any, isMultiple: number) {
129
+ const selectedData = {
130
+ ...ticket,
131
+ qty: Number(priceTypeItem.qty_min),
132
+ qty_min: Number(priceTypeItem?.qty_min),
133
+ qty_max: Number(priceTypeItem?.qty_max),
134
+ list_id: ticket.list_id,
135
+ subtotal: Number(ticket.price) * Number(priceTypeItem.qty_min),
136
+ type: priceTypeItem?.type,
137
+ tax: priceTypeItem?.tax,
138
+ term: priceTypeItem?.term,
139
+ has_addition: priceTypeItem?.has_addition,
140
+ image_map: priceTypeItem?.image_map,
141
+ use_seat: priceTypeItem?.use_seat,
142
+ adjacent_seats: priceTypeItem?.config?.seat_autopick,
143
+ fee_amount: priceTypeItem?.fee_amount,
144
+ fee_type: priceTypeItem?.fee_type,
145
+ // event_id: availableResult?.id
146
+ }
147
+
148
+ setSelectedTicket((prev: any) => {
149
+ const alreadySelected = prev.some((x: any) => x.list_id == ticket.list_id)
150
+
151
+ // SINGLE
152
+ if (isMultiple != 1) {
153
+
154
+ // klik lagi = unselect
155
+ if (alreadySelected) {
156
+ return []
157
+ }
158
+
159
+ // replace semua
160
+ return [selectedData]
161
+ }
162
+
163
+ // MULTIPLE
164
+ // remove
165
+ if (alreadySelected) {
166
+ return prev.filter((x: any) => x.list_id != ticket.list_id)
167
+ }
168
+
169
+ // add
170
+ return [...prev, selectedData]
171
+ })
172
+ }
173
+
174
+ function getTicketStatusMessage(priceTypeItem: any, ticket: any) {
175
+ const status = priceTypeItem.status != 1 ? priceTypeItem.status : ticket.status
176
+
177
+ switch (status) {
178
+ case 2:
179
+ return "Segera Hadir"
180
+
181
+ case 0:
182
+ return "Habis terjual"
183
+
184
+ default:
185
+ return ""
186
+ }
187
+ }
188
+
189
+ function renderItem(itemC: any, iC: any, item: any) {
129
190
  let ticketWithDate = item.price_date == 1 && item.use_code == 0
130
191
  let ticketSpecial = item.price_date == 0 && item.use_code == 0
131
192
 
132
- let _selectedTicket = item.price_id == selectedTicket?.price_id && itemT.index_id == selectedTicket?.list?.index_id
193
+ // let _selectedTicket = item.price_id == selectedTicket?.price_id && itemC?.index_id == selectedTicket?.list?.index_id
194
+ let _selectedTicket = getSelectedTicket()?.find((x: any) => x.list_id == itemC.list_id)
195
+ // const qty = _selectedTicket?.qty || 0
196
+ let isMultiple = 1
197
+
133
198
 
134
199
  let colorDefault = _selectedTicket ? "#FFE9AD" : '#fff'
135
- let colorBackground = item?.status != 1 ? LibStyle.colorLightGrey : itemT?.status != 1 ? LibStyle.colorLightGrey : colorDefault
136
- let textOpacity = /* item?.status == 1 ? 1 : */ itemT?.status == 1 ? 1 : 0.3
200
+ let colorBackground = item?.status != 1 ? LibStyle.colorLightGrey : itemC?.status != 1 ? LibStyle.colorLightGrey : colorDefault
201
+ let textOpacity = /* item?.status == 1 ? 1 : */ itemC?.status == 1 ? 1 : 0.3
137
202
 
138
203
  return (
139
204
  <TouchableOpacity
140
205
  onPress={() => {
141
- let itemTicket = {
142
- ...item
143
- }
144
- let replaceList = LibObject.set(itemTicket, itemT)('list')
145
- let msg = itemT?.status == 0 ? esp.lang("event/artist_detail", "sold_out") : esp.lang("event/artist_detail", "coming_soon")
146
-
147
- // kondisi untuk tipe tiket yang ada tanggalnya
148
- if (item?.status == 1 && itemT?.status == 1) {
149
- setSelectedTicket(replaceList)
150
- setQty(item.qty_min)
151
- } else if (item?.status == 0) {
152
- LibToastProperty.show(msg)
153
- } else if (item?.status == 2) {
154
- LibToastProperty.show(msg)
206
+ const isAvailable = item.status == 1 && itemC.status == 1
207
+
208
+ if (!isAvailable) {
209
+ LibToastProperty.show(getTicketStatusMessage(item, itemC))
210
+ return
155
211
  }
156
- }} activeOpacity={itemT?.status == 1 ? 0 : 1} key={iT} style={{ flex: 1, flexDirection: 'row', backgroundColor: colorBackground, justifyContent: 'space-between', padding: 10, alignItems: 'center' }}>
212
+ selectTicket(item, itemC, isMultiple)
213
+
214
+
215
+ }} activeOpacity={itemC?.status == 1 ? 0 : 1} key={iC} style={{ flex: 1, flexDirection: 'row', backgroundColor: colorBackground, justifyContent: 'space-between', padding: 10, alignItems: 'center' }}>
157
216
  {
158
- itemT.ondate == "0000-00-00" ?
217
+ itemC?.ondate == "0000-00-00" ?
159
218
  <LibPicture source={esp.assets('icons/ic_special2.png')} style={{ height: 42, width: 42 }} />
160
219
  :
161
220
  <>
162
221
  <View style={applyStyle({ marginLeft: 10, marginHorizontal: 20, width: 42, height: 42, borderRadius: 5, backgroundColor: "#fff", borderStyle: "solid", borderWidth: 1, borderColor: _selectedTicket ? "#3ea4dc" : '#999', alignContent: 'center', alignItems: 'center', justifyContent: 'center' })}>
163
- <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0.23, textAlign: "center", color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('DD')}</Text>
222
+ <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0.23, textAlign: "center", color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemC?.ondate).localeFormat('DD')}</Text>
164
223
  </View>
165
224
  <View style={applyStyle({ flexDirection: 'column', flex: 1 })}>
166
225
  {
167
- item?.status == 1 && itemT?.status != 1 &&
226
+ item?.status == 1 && itemC?.status != 1 &&
168
227
  <View style={applyStyle({ flexDirection: 'row', marginBottom: 5 })}>
169
- <View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', marginTop: 5, borderWidth: 1, backgroundColor: itemT?.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: itemT?.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 })}>
170
- <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color:/* itemT?.status == 2 ? "#000" : */"#fff", fontWeight: 'bold' })}>{itemT?.status == 0 ? esp.lang("event/artist_detail", "sold_out") : esp.lang("event/artist_detail", "coming_soon")}</Text>
228
+ <View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', marginTop: 5, borderWidth: 1, backgroundColor: itemC?.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: itemC?.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 })}>
229
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color:/* itemC?.status == 2 ? "#000" : */"#fff", fontWeight: 'bold' })}>{itemC?.status == 0 ? esp.lang("event/artist_detail", "sold_out") : esp.lang("event/artist_detail", "coming_soon")}</Text>
171
230
  </View>
172
231
  </View>
173
232
  }
174
- <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('dddd')}</Text>
233
+ <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemC?.ondate).localeFormat('dddd')}</Text>
175
234
  <View style={applyStyle({ flexDirection: 'row' })}>
176
- <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('MMMM')}</Text>
177
- <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, marginLeft: 7, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemT.ondate).localeFormat('YYYY')}</Text>
235
+ <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemC?.ondate).localeFormat('MMMM')}</Text>
236
+ <Text allowFontScaling={false} style={applyStyle({ opacity: textOpacity, marginLeft: 7, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: _selectedTicket ? "#3ea4dc" : '#999' })}>{LibUtils.moment(itemC?.ondate).localeFormat('YYYY')}</Text>
178
237
  </View>
179
238
  </View>
180
239
  </>
@@ -182,19 +241,19 @@ export default function m(props: EventArtist_detailv2Props): any {
182
241
 
183
242
  <View style={applyStyle({ marginRight: 5, marginLeft: 5, flexDirection: 'column' })} >
184
243
  {
185
- (itemT?.status == 1 || itemT?.status == 0) &&
186
- <Text allowFontScaling={false} style={applyStyle({ opacity: ticketWithDate ? textOpacity : 1, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "right", color: _selectedTicket ? "#3ea4dc" : (itemT.price == 0 ? LibStyle.colorGreen : '#999') })} >{itemT.price == 0 ? esp.lang("event/ticket_list", "free") : LibUtils.money(itemT.price, item.currency)}</Text>
244
+ (itemC?.status == 1 || itemC?.status == 0) &&
245
+ <Text allowFontScaling={false} style={applyStyle({ opacity: ticketWithDate ? textOpacity : 1, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, textAlign: "right", color: _selectedTicket ? "#3ea4dc" : (itemC?.price == 0 ? LibStyle.colorGreen : '#999') })} >{itemC?.price == 0 ? esp.lang("event/ticket_list", "free") : LibUtils.money(itemC?.price, item.currency)}</Text>
187
246
  }
188
247
  {
189
248
  item?.status == 1 && (ticketWithDate || ticketSpecial) && _selectedTicket &&
190
249
  <View style={applyStyle({ marginTop: 4, flexDirection: 'row', marginLeft: 8, alignContent: 'center', alignItems: 'center' })}>
191
- <TouchableOpacity onPress={() => { min() }}>
250
+ <TouchableOpacity onPress={() => { /* min() */ }}>
192
251
  <View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
193
252
  <LibIcon name="minus" color="#e74c3c" />
194
253
  </View>
195
254
  </TouchableOpacity>
196
255
  <Text style={applyStyle({ fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#9b9b9b", marginLeft: 13, marginRight: 13 })}>{qty}</Text>
197
- <TouchableOpacity onPress={() => { add() }}>
256
+ <TouchableOpacity onPress={() => { /* add() */ }}>
198
257
  <View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
199
258
  <LibIcon name="plus" color="#16a085" />
200
259
  </View>
@@ -319,47 +378,48 @@ export default function m(props: EventArtist_detailv2Props): any {
319
378
  <Text allowFontScaling={false} style={applyStyle({ marginBottom: 15, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, textAlign: "center", color: "#34495e" })}>{esp.lang("event/artist_detail", "select_date")}</Text>
320
379
  <ScrollView showsVerticalScrollIndicator={false} >
321
380
  {
322
- priceList?.map((item: any, i: number) => {
381
+ priceList?.map((priceType: any, i: number) => {
323
382
  let filterFullData = priceList?.filter((it: any) => it.status != 0)
324
- const displayedData = showAll[item.price_id] ? item?.list : item?.list.slice(0, maxDisplay);
325
- let textOpacity = item?.status == 1 ? 1 : 0.3
326
- let selTic = item.price_id == selectedTicket?.price_id
383
+ const displayedData = showAll[priceType.price_id] ? priceType?.list : priceType?.list.slice(0, maxDisplay);
384
+ let textOpacity = priceType?.status == 1 ? 1 : 0.3
385
+ let _selectedTicket = getSelectedTicket()?.some((x: any) => x.price_id == priceType.price_id)
386
+
327
387
  return (
328
- <View key={i} style={{ overflow: 'hidden', margin: 15, marginBottom: 5, backgroundColor: '#fff', borderRadius: 10, ...LibStyle.elevation(2), borderWidth: 1, borderColor: selTic ? LibStyle.colorBlue : LibStyle.colorBgGrey }}>
388
+ <View key={i} style={{ overflow: 'hidden', margin: 15, marginBottom: 5, backgroundColor: '#fff', borderRadius: 10, ...LibStyle.elevation(2), borderWidth: 1, borderColor: _selectedTicket ? LibStyle.colorBlue : LibStyle.colorBgGrey }}>
329
389
  <View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius: 10, borderTopRightRadius: 10 }}>
330
390
  <View style={{ alignContent: 'center', alignItems: 'center', flexDirection: 'row', justifyContent: 'space-between', }}>
331
- <EventHtmltext allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold' }}>{item.name}</EventHtmltext>
391
+ <EventHtmltext allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold' }}>{priceType.name}</EventHtmltext>
332
392
  {
333
- item.qty_min > 1 &&
334
- <Text style={{ color: LibStyle.colorRed, fontSize: 10, fontWeight: 'normal' }}> {"(" + esp.lang("event/ticket_list", "min_order") + LibUtils.number(item.qty_min) + ")"}</Text>
393
+ priceType.qty_min > 1 &&
394
+ <Text style={{ color: LibStyle.colorRed, fontSize: 10, fontWeight: 'normal' }}> {"(" + esp.lang("event/ticket_list", "min_order") + LibUtils.number(priceType.qty_min) + ")"}</Text>
335
395
  }
336
396
  {
337
- item?.status != 1 &&
397
+ priceType?.status != 1 &&
338
398
  <View style={applyStyle({ flexDirection: 'row' })}>
339
- <View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', borderWidth: 1, backgroundColor: item?.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: item?.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 })}>
340
- <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: /* item?.status == 2 ? "#000" : */ "#fff", fontWeight: 'bold' })}>{item?.status == 0 ? esp.lang("event/artist_detail", "sold_out") : esp.lang("event/artist_detail", "coming_soon")}</Text>
399
+ <View style={applyStyle({ alignContent: 'center', alignItems: 'center', justifyContent: 'center', borderWidth: 1, backgroundColor: priceType?.status == 0 ? LibStyle.colorRed : "#4cd964", borderColor: priceType?.status == 0 ? LibStyle.colorRed : "#4cd964", borderRadius: 5, padding: 3, opacity: 0.8 })}>
400
+ <Text allowFontScaling={false} style={applyStyle({ fontSize: 10, fontStyle: "normal", letterSpacing: 0, color: /* priceType?.status == 2 ? "#000" : */ "#fff", fontWeight: 'bold' })}>{priceType?.status == 0 ? esp.lang("event/artist_detail", "sold_out") : esp.lang("event/artist_detail", "coming_soon")}</Text>
341
401
  </View>
342
402
  </View>
343
403
  }
344
404
  </View>
345
405
  {
346
- item.hasOwnProperty("price_type_info") && item.price_type_info != "" &&
406
+ priceType.hasOwnProperty("price_type_info") && priceType.price_type_info != "" &&
347
407
  <View style={{ marginTop: 3, alignContent: 'center', alignItems: 'center', flexDirection: 'row', marginRight: 5 }}>
348
- <Text allowFontScaling={false} style={{ fontSize: 12, color: LibStyle.colorBlue }}>{item.price_type_info}</Text>
408
+ <Text allowFontScaling={false} style={{ fontSize: 12, color: LibStyle.colorBlue }}>{priceType.price_type_info}</Text>
349
409
  </View>
350
410
  }
351
411
  </View>
352
412
 
353
413
  {
354
- displayedData?.map((itemT: any, iT: number) => renderItem(item, itemT, iT))
414
+ displayedData?.map((itemC: any, iC: number) => renderItem(itemC, iC, priceType))
355
415
  }
356
416
  {
357
417
  filterFullData?.[i]?.list?.length > 3 &&
358
418
  <TouchableOpacity onPress={() => {
359
- handleShowAll(item.price_id)
419
+ handleShowAll(priceType.price_id)
360
420
  }} style={{ borderTopColor: LibStyle.colorGrey, borderTopWidth: 0.8, flex: 1, padding: 8, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'center' }}>
361
- <Text allowFontScaling={false} style={{ marginRight: 5, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorBlue }}>{showAll[item.price_id] ? esp.lang("event/ticket_list", "see_less") : esp.lang("event/ticket_list", "see_more")}</Text>
362
- <LibIcon name={showAll[item.price_id] ? 'chevron-up-circle-outline' : 'chevron-down-circle-outline'} color={LibStyle.colorBlue} size={18} />
421
+ <Text allowFontScaling={false} style={{ marginRight: 5, fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorBlue }}>{showAll[priceType.price_id] ? esp.lang("event/ticket_list", "see_less") : esp.lang("event/ticket_list", "see_more")}</Text>
422
+ <LibIcon name={showAll[priceType.price_id] ? 'chevron-up-circle-outline' : 'chevron-down-circle-outline'} color={LibStyle.colorBlue} size={18} />
363
423
  </TouchableOpacity>
364
424
  }
365
425
 
@@ -371,9 +431,9 @@ export default function m(props: EventArtist_detailv2Props): any {
371
431
  <View style={applyStyle({ paddingVertical: 10 })} >
372
432
  <EventButton label={esp.lang("event/artist_detail", "buy_ticket")} onPress={() => {
373
433
  EventIndexProperty.isLogin(() => {
374
- if (selectedTicket) {
375
- loadDataPriceConfig(selectedTicket?.url_config)
376
- }
434
+ // if (selectedTicket) {
435
+ // loadDataPriceConfig(selectedTicket?.url_config)
436
+ // }
377
437
  // proceedToPayment()
378
438
  })
379
439
  }} style={{ backgroundColor: LibStyle.colorGreen, marginTop: 2, marginHorizontal: 15 }} />
@@ -39,19 +39,10 @@ export default function m(props: EventArtistv2Props): any {
39
39
  /* get detail event untuk dapat config antrian */
40
40
 
41
41
  // new LibCurl(url, null,
42
- new LibCurl('v2/event_artist&event_id=443', null,
42
+ new LibCurl('v2/event_artist&event_id=523', null,
43
43
  (res) => {
44
- esp.log({ res });
45
- // EventFirebase_socketProperty.eventIdQueue.set(res?.[0]?.event_id)
46
- // if (res.allotment) {
47
- // esp.modProp("event/firebase_socket").userIdKeyReplacer.set({
48
- // t: Number(res.allotment.t),
49
- // s: Number(res.allotment.s),
50
- // priority: 1
51
- // })
52
- // }
53
-
54
44
  setResult(res)
45
+ esp.log(res);
55
46
  }, (err) => {
56
47
  setError(err?.message)
57
48
  }, 1)
package/event/capture.tsx CHANGED
@@ -19,6 +19,8 @@ export default class m {
19
19
  const uriArray = images.split("/");
20
20
  const nameToChange = uriArray[uriArray.length - 1];
21
21
  const renamedURI = images.replace(nameToChange, name.replace(/\s/g, '_') + ".jpg");
22
+
23
+
22
24
  if (Platform.OS == 'ios') {
23
25
  MediaLibrary.saveToLibraryAsync(images)
24
26
  LibToastProperty.show(esp.lang("lib/capture", "saved_to_gallery"))
package/event/detail.tsx CHANGED
@@ -14,7 +14,6 @@ import { applyStyle } from 'esoftplay';
14
14
  import { EventCountdown_event } from 'esoftplay/cache/event/countdown_event/import';
15
15
  import { EventFirebase_socketProperty } from 'esoftplay/cache/event/firebase_socket/import';
16
16
  import { EventHeader } from 'esoftplay/cache/event/header/import';
17
- import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
18
17
  import { EventSlider } from 'esoftplay/cache/event/slider/import';
19
18
  import { UseCondition } from 'esoftplay/cache/use/condition/import';
20
19
  import { UseDeeplinkProperty } from 'esoftplay/cache/use/deeplink/import';
@@ -35,7 +34,6 @@ export default function m(props: EventDetailProps): any {
35
34
  const url = LibNavigation.getArgs(props, 'url')
36
35
  const [deeplinkParams] = UseDeeplinkProperty.params.useState()
37
36
  const [priority, setPriority] = useSafeState(false)
38
- const user = UserClass.state().get()
39
37
 
40
38
  moment().locale('id')
41
39
  function loadData(): void {
@@ -61,12 +59,12 @@ export default function m(props: EventDetailProps): any {
61
59
  }
62
60
 
63
61
  useEffect(() => {
64
- // if (esp.isDebug("") && user?.email == "bagus@fisip.net") {
65
- // LibNavigation.replace('event/detail2', { url: url })
66
- // } else {
67
- // loadData()
68
- // }
69
- loadData()
62
+ if (esp.isDebug("") && UserClass?.state()?.get()?.email == "bagus@fisip.net") {
63
+ LibNavigation.replace('event/detail2', { url: url })
64
+ } else {
65
+ loadData()
66
+ }
67
+ // loadData()
70
68
  }, [])
71
69
 
72
70
  if (!result) {
@@ -275,7 +273,6 @@ export default function m(props: EventDetailProps): any {
275
273
  {
276
274
  result?.url_artist != "" &&
277
275
  <TouchableOpacity onPress={() => {
278
- // LibNavigation.navigate('event/artist', { title: result?.title, url: result?.url_artist, has_addition: result?.has_addition })
279
276
  LibNavigation.navigate('event/artist', {
280
277
  title: result?.title,
281
278
  url: result?.url_artist,
@@ -286,14 +283,13 @@ export default function m(props: EventDetailProps): any {
286
283
  </TouchableOpacity>
287
284
  }
288
285
  <TouchableOpacity onPress={() => {
289
- EventIndexProperty.isLogin(async () => {
286
+ esp.modProp("event/index").isLogin(async () => {
290
287
  LibNavigation.navigate(
291
- user?.config?.tester == 1 ?
292
- 'event/ticket_list2'
288
+ (esp.isDebug("") && UserClass?.state()?.get()?.email == "bagus@fisip.net") ? 'event/ticket_list_new'
293
289
  :
294
290
  (result?.config?.hasOwnProperty('multiprice') && result?.config?.multiprice == 1 ? 'event/ticket_list2' : 'event/ticket_list'),
295
291
  {
296
- url: result.url_price,
292
+ url: esp.isDebug("") && UserClass?.state()?.get()?.email == "bagus@fisip.net" ? result?.url_price_v2 : result.url_price,
297
293
  fee_platform: {
298
294
  fee_platform_amount: result?.fee_platform_amount,
299
295
  fee_platform_type: result?.fee_platform_type,
package/event/detail2.tsx CHANGED
@@ -1,14 +1,12 @@
1
1
  // withHooks
2
2
  import { applyStyle } from 'esoftplay';
3
- import { EventFirebase_socket } from 'esoftplay/cache/event/firebase_socket/import';
3
+ import { EventFirebase_socketProperty } from 'esoftplay/cache/event/firebase_socket/import';
4
4
  import { EventHeader } from 'esoftplay/cache/event/header/import';
5
- import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
6
5
  import { EventSlider } from 'esoftplay/cache/event/slider/import';
7
6
  import { LibCurl } from 'esoftplay/cache/lib/curl/import';
8
7
  import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
9
8
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
10
9
  import { LibPicture } from 'esoftplay/cache/lib/picture/import';
11
- import { LibProgress } from 'esoftplay/cache/lib/progress/import';
12
10
  import { LibScroll } from 'esoftplay/cache/lib/scroll/import';
13
11
  import { LibSkeleton } from 'esoftplay/cache/lib/skeleton/import';
14
12
  import { LibStyle } from 'esoftplay/cache/lib/style/import';
@@ -17,11 +15,12 @@ import { LibVideoProperty } from 'esoftplay/cache/lib/video/import';
17
15
  import { LibWebview } from 'esoftplay/cache/lib/webview/import';
18
16
  import { UseCondition } from 'esoftplay/cache/use/condition/import';
19
17
  import { UseDeeplinkProperty } from 'esoftplay/cache/use/deeplink/import';
20
- import { UserClass } from 'esoftplay/cache/user/class/import';
21
18
  import esp from 'esoftplay/esp';
22
19
  import useSafeState from 'esoftplay/state';
23
20
  import { useEffect } from 'react';
24
21
 
22
+ import useGlobalState, { useGlobalReturn } from 'esoftplay/global';
23
+ import moment from 'esoftplay/moment';
25
24
  import React from 'react';
26
25
  import { Linking, Pressable, Text, TouchableOpacity, View } from 'react-native';
27
26
  import MapView, { Marker } from 'react-native-maps';
@@ -33,53 +32,76 @@ export interface EventDetail2Args {
33
32
  export interface EventDetail2Props {
34
33
 
35
34
  }
36
- export default function m(props: EventDetail2Props): any {
37
- const { url } = LibNavigation.getArgsAll(props)
35
+
36
+ const stateFeePlatform = useGlobalState({})
37
+ // {
38
+ // fee_platform_amount
39
+ // fee_platform_type
40
+ // show_fee_percentage
41
+ // }
42
+ export function stateSetFeePlatform(): useGlobalReturn<any> {
43
+ return stateFeePlatform
44
+ }
45
+
46
+ const stateSubscribe = useGlobalState({})
47
+ // {
48
+ // is_subscribed
49
+ // is_subscribed_default
50
+ // is_subscribed_label
51
+ // }
52
+ export function stateSetSubscribe(): useGlobalReturn<any> {
53
+ return stateSubscribe
54
+ }
38
55
 
39
56
 
40
- const { isInPricingQueueConfig } = EventFirebase_socket()
57
+ export default function m(props: EventDetail2Props): any {
58
+ const [result, setResult] = useSafeState<any>(undefined)
59
+ const url = LibNavigation.getArgs(props, 'url')
41
60
  const [deeplinkParams] = UseDeeplinkProperty.params.useState()
42
- const [result, setResult] = useSafeState()
43
61
  const [priority, setPriority] = useSafeState(false)
44
- const user = UserClass.state().get()
45
62
 
46
63
  useEffect(() => {
47
64
  loadData()
48
65
  }, [])
49
66
 
50
- function loadData() {
51
- new LibCurl("v2/event_detail?event_id=443", null, (res, msg) => {
52
- res.images = res?.images.map((url: string) => ({ image: url }));
53
- setResult(res)
54
- esp.log(res);
55
- }, (error) => {
56
- LibDialog.warning(esp.lang("event/detail", "load_failed"), error?.message)
57
- LibNavigation.back()
58
- })
59
- }
60
-
61
- function loadDataConfig(url: string) {
62
- LibProgress.show("Mohon tunggu")
67
+ moment().locale('id')
68
+ function loadData(): void {
69
+ // CacheHit.doHit(url)
63
70
  new LibCurl(url, null, (res, msg) => {
64
- esp.log(res);
65
- LibProgress.hide()
66
- // return
67
- LibNavigation.navigate(
68
- user?.config?.tester == 1 ?
69
- 'event/ticket_list2'
70
- :
71
- (res?.multiprice == 1 ? 'event/ticket_list2' : 'event/ticket_list'),
72
- {
73
- url: res.url_price,
74
- is_multiprice: res?.multiprice == 1 ? 1 : 0,
71
+ esp.modProp("event/countdown").eventURI.set(url)
72
+ EventFirebase_socketProperty.eventIdQueue.set(res.id)
73
+ setResult(res)
74
+ if (res.allotment) {
75
+ esp.modProp("event/firebase_socket").userIdKeyReplacer.set({
76
+ t: Number(res.allotment.t),
77
+ s: Number(res.allotment.s),
78
+ priority: 1
75
79
  })
80
+ setPriority(true)
81
+ } else {
82
+ setPriority(false)
83
+ }
84
+
85
+ let fee_platform: any = {
86
+ fee_platform_amount: res?.fee_platform_amount,
87
+ fee_platform_type: res?.fee_platform_type,
88
+ show_fee_percentage: res?.config?.show_fee_percentage,
89
+ }
90
+ stateFeePlatform.set(fee_platform)
76
91
 
92
+ let subscribed = {
93
+ is_subscribed: res?.config?.is_subscribed,
94
+ is_subscribed_default: res?.config?.is_subscribed_default,
95
+ is_subscribed_label: res?.config?.is_subscribed_label
96
+ }
97
+ stateSubscribe.set(subscribed)
77
98
  }, (error) => {
78
- LibProgress.hide()
79
99
  LibDialog.warning(esp.lang("event/detail", "load_failed"), error?.message)
100
+ LibNavigation.back()
80
101
  })
81
102
  }
82
103
 
104
+
83
105
  if (!result) {
84
106
  let itemWidth = LibStyle.width - 60
85
107
  return (
@@ -268,7 +290,7 @@ export default function m(props: EventDetail2Props): any {
268
290
  <View style={{ height: 35, borderRadius: 17, backgroundColor: LibStyle.colorLightGrey, justifyContent: 'center', alignItems: 'center', paddingHorizontal: 9 }} >
269
291
  <Text allowFontScaling={false} style={{ fontFamily: "ArialBold", fontSize: 12, textAlign: "center", textAlignVertical: 'center', color: 'black', marginHorizontal: 10 }} >
270
292
  {
271
- esp.lang("event/detail", "text_book_on", LibUtils.moment(result.start_booking).serverFormat('DD MMMM YYYY H:mm:ss', result?.timezone), result?.timezone_locale || "")
293
+ esp.lang("event/detail", "text_book_on", moment(result.start_booking).serverFormat('DD MMMM YYYY H:mm:ss', result?.timezone), result?.timezone_locale || "")
272
294
  }
273
295
  </Text>
274
296
  </View>
@@ -279,45 +301,25 @@ export default function m(props: EventDetail2Props): any {
279
301
  {
280
302
  result?.url_artist != "" &&
281
303
  <TouchableOpacity onPress={() => {
282
- // LibNavigation.navigate('event/artist', { title: result?.title, url: result?.url_artist, has_addition: result?.has_addition })
283
304
  LibNavigation.navigate('event/artist', {
284
305
  title: result?.title,
285
306
  url: result?.url_artist,
286
307
  has_addition: result?.has_addition
287
308
  })
288
- }} style={applyStyle({ width: (LibStyle.width - 30) * 0.5, borderWidth: 2, borderColor: LibStyle.colorGreen, height: 40, borderRadius: 16, backgroundColor: 'white', flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
309
+ }} style={applyStyle({ width: (LibStyle.width - 30) * 0.5, borderWidth: 2, borderColor: LibStyle.colorGreen, height: 40, borderRadius: 5, backgroundColor: 'white', flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
289
310
  <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: LibStyle.colorGreen })} >{esp.lang("event/detail", "line_up")}</Text>
290
311
  </TouchableOpacity>
291
312
  }
292
313
  <TouchableOpacity onPress={() => {
293
- EventIndexProperty.isLogin(async () => {
294
- if (isInPricingQueueConfig(result.id)) {
295
- await LibNavigation.navigateForResult('event/queue_pricing', { event_id: result?.id })
296
- }
297
- loadDataConfig(result?.url_config)
298
- return
299
- LibNavigation.navigate(
300
- user?.config?.tester == 1 ?
301
- 'event/ticket_list2'
302
- :
303
- (result?.config?.hasOwnProperty('multiprice') && result?.config?.multiprice == 1 ? 'event/ticket_list2' : 'event/ticket_list'),
314
+ esp.modProp("event/index").isLogin(async () => {
315
+ LibNavigation.navigate('event/ticket_list_new',
304
316
  {
305
- url: result.url_price,
306
- fee_platform: {
307
- fee_platform_amount: result?.fee_platform_amount,
308
- fee_platform_type: result?.fee_platform_type,
309
- },
310
- subscribed: {
311
- is_subscribed: result?.config?.is_subscribed,
312
- is_subscribed_default: result?.config?.is_subscribed_default,
313
- is_subscribed_label: result?.config?.is_subscribed_label
314
- },
315
- show_fee_percentage: result?.config?.show_fee_percentage,
317
+ url: result?.url_price_v2,
316
318
  is_multiprice: result?.config?.multiprice == 1 ? 1 : 0,
317
319
  })
318
- })
319
320
 
320
- }} 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 })} >
321
+ })
322
+ }} style={applyStyle({ width: result?.url_artist != "" ? (LibStyle.width - 30) * 0.5 : LibStyle.width - 20, borderWidth: 2, borderColor: LibStyle.colorGreen, height: 40, borderRadius: 5, backgroundColor: LibStyle.colorGreen, flexDirection: 'row', alignItems: 'center', alignContent: 'center', justifyContent: 'center', paddingHorizontal: 9 })} >
321
323
  <Text allowFontScaling={false} style={applyStyle({ fontFamily: "ArialBold", fontSize: 14, textAlign: "center", textAlignVertical: 'center', color: "#fff" })} >{esp.lang("event/detail", "text_buy_ticket")}</Text>
322
324
  </TouchableOpacity>
323
325
  <UseCondition if={priority} >