esoftplay-event 0.0.0-a → 0.0.0-c
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/additional.tsx +4 -4
- package/event/additional_input.tsx +15 -15
- package/event/alert.tsx +32 -0
- package/event/artist.tsx +166 -0
- package/event/artist_detail.tsx +521 -0
- package/event/artist_detail_multi.tsx +548 -0
- package/event/badge.tsx +22 -0
- package/event/button.tsx +40 -0
- package/event/config.ts +4 -0
- package/event/countdown.tsx +5 -5
- package/event/countdown_base.tsx +83 -0
- package/event/counter_cashier.tsx +13 -13
- package/event/counter_cashier_report.tsx +6 -6
- package/event/counter_cashier_sell.tsx +7 -7
- package/event/counter_eo.tsx +21 -21
- package/event/counter_history.tsx +4 -4
- package/event/counter_lm.tsx +18 -18
- package/event/counter_report.tsx +4 -4
- package/event/counter_report_breakdown.tsx +2 -2
- package/event/counter_report_detail.tsx +15 -15
- package/event/counter_report_detail_list.tsx +4 -4
- package/event/counter_request.tsx +4 -4
- package/event/counter_request_detail.tsx +6 -6
- package/event/counter_send.tsx +9 -9
- package/event/counter_user_list.tsx +15 -15
- package/event/coupon.tsx +4 -4
- package/event/coupon_claim.tsx +4 -4
- package/event/coupon_claim_detail.tsx +8 -7
- package/event/coupon_claim_history.tsx +9 -9
- package/event/coupon_claim_reimburse.tsx +7 -8
- package/event/coupon_claim_reimburse_history.tsx +4 -4
- package/event/coupon_claim_reimburse_history_detail.tsx +4 -4
- package/event/coupon_claim_staff.tsx +10 -10
- package/event/coupon_detail.tsx +3 -3
- package/event/coupon_event_list.tsx +4 -4
- package/event/coupon_generate.tsx +4 -4
- package/event/coupon_generate_event.tsx +4 -4
- package/event/coupon_generate_list.tsx +2 -2
- package/event/date_picker.tsx +5 -5
- package/event/detail.tsx +12 -15
- package/event/entrance.tsx +17 -17
- package/event/entrance_again.tsx +22 -23
- package/event/entrance_failed.tsx +15 -15
- package/event/entrance_idcard.tsx +23 -23
- package/event/entrance_list.tsx +24 -24
- package/event/entrance_list_item.tsx +6 -6
- package/event/entrance_log.tsx +24 -24
- package/event/entrance_success.tsx +8 -8
- package/event/entrance_warning.tsx +14 -14
- package/event/exchange_reward.tsx +2 -2
- package/event/exchange_reward_result.tsx +7 -8
- package/event/exchange_ticket.tsx +11 -12
- package/event/exchange_ticket_list.tsx +10 -12
- package/event/exchange_ticket_result.tsx +11 -12
- package/event/exit.tsx +9 -9
- package/event/exit_failed.tsx +12 -12
- package/event/exit_list.tsx +15 -15
- package/event/exit_log.tsx +22 -22
- package/event/exit_success.tsx +8 -8
- package/event/exit_temporary.tsx +21 -21
- package/event/expander.tsx +36 -0
- package/event/fab.tsx +24 -0
- package/event/firebase_socket.ts +365 -0
- package/event/hall_in.tsx +13 -13
- package/event/hall_in_failed.tsx +22 -22
- package/event/hall_in_list.tsx +17 -17
- package/event/hall_in_log.tsx +24 -24
- package/event/hall_in_success.tsx +8 -8
- package/event/hall_out.tsx +13 -13
- package/event/hall_out_failed.tsx +11 -11
- package/event/hall_out_list.tsx +17 -17
- package/event/hall_out_log.tsx +24 -24
- package/event/hall_out_success.tsx +8 -8
- package/event/header.tsx +119 -0
- package/event/header_home.tsx +108 -0
- package/event/index.tsx +270 -0
- package/event/input_rectangle.tsx +208 -0
- package/event/item.tsx +40 -0
- package/event/label_input.tsx +23 -0
- package/event/list.tsx +20 -21
- package/event/list_filter.tsx +12 -13
- package/event/list_item.tsx +76 -0
- package/event/list_item2.tsx +78 -0
- package/event/loading_page.tsx +248 -0
- package/event/log.tsx +54 -54
- package/event/message.tsx +32 -0
- package/event/notice.tsx +41 -0
- package/event/order.tsx +323 -0
- package/event/order_detail.tsx +813 -0
- package/event/order_detail_payment.tsx +153 -0
- package/event/order_detail_upgrade.tsx +164 -0
- package/event/order_detail_upgrade_button.tsx +60 -0
- package/event/order_detail_upgrade_payment.tsx +221 -0
- package/event/order_detail_visitor.tsx +196 -0
- package/event/order_detail_waiting.tsx +520 -0
- package/event/order_history.tsx +101 -0
- package/event/order_item.tsx +118 -0
- package/event/order_lottery.tsx +172 -0
- package/event/order_reschedule.tsx +439 -0
- package/event/order_reschedule_list.tsx +85 -0
- package/event/order_share_to.tsx +219 -0
- package/event/order_share_to_detail.tsx +181 -0
- package/event/order_status.tsx +66 -0
- package/event/order_waiting.tsx +143 -0
- package/event/pending_trx.tsx +50 -0
- package/event/qc_idcard.tsx +12 -12
- package/event/qc_idcard_failed.tsx +4 -4
- package/event/qc_idcard_success.tsx +4 -4
- package/event/qr_bg.tsx +22 -0
- package/event/queue_out.tsx +3 -3
- package/event/queue_pricing.tsx +2 -3
- package/event/rating.tsx +49 -0
- package/event/rating_mini.tsx +35 -0
- package/event/refresh_button.tsx +40 -0
- package/event/review.tsx +3 -3
- package/event/review_add.tsx +8 -8
- package/event/review_detail.tsx +4 -4
- package/event/review_item.tsx +4 -4
- package/event/scan_item.tsx +2 -2
- package/event/schedule.tsx +8 -9
- package/event/seat.tsx +16 -18
- package/event/seat_autopick.tsx +4 -4
- package/event/seat_map.tsx +4 -4
- package/event/seat_map_test.tsx +2 -2
- package/event/section.tsx +35 -0
- package/event/section_menu.tsx +40 -0
- package/event/sheet.tsx +73 -0
- package/event/slider.tsx +46 -0
- package/event/step.tsx +29 -0
- package/event/ticket_list.tsx +15 -16
- package/event/ticket_list2.tsx +16 -17
- package/event/tms.tsx +4 -4
- package/event/tms_add.tsx +7 -8
- package/event/tms_add_result.tsx +4 -4
- package/event/tms_check_code.tsx +160 -0
- package/event/tms_check_ticket.tsx +72 -0
- package/event/tms_check_ticket_result.tsx +384 -0
- package/event/tms_dashboard.tsx +7 -7
- package/event/tms_event_list.tsx +46 -43
- package/event/tms_gate.tsx +96 -0
- package/event/tms_home.tsx +639 -0
- package/event/tms_idcard.tsx +203 -0
- package/event/tms_in.tsx +215 -0
- package/event/tms_in_again.tsx +199 -0
- package/event/tms_in_failed.tsx +190 -0
- package/event/tms_in_hall.tsx +148 -0
- package/event/tms_in_hall_failed.tsx +270 -0
- package/event/tms_in_hall_list.tsx +222 -0
- package/event/tms_in_hall_log.tsx +134 -0
- package/event/tms_in_hall_success.tsx +132 -0
- package/event/tms_in_list.tsx +264 -0
- package/event/tms_in_log.tsx +130 -0
- package/event/tms_in_success.tsx +155 -0
- package/event/tms_in_warning.tsx +91 -0
- package/event/tms_list_item.tsx +88 -0
- package/event/tms_log.tsx +435 -0
- package/event/tms_out.tsx +91 -0
- package/event/tms_out_failed.tsx +135 -0
- package/event/tms_out_hall.tsx +143 -0
- package/event/tms_out_hall_failed.tsx +133 -0
- package/event/tms_out_hall_list.tsx +215 -0
- package/event/tms_out_hall_log.tsx +133 -0
- package/event/tms_out_hall_success.tsx +130 -0
- package/event/tms_out_list.tsx +118 -0
- package/event/tms_out_log.tsx +131 -0
- package/event/tms_out_success.tsx +143 -0
- package/event/tms_out_temporary.tsx +226 -0
- package/event/toggle.tsx +30 -0
- package/event/transaction.ts +34 -0
- package/event/turnstile_event_gate.tsx +2 -2
- package/event/turnstile_event_list.tsx +4 -4
- package/event/turnstile_event_ticket.tsx +4 -4
- package/event/turnstile_settings.tsx +11 -11
- package/event/turnstile_settings_otp.tsx +4 -4
- package/event/turnstile_settings_status.tsx +2 -2
- package/event/voucher.tsx +9 -10
- package/event/voucher_multi.tsx +4 -5
- package/id.json +644 -0
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
// noPage
|
|
3
|
+
import { applyStyle } from 'esoftplay';
|
|
4
|
+
import { EventCountdown_base } from 'esoftplay/cache/event/countdown_base/import';
|
|
5
|
+
import { LibHtmltext } from 'esoftplay/cache/lib/htmltext/import';
|
|
6
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
7
|
+
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
|
|
8
|
+
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
9
|
+
import { LibUtils } from 'esoftplay/cache/lib/utils/import';
|
|
10
|
+
import esp from 'esoftplay/esp';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { Pressable, Text, View } from 'react-native';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export interface EventOrder_itemProps {
|
|
16
|
+
item: any,
|
|
17
|
+
onPress: () => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function textColor(colorTag: string) {
|
|
21
|
+
const normalized = Number(`0x${colorTag?.substr(1, 16)}`);
|
|
22
|
+
const r = (normalized >> 16) & 0xFF;
|
|
23
|
+
const g = (normalized >> 8) & 0xFF;
|
|
24
|
+
const b = normalized & 0xFF;
|
|
25
|
+
const luminocity = (0.2106 * r + 0.7171 * g + 0.0721 * b) / 255;
|
|
26
|
+
|
|
27
|
+
return luminocity < 0.6 ? '#FFFFFF' : '#000000';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function m(props: EventOrder_itemProps): any {
|
|
31
|
+
const { item } = props
|
|
32
|
+
let isInvitationDate = item?.ondate == "0000-00-00" && item?.kind_detail?.use_code == 1
|
|
33
|
+
let isOnlineWithoutDate = item?.ondate == "0000-00-00" && item?.kind_detail?.everyday_pass == 0
|
|
34
|
+
return (
|
|
35
|
+
<Pressable onPress={props.onPress} style={{ backgroundColor: '#fff', borderRadius: 5, overflow: 'hidden', width: LibStyle.width - 30, margin: 15, marginBottom: 0 }}>
|
|
36
|
+
<View style={{ alignContent: 'center', borderBottomWidth: 1, borderBottomColor: textColor(item?.color), alignItems: 'center', justifyContent: 'center', backgroundColor: item?.color, padding: 10 }}>
|
|
37
|
+
<LibHtmltext allowFontScaling={false} numberOfLines={1} ellipsizeMode="tail" style={{ color: textColor(item?.color), alignSelf: 'center', textAlign: 'center', fontSize: 16, fontWeight: 'bold' }}> {item?.price_name}</LibHtmltext>
|
|
38
|
+
</View>
|
|
39
|
+
<View style={{ padding: 10, backgroundColor: '#fff', flex: 1 }}>
|
|
40
|
+
<Text allowFontScaling={false} style={applyStyle({ marginHorizontal: 15, fontSize: 14, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#4a4a4a" })}>{item?.event_name}</Text>
|
|
41
|
+
|
|
42
|
+
<View style={applyStyle({ marginHorizontal: 15, borderBottomWidth: 1, marginTop: 15, borderBottomColor: '#9b9b9b' })}>
|
|
43
|
+
<View style={{ flexDirection: 'row', marginBottom: 10 }}>
|
|
44
|
+
<View style={applyStyle({ width: 60, height: 60, borderRadius: 5, backgroundColor: LibStyle.colorBgGrey, ...LibStyle.elevation(2) })}>
|
|
45
|
+
<LibPicture style={applyStyle({ width: 60, height: 60, resizeMode: 'cover', borderRadius: 5, })} source={{ uri: item?.image }} />
|
|
46
|
+
</View>
|
|
47
|
+
<View style={applyStyle({ flexDirection: 'row', justifyContent: 'space-between', marginLeft: 14, flex: 1 })}>
|
|
48
|
+
<View style={{ flex: 2, marginRight: 5, }}>
|
|
49
|
+
<View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', marginBottom: 4 }}>
|
|
50
|
+
<LibIcon name='ticket' size={20} color="#9b9b9b" />
|
|
51
|
+
{
|
|
52
|
+
Number(item?.qty) == 0 ?
|
|
53
|
+
<Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{esp.lang("event/order_item", "ticket_run_out")}</Text>
|
|
54
|
+
: <Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 16, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{esp.lang("event/order_item", "ticket", String(LibUtils.number(item?.qty)))}</Text>
|
|
55
|
+
}
|
|
56
|
+
</View>
|
|
57
|
+
<View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', marginBottom: 4 }}>
|
|
58
|
+
<LibIcon name='cash' size={20} color="#9b9b9b" />
|
|
59
|
+
<Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{item?.total != "0" ? LibUtils.money(Number(item?.total), item.currency) : esp.lang("event/order_item", "free")}
|
|
60
|
+
{item.hasOwnProperty("payment_title") && " (" + item.payment_title + ")"}
|
|
61
|
+
</Text>
|
|
62
|
+
</View>
|
|
63
|
+
|
|
64
|
+
{
|
|
65
|
+
item?.ondate == "0000-00-00" &&
|
|
66
|
+
<View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', marginBottom: 4 }}>
|
|
67
|
+
<LibIcon name='calendar' size={18} color="#9b9b9b" />
|
|
68
|
+
<Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{
|
|
69
|
+
(isInvitationDate || isOnlineWithoutDate) ? // apakah dia tipe undangan dengan tanggal atau online tanpa tanggal
|
|
70
|
+
esp.lang("event/order_item", "used_once") :
|
|
71
|
+
(item?.start_date == "0000-00-00" && item?.end_date == "0000-00-00") ? // apakah eventnya sudah di hapus, tau nya dari start_date dan end_datenya 0000-00-00
|
|
72
|
+
esp.lang("event/order_item", "event_arsip") :
|
|
73
|
+
LibUtils.getDateRange(item?.start_date, item?.end_date) // contoh 20 - 23 Oktober 2023
|
|
74
|
+
}</Text>
|
|
75
|
+
</View>
|
|
76
|
+
}
|
|
77
|
+
</View>
|
|
78
|
+
{
|
|
79
|
+
item?.ondate != "0000-00-00" &&
|
|
80
|
+
<View style={{ flex: 1, marginLeft: 15, alignContent: 'flex-end', alignItems: 'flex-end' }}>
|
|
81
|
+
<Text allowFontScaling={false} style={{ fontSize: 30, fontWeight: 'bold' }}>{LibUtils.moment(item?.ondate).localeFormat("DD")}</Text>
|
|
82
|
+
<Text allowFontScaling={false} style={{ fontSize: 20, fontWeight: 'bold', marginTop: -5, }}>{LibUtils.moment(item?.ondate).localeFormat("MMM")}</Text>
|
|
83
|
+
</View>
|
|
84
|
+
}
|
|
85
|
+
</View>
|
|
86
|
+
</View>
|
|
87
|
+
|
|
88
|
+
{
|
|
89
|
+
item?.address != "" &&
|
|
90
|
+
<View style={{ flexDirection: 'row', alignContent: 'center', alignItems: 'center', marginBottom: 10 }}>
|
|
91
|
+
<LibIcon name='map-marker' size={18} color="#9b9b9b" />
|
|
92
|
+
<Text allowFontScaling={false} style={applyStyle({ marginLeft: 5, fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: "#000" })}>{item?.address}</Text>
|
|
93
|
+
</View>
|
|
94
|
+
}
|
|
95
|
+
</View>
|
|
96
|
+
{
|
|
97
|
+
item?.status == 0 ?
|
|
98
|
+
<View style={applyStyle({ flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', alignContent: 'center', paddingHorizontal: 15 })}>
|
|
99
|
+
<View style={{ flex: 1 }}>
|
|
100
|
+
<EventCountdown_base expired={LibUtils.moment(item?.exp_payment).serverFormat('YYYY-MM-DD HH:mm:ss')} style={applyStyle({ fontSize: 12, color: LibStyle.colorRed, fontFamily: "ArialBold", fontWeight: "normal", fontStyle: "normal" })} />
|
|
101
|
+
</View>
|
|
102
|
+
{
|
|
103
|
+
!!item?.booking_code &&
|
|
104
|
+
<Text allowFontScaling={false} style={applyStyle({ flex: 1, flexWrap: 'wrap', padding: 10, paddingHorizontal: 0, textAlign: 'right', fontFamily: "ArialBold", fontSize: 12, fontWeight: "normal", fontStyle: "normal", letterSpacing: 0, color: LibStyle.colorRed })}>{item?.booking_code}</Text>
|
|
105
|
+
}
|
|
106
|
+
</View>
|
|
107
|
+
:
|
|
108
|
+
<Text allowFontScaling={false} style={applyStyle({ padding: 10, paddingBottom: 0, textAlign: 'center', textAlignVertical: 'center', fontFamily: "ArialBold", fontSize: 14, fontWeight: "normal", fontStyle: "normal", letterSpacing: 4, color: item?.status == 1 ? '#70472b' : LibStyle.colorRed })}>{item?.booking_code}</Text>
|
|
109
|
+
}
|
|
110
|
+
<View style={applyStyle({ flexDirection: 'row', alignItems: 'center', justifyContent: 'center', position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 })}>
|
|
111
|
+
<View style={applyStyle({ width: 25, height: 25, borderRadius: 12.5, backgroundColor: LibStyle.colorBgGrey, marginLeft: -12.5 })} />
|
|
112
|
+
<View style={applyStyle({ flex: 1 })} />
|
|
113
|
+
<View style={applyStyle({ width: 25, height: 25, borderRadius: 12.5, backgroundColor: LibStyle.colorBgGrey, marginRight: -12.5 })} />
|
|
114
|
+
</View>
|
|
115
|
+
</View>
|
|
116
|
+
</Pressable>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// withHooks
|
|
2
|
+
import { applyStyle } from 'esoftplay';
|
|
3
|
+
import { EventButton } from 'esoftplay/cache/event/button/import';
|
|
4
|
+
import { EventHeader } from 'esoftplay/cache/event/header/import';
|
|
5
|
+
import { LibCurl } from 'esoftplay/cache/lib/curl/import';
|
|
6
|
+
import { LibDialog } from 'esoftplay/cache/lib/dialog/import';
|
|
7
|
+
import { LibIcon } from 'esoftplay/cache/lib/icon/import';
|
|
8
|
+
import { LibLoading } from 'esoftplay/cache/lib/loading/import';
|
|
9
|
+
import { LibNavigation } from 'esoftplay/cache/lib/navigation/import';
|
|
10
|
+
import { LibObject } from 'esoftplay/cache/lib/object/import';
|
|
11
|
+
import { LibPicture } from 'esoftplay/cache/lib/picture/import';
|
|
12
|
+
import { LibStyle } from 'esoftplay/cache/lib/style/import';
|
|
13
|
+
import { LibToastProperty } from 'esoftplay/cache/lib/toast/import';
|
|
14
|
+
import esp from 'esoftplay/esp';
|
|
15
|
+
import useSafeState from 'esoftplay/state';
|
|
16
|
+
import { useEffect } from 'react';
|
|
17
|
+
|
|
18
|
+
import { LibProgress } from 'esoftplay/cache/lib/progress/import';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { Pressable, ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export interface EventOrder_lotteryArgs {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
export interface EventOrder_lotteryProps {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
export default function m(props: EventOrder_lotteryProps): any {
|
|
30
|
+
const { id } = LibNavigation.getArgsAll(props)
|
|
31
|
+
const [result, setResult] = useSafeState<any>()
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
loadData()
|
|
35
|
+
return () => LibNavigation.cancelBackResult(LibNavigation.getResultKey(props))
|
|
36
|
+
}, [])
|
|
37
|
+
|
|
38
|
+
function loadData(): void {
|
|
39
|
+
new LibCurl("event_order_detail_luckydraw?id=" + id, null, (res: any) => {
|
|
40
|
+
let a = res?.list?.map((item: any) => {
|
|
41
|
+
return ({
|
|
42
|
+
...item,
|
|
43
|
+
qty: 0
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
let b = {
|
|
47
|
+
coupon: res?.coupon,
|
|
48
|
+
list: a
|
|
49
|
+
}
|
|
50
|
+
setResult(b)
|
|
51
|
+
}, (error: any) => {
|
|
52
|
+
esp.log(error);
|
|
53
|
+
LibDialog.warning("Oops", error?.message)
|
|
54
|
+
LibNavigation.back()
|
|
55
|
+
}, 1)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function sendSubmit() {
|
|
59
|
+
let filterData = result?.list?.filter((x: any) => x.qty > 0).map((item: any) => {
|
|
60
|
+
return ({
|
|
61
|
+
id: item.id,
|
|
62
|
+
qty: item.qty
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
let post = {
|
|
67
|
+
prize_list: JSON.stringify(filterData)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
LibDialog.confirm(esp.lang("event/order_lottery", "confirm"), esp.lang("event/order_lottery", "confirm_point"), esp.lang("event/order_lottery", "yes"), () => {
|
|
71
|
+
LibProgress.show("Mohon tunggu")
|
|
72
|
+
new LibCurl("event_order_detail_luckydraw_claim?id=" + id, post, (res: any) => {
|
|
73
|
+
LibProgress.hide()
|
|
74
|
+
esp.log(res);
|
|
75
|
+
LibDialog.info(esp.lang("event/order_lottery", "information"), res)
|
|
76
|
+
LibNavigation.sendBackResult(res)
|
|
77
|
+
}, (error: any) => {
|
|
78
|
+
LibProgress.hide()
|
|
79
|
+
esp.log(error);
|
|
80
|
+
LibDialog.warning(esp.lang("event/order_lottery", "oops"), error?.message)
|
|
81
|
+
}, 1)
|
|
82
|
+
}, esp.lang("event/order_lottery", "no"), () => {
|
|
83
|
+
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function getTotalQty() {
|
|
88
|
+
return result.list.reduce((x: any, current: any) => x + current.qty, 0);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
function renderItem(item: any, i: number) {
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<View key={i} style={{ flexDirection: 'row', margin: 15 }}>
|
|
95
|
+
<Pressable onPress={() => { }} style={{ flex: 1, flexDirection: 'row', alignContent: 'center', alignItems: 'center', justifyContent: 'center', paddingLeft: 50, marginLeft: 35, borderRadius: 5, padding: 10, backgroundColor: '#fff' }}>
|
|
96
|
+
<View style={{ flex: 1, marginRight: 5, }}>
|
|
97
|
+
<Text allowFontScaling={false} numberOfLines={1} ellipsizeMode='tail' style={{ fontWeight: 'bold', fontSize: 16 }} >{item.title}</Text>
|
|
98
|
+
<Text allowFontScaling={false} numberOfLines={2} ellipsizeMode='tail' style={{ fontSize: 12, color: 'grey' }}>{item.description}</Text>
|
|
99
|
+
|
|
100
|
+
<View style={applyStyle({ marginTop: 10, alignSelf: 'flex-end', flexDirection: 'row', alignContent: 'center', alignItems: 'center' })}>
|
|
101
|
+
<TouchableOpacity onPressIn={() => {
|
|
102
|
+
if (item.qty > 0) {
|
|
103
|
+
let updatedList = LibObject.set(result, item.qty - 1)('list', i, 'qty');
|
|
104
|
+
setResult(updatedList);
|
|
105
|
+
}
|
|
106
|
+
}} hitSlop={{ top: 15, left: 15, right: 15, bottom: 15 }} testID='minus_btn' onPress={() => { }}>
|
|
107
|
+
<View style={applyStyle({ padding: 1, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
|
|
108
|
+
<LibIcon name="minus" color="#e74c3c" />
|
|
109
|
+
</View>
|
|
110
|
+
</TouchableOpacity>
|
|
111
|
+
<Text style={applyStyle({ fontFamily: "Arial", fontSize: 20, fontWeight: "bold", fontStyle: "normal", letterSpacing: 0, color: "#9b9b9b", marginLeft: 13, marginRight: 13 })}>{item.qty}</Text>
|
|
112
|
+
<TouchableOpacity onPressIn={() => {
|
|
113
|
+
const currentTotalQty = getTotalQty();
|
|
114
|
+
if (currentTotalQty < result.coupon) {
|
|
115
|
+
let updatedQty = item.qty + 1;
|
|
116
|
+
if (currentTotalQty + 1 > result.coupon) {
|
|
117
|
+
updatedQty = item.qty + (result.coupon - currentTotalQty);
|
|
118
|
+
}
|
|
119
|
+
let updatedList = LibObject.set(result, updatedQty)('list', i, 'qty');
|
|
120
|
+
setResult(updatedList);
|
|
121
|
+
} else {
|
|
122
|
+
LibToastProperty.show(esp.lang("event/order_lottery", "your_maks_token_is") + result?.coupon)
|
|
123
|
+
}
|
|
124
|
+
}} hitSlop={{ top: 15, left: 15, right: 15, bottom: 15 }} testID='plus_btn' onPress={() => { }}>
|
|
125
|
+
<View style={applyStyle({ padding: 1, borderRadius: 6, backgroundColor: "#ecf0f1", alignContent: 'center', alignItems: 'center' })}>
|
|
126
|
+
<LibIcon name="plus" color="#16a085" />
|
|
127
|
+
</View>
|
|
128
|
+
</TouchableOpacity>
|
|
129
|
+
</View>
|
|
130
|
+
|
|
131
|
+
</View>
|
|
132
|
+
</Pressable>
|
|
133
|
+
<View style={{ position: 'absolute', top: 15, height: 80, width: 80, borderRadius: 40, alignContent: 'center', alignItems: 'center', justifyContent: 'center', backgroundColor: '#fff' }}>
|
|
134
|
+
<LibPicture style={{ height: 70, width: 70, borderRadius: 35, backgroundColor: '#000' }} resizeMode='cover' source={{ uri: item.image }} />
|
|
135
|
+
</View>
|
|
136
|
+
</View>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (!result) {
|
|
141
|
+
return <LibLoading />
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<View style={{ flex: 1, backgroundColor: LibStyle.colorBgGrey /* "#FFC523" */ }}>
|
|
146
|
+
<EventHeader title={esp.lang("event/order_lottery", "follow_lucky_draw")} />
|
|
147
|
+
|
|
148
|
+
<ScrollView>
|
|
149
|
+
{
|
|
150
|
+
result?.list?.map(renderItem)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
</ScrollView>
|
|
154
|
+
<View style={{ backgroundColor: '#fff' }}>
|
|
155
|
+
<Text style={{ margin: 10, marginBottom: 0 }} >{esp.lang("event/order_lottery", "u_have") + result?.coupon + esp.lang("event/order_lottery", "token_for_luckydraw")}</Text>
|
|
156
|
+
|
|
157
|
+
<EventButton
|
|
158
|
+
label={esp.lang("event/order_lottery", "submit")}
|
|
159
|
+
onPress={() => {
|
|
160
|
+
if (getTotalQty() == result?.coupon) {
|
|
161
|
+
sendSubmit()
|
|
162
|
+
} else {
|
|
163
|
+
LibToastProperty.show(esp.lang("event/order_lottery", "please_enter_all_point"))
|
|
164
|
+
}
|
|
165
|
+
}}
|
|
166
|
+
style={{ margin: 10, borderRadius: 5 }}
|
|
167
|
+
backgroundColor={getTotalQty() == result?.coupon ? LibStyle.colorGreen : LibStyle.colorBgGrey}
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
170
|
+
</View>
|
|
171
|
+
)
|
|
172
|
+
}
|