tripstorekrabi-shared 1.19.7 → 1.19.8
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/booking.js +60 -58
- package/package.json +1 -1
package/booking.js
CHANGED
|
@@ -251,7 +251,7 @@ function addPhoneNumbers(phoneNumbers, phoneNumber) {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
export function getStartingPointMessage(booking, product) {
|
|
254
|
+
export function getStartingPointMessage(booking, product, options = { compact: false }) {
|
|
255
255
|
let text = booking.startingPointDescription;
|
|
256
256
|
if (booking.pickupTime.indexOf('-') != -1) {
|
|
257
257
|
text +=
|
|
@@ -282,76 +282,78 @@ export function getStartingPointMessage(booking, product) {
|
|
|
282
282
|
|
|
283
283
|
text += 'Kindly watch for staff representing ' + booking.operator + '.';
|
|
284
284
|
|
|
285
|
-
if (
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
if (!options.compact) {
|
|
286
|
+
if (booking.googleMapsLocation?.length > 0) {
|
|
287
|
+
text += `\n\n${isHotelPickup(booking.startingPointDescription)
|
|
288
|
+
? 'PICKUP COORDINATES ON GOOGLE MAP'
|
|
289
|
+
: 'MEETING COORDINATES ON GOOGLE MAP'
|
|
290
|
+
}:\n${booking.googleMapsLocation}`;
|
|
291
|
+
}
|
|
291
292
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
if (product?.whatToBring?.length > 0) {
|
|
294
|
+
text += '\n\nWHAT TO BRING: ' + product.whatToBring;
|
|
295
|
+
}
|
|
295
296
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
let notes = Object.values(booking.notes ?? {})
|
|
298
|
+
.filter((item) => item.visibility.includes(CUSTOMER_NOTE))
|
|
299
|
+
.map((item) => item.description);
|
|
300
|
+
if (notes.length > 0) {
|
|
301
|
+
text += '\n\nSPECIAL CUSTOMER NEEDS: ' + notes.join(', ');
|
|
302
|
+
}
|
|
302
303
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
// add customer information from starting point
|
|
305
|
+
let important = [];
|
|
306
|
+
if (product) {
|
|
307
|
+
let startingPoint = product.startingPoints.find(
|
|
308
|
+
(item) => item.id === booking.startingPointId
|
|
309
|
+
);
|
|
309
310
|
|
|
310
|
-
|
|
311
|
-
|
|
311
|
+
if (startingPoint?.customerInformation) {
|
|
312
|
+
important.push(startingPoint.customerInformation.trim());
|
|
313
|
+
}
|
|
312
314
|
}
|
|
313
|
-
}
|
|
314
315
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
if (product?.customerInformation?.length > 0) {
|
|
317
|
+
important.push(product.customerInformation);
|
|
318
|
+
}
|
|
318
319
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
if (important.length > 0) {
|
|
321
|
+
text += '\n\nIMPORTANT INFORMATION: ' + important.join("\n\n");
|
|
322
|
+
}
|
|
322
323
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
if (booking.dietary?.length > 0) {
|
|
325
|
+
text += '\n\nDIETARY NEEDS: ' + booking.dietary;
|
|
326
|
+
}
|
|
326
327
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
let payOnTour = [];
|
|
329
|
+
if (booking.nationalParkFee == PAY_ON_TOUR) {
|
|
330
|
+
let item = 'As stated on the website, there is an entrance fee';
|
|
330
331
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
if (product?.nationalPark) {
|
|
333
|
+
item += ' to ' + product?.nationalPark.title;
|
|
334
|
+
}
|
|
334
335
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
336
|
+
if (product?.nationalPark?.pricing) {
|
|
337
|
+
item +=
|
|
338
|
+
' of ' +
|
|
339
|
+
product.nationalPark.pricing.adult +
|
|
340
|
+
' THB per adult and ' +
|
|
341
|
+
product.nationalPark.pricing.child +
|
|
342
|
+
' THB per child';
|
|
343
|
+
}
|
|
344
|
+
item += ' to be paid at the point of entry';
|
|
344
345
|
|
|
345
|
-
|
|
346
|
-
|
|
346
|
+
payOnTour.push(` • ${item}`);
|
|
347
|
+
}
|
|
347
348
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
349
|
+
let extraPayments = Object.values(booking.extraPayments)
|
|
350
|
+
.filter((item) => !item.disabled && item.paymentMethod === PAY_ON_TOUR)
|
|
351
|
+
.map((item) => ` • ${item.description}: ${item.price} THB`);
|
|
352
|
+
payOnTour = [...payOnTour, ...extraPayments];
|
|
353
|
+
if (payOnTour.length > 0) {
|
|
354
|
+
text += '\n\nTO BE PAID ON TOUR:\n' + payOnTour.join('\n');
|
|
355
|
+
text += '\n\nPlease bring the total amount in cash to the trip.';
|
|
356
|
+
}
|
|
355
357
|
}
|
|
356
358
|
|
|
357
359
|
return text;
|