@movvjs/svelte-schedule-view 0.4.1-beta-1 → 0.4.1-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.
@@ -1,8 +1,8 @@
1
- import { _, register } from 'svelte-i18n';
1
+ import { _, register, init, isLoading } from 'svelte-i18n';
2
2
  register('en', () => import('./locales/en.json'));
3
3
  register('ko', () => import('./locales/ko.json'));
4
4
  register('zh-cn', () => import('./locales/zh-cn.json'));
5
5
  register('zh-tw', () => import('./locales/zh-tw.json'));
6
6
  register('vi', () => import('./locales/vi.json'));
7
7
  const t = _;
8
- export { t };
8
+ export { t, init, isLoading };
@@ -1,26 +1,59 @@
1
1
  <script context="module">export const isEdit = writable(false);
2
2
  </script>
3
3
 
4
- <script>import { Toaster } from "svelte-french-toast";
4
+ <script>import "./assets/scss/indie_booking.scss";
5
+ import { Toaster } from "svelte-french-toast";
6
+ import { onMount } from "svelte";
5
7
  import { writable } from "svelte/store";
6
8
  import { cloneDeep } from "lodash-es";
7
9
  import consola from "consola";
10
+ import QS from "qs";
11
+ import Axios from "axios";
8
12
  import { dayjs } from "../dayjs";
9
- import { t } from "../i18n";
13
+ import { t, init as i18nInit, isLoading } from "../i18n";
10
14
  import { env } from "../store/env";
15
+ import { API_URL } from "../axios/constant";
11
16
  import { BookingAPI } from "./api";
12
17
  import { copiedBooking, originalBooking } from "./stores/booking";
13
18
  import { comma } from "./utils";
14
19
  import { loader } from "./components/loader";
15
- import { alert } from "./components/notifications";
16
- import Layout from "./Layout.svelte";
20
+ import { alert, Alert, Confirm } from "./components/notifications";
21
+ import Loader from "./components/loader/Loader.svelte";
17
22
  import Map from "./Map.svelte";
18
23
  import ServiceZone from "./ServiceZone.svelte";
19
24
  import Plan from "./Plan.svelte";
20
25
  import BookingInfo from "./BookingInfo.svelte";
21
- import { API_URL } from "../axios/constant";
22
- import QS from "qs";
23
- import Axios from "axios";
26
+ import Portal from "svelte-portal";
27
+ onMount(() => {
28
+ googleMaps();
29
+ function googleMaps() {
30
+ ;
31
+ ((g) => {
32
+ var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
33
+ b = b[c] || (b[c] = {});
34
+ var d = b.maps || (b.maps = {}), r = /* @__PURE__ */ new Set(), e = new URLSearchParams(), u = () => h || (h = new Promise(async (f, n) => {
35
+ await (a = m.createElement("script"));
36
+ e.set("libraries", [...r] + "");
37
+ for (k in g)
38
+ e.set(k.replace(/[A-Z]/g, (t2) => "_" + t2[0].toLowerCase()), g[k]);
39
+ e.set("callback", c + ".maps." + q);
40
+ a.src = `https://maps.${c}apis.com/maps/api/js?` + e;
41
+ d[q] = f;
42
+ a.onerror = () => h = n(Error(p + " could not load."));
43
+ a.nonce = m.querySelector("script[nonce]")?.nonce || "";
44
+ m.head.append(a);
45
+ }));
46
+ d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n));
47
+ })({
48
+ key: "AIzaSyDe1e91bi67YTTnPGQlKTHXeNqMPOYkjW0",
49
+ v: "weekly",
50
+ region: "kr",
51
+ language: navigator?.language || "en"
52
+ // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
53
+ // Add other bootstrap parameters as needed, using camel case.
54
+ });
55
+ }
56
+ });
24
57
  const { stdt, price, priceDifference, isModifiable } = originalBooking;
