esoftplay-event 0.0.2-o → 0.0.2-q

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.
@@ -32,6 +32,7 @@ import { EventSecure_page } from 'esoftplay/cache/event/secure_page/import';
32
32
  import { EventStep } from 'esoftplay/cache/event/step/import';
33
33
  import { LibCollaps } from 'esoftplay/cache/lib/collaps/import';
34
34
  import { LibCurl_view } from 'esoftplay/cache/lib/curl_view/import';
35
+ import { LibObject } from 'esoftplay/cache/lib/object/import';
35
36
  import { LibSlidingup } from 'esoftplay/cache/lib/slidingup/import';
36
37
  import { UseCondition } from 'esoftplay/cache/use/condition/import';
37
38
  import esp from 'esoftplay/esp';
@@ -122,6 +123,8 @@ export default function m(props: EventOrder_detailProps): any {
122
123
  let availableOfflineReview = dataOfflineReview?.filter((z: any) => z?.booking_id == result?.id)
123
124
  const [dataReview, setDataReview] = useSafeState<any>(availableOfflineReview?.length == 1 ? availableOfflineReview[0] : result?.detail_review)
124
125
 
126
+ const [dataTicket, setDataTicket] = useSafeState()
127
+
125
128
  moment().locale?.('id')
126
129
 
127
130
  const imgWidth = LibStyle.width - 30
@@ -144,6 +147,7 @@ export default function m(props: EventOrder_detailProps): any {
144
147
  if (res?.hasOwnProperty('url_addons_booked') && res?.url_addons_booked != "") {
145
148
  loadDataAddonsBooked(res?.url_addons_booked)
146
149
  }
150
+ // loadDataTicket(res?.id)
147
151
 
148
152
  }, (error: any) => {
149
153
  const transformedUrl = url?.includes("?id=") ? url?.replace(/\?id=/, '/') : url
@@ -179,6 +183,26 @@ export default function m(props: EventOrder_detailProps): any {
179
183
  })
180
184
  }
181
185
 
