@movvjs/svelte-schedule-view 0.4.15 → 0.4.17-beta-2
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/dist/i18n/locales/en.json +2 -1
- package/dist/i18n/locales/ko.json +2 -1
- package/dist/i18n/locales/vi.json +2 -1
- package/dist/i18n/locales/zh-cn.json +2 -1
- package/dist/i18n/locales/zh-tw.json +2 -1
- package/dist/schedule-view/BookingInfo.svelte +10 -2
- package/dist/schedule-view/EmailList.svelte +33 -0
- package/dist/schedule-view/EmailList.svelte.d.ts +17 -0
- package/dist/schedule-view/Schedule.svelte +18 -2
- package/dist/schedule-view/api/booking/dto.d.ts +2 -0
- package/dist/schedule-view/api/booking/index.js +4 -4
- package/dist/schedule-view/stores/booking.d.ts +8 -0
- package/dist/schedule-view/stores/booking.js +24 -2
- package/package.json +1 -1
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
"defaultCancelButton": "Cancel",
|
|
6
6
|
"defaultTitle": "Info",
|
|
7
7
|
"error": "Error",
|
|
8
|
-
"failedToUploadFile": "Failed to upload file."
|
|
8
|
+
"failedToUploadFile": "Failed to upload file.",
|
|
9
|
+
"completed": "Your request has been completed."
|
|
9
10
|
},
|
|
10
11
|
"booking": {
|
|
11
12
|
"autoPicket": "Auto",
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
"defaultCancelButton": "Hủy",
|
|
6
6
|
"defaultTitle": "Thông tin",
|
|
7
7
|
"error": "Lỗi",
|
|
8
|
-
"failedToUploadFile": "Không thể tải tệp lên."
|
|
8
|
+
"failedToUploadFile": "Không thể tải tệp lên.",
|
|
9
|
+
"completed": "Yêu cầu của bạn đã được hoàn tất."
|
|
9
10
|
},
|
|
10
11
|
"booking": {
|
|
11
12
|
"autoPicket": "Tự động",
|
|
@@ -15,6 +15,7 @@ import PhoneNumberInput from "./PhoneNumberInput.svelte";
|
|
|
15
15
|
import FileUploader from "./FileUploader.svelte";
|
|
16
16
|
import CarSearch from "./CarSearch.svelte";
|
|
17
17
|
import Calender from "./Calender.svelte";
|
|
18
|
+
import EmailList from "./EmailList.svelte";
|
|
18
19
|
const { stdt, fullName, pax, extraServices, files, plans, isFlightService } = originalBooking;
|
|
19
20
|
const {
|
|
20
21
|
withPreserveAndPreview,
|
|
@@ -283,10 +284,17 @@ function openCalender() {
|
|
|
283
284
|
<tr>
|
|
284
285
|
<th>E-mail</th>
|
|
285
286
|
<td>
|
|
286
|
-
{#if
|
|
287
|
+
{#if $isEdit}
|
|
287
288
|
<p class="value-txt">{$originalBooking.email}</p>
|
|
289
|
+
|
|
290
|
+
{#each $originalBooking.emailList || [] as email}
|
|
291
|
+
{#if email?.trim()}
|
|
292
|
+
<p class="value-txt">{email}</p>
|
|
293
|
+
{/if}
|
|
294
|
+
{/each}
|
|
288
295
|
{:else}
|
|
289
|
-
<input bind:value={$copiedBooking.email} type="email" class="indie_text_nor xs3 white w100" placeholder="E-mail" />
|
|
296
|
+
<!-- <input bind:value={$copiedBooking.email} type="email" class="indie_text_nor xs3 white w100" placeholder="E-mail" /> -->
|
|
297
|
+
<EmailList bind:emailList={$copiedBooking.emailList} />
|
|
290
298
|
{/if}
|
|
291
299
|
</td>
|
|
292
300
|
</tr>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script>export let emailList = [""];
|
|
2
|
+
export let required = true;
|
|
3
|
+
$:
|
|
4
|
+
if (!emailList || emailList.length === 0) {
|
|
5
|
+
emailList = [""];
|
|
6
|
+
}
|
|
7
|
+
function addEmail() {
|
|
8
|
+
emailList = [...emailList, ""];
|
|
9
|
+
}
|
|
10
|
+
function removeEmail(index) {
|
|
11
|
+
if (index === 0 && required)
|
|
12
|
+
return;
|
|
13
|
+
emailList = emailList.filter((_, i) => i !== index);
|
|
14
|
+
}
|
|
15
|
+
function updateEmail(index, value) {
|
|
16
|
+
emailList[index] = value;
|
|
17
|
+
emailList = [...emailList];
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<div class="add_email_list">
|
|
22
|
+
{#each emailList as email, index}
|
|
23
|
+
<div class="item">
|
|
24
|
+
<input type="text" class="text_nor w100" placeholder="email" value={email} on:input={e => updateEmail(index, e.currentTarget.value)} />
|
|
25
|
+
|
|
26
|
+
{#if index === 0}
|
|
27
|
+
<button type="button" class="button_add" on:click={addEmail}> 추가 </button>
|
|
28
|
+
{:else}
|
|
29
|
+
<button type="button" class="button_minus" on:click={() => removeEmail(index)}> 삭제 </button>
|
|
30
|
+
{/if}
|
|
31
|
+
</div>
|
|
32
|
+
{/each}
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
emailList?: string[];
|
|
5
|
+
required?: boolean;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export type EmailListProps = typeof __propDef.props;
|
|
13
|
+
export type EmailListEvents = typeof __propDef.events;
|
|
14
|
+
export type EmailListSlots = typeof __propDef.slots;
|
|
15
|
+
export default class EmailList extends SvelteComponent<EmailListProps, EmailListEvents, EmailListSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -40,6 +40,8 @@ $:
|
|
|
40
40
|
forex = targetPrice?.new?.forex ?? "";
|
|
41
41
|
$:
|
|
42
42
|
difference = $isEdit ? $editPriceDifference : $priceDifference;
|
|
43
|
+
$:
|
|
44
|
+
HERTZ = "HERTZ";
|
|
43
45
|
export function init(options) {
|
|
44
46
|
if (!options.target)
|
|
45
47
|
throw new Error("target\uC744 \uC9C0\uC815\uD574\uC8FC\uC138\uC694.");
|
|
@@ -144,6 +146,11 @@ function open({ code }) {
|
|
|
144
146
|
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
145
147
|
} else {
|
|
146
148
|
readyView = true;
|
|
149
|
+
const mergedEmailList = [response.booking.email, ...response.booking.emailList ?? []].filter(Boolean);
|
|
150
|
+
$originalBooking = {
|
|
151
|
+
...response.booking,
|
|
152
|
+
emailList: mergedEmailList
|
|
153
|
+
};
|
|
147
154
|
$originalBooking = response.booking;
|
|
148
155
|
}
|
|
149
156
|
}
|
|
@@ -174,7 +181,10 @@ async function edit() {
|
|
|
174
181
|
$availableDestZones = await BookingAPI.searchDestinations({ type: $copiedBooking.serviceType, coordinate: $copiedBooking.dest, keyword: "" });
|
|
175
182
|
$isEdit = true;
|
|
176
183
|
} catch (e) {
|
|
177
|
-
|
|
184
|
+
if ($originalBooking?.gdsSystemCode !== HERTZ && e?.errorCode === "E-0003")
|
|
185
|
+
alert.open({ title: $t("alert.defaultTitle"), text: $t("alert.completed") });
|
|
186
|
+
else
|
|
187
|
+
alert.open({ title: $t("alert.error"), text: e.message });
|
|
178
188
|
} finally {
|
|
179
189
|
loader.hide();
|
|
180
190
|
}
|
|
@@ -190,6 +200,9 @@ async function save() {
|
|
|
190
200
|
if (!$copiedBooking.tel) {
|
|
191
201
|
throw new Error($t("error.pleaseEnterTelNumber"));
|
|
192
202
|
}
|
|
203
|
+
const cleaned = $copiedBooking.emailList.map((e) => e?.trim()).filter(Boolean);
|
|
204
|
+
$copiedBooking.email = cleaned[0] ?? "";
|
|
205
|
+
$copiedBooking.emailList = cleaned.slice(1);
|
|
193
206
|
loader.show();
|
|
194
207
|
const modifiedBooking = await BookingAPI.modify({
|
|
195
208
|
...$copiedBooking,
|
|
@@ -202,7 +215,10 @@ async function save() {
|
|
|
202
215
|
$originalBooking = modifiedBooking;
|
|
203
216
|
isEdit.set(false);
|
|
204
217
|
} catch (e) {
|
|
205
|
-
|
|
218
|
+
if ($originalBooking?.gdsSystemCode !== HERTZ && e?.errorCode === "E-0003")
|
|
219
|
+
alert.open({ title: $t("alert.defaultTitle"), text: $t("alert.completed") });
|
|
220
|
+
else
|
|
221
|
+
alert.open({ title: $t("alert.error"), text: e.message });
|
|
206
222
|
} finally {
|
|
207
223
|
loader.hide();
|
|
208
224
|
}
|
|
@@ -17,6 +17,7 @@ export type BookingViewDTO = {
|
|
|
17
17
|
tel: string;
|
|
18
18
|
countryCode: string;
|
|
19
19
|
email: string;
|
|
20
|
+
emailList: string[];
|
|
20
21
|
serviceType: BookingServiceType;
|
|
21
22
|
carInfo: CarInfo;
|
|
22
23
|
status: BookingStatus;
|
|
@@ -58,4 +59,5 @@ export type BookingViewDTO = {
|
|
|
58
59
|
};
|
|
59
60
|
carList: SearchPriceV2[];
|
|
60
61
|
psno?: string;
|
|
62
|
+
gdsSystemCode?: string;
|
|
61
63
|
};
|
|
@@ -39,7 +39,7 @@ export class BookingAPI {
|
|
|
39
39
|
if (target === 'B2B') {
|
|
40
40
|
const { data } = await axios.post('/booking/scheduleView/modifyPreview', payload);
|
|
41
41
|
if (data.mode === false) {
|
|
42
|
-
throw
|
|
42
|
+
throw data;
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
return data.data;
|
|
@@ -48,7 +48,7 @@ export class BookingAPI {
|
|
|
48
48
|
else if (target === 'FMS' || target === 'MOVV') {
|
|
49
49
|
const { data } = await axios.post('/partner/booking/modifyPreview', payload);
|
|
50
50
|
if (data.mode === false) {
|
|
51
|
-
throw
|
|
51
|
+
throw data;
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
return data.data;
|
|
@@ -63,7 +63,7 @@ export class BookingAPI {
|
|
|
63
63
|
if (target === 'B2B') {
|
|
64
64
|
const { data } = await axios.post('/booking/scheduleView/modify', payload);
|
|
65
65
|
if (data.mode === false) {
|
|
66
|
-
throw
|
|
66
|
+
throw data;
|
|
67
67
|
}
|
|
68
68
|
else {
|
|
69
69
|
return data.data;
|
|
@@ -72,7 +72,7 @@ export class BookingAPI {
|
|
|
72
72
|
else if (target === 'FMS' || target === 'MOVV') {
|
|
73
73
|
const { data } = await axios.post('/partner/booking/modify', payload);
|
|
74
74
|
if (data.mode === false) {
|
|
75
|
-
throw
|
|
75
|
+
throw data;
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
78
|
return data.data;
|
|
@@ -95,6 +95,10 @@ export declare const originalBooking: {
|
|
|
95
95
|
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
96
96
|
set(ymd: string): void;
|
|
97
97
|
};
|
|
98
|
+
emailList: {
|
|
99
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<string[]>, invalidate?: import("svelte/store").Invalidator<string[]>) => import("svelte/store").Unsubscriber;
|
|
100
|
+
set(list: string[]): void;
|
|
101
|
+
};
|
|
98
102
|
};
|
|
99
103
|
export declare const copiedBooking: {
|
|
100
104
|
subscribe: (this: void, run: import("svelte/store").Subscriber<BookingViewDTO>, invalidate?: import("svelte/store").Invalidator<BookingViewDTO>) => import("svelte/store").Unsubscriber;
|
|
@@ -190,4 +194,8 @@ export declare const copiedBooking: {
|
|
|
190
194
|
subscribe: (this: void, run: import("svelte/store").Subscriber<string>, invalidate?: import("svelte/store").Invalidator<string>) => import("svelte/store").Unsubscriber;
|
|
191
195
|
set(ymd: string): void;
|
|
192
196
|
};
|
|
197
|
+
emailList: {
|
|
198
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<string[]>, invalidate?: import("svelte/store").Invalidator<string[]>) => import("svelte/store").Unsubscriber;
|
|
199
|
+
set(list: string[]): void;
|
|
200
|
+
};
|
|
193
201
|
};
|
|
@@ -5,6 +5,8 @@ import { env } from '../../store/env';
|
|
|
5
5
|
import { BookingServiceType, BookingStatus, ExtraPoiType, ExtraServiceType, FileType } from '../types';
|
|
6
6
|
import { BookingAPI } from '../api';
|
|
7
7
|
import { loader } from '../components/loader';
|
|
8
|
+
import { alert as alertStore } from '../components/notifications';
|
|
9
|
+
import { t } from '../../i18n';
|
|
8
10
|
function createBookingStore(bookingDTO) {
|
|
9
11
|
const booking = writable(null);
|
|
10
12
|
const availableWaypointZones = writable([]);
|
|
@@ -280,6 +282,18 @@ function createBookingStore(bookingDTO) {
|
|
|
280
282
|
return !viewOnly;
|
|
281
283
|
}
|
|
282
284
|
});
|
|
285
|
+
// 이메일 리스트
|
|
286
|
+
const emailList = {
|
|
287
|
+
subscribe: derived(booking, $booking => $booking?.emailList ?? []).subscribe,
|
|
288
|
+
set(list) {
|
|
289
|
+
withPreserveAndPreview(() => {
|
|
290
|
+
booking.update($booking => {
|
|
291
|
+
$booking.emailList = list;
|
|
292
|
+
return $booking;
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
};
|
|
283
297
|
/**
|
|
284
298
|
* 예약 정보 세팅
|
|
285
299
|
* - name은 있는데, first / last가 없는 경우, name을 first로 세팅
|
|
@@ -312,8 +326,15 @@ function createBookingStore(bookingDTO) {
|
|
|
312
326
|
booking.set(modifiedBooking);
|
|
313
327
|
}
|
|
314
328
|
catch (e) {
|
|
329
|
+
console.log('modify preview error=>', e, e.response);
|
|
330
|
+
const $t = get(t);
|
|
331
|
+
const $alert = get(alertStore);
|
|
332
|
+
const $originalBooking = get(originalBooking);
|
|
333
|
+
if ($originalBooking?.gdsSystemCode !== 'HERTZ' && e?.errorCode === 'E-0003')
|
|
334
|
+
$alert.open({ title: $t('alert.defaultTitle'), text: $t('alert.completed') });
|
|
335
|
+
else
|
|
336
|
+
alert(e.message);
|
|
315
337
|
booking.set(prevEditItem);
|
|
316
|
-
alert(e.message);
|
|
317
338
|
}
|
|
318
339
|
finally {
|
|
319
340
|
loader.hide();
|
|
@@ -362,7 +383,8 @@ function createBookingStore(bookingDTO) {
|
|
|
362
383
|
isPicketService,
|
|
363
384
|
isAeroService,
|
|
364
385
|
addTime,
|
|
365
|
-
ymd
|
|
386
|
+
ymd,
|
|
387
|
+
emailList
|
|
366
388
|
};
|
|
367
389
|
}
|
|
368
390
|
export const originalBooking = createBookingStore(null);
|