@movvjs/svelte-schedule-view 0.0.1
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/README.md +26 -0
- package/dist/alert/component.svelte +23 -0
- package/dist/alert/component.svelte.d.ts +14 -0
- package/dist/alert/index.d.ts +7 -0
- package/dist/alert/index.js +20 -0
- package/dist/alert/types.d.ts +9 -0
- package/dist/alert/types.js +1 -0
- package/dist/api/booking/dto.d.ts +60 -0
- package/dist/api/booking/dto.js +1 -0
- package/dist/api/booking/index.d.ts +28 -0
- package/dist/api/booking/index.js +159 -0
- package/dist/api/common/dto.d.ts +11 -0
- package/dist/api/common/dto.js +1 -0
- package/dist/api/common/index.d.ts +18 -0
- package/dist/api/common/index.js +117 -0
- package/dist/assets/icon/dest.png +0 -0
- package/dist/assets/icon/place.png +0 -0
- package/dist/assets/icon/start.png +0 -0
- package/dist/assets/icon/transparent.png +0 -0
- package/dist/assets/scss/indie_booking.scss +4464 -0
- package/dist/axios/index.d.ts +1 -0
- package/dist/axios/index.js +71 -0
- package/dist/components/BaseSearchInput.svelte +115 -0
- package/dist/components/BaseSearchInput.svelte.d.ts +31 -0
- package/dist/components/Layout.svelte +33 -0
- package/dist/components/Layout.svelte.d.ts +17 -0
- package/dist/confirm/component.svelte +35 -0
- package/dist/confirm/component.svelte.d.ts +14 -0
- package/dist/confirm/index.d.ts +8 -0
- package/dist/confirm/index.js +32 -0
- package/dist/confirm/types.d.ts +14 -0
- package/dist/confirm/types.js +1 -0
- package/dist/constant/index.d.ts +58 -0
- package/dist/constant/index.js +58 -0
- package/dist/contents/telCodes.json +235 -0
- package/dist/dayjs/index.d.ts +11 -0
- package/dist/dayjs/index.js +30 -0
- package/dist/i18n/index.js +8 -0
- package/dist/i18n/locales/en.json +116 -0
- package/dist/i18n/locales/ko.json +92 -0
- package/dist/i18n/locales/vi.json +92 -0
- package/dist/i18n/locales/zh-cn.json +92 -0
- package/dist/i18n/locales/zh-tw.json +92 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/init.d.ts +11 -0
- package/dist/init.js +14 -0
- package/dist/loaders/component.svelte +7 -0
- package/dist/loaders/component.svelte.d.ts +16 -0
- package/dist/loaders/index.d.ts +6 -0
- package/dist/loaders/index.js +16 -0
- package/dist/schedule/BookingInfo.svelte +547 -0
- package/dist/schedule/BookingInfo.svelte.d.ts +14 -0
- package/dist/schedule/CarSearch.svelte +22 -0
- package/dist/schedule/CarSearch.svelte.d.ts +23 -0
- package/dist/schedule/FileUploader.svelte +76 -0
- package/dist/schedule/FileUploader.svelte.d.ts +23 -0
- package/dist/schedule/FlightSearch.svelte +261 -0
- package/dist/schedule/FlightSearch.svelte.d.ts +24 -0
- package/dist/schedule/Map.svelte +132 -0
- package/dist/schedule/Map.svelte.d.ts +14 -0
- package/dist/schedule/PhoneNumberInput.svelte +82 -0
- package/dist/schedule/PhoneNumberInput.svelte.d.ts +19 -0
- package/dist/schedule/PickupPointView.svelte +88 -0
- package/dist/schedule/PickupPointView.svelte.d.ts +17 -0
- package/dist/schedule/PlaceSearch.svelte +27 -0
- package/dist/schedule/PlaceSearch.svelte.d.ts +21 -0
- package/dist/schedule/Plan.svelte +175 -0
- package/dist/schedule/Plan.svelte.d.ts +14 -0
- package/dist/schedule/PlanItem.svelte +174 -0
- package/dist/schedule/PlanItem.svelte.d.ts +34 -0
- package/dist/schedule/Schedule.svelte +183 -0
- package/dist/schedule/Schedule.svelte.d.ts +45 -0
- package/dist/schedule/ServiceZone.svelte +76 -0
- package/dist/schedule/ServiceZone.svelte.d.ts +14 -0
- package/dist/schedule/ServiceZoneItem.svelte +73 -0
- package/dist/schedule/ServiceZoneItem.svelte.d.ts +33 -0
- package/dist/schedule/Translation.svelte +136 -0
- package/dist/schedule/Translation.svelte.d.ts +17 -0
- package/dist/schedule/booking.d.ts +114 -0
- package/dist/schedule/booking.js +150 -0
- package/dist/store/env.d.ts +16 -0
- package/dist/store/env.js +33 -0
- package/dist/types/booking.d.ts +88 -0
- package/dist/types/booking.js +40 -0
- package/dist/types/common.d.ts +28 -0
- package/dist/types/common.js +14 -0
- package/dist/types/file.d.ts +13 -0
- package/dist/types/file.js +5 -0
- package/dist/types/flight.d.ts +25 -0
- package/dist/types/flight.js +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/price.d.ts +18 -0
- package/dist/types/price.js +1 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.js +48 -0
- package/package.json +62 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script>import { t } from "../i18n";
|
|
2
|
+
import { BookingServiceType } from "../types";
|
|
3
|
+
import { isEdit } from "./Schedule.svelte";
|
|
4
|
+
import ServiceZoneItem from "./ServiceZoneItem.svelte";
|
|
5
|
+
import { copiedBooking, originalBooking } from "./booking";
|
|
6
|
+
const { isWaypointService, serviceZone } = originalBooking;
|
|
7
|
+
const { serviceZone: editServiceZone, availableDestZones, availableWaypointZones, withPreserveAndPreview } = copiedBooking;
|
|
8
|
+
function addServiceZoneWaypoint(code) {
|
|
9
|
+
withPreserveAndPreview(() => {
|
|
10
|
+
const findWaypoint = $availableWaypointZones.find((w) => w.code === code);
|
|
11
|
+
$copiedBooking.wayPoints = [...$copiedBooking.wayPoints, findWaypoint];
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function removeServiceZoneWaypoint(code) {
|
|
15
|
+
withPreserveAndPreview(() => {
|
|
16
|
+
$copiedBooking.wayPoints = $copiedBooking.wayPoints.filter((w) => w.code !== code);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function changeServiceZoneDest(code) {
|
|
20
|
+
withPreserveAndPreview(() => {
|
|
21
|
+
const findZone = $availableDestZones.find((z) => z.code === code);
|
|
22
|
+
$copiedBooking.serviceZone = $copiedBooking.serviceZone.map((z) => z.type === "DEST" ? { ...findZone, type: "DEST" } : z);
|
|
23
|
+
$copiedBooking.dest = findZone;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<div class="serviceZone">
|
|
29
|
+
<h3>{$t('booking.serviceZone')}</h3>
|
|
30
|
+
<div class="list_box">
|
|
31
|
+
<ul class="indie_schedule_drag_list service">
|
|
32
|
+
<ServiceZoneItem
|
|
33
|
+
start
|
|
34
|
+
{...{
|
|
35
|
+
headerTitle: $t('booking.pickUpZone'),
|
|
36
|
+
title: $serviceZone.origin?.title
|
|
37
|
+
}} />
|
|
38
|
+
|
|
39
|
+
{#if $isWaypointService}
|
|
40
|
+
{#if !$isEdit}
|
|
41
|
+
{#if $serviceZone.waypoints.length > 0}
|
|
42
|
+
<ServiceZoneItem
|
|
43
|
+
waypoint
|
|
44
|
+
{...{
|
|
45
|
+
headerTitle: $t('booking.waypointZone'),
|
|
46
|
+
waypoints: $serviceZone.waypoints
|
|
47
|
+
}} />
|
|
48
|
+
{/if}
|
|
49
|
+
{:else}
|
|
50
|
+
<ServiceZoneItem
|
|
51
|
+
edit
|
|
52
|
+
waypoint
|
|
53
|
+
on:selectZone={({ detail: code }) => addServiceZoneWaypoint(code)}
|
|
54
|
+
on:removeWaypoint={({ detail: code }) => removeServiceZoneWaypoint(code)}
|
|
55
|
+
{...{
|
|
56
|
+
headerTitle: $t('booking.waypointZone'),
|
|
57
|
+
waypoints: $editServiceZone.waypoints,
|
|
58
|
+
selectableZones: $availableWaypointZones
|
|
59
|
+
}} />
|
|
60
|
+
{/if}
|
|
61
|
+
{/if}
|
|
62
|
+
|
|
63
|
+
{#if !$isEdit || $copiedBooking.serviceType === BookingServiceType.pickup || $copiedBooking.serviceType === BookingServiceType.sending}
|
|
64
|
+
<ServiceZoneItem end headerTitle={$t('booking.dropOffZone')} title={$serviceZone.dest?.title} />
|
|
65
|
+
{:else}
|
|
66
|
+
<ServiceZoneItem
|
|
67
|
+
end
|
|
68
|
+
edit
|
|
69
|
+
on:selectZone={({ detail: code }) => changeServiceZoneDest(code)}
|
|
70
|
+
headerTitle={$t('booking.dropOffZone')}
|
|
71
|
+
selected={$editServiceZone.dest?.code}
|
|
72
|
+
selectableZones={$availableDestZones} />
|
|
73
|
+
{/if}
|
|
74
|
+
</ul>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type ServiceZoneProps = typeof __propDef.props;
|
|
10
|
+
export type ServiceZoneEvents = typeof __propDef.events;
|
|
11
|
+
export type ServiceZoneSlots = typeof __propDef.slots;
|
|
12
|
+
export default class ServiceZone extends SvelteComponent<ServiceZoneProps, ServiceZoneEvents, ServiceZoneSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script>import { t } from "../i18n";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
const dispatch = createEventDispatcher();
|
|
4
|
+
export let edit = false;
|
|
5
|
+
export let headerTitle;
|
|
6
|
+
export let start = false;
|
|
7
|
+
export let end = false;
|
|
8
|
+
export let title = "";
|
|
9
|
+
export let waypoint = false;
|
|
10
|
+
export let waypoints = [];
|
|
11
|
+
export let selected = null;
|
|
12
|
+
export let selectableZones = [];
|
|
13
|
+
function onSelectZone(e) {
|
|
14
|
+
const code = e.target.value;
|
|
15
|
+
if (!code)
|
|
16
|
+
return;
|
|
17
|
+
dispatch("selectZone", code);
|
|
18
|
+
e.target.value = null;
|
|
19
|
+
}
|
|
20
|
+
function onRemoveWaypoint(code) {
|
|
21
|
+
dispatch("removeWaypoint", code);
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if start || end}
|
|
26
|
+
<li class:start class:end>
|
|
27
|
+
<span class="dot_txt" />
|
|
28
|
+
<div class="service_data">
|
|
29
|
+
<p class="sbj">{headerTitle}</p>
|
|
30
|
+
{#if edit}
|
|
31
|
+
<select value={selected} class="indie_select_nor xs3 black-color w100 mgb5" on:input={onSelectZone}>
|
|
32
|
+
{#each selectableZones as zone}
|
|
33
|
+
<option value={zone.code}>{zone.title}</option>
|
|
34
|
+
{:else}
|
|
35
|
+
<option value={null}>{$t('booking.noZonesAreAvailableToSelect')}</option>
|
|
36
|
+
{/each}
|
|
37
|
+
</select>
|
|
38
|
+
{:else}
|
|
39
|
+
<p class="city">{title}</p>
|
|
40
|
+
{/if}
|
|
41
|
+
</div>
|
|
42
|
+
</li>
|
|
43
|
+
{:else if waypoint}
|
|
44
|
+
<li>
|
|
45
|
+
<span class="dot_txt" />
|
|
46
|
+
<div class="service_data">
|
|
47
|
+
<p class="sbj">{headerTitle}</p>
|
|
48
|
+
<!-- * 경유지 추가 -->
|
|
49
|
+
{#if edit}
|
|
50
|
+
<select value={null} class="indie_select_nor xs3 black-color w100 mgb5" on:input={onSelectZone}>
|
|
51
|
+
<option value={null}>{$t('booking.selectWaypoint')}</option>
|
|
52
|
+
{#each selectableZones as zone}
|
|
53
|
+
{@const disabled = waypoints.findIndex(w => w.code === zone.code) > -1}
|
|
54
|
+
<option {disabled} value={zone.code}>{zone.title}</option>
|
|
55
|
+
{/each}
|
|
56
|
+
</select>
|
|
57
|
+
{/if}
|
|
58
|
+
|
|
59
|
+
<div class="city_gather">
|
|
60
|
+
{#each waypoints as item}
|
|
61
|
+
{#if edit}
|
|
62
|
+
<p class="indie_tag_close round w100">
|
|
63
|
+
<span>{item.title}</span>
|
|
64
|
+
<a href={null} class="indie_btn_close_sm" on:click={() => onRemoveWaypoint(item.code)}>닫기</a>
|
|
65
|
+
</p>
|
|
66
|
+
{:else}
|
|
67
|
+
<p class="indie_tag_round gray">{item.title}</p>
|
|
68
|
+
{/if}
|
|
69
|
+
{/each}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</li>
|
|
73
|
+
{/if}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
edit?: boolean;
|
|
5
|
+
headerTitle: string;
|
|
6
|
+
start?: boolean;
|
|
7
|
+
end?: boolean;
|
|
8
|
+
title?: string;
|
|
9
|
+
waypoint?: boolean;
|
|
10
|
+
waypoints?: {
|
|
11
|
+
title: string;
|
|
12
|
+
code?: string;
|
|
13
|
+
}[];
|
|
14
|
+
selected?: string;
|
|
15
|
+
selectableZones?: {
|
|
16
|
+
title: string;
|
|
17
|
+
code?: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
selectZone: CustomEvent<any>;
|
|
22
|
+
removeWaypoint: CustomEvent<any>;
|
|
23
|
+
} & {
|
|
24
|
+
[evt: string]: CustomEvent<any>;
|
|
25
|
+
};
|
|
26
|
+
slots: {};
|
|
27
|
+
};
|
|
28
|
+
export type ServiceZoneItemProps = typeof __propDef.props;
|
|
29
|
+
export type ServiceZoneItemEvents = typeof __propDef.events;
|
|
30
|
+
export type ServiceZoneItemSlots = typeof __propDef.slots;
|
|
31
|
+
export default class ServiceZoneItem extends SvelteComponent<ServiceZoneItemProps, ServiceZoneItemEvents, ServiceZoneItemSlots> {
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script>import { alert } from "../alert";
|
|
2
|
+
import { CommonAPI } from "../api/common";
|
|
3
|
+
import { t } from "../i18n";
|
|
4
|
+
import { TranslateLanguage } from "../types";
|
|
5
|
+
import { sortBy } from "lodash-es";
|
|
6
|
+
let text = "";
|
|
7
|
+
let on = false;
|
|
8
|
+
let sourceLanguage = null;
|
|
9
|
+
let targetLanguage = null;
|
|
10
|
+
let result = "";
|
|
11
|
+
let loading = false;
|
|
12
|
+
const languages = sortBy(
|
|
13
|
+
[
|
|
14
|
+
{ value: TranslateLanguage.korean, label: "Korean" },
|
|
15
|
+
{ value: TranslateLanguage.english, label: "English" },
|
|
16
|
+
{ value: TranslateLanguage.japanese, label: "Japanese" },
|
|
17
|
+
{ value: TranslateLanguage.chinese_simplified, label: "Chinese (Simplified)" },
|
|
18
|
+
{ value: TranslateLanguage.chinese_traditional, label: "Chinese (Traditional)" },
|
|
19
|
+
{ value: TranslateLanguage.vietnamese, label: "Vietnamese" }
|
|
20
|
+
],
|
|
21
|
+
["label"]
|
|
22
|
+
);
|
|
23
|
+
$:
|
|
24
|
+
sourceText = sourceLanguage ? languages.find((item) => item.value === sourceLanguage).label : $t("translate.setSourceLanguage");
|
|
25
|
+
$:
|
|
26
|
+
targetText = targetLanguage ? languages.find((item) => item.value === targetLanguage).label : $t("translate.setTargetLanguage");
|
|
27
|
+
$:
|
|
28
|
+
isTranslatable = sourceLanguage && targetLanguage && sourceLanguage !== targetLanguage;
|
|
29
|
+
export function open(originText) {
|
|
30
|
+
text = originText;
|
|
31
|
+
on = true;
|
|
32
|
+
}
|
|
33
|
+
function close() {
|
|
34
|
+
on = false;
|
|
35
|
+
}
|
|
36
|
+
async function translate() {
|
|
37
|
+
const { isValid, message } = validation();
|
|
38
|
+
if (!isValid) {
|
|
39
|
+
alert.open({ text: message });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
loading = true;
|
|
44
|
+
result = await CommonAPI.translate(sourceLanguage, targetLanguage, text);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
alert.open({ text: e.message });
|
|
47
|
+
} finally {
|
|
48
|
+
loading = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function validation() {
|
|
52
|
+
if (!sourceLanguage)
|
|
53
|
+
return { isValid: false, message: $t("translage.pleaseSelectSourceLanguage") };
|
|
54
|
+
if (!targetLanguage)
|
|
55
|
+
return { isValid: false, message: $t("translate.pleaseSelectTargetLanguage") };
|
|
56
|
+
if (sourceLanguage === targetLanguage)
|
|
57
|
+
return { isValid: false, message: $t("translate.pleaseSelectDifferentLanguage") };
|
|
58
|
+
return { isValid: true };
|
|
59
|
+
}
|
|
60
|
+
function toggleLanguageSelectPop(id) {
|
|
61
|
+
document.getElementById(id).classList.toggle("on");
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<section class="indie_pop_wrap" class:on>
|
|
66
|
+
<div class="pop_base translate">
|
|
67
|
+
{#if on}
|
|
68
|
+
<div class="top_box">
|
|
69
|
+
<h3>{$t('booking.translate')}</h3>
|
|
70
|
+
<button type="button" class="btn_close" on:click={() => close()}>닫기</button>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="contents">
|
|
74
|
+
<section class="indie_booking_new_translation">
|
|
75
|
+
<div class="start_lang">
|
|
76
|
+
<div class="select_lan_box">
|
|
77
|
+
<!-- 클릭 시 - 클래스 on 추가 -->
|
|
78
|
+
<a id="source_pop" class="a_btn_select" on:click={() => toggleLanguageSelectPop('source_pop')}>{sourceText}</a>
|
|
79
|
+
<div class="pop_lang_select">
|
|
80
|
+
<div class="language_wrap">
|
|
81
|
+
{#each languages as item}
|
|
82
|
+
<span>
|
|
83
|
+
<input
|
|
84
|
+
value={item.value}
|
|
85
|
+
bind:group={sourceLanguage}
|
|
86
|
+
type="radio"
|
|
87
|
+
class="radio_ch"
|
|
88
|
+
id="ch_start_{item.value}"
|
|
89
|
+
on:click={() => toggleLanguageSelectPop('source_pop')} />
|
|
90
|
+
<label for="ch_start_{item.value}">{item.label}</label>
|
|
91
|
+
</span>
|
|
92
|
+
{/each}
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="text_box">
|
|
97
|
+
<p>{text}</p>
|
|
98
|
+
</div>
|
|
99
|
+
<!-- 출발 언어 선택을 하지 않으면 disabled 해주세요 -->
|
|
100
|
+
<button type="button" class="btn_trans" disabled={!isTranslatable} on:click={() => translate()}>{$t('booking.translate')}</button>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<!-- 클래스 loading 추가 시 - 로딩화면 표시 -->
|
|
104
|
+
<div class="trans_lang" class:loading>
|
|
105
|
+
<div class="select_lan_box">
|
|
106
|
+
<!-- 클릭 시 - 클래스 on 추가 -->
|
|
107
|
+
<a id="target_pop" class="a_btn_select" on:click={() => toggleLanguageSelectPop('target_pop')}>{targetText}</a>
|
|
108
|
+
<div class="pop_lang_select">
|
|
109
|
+
<div class="language_wrap">
|
|
110
|
+
{#each languages as item}
|
|
111
|
+
<span>
|
|
112
|
+
<input
|
|
113
|
+
value={item.value}
|
|
114
|
+
bind:group={targetLanguage}
|
|
115
|
+
type="radio"
|
|
116
|
+
class="radio_ch"
|
|
117
|
+
id="ch_target_{item.value}"
|
|
118
|
+
on:click={() => toggleLanguageSelectPop('target_pop')} />
|
|
119
|
+
<label for="ch_target_{item.value}">{item.label}</label>
|
|
120
|
+
</span>
|
|
121
|
+
{/each}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
<div class="loading_box">
|
|
126
|
+
<p class="indie_loading_dots gray" />
|
|
127
|
+
</div>
|
|
128
|
+
<div class="text_box">
|
|
129
|
+
<p>{@html result}</p>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</section>
|
|
133
|
+
</div>
|
|
134
|
+
{/if}
|
|
135
|
+
</div>
|
|
136
|
+
</section>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
open?: (originText: string) => void;
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
};
|
|
9
|
+
slots: {};
|
|
10
|
+
};
|
|
11
|
+
export type TranslationProps = typeof __propDef.props;
|
|
12
|
+
export type TranslationEvents = typeof __propDef.events;
|
|
13
|
+
export type TranslationSlots = typeof __propDef.slots;
|
|
14
|
+
export default class Translation extends SvelteComponent<TranslationProps, TranslationEvents, TranslationSlots> {
|
|
15
|
+
get open(): (originText: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import { ExtraServiceType, type SearchPriceV2 } from '../types';
|
|
3
|
+
export declare const originalBooking: {
|
|
4
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<import("../api/booking/dto").BookingViewDTO>, invalidate?: import("svelte/store").Invalidator<import("../api/booking/dto").BookingViewDTO>) => import("svelte/store").Unsubscriber;
|
|
5
|
+
set: (this: void, value: import("../api/booking/dto").BookingViewDTO) => void;
|
|
6
|
+
update: (this: void, updater: import("svelte/store").Updater<import("../api/booking/dto").BookingViewDTO>) => void;
|
|
7
|
+
withPreserveAndPreview: (modifying: Function) => Promise<void>;
|
|
8
|
+
stdt: import("svelte/store").Readable<string>;
|
|
9
|
+
serviceZone: import("svelte/store").Readable<{
|
|
10
|
+
origin: import("../types").BookingServiceZone;
|
|
11
|
+
dest: import("../types").BookingServiceZone;
|
|
12
|
+
waypoints: import("../types").BookingLocation[];
|
|
13
|
+
}>;
|
|
14
|
+
isWaypointService: import("svelte/store").Readable<boolean>;
|
|
15
|
+
plans: import("svelte/store").Readable<{
|
|
16
|
+
origin: import("../types").BookingLocation | import("../types").ExtraPoi;
|
|
17
|
+
waypoints: import("../types").BookingLocation[];
|
|
18
|
+
dest: import("../types").BookingLocation | import("../types").ExtraPoi;
|
|
19
|
+
}>;
|
|
20
|
+
pickupService: import("svelte/store").Readable<import("../types").ExtraPoi>;
|
|
21
|
+
availablePickupService: import("svelte/store").Readable<import("../types").ExtraPoi[]>;
|
|
22
|
+
dropOffService: import("svelte/store").Readable<import("../types").ExtraPoi>;
|
|
23
|
+
availableDropOffService: import("svelte/store").Readable<import("../types").ExtraPoi[]>;
|
|
24
|
+
isPickupPoint: import("svelte/store").Readable<boolean>;
|
|
25
|
+
fullName: import("svelte/store").Readable<string>;
|
|
26
|
+
pax: import("svelte/store").Readable<number>;
|
|
27
|
+
files: import("svelte/store").Readable<import("../types").UploadFile[]>;
|
|
28
|
+
defaultFiles: import("svelte/store").Readable<import("../types").UploadFile[]>;
|
|
29
|
+
picketFiles: import("svelte/store").Readable<import("../types").UploadFile[]>;
|
|
30
|
+
isAutoPicketFile: import("svelte/store").Readable<boolean>;
|
|
31
|
+
extraServices: import("svelte/store").Readable<import("../types").BookingExtraService[]>;
|
|
32
|
+
availableExtraServices: import("svelte/store").Readable<{
|
|
33
|
+
type: ExtraServiceType;
|
|
34
|
+
price: number;
|
|
35
|
+
file: import("../types").UploadFile[];
|
|
36
|
+
}[]>;
|
|
37
|
+
isPicketServiceSelected: import("svelte/store").Readable<boolean>;
|
|
38
|
+
isBabySeatServiceAvailable: import("svelte/store").Readable<boolean>;
|
|
39
|
+
isPicketServiceAvailable: import("svelte/store").Readable<boolean>;
|
|
40
|
+
price: import("svelte/store").Readable<{
|
|
41
|
+
before: {
|
|
42
|
+
amount: number;
|
|
43
|
+
forex: import("../types").Currency;
|
|
44
|
+
};
|
|
45
|
+
new: {
|
|
46
|
+
amount: number;
|
|
47
|
+
forex: import("../types").Currency;
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
50
|
+
coordinates: import("svelte/store").Readable<(import("../types").BookingLocation | import("../types").ExtraPoi)[]>;
|
|
51
|
+
availableWaypointZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
|
|
52
|
+
availableDestZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
|
|
53
|
+
hour: import("svelte/store").Readable<number>;
|
|
54
|
+
minute: import("svelte/store").Readable<number>;
|
|
55
|
+
telCountryCode: import("svelte/store").Readable<string>;
|
|
56
|
+
telNumber: import("svelte/store").Readable<string>;
|
|
57
|
+
selectedPrice: import("svelte/store").Writable<SearchPriceV2>;
|
|
58
|
+
};
|
|
59
|
+
export declare const copiedBooking: {
|
|
60
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<import("../api/booking/dto").BookingViewDTO>, invalidate?: import("svelte/store").Invalidator<import("../api/booking/dto").BookingViewDTO>) => import("svelte/store").Unsubscriber;
|
|
61
|
+
set: (this: void, value: import("../api/booking/dto").BookingViewDTO) => void;
|
|
62
|
+
update: (this: void, updater: import("svelte/store").Updater<import("../api/booking/dto").BookingViewDTO>) => void;
|
|
63
|
+
withPreserveAndPreview: (modifying: Function) => Promise<void>;
|
|
64
|
+
stdt: import("svelte/store").Readable<string>;
|
|
65
|
+
serviceZone: import("svelte/store").Readable<{
|
|
66
|
+
origin: import("../types").BookingServiceZone;
|
|
67
|
+
dest: import("../types").BookingServiceZone;
|
|
68
|
+
waypoints: import("../types").BookingLocation[];
|
|
69
|
+
}>;
|
|
70
|
+
isWaypointService: import("svelte/store").Readable<boolean>;
|
|
71
|
+
plans: import("svelte/store").Readable<{
|
|
72
|
+
origin: import("../types").BookingLocation | import("../types").ExtraPoi;
|
|
73
|
+
waypoints: import("../types").BookingLocation[];
|
|
74
|
+
dest: import("../types").BookingLocation | import("../types").ExtraPoi;
|
|
75
|
+
}>;
|
|
76
|
+
pickupService: import("svelte/store").Readable<import("../types").ExtraPoi>;
|
|
77
|
+
availablePickupService: import("svelte/store").Readable<import("../types").ExtraPoi[]>;
|
|
78
|
+
dropOffService: import("svelte/store").Readable<import("../types").ExtraPoi>;
|
|
79
|
+
availableDropOffService: import("svelte/store").Readable<import("../types").ExtraPoi[]>;
|
|
80
|
+
isPickupPoint: import("svelte/store").Readable<boolean>;
|
|
81
|
+
fullName: import("svelte/store").Readable<string>;
|
|
82
|
+
pax: import("svelte/store").Readable<number>;
|
|
83
|
+
files: import("svelte/store").Readable<import("../types").UploadFile[]>;
|
|
84
|
+
defaultFiles: import("svelte/store").Readable<import("../types").UploadFile[]>;
|
|
85
|
+
picketFiles: import("svelte/store").Readable<import("../types").UploadFile[]>;
|
|
86
|
+
isAutoPicketFile: import("svelte/store").Readable<boolean>;
|
|
87
|
+
extraServices: import("svelte/store").Readable<import("../types").BookingExtraService[]>;
|
|
88
|
+
availableExtraServices: import("svelte/store").Readable<{
|
|
89
|
+
type: ExtraServiceType;
|
|
90
|
+
price: number;
|
|
91
|
+
file: import("../types").UploadFile[];
|
|
92
|
+
}[]>;
|
|
93
|
+
isPicketServiceSelected: import("svelte/store").Readable<boolean>;
|
|
94
|
+
isBabySeatServiceAvailable: import("svelte/store").Readable<boolean>;
|
|
95
|
+
isPicketServiceAvailable: import("svelte/store").Readable<boolean>;
|
|
96
|
+
price: import("svelte/store").Readable<{
|
|
97
|
+
before: {
|
|
98
|
+
amount: number;
|
|
99
|
+
forex: import("../types").Currency;
|
|
100
|
+
};
|
|
101
|
+
new: {
|
|
102
|
+
amount: number;
|
|
103
|
+
forex: import("../types").Currency;
|
|
104
|
+
};
|
|
105
|
+
}>;
|
|
106
|
+
coordinates: import("svelte/store").Readable<(import("../types").BookingLocation | import("../types").ExtraPoi)[]>;
|
|
107
|
+
availableWaypointZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
|
|
108
|
+
availableDestZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
|
|
109
|
+
hour: import("svelte/store").Readable<number>;
|
|
110
|
+
minute: import("svelte/store").Readable<number>;
|
|
111
|
+
telCountryCode: import("svelte/store").Readable<string>;
|
|
112
|
+
telNumber: import("svelte/store").Readable<string>;
|
|
113
|
+
selectedPrice: import("svelte/store").Writable<SearchPriceV2>;
|
|
114
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { BookingAPI } from '../api/booking';
|
|
2
|
+
import { dayjs } from '../dayjs';
|
|
3
|
+
import { loaders } from '../loaders';
|
|
4
|
+
import { BookingServiceType, ExtraServiceType, FileType } from '../types';
|
|
5
|
+
import { cloneDeep } from 'lodash-es';
|
|
6
|
+
import { derived, get, writable } from 'svelte/store';
|
|
7
|
+
function createBookingStore(bookingDTO) {
|
|
8
|
+
const booking = writable(null);
|
|
9
|
+
const availableWaypointZones = writable([]);
|
|
10
|
+
const availableDestZones = writable([]);
|
|
11
|
+
const selectedPrice = writable(null);
|
|
12
|
+
const stdt = derived(booking, $booking => $booking?.ymd);
|
|
13
|
+
const hour = derived(stdt, $stdt => dayjs($stdt).hour());
|
|
14
|
+
const minute = derived(stdt, $stdt => dayjs($stdt).minute());
|
|
15
|
+
const pax = derived(booking, $booking => {
|
|
16
|
+
return ($booking?.person?.adult ?? 0) + ($booking?.person?.child ?? 0);
|
|
17
|
+
});
|
|
18
|
+
const isPickupPoint = derived(booking, $booking => !!$booking?.ppno);
|
|
19
|
+
const fullName = derived(booking, $booking => `${$booking?.firstName ?? ''} ${$booking?.lastName ?? ''}`);
|
|
20
|
+
const telCountryCode = derived(booking, $booking => {
|
|
21
|
+
if (!$booking?.tel)
|
|
22
|
+
return null;
|
|
23
|
+
const splitted = $booking.tel.split(' ');
|
|
24
|
+
return splitted.find(tel => tel.startsWith('+')) ?? null;
|
|
25
|
+
});
|
|
26
|
+
const telNumber = derived(booking, $booking => {
|
|
27
|
+
if (!$booking?.tel)
|
|
28
|
+
return null;
|
|
29
|
+
const splitted = $booking.tel.split(' ').filter(tel => !tel.startsWith('+'));
|
|
30
|
+
return splitted.join('');
|
|
31
|
+
});
|
|
32
|
+
const serviceZone = derived(booking, $booking => ({
|
|
33
|
+
origin: $booking?.serviceZone?.find(zone => zone.type === 'ORIGIN') ?? null,
|
|
34
|
+
dest: $booking?.serviceZone?.find(zone => zone.type === 'DEST') ?? null,
|
|
35
|
+
waypoints: $booking?.wayPoints?.filter(zone => !!zone.code) ?? []
|
|
36
|
+
}));
|
|
37
|
+
const plans = derived(booking, $booking => ({
|
|
38
|
+
origin: (() => {
|
|
39
|
+
const findService = $booking?.extraPoi?.find(poi => poi.type === 'PICKUP');
|
|
40
|
+
if (findService)
|
|
41
|
+
return findService;
|
|
42
|
+
return $booking?.origin;
|
|
43
|
+
})(),
|
|
44
|
+
waypoints: $booking?.wayPoints.filter(waypoint => !waypoint.code) ?? [],
|
|
45
|
+
dest: (() => {
|
|
46
|
+
const findService = $booking?.extraPoi?.find(poi => poi.type === 'DROPOFF');
|
|
47
|
+
if (findService)
|
|
48
|
+
return findService;
|
|
49
|
+
return $booking?.dest;
|
|
50
|
+
})()
|
|
51
|
+
}));
|
|
52
|
+
const coordinates = derived([booking, plans], ([$booking, $plans]) => {
|
|
53
|
+
return !$booking ? [] : [$plans.origin, ...$plans.waypoints, $plans.dest];
|
|
54
|
+
});
|
|
55
|
+
const files = derived(booking, $booking => $booking?.files ?? []);
|
|
56
|
+
const defaultFiles = derived(booking, $booking => $booking?.files.filter(file => file.type === FileType.default) ?? []);
|
|
57
|
+
const picketFiles = derived(booking, $booking => $booking?.files.filter(file => file.type === FileType.picket) ?? []);
|
|
58
|
+
const isAutoPicketFile = derived(picketFiles, $picketFiles => $picketFiles.some(file => file.auto));
|
|
59
|
+
const isWaypointService = derived(booking, $booking => $booking?.serviceType === BookingServiceType.oneWay || $booking?.serviceType === BookingServiceType.day);
|
|
60
|
+
const pickupService = derived(booking, $booking => $booking?.extraPoi?.find(poi => poi.type === 'PICKUP') ?? null);
|
|
61
|
+
const availablePickupService = derived(booking, $booking => $booking?.defaultExtraPoi?.pickup ?? []);
|
|
62
|
+
const dropOffService = derived(booking, $booking => $booking?.extraPoi?.find(poi => poi.type === 'DROPOFF') ?? null);
|
|
63
|
+
const availableDropOffService = derived(booking, $booking => $booking?.defaultExtraPoi?.sending ?? []);
|
|
64
|
+
const extraServices = derived(booking, $booking => $booking?.extra ?? []);
|
|
65
|
+
const availableExtraServices = derived(booking, $booking => $booking?.defaultExtra ?? []);
|
|
66
|
+
const isPicketServiceSelected = derived(extraServices, $extraServices => $extraServices.some(extra => extra.type === ExtraServiceType.picket));
|
|
67
|
+
const isBabySeatServiceAvailable = derived(availableExtraServices, $availableExtraServices => $availableExtraServices.some(extra => extra.type === ExtraServiceType.baby));
|
|
68
|
+
const isPicketServiceAvailable = derived(availableExtraServices, $availableExtraServices => $availableExtraServices.some(extra => extra.type === ExtraServiceType.picket));
|
|
69
|
+
const price = derived(booking, $booking => {
|
|
70
|
+
return {
|
|
71
|
+
before: !$booking?.price
|
|
72
|
+
? null
|
|
73
|
+
: {
|
|
74
|
+
amount: (() => {
|
|
75
|
+
const price = $booking.price;
|
|
76
|
+
const additionalPrice = $booking.addPrice;
|
|
77
|
+
return price + additionalPrice;
|
|
78
|
+
})(),
|
|
79
|
+
forex: $booking.forex
|
|
80
|
+
},
|
|
81
|
+
new: !$booking?.newPrice
|
|
82
|
+
? null
|
|
83
|
+
: {
|
|
84
|
+
amount: (() => {
|
|
85
|
+
const price = $booking.newPrice;
|
|
86
|
+
const additionalPrice = $booking.addNewPrice;
|
|
87
|
+
return price + additionalPrice;
|
|
88
|
+
})(),
|
|
89
|
+
forex: $booking.forex
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
async function withPreserveAndPreview(modifying) {
|
|
94
|
+
const prevEditItem = cloneDeep(get(booking));
|
|
95
|
+
try {
|
|
96
|
+
loaders.show();
|
|
97
|
+
if (typeof modifying === 'function')
|
|
98
|
+
modifying();
|
|
99
|
+
const modifiedBooking = await BookingAPI.modifyPreview({
|
|
100
|
+
...get(booking),
|
|
101
|
+
...(get(selectedPrice) ? { psno: get(selectedPrice).psno } : {})
|
|
102
|
+
});
|
|
103
|
+
booking.set(modifiedBooking);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
booking.set(prevEditItem);
|
|
107
|
+
alert(e.message);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
loaders.hide();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
subscribe: booking.subscribe,
|
|
115
|
+
set: booking.set,
|
|
116
|
+
update: booking.update,
|
|
117
|
+
withPreserveAndPreview,
|
|
118
|
+
stdt,
|
|
119
|
+
serviceZone,
|
|
120
|
+
isWaypointService,
|
|
121
|
+
plans,
|
|
122
|
+
pickupService,
|
|
123
|
+
availablePickupService,
|
|
124
|
+
dropOffService,
|
|
125
|
+
availableDropOffService,
|
|
126
|
+
isPickupPoint,
|
|
127
|
+
fullName,
|
|
128
|
+
pax,
|
|
129
|
+
files,
|
|
130
|
+
defaultFiles,
|
|
131
|
+
picketFiles,
|
|
132
|
+
isAutoPicketFile,
|
|
133
|
+
extraServices,
|
|
134
|
+
availableExtraServices,
|
|
135
|
+
isPicketServiceSelected,
|
|
136
|
+
isBabySeatServiceAvailable,
|
|
137
|
+
isPicketServiceAvailable,
|
|
138
|
+
price,
|
|
139
|
+
coordinates,
|
|
140
|
+
availableWaypointZones,
|
|
141
|
+
availableDestZones,
|
|
142
|
+
hour,
|
|
143
|
+
minute,
|
|
144
|
+
telCountryCode,
|
|
145
|
+
telNumber,
|
|
146
|
+
selectedPrice
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export const originalBooking = createBookingStore(null);
|
|
150
|
+
export const copiedBooking = createBookingStore(null);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { Locale, Target } from '../types';
|
|
3
|
+
export declare const env: import("svelte/store").Writable<{
|
|
4
|
+
target: Target;
|
|
5
|
+
locale: Locale;
|
|
6
|
+
accessToken: string;
|
|
7
|
+
refreshToken: string;
|
|
8
|
+
isModifiable: boolean;
|
|
9
|
+
isDev: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const API_URL: import("svelte/store").Readable<"https://api-b2b-dev.movv.co" | "https://api-b2b.movv.co" | "https://api-test.exvehicle.com" | "https://api.exvehicle.com">;
|
|
12
|
+
export declare const AUTH_PATH: import("svelte/store").Readable<string>;
|
|
13
|
+
export declare const authInfo: import("svelte/store").Readable<{
|
|
14
|
+
username: string;
|
|
15
|
+
password: string;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { derived, writable } from 'svelte/store';
|
|
2
|
+
export const env = writable({
|
|
3
|
+
target: null,
|
|
4
|
+
locale: 'en',
|
|
5
|
+
accessToken: null,
|
|
6
|
+
refreshToken: null,
|
|
7
|
+
isModifiable: false,
|
|
8
|
+
isDev: true
|
|
9
|
+
});
|
|
10
|
+
export const API_URL = derived(env, $env => {
|
|
11
|
+
// api-
|
|
12
|
+
if ($env.target === 'B2B')
|
|
13
|
+
return $env.isDev ? 'https://api-b2b-dev.movv.co' : 'https://api-b2b.movv.co';
|
|
14
|
+
if ($env.target === 'FMS')
|
|
15
|
+
return $env.isDev ? 'https://api-test.exvehicle.com' : 'https://api.exvehicle.com';
|
|
16
|
+
});
|
|
17
|
+
export const AUTH_PATH = derived(env, _ => '/oauth2/token');
|
|
18
|
+
export const authInfo = derived(env, $env => {
|
|
19
|
+
return {
|
|
20
|
+
username: (() => {
|
|
21
|
+
if ($env.target === 'B2B')
|
|
22
|
+
return 'movv';
|
|
23
|
+
if ($env.target === 'FMS')
|
|
24
|
+
return 'fms';
|
|
25
|
+
})(),
|
|
26
|
+
password: (() => {
|
|
27
|
+
if ($env.target === 'B2B')
|
|
28
|
+
return '7d8feb82-e2b1-43a0-906e-18f905f71959';
|
|
29
|
+
if ($env.target === 'FMS')
|
|
30
|
+
return '3cfaef35-002f-497b-86a0-3e5bf9385dcc';
|
|
31
|
+
})()
|
|
32
|
+
};
|
|
33
|
+
});
|