@movvjs/svelte-schedule-view 0.1.6 → 0.1.7

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.
@@ -22,7 +22,7 @@ import { API_URL } from "../axios/constant";
22
22
  import QS from "qs";
23
23
  import Axios from "axios";
24
24
  const { stdt, price, isModifiable } = originalBooking;
25
- const { price: editPrice, availableDestZones, availableWaypointZones, fullName, selectedPrice } = copiedBooking;
25
+ const { price: editPrice, availableDestZones, availableWaypointZones, fullName, selectedPrice, priceDifference } = copiedBooking;
26
26
  let on = false;
27
27
  let resolver;
28
28
  export function init(options) {
@@ -187,12 +187,15 @@ async function save() {
187
187
  {#if !$isEdit}
188
188
  <strong>{comma($price.before.amount)} {$price.before.forex}</strong>
189
189
  {:else}
190
- {@const diff = $price.new.amount - $price.before.amount}
191
190
  {@const forex = $price.new.forex}
192
- {#if diff > 0}
193
- <span>{comma($editPrice.before.amount)} {forex} + {comma(diff)} {forex} = </span>
194
- {:else if diff < 0}
195
- <span>{comma($editPrice.before.amount)} {forex} - {comma(Math.abs(diff))} {forex} = </span>
191
+ {#if $priceDifference > 0}
192
+ <span>{comma($editPrice.before.amount)} {forex} + {comma($priceDifference)} {forex} = </span>
193
+ {:else if $priceDifference < 0}
194
+ <span>
195
+ {comma($editPrice.before.amount)}
196
+ {forex} - {comma(Math.abs($priceDifference))}
197
+ {forex} =
198
+ </span>
196
199
  {/if}
197
200
  <strong>{comma($editPrice.new.amount)} {forex}</strong>
198
201
  {/if}
@@ -52,6 +52,7 @@ export declare const originalBooking: {
52
52
  availableDestZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
53
53
  selectedPrice: import("svelte/store").Writable<SearchPriceV2>;
54
54
  isModifiable: import("svelte/store").Readable<boolean>;
55
+ priceDifference: import("svelte/store").Readable<number>;
55
56
  hour: {
56
57
  subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
57
58
  set(hour: number): void;
@@ -144,6 +145,7 @@ export declare const copiedBooking: {
144
145
  availableDestZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
145
146
  selectedPrice: import("svelte/store").Writable<SearchPriceV2>;
146
147
  isModifiable: import("svelte/store").Readable<boolean>;
148
+ priceDifference: import("svelte/store").Readable<number>;
147
149
  hour: {
148
150
  subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
149
151
  set(hour: number): void;
@@ -98,6 +98,11 @@ function createBookingStore(bookingDTO) {
98
98
  };
99
99
  return result;
100
100
  });
101
+ const priceDifference = derived(price, $price => {
102
+ if (!$price.before || !$price.new)
103
+ return null;
104
+ return $price.new.amount - $price.before.amount;
105
+ });
101
106
  /**
102
107
  * 이하 subscribe & set => 보려는 값과 변경하는 방식이 복잡한 경우
103
108
  */
@@ -344,6 +349,7 @@ function createBookingStore(bookingDTO) {
344
349
  availableDestZones,
345
350
  selectedPrice,
346
351
  isModifiable,
352
+ priceDifference,
347
353
  // subscribe & set
348
354
  hour,
349
355
  minute,
@@ -22,7 +22,7 @@ import { API_URL } from "../axios/constant";
22
22
  import QS from "qs";
23
23
  import Axios from "axios";
24
24
  const { stdt, price, isModifiable } = originalBooking;
25
- const { price: editPrice, availableDestZones, availableWaypointZones, fullName, selectedPrice } = copiedBooking;
25
+ const { price: editPrice, availableDestZones, availableWaypointZones, fullName, selectedPrice, priceDifference } = copiedBooking;
26
26
  let on = false;
27
27
  let resolver;
28
28
  export function init(options) {
@@ -187,12 +187,15 @@ async function save() {
187
187
  {#if !$isEdit}
188
188
  <strong>{comma($price.before.amount)} {$price.before.forex}</strong>
189
189
  {:else}
190
- {@const diff = $price.new.amount - $price.before.amount}
191
190
  {@const forex = $price.new.forex}
192
- {#if diff > 0}
193
- <span>{comma($editPrice.before.amount)} {forex} + {comma(diff)} {forex} = </span>
194
- {:else if diff < 0}
195
- <span>{comma($editPrice.before.amount)} {forex} - {comma(Math.abs(diff))} {forex} = </span>
191
+ {#if $priceDifference > 0}
192
+ <span>{comma($editPrice.before.amount)} {forex} + {comma($priceDifference)} {forex} = </span>
193
+ {:else if $priceDifference < 0}
194
+ <span>
195
+ {comma($editPrice.before.amount)}
196
+ {forex} - {comma(Math.abs($priceDifference))}
197
+ {forex} =
198
+ </span>
196
199
  {/if}
197
200
  <strong>{comma($editPrice.new.amount)} {forex}</strong>
198
201
  {/if}
@@ -52,6 +52,7 @@ export declare const originalBooking: {
52
52
  availableDestZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
53
53
  selectedPrice: import("svelte/store").Writable<SearchPriceV2>;
54
54
  isModifiable: import("svelte/store").Readable<boolean>;
55
+ priceDifference: import("svelte/store").Readable<number>;
55
56
  hour: {
56
57
  subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
57
58
  set(hour: number): void;
@@ -144,6 +145,7 @@ export declare const copiedBooking: {
144
145
  availableDestZones: import("svelte/store").Writable<import("../types").BookingLocation[]>;
145
146
  selectedPrice: import("svelte/store").Writable<SearchPriceV2>;
146
147
  isModifiable: import("svelte/store").Readable<boolean>;
148
+ priceDifference: import("svelte/store").Readable<number>;
147
149
  hour: {
148
150
  subscribe: (this: void, run: import("svelte/store").Subscriber<number>, invalidate?: import("svelte/store").Invalidator<number>) => import("svelte/store").Unsubscriber;
149
151
  set(hour: number): void;
@@ -98,6 +98,11 @@ function createBookingStore(bookingDTO) {
98
98
  };
99
99
  return result;
100
100
  });
101
+ const priceDifference = derived(price, $price => {
102
+ if (!$price.before || !$price.new)
103
+ return null;
104
+ return $price.new.amount - $price.before.amount;
105
+ });
101
106
  /**
102
107
  * 이하 subscribe & set => 보려는 값과 변경하는 방식이 복잡한 경우
103
108
  */
@@ -344,6 +349,7 @@ function createBookingStore(bookingDTO) {
344
349
  availableDestZones,
345
350
  selectedPrice,
346
351
  isModifiable,
352
+ priceDifference,
347
353
  // subscribe & set
348
354
  hour,
349
355
  minute,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@movvjs/svelte-schedule-view",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "author": {
@@ -40,7 +40,7 @@
40
40
  import Axios from 'axios'
41
41
 
42
42
  const { stdt, price, isModifiable } = originalBooking
43
- const { price: editPrice, availableDestZones, availableWaypointZones, fullName, selectedPrice } = copiedBooking
43
+ const { price: editPrice, availableDestZones, availableWaypointZones, fullName, selectedPrice, priceDifference } = copiedBooking
44
44
 
45
45
  let on = false
46
46
 
@@ -241,12 +241,15 @@
241
241
  {#if !$isEdit}
242
242
  <strong>{comma($price.before.amount)} {$price.before.forex}</strong>
243
243
  {:else}
244
- {@const diff = $price.new.amount - $price.before.amount}
245
244
  {@const forex = $price.new.forex}
246
- {#if diff > 0}
247
- <span>{comma($editPrice.before.amount)} {forex} + {comma(diff)} {forex} = </span>
248
- {:else if diff < 0}
249
- <span>{comma($editPrice.before.amount)} {forex} - {comma(Math.abs(diff))} {forex} = </span>
245
+ {#if $priceDifference > 0}
246
+ <span>{comma($editPrice.before.amount)} {forex} + {comma($priceDifference)} {forex} = </span>
247
+ {:else if $priceDifference < 0}
248
+ <span>
249
+ {comma($editPrice.before.amount)}
250
+ {forex} - {comma(Math.abs($priceDifference))}
251
+ {forex} =
252
+ </span>
250
253
  {/if}
251
254
  <strong>{comma($editPrice.new.amount)} {forex}</strong>
252
255
  {/if}
@@ -121,6 +121,11 @@ function createBookingStore(bookingDTO: Awaited<ReturnType<typeof BookingAPI.get
121
121
  return result
122
122
  })
123
123
 
124
+ const priceDifference = derived(price, $price => {
125
+ if (!$price.before || !$price.new) return null
126
+ return $price.new.amount - $price.before.amount
127
+ })
128
+
124
129
  /**
125
130
  * 이하 subscribe & set => 보려는 값과 변경하는 방식이 복잡한 경우
126
131
  */
@@ -373,6 +378,7 @@ function createBookingStore(bookingDTO: Awaited<ReturnType<typeof BookingAPI.get
373
378
  availableDestZones,
374
379
  selectedPrice,
375
380
  isModifiable,
381
+ priceDifference,
376
382
 
377
383
  // subscribe & set
378
384
  hour,