186
+ function loadDataTicket(id: any, price_id: string, ondate: string) {
187
+ let param = {
188
+ booking_id: id, price_id: price_id, ondate: ondate
189
+ }
190
+
191
+ new LibCurl("addons_item" + LibUtils.objectToUrlParam(param), null, (ress: any) => {
192
+ let data = ress?.length > 0 && ress?.map((item: any, i: number) => {
193
+ return ({
194
+ ...item,
195
+ checked: 0,
196
+ })
197
+ })
198
+ esp.log({ data });
199
+ setDataTicket(data)
200
+ LibUtils.debounce(() => { dialogQtyAddons?.current?.show() }, 100)
201
+ }, (error: any) => {
202
+ // setEmptyCoupons(error)
203
+ }, 1)
204
+ }
205
+
182
206
  function loadDataAddonsBooked(url: string) {
183
207
  new LibCurl(url, null, (ress: any) => {
184
208
  setAddOnsBooked(ress)
@@ -243,6 +267,7 @@ export default function m(props: EventOrder_detailProps): any {
243
267
  function loadDataAddons(id: any, url: string) {
244
268
  LibProgress.show(esp.lang("event/order_detail", "wait"))
245
269
  new LibCurl(url, null, (res: any, msg: any) => {
270
+ let _bookingMemberId = dataTicket?.filter((item: any) => item.checked == 1).map((it: any) => it.id)
246
271
  LibProgress.hide()
247
272
  let dataBookingEvent = {
248
273
  event_id: res?.event_id,
@@ -262,7 +287,8 @@ export default function m(props: EventOrder_detailProps): any {
262
287
  currency: res?.currency,
263
288
  }
264
289
  },
265
- qty: qty
290
+ qty: dataTicket?.filter((item: any) => item.checked == 1).length,
291
+ booking_member_ids: JSON.stringify(_bookingMemberId)
266
292
  }
267
293
  let fee_platform = {
268
294
  fee_platform_amount: res?.fee_platform?.fee_platform_amount,
@@ -681,11 +707,12 @@ export default function m(props: EventOrder_detailProps): any {
681
707
  <LibCurl_view
682
708
  url={result?.url_addons}
683
709
  onSuccess={(res, msg): any => {
710
+ esp.log(res);
684
711
  return (
685
712
  <View>
686
713
  {
687
714
  res?.length > 0 && res?.map((item: any, i: number) => {
688
- if (item?.hasOwnProperty('list')) {
715
+ if (item?.list?.length > 1) {
689
716
  return (
690
717
  <EventButton_order_detail
691
718
  disable={item?.hasOwnProperty('status') && item.status == 0 ? true : false}
@@ -695,7 +722,7 @@ export default function m(props: EventOrder_detailProps): any {
695
722
  onPress={() => {
696
723
  setGroupAddon(item)
697
724
  LibUtils.debounce(() => {
698
- setQty(1)
725
+ // setQty(1)
699
726
  dialogAddonList?.current?.show()
700
727
  }, 100)
701
728
  // loadDataAddons(item?.addons_id, item?.url)
@@ -714,9 +741,10 @@ export default function m(props: EventOrder_detailProps): any {
714
741
  color={result?.color}
715
742
  onPress={() => {
716
743
  if (item?.hasOwnProperty('status') && item?.status == 1) {
717
- setQty(1)
744
+ // setQty(1)
718
745
  setSelectedAddon(item)
719
- dialogQtyAddons?.current?.show()
746
+ loadDataTicket(result?.id, item?.[0]?.price_id, item?.[0]?.ondate)
747
+
720
748
  // loadDataAddons(item?.addons_id, item?.url)
721
749
  }
722
750
  }}
@@ -990,11 +1018,37 @@ export default function m(props: EventOrder_detailProps): any {
990
1018
  <LibCurl_view
991
1019
  url={result?.url_term}
992
1020
  onSuccess={(res, msg): any => {
993
- return (
994
- <View>
995
- {res?.map(renderTermItem)}
996
- </View>
997
- )
1021
+ esp.log(res);
1022
+ if (Array.isArray(res)) {
1023
+ return (
1024
+ <View>
1025
+ {res?.map(renderTermItem)}
1026
+ </View>
1027
+ )
1028
+ } else {
1029
+ return (
1030
+ <View>
1031
+ {
1032
+ Object.entries(res).map(([title, items]: any) => {
1033
+ return (
1034
+ <View key={title}>
1035
+ <LibCollaps header={(show) =>
1036
+ <View style={{ padding: 15, paddingRight: 25, paddingLeft: 20, paddingBottom: 10, borderBottomWidth: 1, borderColor: LibStyle.colorBgGrey, alignContent: 'center', alignItems: 'center', borderRadius: 7, backgroundColor: '#f9f9f9', flexDirection: 'row' }}>
1037
+ <View style={{ flex: 1 }}>
1038
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: "#495057" }}>{title}</Text>
1039
+ </View>
1040
+ <LibIcon name={!show ? "chevron-down" : "chevron-up"} color='#495057' />
1041
+ </View>
1042
+ }>
1043
+ {items.map(renderTermItem)}
1044
+ </LibCollaps>
1045
+ </View>
1046
+ )
1047
+ })
1048
+ }
1049
+ </View>
1050
+ )
1051
+ }
998
1052
  }}
999
1053
  onError={(err) => {
1000
1054
  return (
@@ -1102,28 +1156,77 @@ export default function m(props: EventOrder_detailProps): any {
1102
1156
  </LibSlidingup>
1103
1157
 
1104
1158
  <LibSlidingup ref={dialogQtyAddons}>
1105
- <View style={{ backgroundColor: 'white', borderTopRightRadius: 20, borderTopLeftRadius: 20, padding: 10 }}>
1106
- <Text allowFontScaling={false} style={{ padding: 15, alignSelf: 'center', fontFamily: "Arial", fontSize: 18, fontWeight: "bold", fontStyle: "normal", lineHeight: 22, letterSpacing: 0 }}>{"QTY ADDONS"}</Text>
1159
+ <View style={{ backgroundColor: 'white', maxHeight: LibStyle.height - (LibStyle.height / 3), borderTopRightRadius: 20, borderTopLeftRadius: 20, padding: 20 }}>
1160
+ <Text style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", color: "#b7b7b7" }} >{esp.lang("event/order_detail", "addons")}</Text>
1161
+ <Text style={{ fontFamily: "Arial", marginBottom: 10, fontSize: 16, fontWeight: "bold", color: "#4a4a4a" }} >{getSelectedAddon()?.title}</Text>
1107
1162
 
1108
- <View style={{ flexDirection: 'row', alignItems: 'center', marginVertical: 20 }} >
1109
- <TouchableOpacity
1110
- onPress={() => {
1111
- min()
1112
- }}
1113
- style={{ height: 70, width: 70, borderRadius: 10, backgroundColor: '#f1f1f1', alignItems: 'center', justifyContent: 'center' }} >
1114
- <LibIcon name='minus' color={LibStyle.colorRed} size={50} />
1115
- </TouchableOpacity>
1116
- <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }} >
1117
- <Text style={{ fontSize: 50 }} >{qty}</Text>
1118
- </View>
1119
- <TouchableOpacity
1120
- onPress={() => {
1121
- add(Number(getSelectedAddon()?.qty_left))
1122
- }}
1123
- style={{ height: 70, width: 70, borderRadius: 10, backgroundColor: '#f1f1f1', alignItems: 'center', justifyContent: 'center' }} >
1124
- <LibIcon name='plus' color={LibStyle.colorGreen} size={50} />
1125
- </TouchableOpacity>
1126
- </View>
1163
+ <ScrollView>
1164
+ <Text allowFontScaling={false} style={{ marginVertical: 10, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: "#000" }}>{esp.lang("event/order_detail_share", "chose_ticket")}</Text>
1165
+ {
1166
+ dataTicket?.length > 0 && dataTicket?.map((item: any, i: number) => {
1167
+ const [front, end] = item?.seat_name?.split("#") || ["", ""];
1168
+ let colorDisable = item?.status == 0 ? LibStyle.colorBgGrey : "#f1f1f1"
1169
+ let colorAccent = item?.checked == 1 ? LibStyle?.colorGreen : colorDisable
1170
+ return (
1171
+ <TouchableOpacity key={i} onPress={() => {
1172
+ if (item?.status == 1) {
1173
+ let a = LibObject.set(dataTicket, item.checked == 1 ? 0 : 1)(i, 'checked')
1174
+ setDataTicket(a)
1175
+ }
1176
+
1177
+ }} style={{ padding: 10, marginBottom: 10, borderRadius: 4, backgroundColor: item?.status == 1 ? "#fff" : LibStyle.colorBgGrey, borderColor: colorAccent, borderWidth: 1, flexDirection: 'row' }}>
1178
+ <View style={{ flex: 5 }}>
1179
+ <Text allowFontScaling={false} style={{ fontSize: 14, fontStyle: "normal", color: "#000", fontWeight: "bold", }}>{result?.price_name}</Text>
1180
+ {/* seat */}
1181
+ {
1182
+ item?.seat_name != "" &&
1183
+ <View style={{ marginVertical: 10 }}>
1184
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, marginBottom: 5, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#b7b7b7" }}>{esp.lang("event/order_detail", "seat_number")}</Text>
1185
+
1186
+ <View style={{ marginLeft: 7, flexDirection: 'row' }}>
1187
+ <View style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: 5, paddingHorizontal: 5, backgroundColor: '#f1f1f1', borderRadius: 5, marginRight: 7 }}>
1188
+ <Text allowFontScaling={false} style={{ fontWeight: 'bold', fontSize: 16, color: "#000" }}> {front}</Text>
1189
+ <Text allowFontScaling={false} style={{ marginLeft: 3, fontWeight: 'bold', fontSize: 16, color: '#000', }}>{end}</Text>
1190
+ </View>
1191
+ </View>
1192
+ </View>
1193
+ }
1194
+ {/* add ons */}
1195
+ {
1196
+ item?.addons?.length > 0 &&
1197
+ <View style={{ marginTop: 5 }}>
1198
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 12, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#b7b7b7" }}>{esp.lang("event/order_detail", "addons")}</Text>
1199
+ </View>
1200
+ }
1201
+ {
1202
+ item?.addons?.length > 0 && item?.addons?.map((x: any, ii: number) => {
1203
+ return (
1204
+ <View key={ii} style={{ marginLeft: 7, flexDirection: 'row' }}>
1205
+ <View style={{}}>
1206
+ <Text allowFontScaling={false} style={{ color: '#484848', fontSize: 12, fontWeight: 'bold', fontFamily: "Arial" }}>- {
1207
+ x?.list?.map((y: any) => y).join(', ')
1208
+ }</Text>
1209
+ {
1210
+ x?.ondate != "0000-00-00" &&
1211
+ <Text allowFontScaling={false} style={{ marginLeft: 7, marginBottom: 3, marginTop: 3, fontFamily: "Arial", fontSize: 12, fontStyle: "normal", letterSpacing: 0, color: '#484848' }}>{
1212
+ LibUtils.moment(x?.ondate).localeFormat('DD MMM YYYY')}</Text>
1213
+ }
1214
+ </View>
1215
+ </View>
1216
+ )
1217
+ })
1218
+ }
1219
+
1220
+
1221
+ </View>
1222
+ <View style={{ flex: 1, alignContent: 'flex-end', alignItems: 'flex-end' }}>
1223
+ <LibIcon name={item?.checked == 1 ? 'check-circle' : 'radiobox-blank'} color={colorAccent} />
1224
+ </View>
1225
+ </TouchableOpacity>
1226
+ )
1227
+ })
1228
+ }
1229
+ </ScrollView>
1127
1230
 
1128
1231
  <EventButton label={esp.lang("event/order_detail", "next")} onPress={() => {
1129
1232
  dialogQtyAddons?.current?.hide()
@@ -1153,14 +1256,9 @@ export default function m(props: EventOrder_detailProps): any {
1153
1256
  color={result?.color}
1154
1257
  onPress={() => {
1155
1258
  if (item?.hasOwnProperty('status') && item?.status == 1) {
1156
- let x = {
1157
- addons_id: item?.addons_id,
1158
- url: item?.url,
1159
- qty_left: item?.qty_left
1160
- }
1161
- setSelectedAddon(x)
1259
+ setSelectedAddon(item)
1162
1260
  dialogAddonList?.current?.hide()
1163
- dialogQtyAddons?.current?.show()
1261
+ loadDataTicket(result?.id, item?.price_id, item?.ondate)
1164
1262
  // loadDataAddons(getGroupAddon()?.addons_id, item?.url)
1165
1263
  }
1166
1264
  }}
@@ -191,7 +191,7 @@ export default function m(props: EventOrder_detail_shareProps): any {
191
191
  <LibSlidingup ref={dialogTickets} >
192
192
  <View style={{ backgroundColor: 'white', borderTopLeftRadius: 20, borderTopRightRadius: 20, padding: 15, paddingTop: 5, maxHeight: LibStyle.height - (LibStyle.height / 3) }} >
193
193
  <View style={{ alignSelf: 'center', height: 3, width: 35, backgroundColor: "#c5c5c5", borderRadius: 10 }} />
194
- <Text allowFontScaling={false} style={{ color: '#4a4a4a', fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, marginTop: 15 }}>{"Tiket akan dibagikan kepada"}</Text>
194
+ <Text allowFontScaling={false} style={{ color: '#4a4a4a', fontFamily: "Arial", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, marginTop: 15 }}>{esp.lang("event/order_detail_share", "ticket_will_share_to")}</Text>
195
195
 
196
196
  <View style={{ marginVertical: 15, flexDirection: 'row' }}>
197
197
  <LibPicture source={{ uri: dataUser?.image }} style={{ height: 40, width: 40, borderRadius: 20 }} />
@@ -201,7 +201,7 @@ export default function m(props: EventOrder_detail_shareProps): any {
201
201
  </View>
202
202
  </View>
203
203
  <ScrollView>
204
- <Text allowFontScaling={false} style={{ marginBottom: 10, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: "#000" }}>{"PILIH TIKET"}</Text>
204
+ <Text allowFontScaling={false} style={{ marginBottom: 10, fontFamily: "Arial", fontSize: 16, fontWeight: "bold", fontStyle: "normal", letterSpacing: 1.5, color: "#000" }}>{esp.lang("event/order_detail_share", "chose_ticket")}</Text>
205
205
 
206
206
  {
207
207
  dataTicket?.length > 0 && dataTicket?.map((item: any, i: number) => {
@@ -233,7 +233,7 @@ export default function m(props: EventOrder_detail_shareProps): any {
233
233
  {
234
234
  item?.addons?.length > 0 &&
235
235
  <View style={{ marginBottom: 5 }}>
236
- <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{"Addons"}</Text>
236
+ <Text allowFontScaling={false} style={{ fontFamily: "Arial", fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" }}>{esp.lang("event/order_detail", "addons")}</Text>
237
237
  </View>
238
238
  }
239
239
  {
package/id.json CHANGED
@@ -932,7 +932,7 @@
932
932
  "event/order_detail": {
933
933
  "Checked_within_10_minutes_after_payment_is_made": "Dicek dalam 10 menit setelah pembayaran dilakukan",
934
934
  "This_Event_Has_Changed_the_Event_Date_Please_Reschedule_or_Refund": "Event ini Mengalami Perubahan Tanggal Event, Silahkan Reschedule atau Melakukan Refund",
935
- "addons": "Addons",
935
+ "addons": "Pilihan Tambahan",
936
936
  "already_follow": "Sudah memilih ",
937
937
  "already_join_lucky_draw": "Pilihan sudah dibuat",
938
938
  "back": "Kembali",
@@ -1022,8 +1022,10 @@
1022
1022
  },
1023
1023
  "event/order_detail_share": {
1024
1024
  "cancel": "Batal",
1025
+ "chose_ticket": "PILIH TIKET",
1025
1026
  "select_all": "Pilih Semua",
1026
- "share_ticket": "Bagikan Tiket"
1027
+ "share_ticket": "Bagikan Tiket",
1028
+ "ticket_will_share_to": "Tiket akan dibagikan kepada"
1027
1029
  },
1028
1030
  "event/order_detail_upgrade": {
1029
1031
  "btn_next": "Selanjutnya",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esoftplay-event",
3
- "version": "0.0.2-o",
3
+ "version": "0.0.2-q",
4
4
  "description": "event module on esoftplay framework",
5
5
  "main": "index.js",
6
6
  "scripts": {