@movvjs/svelte-schedule-view 0.4.21 → 0.4.22
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.
|
@@ -42,6 +42,7 @@ const {
|
|
|
42
42
|
let translation$;
|
|
43
43
|
let flightSearch$;
|
|
44
44
|
let calender$;
|
|
45
|
+
export let emailList = [""];
|
|
45
46
|
async function copyContents() {
|
|
46
47
|
const texts = [];
|
|
47
48
|
texts.push(`FMS CODE : ${$originalBooking.code}`);
|
|
@@ -296,9 +297,8 @@ function openCalender() {
|
|
|
296
297
|
</div>
|
|
297
298
|
{:else}
|
|
298
299
|
<!-- <input bind:value={$copiedBooking.email} type="email" class="indie_text_nor xs3 white w100" placeholder="E-mail" /> -->
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
{/if}
|
|
300
|
+
|
|
301
|
+
<EmailList bind:emailList />
|
|
302
302
|
{/if}
|
|
303
303
|
</td>
|
|
304
304
|
</tr>
|
|
@@ -35,6 +35,7 @@ const {
|
|
|
35
35
|
let initialized = false;
|
|
36
36
|
let on = false;
|
|
37
37
|
let resolver;
|
|
38
|
+
let emailList = [""];
|
|
38
39
|
$:
|
|
39
40
|
targetPrice = $isEdit ? $editPrice : $price;
|
|
40
41
|
$:
|
|
@@ -148,6 +149,7 @@ function open({ code }) {
|
|
|
148
149
|
} else {
|
|
149
150
|
readyView = true;
|
|
150
151
|
$originalBooking = response.booking;
|
|
152
|
+
emailList = [response.booking.email, ...response.booking.emailList ?? []].filter(Boolean);
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
155
|
on = true;
|
|
@@ -174,11 +176,10 @@ async function edit() {
|
|
|
174
176
|
const preview = await BookingAPI.modifyPreview($originalBooking);
|
|
175
177
|
if (!preview)
|
|
176
178
|
return;
|
|
177
|
-
const mergedEmailList = [preview.email, ...preview.emailList ?? []].filter(Boolean);
|
|
178
179
|
$copiedBooking = {
|
|
179
|
-
...preview
|
|
180
|
-
emailList: mergedEmailList
|
|
180
|
+
...preview
|
|
181
181
|
};
|
|
182
|
+
emailList = [preview.email, ...preview.emailList ?? []].filter(Boolean);
|
|
182
183
|
$originalBooking = cloneDeep($copiedBooking);
|
|
183
184
|
$isEdit = true;
|
|
184
185
|
} catch (e) {
|
|
@@ -192,9 +193,10 @@ async function edit() {
|
|
|
192
193
|
}
|
|
193
194
|
function reset() {
|
|
194
195
|
$copiedBooking = cloneDeep($originalBooking);
|
|
196
|
+
emailList = [$originalBooking.email, ...$originalBooking.emailList ?? []].filter(Boolean);
|
|
195
197
|
}
|
|
196
|
-
function hasDuplicateEmail(
|
|
197
|
-
const filtered =
|
|
198
|
+
function hasDuplicateEmail(emailList2) {
|
|
199
|
+
const filtered = emailList2.map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
198
200
|
return new Set(filtered).size !== filtered.length;
|
|
199
201
|
}
|
|
200
202
|
async function save() {
|
|
@@ -205,21 +207,22 @@ async function save() {
|
|
|
205
207
|
if (!$copiedBooking.tel) {
|
|
206
208
|
throw new Error($t("error.pleaseEnterTelNumber"));
|
|
207
209
|
}
|
|
208
|
-
if (hasDuplicateEmail(
|
|
210
|
+
if (hasDuplicateEmail(emailList))
|
|
209
211
|
throw new Error($t("error.dupliEmail"));
|
|
210
|
-
const cleaned =
|
|
211
|
-
$copiedBooking.email = cleaned[0] ?? "";
|
|
212
|
-
$copiedBooking.emailList = cleaned.slice(1);
|
|
212
|
+
const cleaned = emailList.map((e) => e?.trim()).filter(Boolean);
|
|
213
213
|
loader.show();
|
|
214
214
|
const modifiedBooking = await BookingAPI.modify({
|
|
215
215
|
...$copiedBooking,
|
|
216
216
|
name: $fullName,
|
|
217
|
+
email: cleaned[0] ?? "",
|
|
218
|
+
emailList: cleaned.slice(1),
|
|
217
219
|
...$selectedPrice ? {
|
|
218
220
|
psno: $selectedPrice.psno,
|
|
219
221
|
cacheCode: $selectedPrice.cacheCode
|
|
220
222
|
} : {}
|
|
221
223
|
});
|
|
222
224
|
$originalBooking = modifiedBooking;
|
|
225
|
+
emailList = [modifiedBooking.email, ...modifiedBooking.emailList ?? []].filter(Boolean);
|
|
223
226
|
isEdit.set(false);
|
|
224
227
|
} catch (e) {
|
|
225
228
|
if ($originalBooking?.gdsSystemCode !== HERTZ && e?.errorCode === "E-0003")
|
|
@@ -261,7 +264,7 @@ async function save() {
|
|
|
261
264
|
<div class="contents_b">
|
|
262
265
|
<ServiceZone />
|
|
263
266
|
<Plan />
|
|
264
|
-
<BookingInfo />
|
|
267
|
+
<BookingInfo bind:emailList />
|
|
265
268
|
</div>
|
|
266
269
|
|
|
267
270
|
<div class="footer_b">
|