25
58
  const {
26
59
  price: editPrice,
@@ -30,7 +63,6 @@ const {
30
63
  fullName,
31
64
  selectedPrice
32
65
  } = copiedBooking;
33
- export let initI18n = true;
34
66
  let on = false;
35
67
  let resolver;
36
68
  $:
@@ -47,6 +79,10 @@ export function init(options) {
47
79
  throw new Error("token\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
48
80
  if (!locale)
49
81
  throw new Error("locale\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
82
+ if (locale) {
83
+ i18nInit({ fallbackLocale: "en", initialLocale: locale });
84
+ dayjs.locale(locale);
85
+ }
50
86
  env.set({
51
87
  target,
52
88
  accessToken: token.accessToken,
@@ -161,80 +197,90 @@ async function save() {
161
197
  </script>
162
198
 
163
199
  <Toaster />
164
- <Layout {initI18n}>
165
- <section class="indie_pop_wrap scroll" class:on>
166
- {#if on}
167
- <div class="pop_base full_2 indie_passengers_info_pop">
168
- <button type="button" class="btn_close" on:click={() => close()}>닫기</button>
169
200
 
170
- <!-- 예약관리 > 예약_view > Schedule -->
171
- <section class="indie_dispatch_passenger_sche_w booking_schedule">
172
- <!-- 지도 부분 -->
173
- <Map />
174
- <!-- 예약 > 스케쥴 -->
175
- <div class="indie_booking_schedule_modify_box">
176
- <div class="header_b">
177
- <div class="tags">
178
- <span>{$originalBooking.code}</span>
179
- <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
180
- </div>
181
- <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
182
- <!-- <select class="indie_select_nor">
183
- <option value="">2023-10-16 (Mon)</option>
184
- <option value="">2023-10-16 (Mon)</option>
185
- </select> -->
201
+ <Portal target="body">
202
+ {#if !$isLoading}
203
+ <div id="indie_booking_wrapper">
204
+ <Loader />
205
+ <Alert />
206
+ <Confirm />
207
+ <section class="indie_pop_wrap scroll" class:on>
208
+ {#if on}
209
+ <div class="pop_base full_2 indie_passengers_info_pop">
210
+ <button type="button" class="btn_close" on:click={() => close()}>닫기</button>
211
+
212
+ <!-- 예약관리 > 예약_view > Schedule -->
213
+ <section class="indie_dispatch_passenger_sche_w booking_schedule">
214
+ <!-- 지도 부분 -->
215
+ <Map />
216
+ <!-- 예약 > 스케쥴 -->
217
+ <div class="indie_booking_schedule_modify_box">
218
+ <div class="header_b">
219
+ <div class="tags">
220
+ <span>{$originalBooking.code}</span>
221
+ <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
222
+ </div>
223
+ <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
224
+ <!-- <select class="indie_select_nor">
225
+ <option value="">2023-10-16 (Mon)</option>
226
+ <option value="">2023-10-16 (Mon)</option>
227
+ </select> -->
186
228
 
187
- <!-- <button type="button" class="btn_close">닫기</button> -->
188
- </div>
229
+ <!-- <button type="button" class="btn_close">닫기</button> -->
230
+ </div>
189
231
 
190
- <div class="contents_b">
191
- <ServiceZone />
192
- <Plan />
193
- <BookingInfo />
194
- </div>
232
+ <div class="contents_b">
233
+ <ServiceZone />
234
+ <Plan />
235
+ <BookingInfo />
236
+ </div>
195
237
 
196
- <div class="footer_b">
197
- <div class="left">
198
- <dl class="priceAll">
199
- <dt>{$t('booking.totalPrice')}</dt>
200
- <dd>
201
- <!-- * 차액 발생시 -->
202
- {#if difference > 0 || difference < 0}
203
- <!-- 검정 표현 -->
204
- <strong>{comma(targetPrice.before.amount)} {forex}</strong>
238
+ <div class="footer_b">
239
+ <div class="left">
240
+ <dl class="priceAll">
241
+ <dt>{$t('booking.totalPrice')}</dt>
242
+ <dd>
243
+ <!-- * 차액 발생시 -->
244
+ {#if difference > 0 || difference < 0}
245
+ <!-- 검정 표현 -->
246
+ <strong>{comma(targetPrice.before.amount)} {forex}</strong>
205
247
 
206
- <!-- 빨간색 표현 -->
207
- <span>
208
- {difference > 0 ? ' + ' : ' - '}
209
- {comma(Math.abs(difference))}
210
- {forex}
211
- = {comma(targetPrice.new.amount)}
212
- {forex}
213
- </span>
248
+ <!-- 빨간색 표현 -->
249
+ <span>
250
+ {difference > 0 ? ' + ' : ' - '}
251
+ {comma(Math.abs(difference))}
252
+ {forex}
253
+ = {comma(targetPrice.new.amount)}
254
+ {forex}
255
+ </span>
256
+ {:else}
257
+ <!-- * 차액 미 발생시 검정색 표현-->
258
+ <strong>{comma(targetPrice.new.amount)} {forex}</strong>
259
+ {/if}
260
+ </dd>
261
+ </dl>
262
+ </div>
263
+
264
+ <div class="right">
265
+ <button type="button" class="indie_btn_nor md line2" on:click={() => close()}>{$t('booking.cancel')}</button>
266
+ {#if !$isEdit}
267
+ {#if $isModifiable}
268
+ <button type="button" class="indie_btn_nor md line2 modify" on:click={() => edit()}>{$t('booking.modify')}</button>
269
+ {/if}
214
270
  {:else}
215
- <!-- * 차액 발생시 검정색 표현-->
216
- <strong>{comma(targetPrice.new.amount)} {forex}</strong>
271
+ <button type="button" class="indie_btn_nor md line2" on:click={() => reset()}>{$t('booking.reset')}</button>
272
+ <button type="button" class="indie_btn_nor md blue" on:click={() => save()}>{$t('booking.save')}</button>
217
273
  {/if}
218
- </dd>
219
- </dl>
220
- </div>
221
-
222
- <div class="right">
223
- <button type="button" class="indie_btn_nor md line2" on:click={() => close()}>{$t('booking.cancel')}</button>
224
- {#if !$isEdit}
225
- {#if $isModifiable}
226
- <button type="button" class="indie_btn_nor md line2 modify" on:click={() => edit()}>{$t('booking.modify')}</button>
227
- {/if}
228
- {:else}
229
- <button type="button" class="indie_btn_nor md line2" on:click={() => reset()}>{$t('booking.reset')}</button>
230
- <button type="button" class="indie_btn_nor md blue" on:click={() => save()}>{$t('booking.save')}</button>
231
- {/if}
274
+ </div>
275
+ </div>
232
276
  </div>
233
- </div>
277
+ </section>
278
+ <!-- // 배차 - 탑승자 정보 및 스케줄 -->
234
279
  </div>
235
- </section>
236
- <!-- // 배차 - 탑승자 정보 및 스케줄 -->
237
- </div>
238
- {/if}
239
- </section>
240
- </Layout>
280
+ {/if}
281
+ </section>
282
+ </div>
283
+ {:else}
284
+ <!-- i18n loading. . . . -->
285
+ {/if}
286
+ </Portal>
@@ -10,10 +10,10 @@ export interface InitOption {
10
10
  };
11
11
  viewOnly?: boolean;
12
12
  }
13
+ import './assets/scss/indie_booking.scss';
13
14
  import type { Locale, Target } from './types';
14
15
  declare const __propDef: {
15
16
  props: {
16
- initI18n?: boolean;
17
17
  init?: (options: InitOption) => {
18
18
  open: ({ code }: {
19
19
  code: string;
@@ -1,8 +1,8 @@
1
- import { _, register } from 'svelte-i18n';
1
+ import { _, register, init, isLoading } from 'svelte-i18n';
2
2
  register('en', () => import('./locales/en.json'));
3
3
  register('ko', () => import('./locales/ko.json'));
4
4
  register('zh-cn', () => import('./locales/zh-cn.json'));
5
5
  register('zh-tw', () => import('./locales/zh-tw.json'));
6
6
  register('vi', () => import('./locales/vi.json'));
7
7
  const t = _;
8
- export { t };
8
+ export { t, init, isLoading };
@@ -1,26 +1,59 @@
1
1
  <script context="module">export const isEdit = writable(false);
2
2
  </script>
3
3
 
4
- <script>import { Toaster } from "svelte-french-toast";
4
+ <script>import "./assets/scss/indie_booking.scss";
5
+ import { Toaster } from "svelte-french-toast";
6
+ import { onMount } from "svelte";
5
7
  import { writable } from "svelte/store";
6
8
  import { cloneDeep } from "lodash-es";
7
9
  import consola from "consola";
10
+ import QS from "qs";
11
+ import Axios from "axios";
8
12
  import { dayjs } from "../dayjs";
9
- import { t } from "../i18n";
13
+ import { t, init as i18nInit, isLoading } from "../i18n";
10
14
  import { env } from "../store/env";
15
+ import { API_URL } from "../axios/constant";
11
16
  import { BookingAPI } from "./api";
12
17
  import { copiedBooking, originalBooking } from "./stores/booking";
13
18
  import { comma } from "./utils";
14
19
  import { loader } from "./components/loader";
15
- import { alert } from "./components/notifications";
16
- import Layout from "./Layout.svelte";
20
+ import { alert, Alert, Confirm } from "./components/notifications";
21
+ import Loader from "./components/loader/Loader.svelte";
17
22
  import Map from "./Map.svelte";
18
23
  import ServiceZone from "./ServiceZone.svelte";
19
24
  import Plan from "./Plan.svelte";
20
25
  import BookingInfo from "./BookingInfo.svelte";
21
- import { API_URL } from "../axios/constant";
22
- import QS from "qs";
23
- import Axios from "axios";
26
+ import Portal from "svelte-portal";
27
+ onMount(() => {
28
+ googleMaps();
29
+ function googleMaps() {
30
+ ;
31
+ ((g) => {
32
+ var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
33
+ b = b[c] || (b[c] = {});
34
+ var d = b.maps || (b.maps = {}), r = /* @__PURE__ */ new Set(), e = new URLSearchParams(), u = () => h || (h = new Promise(async (f, n) => {
35
+ await (a = m.createElement("script"));
36
+ e.set("libraries", [...r] + "");
37
+ for (k in g)
38
+ e.set(k.replace(/[A-Z]/g, (t2) => "_" + t2[0].toLowerCase()), g[k]);
39
+ e.set("callback", c + ".maps." + q);
40
+ a.src = `https://maps.${c}apis.com/maps/api/js?` + e;
41
+ d[q] = f;
42
+ a.onerror = () => h = n(Error(p + " could not load."));
43
+ a.nonce = m.querySelector("script[nonce]")?.nonce || "";
44
+ m.head.append(a);
45
+ }));
46
+ d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n));
47
+ })({
48
+ key: "AIzaSyDe1e91bi67YTTnPGQlKTHXeNqMPOYkjW0",
49
+ v: "weekly",
50
+ region: "kr",
51
+ language: navigator?.language || "en"
52
+ // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
53
+ // Add other bootstrap parameters as needed, using camel case.
54
+ });
55
+ }
56
+ });
24
57
  const { stdt, price, priceDifference, isModifiable } = originalBooking;
25
58
  const {
26
59
  price: editPrice,
@@ -30,7 +63,6 @@ const {
30
63
  fullName,
31
64
  selectedPrice
32
65
  } = copiedBooking;
33
- export let initI18n = true;
34
66
  let on = false;
35
67
  let resolver;
36
68
  $:
@@ -47,6 +79,10 @@ export function init(options) {
47
79
  throw new Error("token\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
48
80
  if (!locale)
49
81
  throw new Error("locale\uC744 \uB123\uC5B4\uC8FC\uC138\uC694.");
82
+ if (locale) {
83
+ i18nInit({ fallbackLocale: "en", initialLocale: locale });
84
+ dayjs.locale(locale);
85
+ }
50
86
  env.set({
51
87
  target,
52
88
  accessToken: token.accessToken,
@@ -161,80 +197,90 @@ async function save() {
161
197
  </script>
162
198
 
163
199
  <Toaster />
164
- <Layout {initI18n}>
165
- <section class="indie_pop_wrap scroll" class:on>
166
- {#if on}
167
- <div class="pop_base full_2 indie_passengers_info_pop">
168
- <button type="button" class="btn_close" on:click={() => close()}>닫기</button>
169
200
 
170
- <!-- 예약관리 > 예약_view > Schedule -->
171
- <section class="indie_dispatch_passenger_sche_w booking_schedule">
172
- <!-- 지도 부분 -->
173
- <Map />
174
- <!-- 예약 > 스케쥴 -->
175
- <div class="indie_booking_schedule_modify_box">
176
- <div class="header_b">
177
- <div class="tags">
178
- <span>{$originalBooking.code}</span>
179
- <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
180
- </div>
181
- <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
182
- <!-- <select class="indie_select_nor">
183
- <option value="">2023-10-16 (Mon)</option>
184
- <option value="">2023-10-16 (Mon)</option>
185
- </select> -->
201
+ <Portal target="body">
202
+ {#if !$isLoading}
203
+ <div id="indie_booking_wrapper">
204
+ <Loader />
205
+ <Alert />
206
+ <Confirm />
207
+ <section class="indie_pop_wrap scroll" class:on>
208
+ {#if on}
209
+ <div class="pop_base full_2 indie_passengers_info_pop">
210
+ <button type="button" class="btn_close" on:click={() => close()}>닫기</button>
211
+
212
+ <!-- 예약관리 > 예약_view > Schedule -->
213
+ <section class="indie_dispatch_passenger_sche_w booking_schedule">
214
+ <!-- 지도 부분 -->
215
+ <Map />
216
+ <!-- 예약 > 스케쥴 -->
217
+ <div class="indie_booking_schedule_modify_box">
218
+ <div class="header_b">
219
+ <div class="tags">
220
+ <span>{$originalBooking.code}</span>
221
+ <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
222
+ </div>
223
+ <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
224
+ <!-- <select class="indie_select_nor">
225
+ <option value="">2023-10-16 (Mon)</option>
226
+ <option value="">2023-10-16 (Mon)</option>
227
+ </select> -->
186
228
 
187
- <!-- <button type="button" class="btn_close">닫기</button> -->
188
- </div>
229
+ <!-- <button type="button" class="btn_close">닫기</button> -->
230
+ </div>
189
231
 
190
- <div class="contents_b">
191
- <ServiceZone />
192
- <Plan />
193
- <BookingInfo />
194
- </div>
232
+ <div class="contents_b">
233
+ <ServiceZone />
234
+ <Plan />
235
+ <BookingInfo />
236
+ </div>
195
237
 
196
- <div class="footer_b">
197
- <div class="left">
198
- <dl class="priceAll">
199
- <dt>{$t('booking.totalPrice')}</dt>
200
- <dd>
201
- <!-- * 차액 발생시 -->
202
- {#if difference > 0 || difference < 0}
203
- <!-- 검정 표현 -->
204
- <strong>{comma(targetPrice.before.amount)} {forex}</strong>
238
+ <div class="footer_b">
239
+ <div class="left">
240
+ <dl class="priceAll">
241
+ <dt>{$t('booking.totalPrice')}</dt>
242
+ <dd>
243
+ <!-- * 차액 발생시 -->
244
+ {#if difference > 0 || difference < 0}
245
+ <!-- 검정 표현 -->
246
+ <strong>{comma(targetPrice.before.amount)} {forex}</strong>
205
247
 
206
- <!-- 빨간색 표현 -->
207
- <span>
208
- {difference > 0 ? ' + ' : ' - '}
209
- {comma(Math.abs(difference))}
210
- {forex}
211
- = {comma(targetPrice.new.amount)}
212
- {forex}
213
- </span>
248
+ <!-- 빨간색 표현 -->
249
+ <span>
250
+ {difference > 0 ? ' + ' : ' - '}
251
+ {comma(Math.abs(difference))}
252
+ {forex}
253
+ = {comma(targetPrice.new.amount)}
254
+ {forex}
255
+ </span>
256
+ {:else}
257
+ <!-- * 차액 미 발생시 검정색 표현-->
258
+ <strong>{comma(targetPrice.new.amount)} {forex}</strong>
259
+ {/if}
260
+ </dd>
261
+ </dl>
262
+ </div>
263
+
264
+ <div class="right">
265
+ <button type="button" class="indie_btn_nor md line2" on:click={() => close()}>{$t('booking.cancel')}</button>
266
+ {#if !$isEdit}
267
+ {#if $isModifiable}
268
+ <button type="button" class="indie_btn_nor md line2 modify" on:click={() => edit()}>{$t('booking.modify')}</button>
269
+ {/if}
214
270
  {:else}
215
- <!-- * 차액 발생시 검정색 표현-->
216
- <strong>{comma(targetPrice.new.amount)} {forex}</strong>
271
+ <button type="button" class="indie_btn_nor md line2" on:click={() => reset()}>{$t('booking.reset')}</button>
272
+ <button type="button" class="indie_btn_nor md blue" on:click={() => save()}>{$t('booking.save')}</button>
217
273
  {/if}
218
- </dd>
219
- </dl>
220
- </div>
221
-
222
- <div class="right">
223
- <button type="button" class="indie_btn_nor md line2" on:click={() => close()}>{$t('booking.cancel')}</button>
224
- {#if !$isEdit}
225
- {#if $isModifiable}
226
- <button type="button" class="indie_btn_nor md line2 modify" on:click={() => edit()}>{$t('booking.modify')}</button>
227
- {/if}
228
- {:else}
229
- <button type="button" class="indie_btn_nor md line2" on:click={() => reset()}>{$t('booking.reset')}</button>
230
- <button type="button" class="indie_btn_nor md blue" on:click={() => save()}>{$t('booking.save')}</button>
231
- {/if}
274
+ </div>
275
+ </div>
232
276
  </div>
233
- </div>
277
+ </section>
278
+ <!-- // 배차 - 탑승자 정보 및 스케줄 -->
234
279
  </div>
235
- </section>
236
- <!-- // 배차 - 탑승자 정보 및 스케줄 -->
237
- </div>
238
- {/if}
239
- </section>
240
- </Layout>
280
+ {/if}
281
+ </section>
282
+ </div>
283
+ {:else}
284
+ <!-- i18n loading. . . . -->
285
+ {/if}
286
+ </Portal>
@@ -10,10 +10,10 @@ export interface InitOption {
10
10
  };
11
11
  viewOnly?: boolean;
12
12
  }
13
+ import './assets/scss/indie_booking.scss';
13
14
  import type { Locale, Target } from './types';
14
15
  declare const __propDef: {
15
16
  props: {
16
- initI18n?: boolean;
17
17
  init?: (options: InitOption) => {
18
18
  open: ({ code }: {
19
19
  code: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movvjs/svelte-schedule-view",
3
- "version": "0.4.1-beta-1",
3
+ "version": "0.4.1-beta-2",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "author": {
@@ -1,4 +1,4 @@
1
- import { _, register } from 'svelte-i18n'
1
+ import { _, register, init, isLoading } from 'svelte-i18n'
2
2
 
3
3
  register('en', () => import('./locales/en.json'))
4
4
  register('ko', () => import('./locales/ko.json'))
@@ -8,4 +8,4 @@ register('vi', () => import('./locales/vi.json'))
8
8
 
9
9
  const t = _
10
10
 
11
- export { t }
11
+ export { t, init, isLoading }
@@ -13,14 +13,19 @@
13
13
  </script>
14
14
 
15
15
  <script lang="ts">
16
+ import './assets/scss/indie_booking.scss'
16
17
  import { Toaster } from 'svelte-french-toast'
18
+ import { onMount } from 'svelte'
17
19
  import { writable } from 'svelte/store'
18
20
  import { cloneDeep } from 'lodash-es'
19
21
  import consola from 'consola'
22
+ import QS from 'qs'
23
+ import Axios from 'axios'
20
24
 
21
25
  import { dayjs } from '$lib/dayjs'
22
- import { t } from '$lib/i18n'
26
+ import { t, init as i18nInit, isLoading } from '$lib/i18n'
23
27
  import { env } from '$lib/store/env'
28
+ import { API_URL } from '$lib/axios/constant'
24
29
 
25
30
  import type { Locale, Target } from '$scheduleView/types'
26
31
  import { BookingAPI } from '$scheduleView/api'
@@ -28,16 +33,31 @@
28
33
  import { comma } from '$scheduleView/utils'
29
34
 
30
35
  import { loader } from '$scheduleView/components/loader'
31
- import { alert } from '$scheduleView/components/notifications'
36
+ import { alert, Alert, Confirm } from '$scheduleView/components/notifications'
37
+ import Loader from './components/loader/Loader.svelte'
32
38
 
33
- import Layout from '$scheduleView/Layout.svelte'
34
39
  import Map from '$scheduleView/Map.svelte'
35
40
  import ServiceZone from '$scheduleView/ServiceZone.svelte'
36
41
  import Plan from '$scheduleView/Plan.svelte'
37
42
  import BookingInfo from '$scheduleView/BookingInfo.svelte'
38
- import { API_URL } from '$lib/axios/constant'
39
- import QS from 'qs'
40
- import Axios from 'axios'
43
+ import Portal from 'svelte-portal'
44
+
45
+ onMount(() => {
46
+ googleMaps()
47
+
48
+ function googleMaps() {
49
+ // https://developers.google.com/maps/documentation/javascript/load-maps-js-api?hl=ko#dynamic-library-import
50
+ // prettier-ignore
51
+ ;(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
52
+ key: "AIzaSyDe1e91bi67YTTnPGQlKTHXeNqMPOYkjW0",
53
+ v: "weekly",
54
+ region: "kr",
55
+ language: navigator?.language || "en",
56
+ // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
57
+ // Add other bootstrap parameters as needed, using camel case.
58
+ });
59
+ }
60
+ })
41
61
 
42
62
  const { stdt, price, priceDifference, isModifiable } = originalBooking
43
63
  const {
@@ -48,7 +68,7 @@
48
68
  fullName,
49
69
  selectedPrice
50
70
  } = copiedBooking
51
- export let initI18n = true
71
+
52
72
  let on = false
53
73
  let resolver: (value: Awaited<ReturnType<typeof open>>) => void
54
74
 
@@ -70,6 +90,11 @@
70
90
  if (!token) throw new Error('token을 넣어주세요.')
71
91
  if (!locale) throw new Error('locale을 넣어주세요.')
72
92
 
93
+ if (locale) {
94
+ i18nInit({ fallbackLocale: 'en', initialLocale: locale })
95
+ dayjs.locale(locale)
96
+ }
97
+
73
98
  env.set({
74
99
  target,
75
100
  accessToken: token.accessToken,
@@ -214,80 +239,90 @@
214
239
  </script>
215
240
 
216
241
  <Toaster />
217
- <Layout {initI18n}>
218
- <section class="indie_pop_wrap scroll" class:on>
219
- {#if on}
220
- <div class="pop_base full_2 indie_passengers_info_pop">
221
- <button type="button" class="btn_close" on:click={() => close()}>닫기</button>
222
-
223
- <!-- 예약관리 > 예약_view > Schedule -->
224
- <section class="indie_dispatch_passenger_sche_w booking_schedule">
225
- <!-- 지도 부분 -->
226
- <Map />
227
- <!-- 예약 > 스케쥴 -->
228
- <div class="indie_booking_schedule_modify_box">
229
- <div class="header_b">
230
- <div class="tags">
231
- <span>{$originalBooking.code}</span>
232
- <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
233
- </div>
234
- <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
235
- <!-- <select class="indie_select_nor">
236
- <option value="">2023-10-16 (Mon)</option>
237
- <option value="">2023-10-16 (Mon)</option>
238
- </select> -->
239
-
240
- <!-- <button type="button" class="btn_close">닫기</button> -->
241
- </div>
242
-
243
- <div class="contents_b">
244
- <ServiceZone />
245
- <Plan />
246
- <BookingInfo />
247
- </div>
248
-
249
- <div class="footer_b">
250
- <div class="left">
251
- <dl class="priceAll">
252
- <dt>{$t('booking.totalPrice')}</dt>
253
- <dd>
254
- <!-- * 차액 발생시 -->
255
- {#if difference > 0 || difference < 0}
256
- <!-- 검정 표현 -->
257
- <strong>{comma(targetPrice.before.amount)} {forex}</strong>
258
-
259
- <!-- 빨간색 표현 -->
260
- <span>
261
- {difference > 0 ? ' + ' : ' - '}
262
- {comma(Math.abs(difference))}
263
- {forex}
264
- = {comma(targetPrice.new.amount)}
265
- {forex}
266
- </span>
242
+
243
+ <Portal target="body">
244
+ {#if !$isLoading}
245
+ <div id="indie_booking_wrapper">
246
+ <Loader />
247
+ <Alert />
248
+ <Confirm />
249
+ <section class="indie_pop_wrap scroll" class:on>
250
+ {#if on}
251
+ <div class="pop_base full_2 indie_passengers_info_pop">
252
+ <button type="button" class="btn_close" on:click={() => close()}>닫기</button>
253
+
254
+ <!-- 예약관리 > 예약_view > Schedule -->
255
+ <section class="indie_dispatch_passenger_sche_w booking_schedule">
256
+ <!-- 지도 부분 -->
257
+ <Map />
258
+ <!-- 예약 > 스케쥴 -->
259
+ <div class="indie_booking_schedule_modify_box">
260
+ <div class="header_b">
261
+ <div class="tags">
262
+ <span>{$originalBooking.code}</span>
263
+ <strong>{$t(`serviceType.${$originalBooking.serviceType}`)}</strong>
264
+ </div>
265
+ <p class="date_text">{dayjs($stdt).format('ll (dd)')}</p>
266
+ <!-- <select class="indie_select_nor">
267
+ <option value="">2023-10-16 (Mon)</option>
268
+ <option value="">2023-10-16 (Mon)</option>
269
+ </select> -->
270
+
271
+ <!-- <button type="button" class="btn_close">닫기</button> -->
272
+ </div>
273
+
274
+ <div class="contents_b">
275
+ <ServiceZone />
276
+ <Plan />
277
+ <BookingInfo />
278
+ </div>
279
+
280
+ <div class="footer_b">
281
+ <div class="left">
282
+ <dl class="priceAll">
283
+ <dt>{$t('booking.totalPrice')}</dt>
284
+ <dd>
285
+ <!-- * 차액 발생시 -->
286
+ {#if difference > 0 || difference < 0}
287
+ <!-- 검정 표현 -->
288
+ <strong>{comma(targetPrice.before.amount)} {forex}</strong>
289
+
290
+ <!-- 빨간색 표현 -->
291
+ <span>
292
+ {difference > 0 ? ' + ' : ' - '}
293
+ {comma(Math.abs(difference))}
294
+ {forex}
295
+ = {comma(targetPrice.new.amount)}
296
+ {forex}
297
+ </span>
298
+ {:else}
299
+ <!-- * 차액 미 발생시 검정색 표현-->
300
+ <strong>{comma(targetPrice.new.amount)} {forex}</strong>
301
+ {/if}
302
+ </dd>
303
+ </dl>
304
+ </div>
305
+
306
+ <div class="right">
307
+ <button type="button" class="indie_btn_nor md line2" on:click={() => close()}>{$t('booking.cancel')}</button>
308
+ {#if !$isEdit}
309
+ {#if $isModifiable}
310
+ <button type="button" class="indie_btn_nor md line2 modify" on:click={() => edit()}>{$t('booking.modify')}</button>
311
+ {/if}
267
312
  {:else}
268
- <!-- * 차액 발생시 검정색 표현-->
269
- <strong>{comma(targetPrice.new.amount)} {forex}</strong>
313
+ <button type="button" class="indie_btn_nor md line2" on:click={() => reset()}>{$t('booking.reset')}</button>
314
+ <button type="button" class="indie_btn_nor md blue" on:click={() => save()}>{$t('booking.save')}</button>
270
315
  {/if}
271
- </dd>
272
- </dl>
273
- </div>
274
-
275
- <div class="right">
276
- <button type="button" class="indie_btn_nor md line2" on:click={() => close()}>{$t('booking.cancel')}</button>
277
- {#if !$isEdit}
278
- {#if $isModifiable}
279
- <button type="button" class="indie_btn_nor md line2 modify" on:click={() => edit()}>{$t('booking.modify')}</button>
280
- {/if}
281
- {:else}
282
- <button type="button" class="indie_btn_nor md line2" on:click={() => reset()}>{$t('booking.reset')}</button>
283
- <button type="button" class="indie_btn_nor md blue" on:click={() => save()}>{$t('booking.save')}</button>
284
- {/if}
316
+ </div>
317
+ </div>
285
318
  </div>
286
- </div>
319
+ </section>
320
+ <!-- // 배차 - 탑승자 정보 및 스케줄 -->
287
321
  </div>
288
- </section>
289
- <!-- // 배차 - 탑승자 정보 및 스케줄 -->
290
- </div>
291
- {/if}
292
- </section>
293
- </Layout>
322
+ {/if}
323
+ </section>
324
+ </div>
325
+ {:else}
326
+ <!-- i18n loading. . . . -->
327
+ {/if}
328
+ </Portal>
@@ -1,63 +0,0 @@
1
- <script>import "./assets/scss/indie_booking.scss";
2
- import { dayjs } from "../dayjs";
3
- import { isLoading, init, locale } from "svelte-i18n";
4
- import Portal from "svelte-portal";
5
- import { env } from "../store/env";
6
- import { Alert, Confirm } from "./components/notifications";
7
- import Loader from "./components/loader/Loader.svelte";
8
- import { onMount } from "svelte";
9
- export let initI18n;
10
- if (initI18n) {
11
- init({
12
- fallbackLocale: "en",
13
- initialLocale: "en"
14
- });
15
- }
16
- env.subscribe(($env) => {
17
- locale.set($env.locale);
18
- dayjs.locale($env.locale);
19
- });
20
- onMount(() => {
21
- googleMaps();
22
- function googleMaps() {
23
- ;
24
- ((g) => {
25
- var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
26
- b = b[c] || (b[c] = {});
27
- var d = b.maps || (b.maps = {}), r = /* @__PURE__ */ new Set(), e = new URLSearchParams(), u = () => h || (h = new Promise(async (f, n) => {
28
- await (a = m.createElement("script"));
29
- e.set("libraries", [...r] + "");
30
- for (k in g)
31
- e.set(k.replace(/[A-Z]/g, (t) => "_" + t[0].toLowerCase()), g[k]);
32
- e.set("callback", c + ".maps." + q);
33
- a.src = `https://maps.${c}apis.com/maps/api/js?` + e;
34
- d[q] = f;
35
- a.onerror = () => h = n(Error(p + " could not load."));
36
- a.nonce = m.querySelector("script[nonce]")?.nonce || "";
37
- m.head.append(a);
38
- }));
39
- d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n));
40
- })({
41
- key: "AIzaSyDe1e91bi67YTTnPGQlKTHXeNqMPOYkjW0",
42
- v: "weekly",
43
- region: "kr",
44
- language: navigator?.language || "en"
45
- // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
46
- // Add other bootstrap parameters as needed, using camel case.
47
- });
48
- }
49
- });
50
- </script>
51
-
52
- <Portal target="body">
53
- {#if !$isLoading}
54
- <div id="indie_booking_wrapper">
55
- <Loader />
56
- <Alert />
57
- <Confirm />
58
- <slot><!-- optional fallback --></slot>
59
- </div>
60
- {:else}
61
- <!-- i18n loading. . . . -->
62
- {/if}
63
- </Portal>
@@ -1,19 +0,0 @@
1
- import { SvelteComponent } from "svelte";
2
- import './assets/scss/indie_booking.scss';
3
- declare const __propDef: {
4
- props: {
5
- initI18n: boolean;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type LayoutProps = typeof __propDef.props;
15
- export type LayoutEvents = typeof __propDef.events;
16
- export type LayoutSlots = typeof __propDef.slots;
17
- export default class Layout extends SvelteComponent<LayoutProps, LayoutEvents, LayoutSlots> {
18
- }
19
- export {};
@@ -1,63 +0,0 @@
1
- <script>import "./assets/scss/indie_booking.scss";
2
- import { dayjs } from "../dayjs";
3
- import { isLoading, init, locale } from "svelte-i18n";
4
- import Portal from "svelte-portal";
5
- import { env } from "../store/env";
6
- import { Alert, Confirm } from "./components/notifications";
7
- import Loader from "./components/loader/Loader.svelte";
8
- import { onMount } from "svelte";
9
- export let initI18n;
10
- if (initI18n) {
11
- init({
12
- fallbackLocale: "en",
13
- initialLocale: "en"
14
- });
15
- }
16
- env.subscribe(($env) => {
17
- locale.set($env.locale);
18
- dayjs.locale($env.locale);
19
- });
20
- onMount(() => {
21
- googleMaps();
22
- function googleMaps() {
23
- ;
24
- ((g) => {
25
- var h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window;
26
- b = b[c] || (b[c] = {});
27
- var d = b.maps || (b.maps = {}), r = /* @__PURE__ */ new Set(), e = new URLSearchParams(), u = () => h || (h = new Promise(async (f, n) => {
28
- await (a = m.createElement("script"));
29
- e.set("libraries", [...r] + "");
30
- for (k in g)
31
- e.set(k.replace(/[A-Z]/g, (t) => "_" + t[0].toLowerCase()), g[k]);
32
- e.set("callback", c + ".maps." + q);
33
- a.src = `https://maps.${c}apis.com/maps/api/js?` + e;
34
- d[q] = f;
35
- a.onerror = () => h = n(Error(p + " could not load."));
36
- a.nonce = m.querySelector("script[nonce]")?.nonce || "";
37
- m.head.append(a);
38
- }));
39
- d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n) => r.add(f) && u().then(() => d[l](f, ...n));
40
- })({
41
- key: "AIzaSyDe1e91bi67YTTnPGQlKTHXeNqMPOYkjW0",
42
- v: "weekly",
43
- region: "kr",
44
- language: navigator?.language || "en"
45
- // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
46
- // Add other bootstrap parameters as needed, using camel case.
47
- });
48
- }
49
- });
50
- </script>
51
-
52
- <Portal target="body">
53
- {#if !$isLoading}
54
- <div id="indie_booking_wrapper">
55
- <Loader />
56
- <Alert />
57
- <Confirm />
58
- <slot><!-- optional fallback --></slot>
59
- </div>
60
- {:else}
61
- <!-- i18n loading. . . . -->
62
- {/if}
63
- </Portal>
@@ -1,19 +0,0 @@
1
- import { SvelteComponent } from "svelte";
2
- import './assets/scss/indie_booking.scss';
3
- declare const __propDef: {
4
- props: {
5
- initI18n: boolean;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {
11
- default: {};
12
- };
13
- };
14
- export type LayoutProps = typeof __propDef.props;
15
- export type LayoutEvents = typeof __propDef.events;
16
- export type LayoutSlots = typeof __propDef.slots;
17
- export default class Layout extends SvelteComponent<LayoutProps, LayoutEvents, LayoutSlots> {
18
- }
19
- export {};
@@ -1,58 +0,0 @@
1
- <script lang="ts">
2
- import './assets/scss/indie_booking.scss'
3
-
4
- import { dayjs } from '$lib/dayjs'
5
- import { isLoading, init, locale } from 'svelte-i18n'
6
- import Portal from 'svelte-portal'
7
-
8
- import { env } from '$lib/store/env'
9
-
10
- import { Alert, Confirm } from './components/notifications'
11
-
12
- import Loader from './components/loader/Loader.svelte'
13
- import { onMount } from 'svelte'
14
-
15
- export let initI18n: boolean
16
-
17
- if (initI18n) {
18
- init({
19
- fallbackLocale: 'en',
20
- initialLocale: 'en'
21
- })
22
- }
23
-
24
- env.subscribe($env => {
25
- locale.set($env.locale)
26
- dayjs.locale($env.locale)
27
- })
28
-
29
- onMount(() => {
30
- googleMaps()
31
-
32
- function googleMaps() {
33
- // https://developers.google.com/maps/documentation/javascript/load-maps-js-api?hl=ko#dynamic-library-import
34
- // prettier-ignore
35
- ;(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
36
- key: "AIzaSyDe1e91bi67YTTnPGQlKTHXeNqMPOYkjW0",
37
- v: "weekly",
38
- region: "kr",
39
- language: navigator?.language || "en",
40
- // Use the 'v' parameter to indicate the version to use (weekly, beta, alpha, etc.).
41
- // Add other bootstrap parameters as needed, using camel case.
42
- });
43
- }
44
- })
45
- </script>
46
-
47
- <Portal target="body">
48
- {#if !$isLoading}
49
- <div id="indie_booking_wrapper">
50
- <Loader />
51
- <Alert />
52
- <Confirm />
53
- <slot><!-- optional fallback --></slot>
54
- </div>
55
- {:else}
56
- <!-- i18n loading. . . . -->
57
- {/if}
58
- </Portal>