esoftplay-event 0.0.1-m → 0.0.1-o

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
@@ -43,6 +43,7 @@ export default function m(props: BigbangArtistProps): any {
43
43
 
44
44
  new LibCurl(url, null,
45
45
  (res) => {
46
+ esp.log({ res });
46
47
  new LibCurl(res?.[0]?.url_event || `event_detail/${res?.[0]?.event_id}`, null, (res) => {
47
48
  setResultEvent(res)
48
49
  if (res?.id) {
@@ -1,14 +1,29 @@
1
1
  // withHooks
2
2
  import { useEffect } from 'react';
3
3
 
4
+ import { applyStyle } from 'esoftplay';
5
+ import { EventButton } from 'esoftplay/cache/event/button/import';
4
6
  import { EventHeader } from 'esoftplay/cache/event/header/import';
7
+ import { EventHtmltext } from 'esoftplay/cache/event/htmltext/import';
8
+ import { EventIndexProperty } from 'esoftplay/cache/event/index/import';
9
+ import { EventShare } from 'esoftplay/cache/event/share/import';
10
+ import { LibCarrousel } from 'esoftplay/cache/lib/carrousel/import';
5
11
  import { LibCurl } from 'esoftplay/cache/lib/curl/import';
12
+ import { LibIcon } from 'esoftplay/cache/lib/icon/import';
6
13
  import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
14
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
15
+ import { LibPicture } from 'esoftplay/cache/lib/picture/import';
16
+ import { LibProgress } from 'esoftplay/cache/lib/progress/import';
17
+ import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
18
+ import { LibStyle } from 'esoftplay/cache/lib/style/import';
7
19
  import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
20
+ import { LibUtils } from 'esoftplay/cache/lib/utils/import';
21
+ import { LibVideoProperty } from 'esoftplay/cache/lib/video/import';
22
+ import { LibWebview } from 'esoftplay/cache/lib/webview/import';
8
23
  import esp from 'esoftplay/esp';
9
24
  import useSafeState from 'esoftplay/state';
10
25
  import React from 'react';
11
- import { View } from 'react-native';
26
+ import { Pressable, RefreshControl, ScrollView, Text, TouchableOpacity, View } from 'react-native';
12
27
 
13
28
 
14
29
  export interface EventArtist_detailv2Args {
@@ -18,26 +33,353 @@ export interface EventArtist_detailv2Props {
18
33
 
19
34
  }
20
35
  export default function m(props: EventArtist_detailv2Props): any {
21
- const { url_price } = LibNavigation.getArgsAll(props)
36
+ const { url, subscribed } = LibNavigation.getArgsAll(props)
22
37
  const [priceList, setPriceList] = useSafeState<any>()
38
+ const [detailArtist, setDetailArtist] = useSafeState<any>()
39
+
40
+ let showSchedule = React.useRef<LibSlidingup>(null)
41
+ const [selectedTicket, setSelectedTicket, getSelectedTicket] = useSafeState<any>()
42
+ const [showAll, setShowAll] = useSafeState<any>({});
43
+ const [qty, setQty] = useSafeState<any>(1)
44
+ const [refreshing, setRefreshing] = useSafeState<boolean>(false);
23
45
 
24
46
  useEffect(() => {
25
- loadData()
47
+ loadDataArtist()
26
48
  }, [])
27
49
 
28
- function loadData() {
29
- new LibCurl(url_price, null, (res, msg) => {
30
- esp.log(res);
31
- setPriceList(res)
50
+ esp.log({ priceList, detailArtist });
51
+
52
+ function loadDataArtist(): void {
53
+ new LibCurl(url, null, (res) => {
54
+ setRefreshing(false)
55
+ setDetailArtist(res)
56
+ loadDataPrice(res?.url_price)
32
57
  }, (err) => {
58
+ setRefreshing(false)
33
59
  LibToastProperty.show(err?.message)
34
60
  LibNavigation.back()
35
61
  }, 1)
36
62
  }
37
63
 
64
+ function loadDataPrice(url: string) {
65
+ new LibCurl(url, null, (res, msg) => {
66
+
67
+ const updatedData = res?.map((item: any) => ({
68
+ ...item,
69
+ list: item?.list?.map((itemList: any) => ({
70
+ ...itemList,
71
+ index_id: item?.price_id + "-" + itemList?.ondate
72
+ }))
73
+ }));
74
+
75
+ setPriceList(updatedData)
76
+ }, (err) => {
77
+ LibToastProperty.show(err?.message)
78
+ LibNavigation.back()
79
+ }, 1)
80
+ }
81
+
82
+ function loadDataPriceConfig(url: string) {
83
+ let post = {
84
+ price_ids: selectedTicket?.price_id,
85
+ event_id: 411
86
+ }
87
+ LibProgress.show("Mohon tunggu")
88
+ new LibCurl(url, post, (res, msg) => {
89
+ esp.log({ res, url });
90
+ LibProgress.hide()
91
+ }, (err) => {
92
+ LibProgress.hide()
93
+ LibToastProperty.show(err?.message)
94
+
95
+ }, 1)
96
+ }
97
+
98
+ const maxDisplay = 3;
99
+ const handleShowAll = (price_id: any) => {
100
+ setShowAll((prevShowAll: any) => ({
101
+ ...prevShowAll,
102
+ [price_id]: !prevShowAll[price_id],
103
+ }));
104
+ };
105
+
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
+ }
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
+ }
122
+
123
+ function onRefresh() {
124
+ setRefreshing(true)
125
+ loadDataArtist()
126
+ }
127
+
128
+ function renderItem(item: any, itemT: any, iT: number) {
129
+ let ticketWithDate = item.price_date == 1 && item.use_code == 0
130
+ let ticketSpecial = item.price_date == 0 && item.use_code == 0
131
+
132
+ let _selectedTicket = item.price_id == selectedTicket?.price_id && itemT.index_id == selectedTicket?.list?.index_id
133
+
134
+ 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
137
+
138
+ return (
139
+ <TouchableOpacity
140
+ 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)
155
+ }
156
+ }} activeOpacity={itemT?.status == 1 ? 0 : 1} key={iT} style={{ flex: 1, flexDirection: 'row', backgroundColor: colorBackground, justifyContent: 'space-between', padding: 10, alignItems: 'center' }}>
157
+ {
158
+ itemT.ondate == "0000-00-00" ?
159
+ <LibPicture source={esp.assets('icons/ic_special2.png')} style={{ height: 42, width: 42 }} />
160
+ :
161
+ <>
162
+ <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>
164
+ </View>
165
+ <View style={applyStyle({ flexDirection: 'column', flex: 1 })}>
166
+ {
167
+ item?.status == 1 && itemT?.status != 1 &&
168
+ <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>
171
+ </View>
172
+ </View>
173
+ }
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>
175
+ <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>
178
+ </View>
179
+ </View>
180
+ </>
181
+ }
182
+
183
+ <View style={applyStyle({ marginRight: 5, marginLeft: 5, flexDirection: 'column' })} >
184
+ {
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>
187
+ }
188
+ {
189
+ item?.status == 1 && (ticketWithDate || ticketSpecial) && _selectedTicket &&
190
+ <View style={applyStyle({ marginTop: 4, flexDirection: 'row', marginLeft: 8, alignContent: 'center', alignItems: 'center' })}>
191
+ <TouchableOpacity onPress={() => { min() }}>
192
+ <View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
193
+ <LibIcon name="minus" color="#e74c3c" />
194
+ </View>
195
+ </TouchableOpacity>
196
+ <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() }}>
198
+ <View style={applyStyle({ width: 28, height: 28, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
199
+ <LibIcon name="plus" color="#16a085" />
200
+ </View>
201
+ </TouchableOpacity>
202
+ </View>
203
+ }
204
+ </View>
205
+ </TouchableOpacity>
206
+ )
207
+ }
208
+
209
+ const bgHeight = LibStyle.width * 9 / 16
210
+
211
+ function renderImages(item: any, i: number) {
212
+ const styleId_Z1ecB7O: any = { height: bgHeight, width: LibStyle.width, resizeMode: 'cover' }
213
+ return (
214
+ <TouchableOpacity key={i} onPress={() => LibNavigation.navigate('lib/gallery', { images: detailArtist?.images, index: i })}>
215
+ <LibPicture source={{ uri: item.image }} style={styleId_Z1ecB7O} />
216
+ </TouchableOpacity>
217
+ )
218
+ }
219
+
220
+ let share = [
221
+ {
222
+ icon: 'icons/ic_facebook.png',
223
+ title: 'Facebook',
224
+ onPress: () => { EventShare.facebook(url) }
225
+ },
226
+ {
227
+ icon: 'icons/ic_whatsapp.png',
228
+ title: 'Whatsapp',
229
+ onPress: () => { EventShare.whatsapp(url) }
230
+ },
231
+ {
232
+ icon: 'icons/ic_twitter.png',
233
+ title: 'Twitter',
234
+ onPress: () => { EventShare.twitter(url) }
235
+ },
236
+ {
237
+ icon: 'icons/ic_copy.png',
238
+ title: esp.lang("event/artist_detail", "copy"),
239
+ onPress: () => {
240
+ LibUtils.copyToClipboard(url).then((v) => {
241
+ LibToastProperty.show(esp.lang("event/artist_detail", "alert"))
242
+ })
243
+ }
244
+ },
245
+ ]
246
+
247
+ function renderShare(item: any, i: number) {
248
+ return (
249
+ <View key={i} style={applyStyle({ marginRight: 10 })}>
250
+ <TouchableOpacity onPress={item.onPress} >
251
+ <LibPicture style={applyStyle({ resizeMode: 'contain', height: 25, width: 25, borderRadius: 12.5, backgroundColor: 'white' })} source={esp.assets(item.icon)} />
252
+ </TouchableOpacity>
253
+ </View>
254
+ )
255
+ }
256
+
38
257
  return (
39
258
  <View style={{ flex: 1 }}>
40
- <EventHeader title={esp.lang("event/artist_detail", "title")} /* subtitle={data?.title} */ />
259
+ <EventHeader title={esp.lang("event/artist_detail", "title")} subtitle={detailArtist?.name} />
260
+ <ScrollView refreshControl={
261
+ <RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
262
+ }>
263
+
264
+ {
265
+ detailArtist?.images && detailArtist?.images?.length > 0 ?
266
+ <LibCarrousel
267
+ delay={3000}
268
+ style={{ height: bgHeight, width: LibStyle.width }}
269
+ autoplay
270
+ bullets
271
+ bulletStyle={{ width: 7, height: 7, backgroundColor: "#fff", borderRadius: 3.5, borderWidth: 0, marginHorizontal: 2 }}
272
+ chosenBulletStyle={{ width: 7, height: 7, backgroundColor: "#f4e31b", borderRadius: 3.5, borderWidth: 0, marginHorizontal: 2 }}
273
+ bulletsContainerStyle={{ marginBottom: -10 }}>
274
+ {
275
+ detailArtist?.images && detailArtist?.images?.map(renderImages)
276
+ }
277
+ </LibCarrousel>
278
+ :
279
+ <Pressable onPress={() => LibNavigation.navigate('lib/gallery', { image: detailArtist?.image })} >
280
+ <LibPicture
281
+ style={applyStyle({ height: LibStyle.width * 9 / 16, width: LibStyle.width, backgroundColor: '#f2f3f4' })}
282
+ source={{ uri: detailArtist?.image }} />
283
+ </Pressable>
284
+ }
285
+ <View style={applyStyle({ marginTop: 10, marginLeft: 17, flexDirection: 'row' })}>
286
+ {
287
+ share.map(renderShare)
288
+ }
289
+ </View>
290
+ <Text allowFontScaling={false} style={applyStyle({ marginBottom: 12, marginLeft: 17, fontFamily: "Arial", marginTop: 20, fontSize: 26, fontWeight: "bold", fontStyle: "normal", lineHeight: 30, letterSpacing: 0, color: "#000" })}>{detailArtist?.name}</Text>
291
+ {
292
+ detailArtist?.description != "" &&
293
+ <ScrollView>
294
+ <LibWebview onFinishLoad={() => { }} source={{ html: detailArtist?.description }} />
295
+ </ScrollView>
296
+ }
297
+ {
298
+ detailArtist?.video != "" &&
299
+ <>
300
+ <Text allowFontScaling={false} style={applyStyle({ marginHorizontal: 20, marginTop: 10, fontFamily: "Arial", fontSize: 13, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0, color: "#4a4a4a" })} >{esp.lang("event/artist_detail", "video")}</Text>
301
+ <TouchableOpacity onPress={() => LibNavigation.navigate('lib/video', { code: detailArtist?.video })} >
302
+ <LibPicture source={{ uri: LibVideoProperty.getUrlThumbnail(detailArtist?.video) }} style={applyStyle({ height: LibStyle.width * 9 / 16, width: LibStyle.width - 40, marginHorizontal: 20, resizeMode: 'cover' })} />
303
+ </TouchableOpacity>
304
+ </>
305
+ }
306
+
307
+
308
+ </ScrollView>
309
+ <View style={{ flexDirection: 'row', padding: 10, backgroundColor: 'white' }} >
310
+ <EventButton label={esp.lang("event/artist_detail", "buy_ticket")} onPress={() => {
311
+ EventIndexProperty.isLogin(() => {
312
+ showSchedule.current?.show()
313
+ })
314
+ }} style={{ backgroundColor: LibStyle.colorGreen }} />
315
+ </View>
316
+
317
+ <LibSlidingup ref={showSchedule}>
318
+ <View style={applyStyle({ backgroundColor: 'white', borderTopRightRadius: 30, borderTopLeftRadius: 30, paddingTop: 15, maxHeight: LibStyle.height - (LibStyle.height / 3) })}>
319
+ <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
+ <ScrollView showsVerticalScrollIndicator={false} >
321
+ {
322
+ priceList?.map((item: any, i: number) => {
323
+ 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
327
+ 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 }}>
329
+ <View style={{ padding: 10, backgroundColor: '#f1f2f3', borderTopLeftRadius: 10, borderTopRightRadius: 10 }}>
330
+ <View style={{ alignContent: 'center', alignItems: 'center', flexDirection: 'row', justifyContent: 'space-between', }}>
331
+ <EventHtmltext allowFontScaling={false} style={{ opacity: textOpacity, fontWeight: 'bold' }}>{item.name}</EventHtmltext>
332
+ {
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>
335
+ }
336
+ {
337
+ item?.status != 1 &&
338
+ <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>
341
+ </View>
342
+ </View>
343
+ }
344
+ </View>
345
+ {
346
+ item.hasOwnProperty("price_type_info") && item.price_type_info != "" &&
347
+ <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>
349
+ </View>
350
+ }
351
+ </View>
352
+
353
+ {
354
+ displayedData?.map((itemT: any, iT: number) => renderItem(item, itemT, iT))
355
+ }
356
+ {
357
+ filterFullData?.[i]?.list?.length > 3 &&
358
+ <TouchableOpacity onPress={() => {
359
+ handleShowAll(item.price_id)
360
+ }} 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} />
363
+ </TouchableOpacity>
364
+ }
365
+
366
+ </View>
367
+ )
368
+ })
369
+ }
370
+ </ScrollView>
371
+ <View style={applyStyle({ paddingVertical: 10 })} >
372
+ <EventButton label={esp.lang("event/artist_detail", "buy_ticket")} onPress={() => {
373
+ EventIndexProperty.isLogin(() => {
374
+ if (selectedTicket) {
375
+ loadDataPriceConfig(selectedTicket?.url_config)
376
+ }
377
+ // proceedToPayment()
378
+ })
379
+ }} style={{ backgroundColor: LibStyle.colorGreen, marginTop: 2, marginHorizontal: 15 }} />
380
+ </View>
381
+ </View>
382
+ </LibSlidingup>
41
383
 
42
384
  </View>
43
385
  )
@@ -29,7 +29,6 @@ export interface EventArtistv2Props {
29
29
 
30
30
  export default function m(props: EventArtistv2Props): any {
31
31
  const [result, setResult] = useSafeState<any>()
32
- const [resultEvent, setResultEvent] = useSafeState<any>()
33
32
  const [error, setError] = useSafeState<any>('')
34
33
  const { isInPricingQueueConfig } = EventFirebase_socket()
35
34
 
@@ -43,21 +42,15 @@ export default function m(props: EventArtistv2Props): any {
43
42
  new LibCurl('v2/event_artist&event_id=411', null,
44
43
  (res) => {
45
44
  esp.log({ res });
46
- new LibCurl(res?.[0]?.url_event || `event_detail/${res?.[0]?.event_id}`, null, (res) => {
47
- setResultEvent(res)
48
- if (res?.id) {
49
- EventFirebase_socketProperty.eventIdQueue.set(res?.id)
50
- }
51
- if (res.allotment) {
52
- esp.modProp("event/firebase_socket").userIdKeyReplacer.set({
53
- t: Number(res.allotment.t),
54
- s: Number(res.allotment.s),
55
- priority: 1
56
- })
57
- }
58
- }, (err) => {
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
+ }
59
53
 
60
- }, 0)
61
54
  setResult(res)
62
55
  }, (err) => {
63
56
  setError(err?.message)
@@ -72,19 +65,21 @@ export default function m(props: EventArtistv2Props): any {
72
65
  const itemHeight = itemWidth * 9 / 16
73
66
 
74
67
  let subs = {
75
- is_subscribed: resultEvent?.config?.is_subscribed,
76
- is_subscribed_default: resultEvent?.config?.is_subscribed_default,
77
- is_subscribed_label: resultEvent?.config?.is_subscribed_label
68
+ is_subscribed: result?.config?.is_subscribed,
69
+ is_subscribed_default: result?.config?.is_subscribed_default,
70
+ is_subscribed_label: result?.config?.is_subscribed_label
78
71
  }
79
72
  const width = LibStyle?.width
80
73
  const sliderHeight = 0.50 * width
81
74
 
82
75
  function renderIt(item: any, i: number) {
83
76
  const styleId_Z2g4Hs7: any = { backgroundColor: '#FFC523', width: itemWidth, height: itemHeight, margin: 0.5, justifyContent: 'center', alignItems: 'center' }
84
-
77
+ let isNotAvailable = item?.status_error != ""
85
78
  const handlePress = () => {
86
- EventIndexProperty.isLogin(async () => {
87
- if (item.status == 1) {
79
+ if (isNotAvailable) {
80
+ LibToastProperty.show(esp.lang("event/artist", "ticket_not_available"));
81
+ } else {
82
+ EventIndexProperty.isLogin(async () => {
88
83
  if (isInPricingQueueConfig(item.event_id)) {
89
84
  LibNavigation.navigateForResult('event/queue_pricing', {
90
85
  event_id: item?.event_id,
@@ -93,16 +88,14 @@ export default function m(props: EventArtistv2Props): any {
93
88
  }
94
89
  // EventCountdownProperty.countdownTime.set(moment().add(EventFirebase_socketProperty.eventQueueConfig.get(item?.event_id).time, 'seconds').localeFormat('YYYY-MM-DD HH:mm:ss'));
95
90
  LibNavigation.navigate(
96
- // item?.config?.multiprice == 1
97
- // ? 'event/artist_detail_multi'
98
- // :
99
- 'event/artist_detailv2',
100
- { url_price: item.url }
91
+ item?.config?.multiprice == 1
92
+ ? 'event/artist_detail_multi'
93
+ :
94
+ 'event/artist_detailv2',
95
+ { url: item.url, subscribed: subs }
101
96
  );
102
- } else {
103
- LibToastProperty.show(esp.lang("event/artist", "ticket_not_available"));
104
- }
105
- });
97
+ });
98
+ }
106
99
  };
107
100
 
108
101
  if (item?.images?.length > 1) {
@@ -117,7 +110,7 @@ export default function m(props: EventArtistv2Props): any {
117
110
  item?.images?.map((item1: any, ii: number) => {
118
111
  return (
119
112
  <TouchableOpacity key={ii} onPress={handlePress} >
120
- <LibPicture key={ii} source={{ uri: item1 }} style={{ height: sliderHeight, width: width, resizeMode: 'cover', backgroundColor: "#f1f2f3" }} />
113
+ <LibPicture key={ii} source={{ uri: item1 }} style={{ opacity: isNotAvailable ? 0.3 : 1, height: sliderHeight, width: width, resizeMode: 'cover', backgroundColor: "#f1f2f3" }} />
121
114
  </TouchableOpacity>
122
115
  )
123
116
  })
@@ -127,7 +120,7 @@ export default function m(props: EventArtistv2Props): any {
127
120
  } else if (item?.images?.length == 1) {
128
121
  return (
129
122
  <TouchableOpacity key={i} onPress={handlePress} >
130
- <LibPicture style={{ height: sliderHeight, width: width, resizeMode: 'cover', backgroundColor: "#f1f2f3" }} source={{ uri: item.images[0] }} />
123
+ <LibPicture style={{opacity: isNotAvailable ? 0.3 : 1, height: sliderHeight, width: width, resizeMode: 'cover', backgroundColor: "#f1f2f3" }} source={{ uri: item.images[0] }} />
131
124
  </TouchableOpacity>
132
125
  )
133
126
  } else {
@@ -141,9 +134,9 @@ export default function m(props: EventArtistv2Props): any {
141
134
 
142
135
  return (
143
136
  <View style={{ flex: 1, backgroundColor: 'white' }} >
144
- <EventHeader title={title ? title : resultEvent?.event_title} iconShare={resultEvent?.url_share_artist && resultEvent?.url_share_artist !== ""}
137
+ <EventHeader title={title ? title : result?.name} iconShare={result?.url_share_artist && result?.url_share_artist !== ""}
145
138
  onPressShare={() => {
146
- LibUtils.share(resultEvent?.url_share_artist)
139
+ LibUtils.share(result?.url_share_artist)
147
140
  }} />
148
141
  {
149
142
  !result && !error ? <LibLoading /> :
@@ -153,7 +146,7 @@ export default function m(props: EventArtistv2Props): any {
153
146
  // }
154
147
  // </ScrollView>
155
148
  <LibList
156
- data={result}
149
+ data={result?.list}
157
150
  // keyExtractor={(item) => item.id}
158
151
  onRefresh={loadData}
159
152
  staticHeight={itemHeight + 1}
package/event/detail.tsx CHANGED
@@ -39,6 +39,7 @@ export default function m(props: EventDetailProps): any {
39
39
  function loadData(): void {
40
40
  // CacheHit.doHit(url)
41
41
  new LibCurl(url, null, (res, msg) => {
42
+ esp.log(res);
42
43
  EventFirebase_socketProperty.eventIdQueue.set(res.id)
43
44
  setResult(res)
44
45
  if (res.allotment) {
@@ -556,8 +556,8 @@ export default function m(props: EventOrder_detailProps): any {
556
556
  loadDataAddons(item?.addons_id, item?.url)
557
557
  }}
558
558
  icon={'plus-circle'}
559
- title={"item.title"}
560
- info={"item.info"}
559
+ title={item.title}
560
+ info={item.info}
561
561
  />
562
562
  )
563
563
  })
@@ -126,7 +126,7 @@ export default function m(props: any): any {
126
126
  new LibCurl("v3/event_seat", {
127
127
  event_id: dataTicket?.event_id,
128
128
  price_id: dataTicket?.selected_ticket?.price_id,
129
- ondate: dataTicket?.selected_ticket?.list?.ondate
129
+ ondate: dataTicket?.ondate || dataTicket?.selected_ticket?.list?.ondate
130
130
  }, (res, msg) => {
131
131
  // esp.log(res);
132
132
  setBoundingBox(res.metadata.bounding_box)
@@ -140,7 +140,7 @@ export default function m(props: any): any {
140
140
  new LibCurl("v3/event_seat_booked", {
141
141
  event_id: dataTicket?.event_id,
142
142
  price_id: dataTicket?.selected_ticket?.price_id,
143
- ondate: dataTicket?.selected_ticket?.list?.ondate
143
+ ondate: dataTicket?.ondate || dataTicket?.selected_ticket?.list?.ondate
144
144
  }, (res, msg) => {
145
145
  loadDataSeatmap(res)
146
146
  setErrBookedSeat(undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay-event",
3
- "version": "0.0.1-m",
3
+ "version": "0.0.1-o",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {