tripstorekrabi-shared 1.12.1 → 1.12.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.
- package/booking.js +56 -0
- package/package.json +1 -1
package/booking.js
CHANGED
|
@@ -189,4 +189,60 @@ function addPhoneNumbers(phoneNumbers, phoneNumber) {
|
|
|
189
189
|
phoneNumbers.push(phoneNumber);
|
|
190
190
|
phoneNumbers.push("+" + phoneNumber);
|
|
191
191
|
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function getStartingPointMessage(booking, product) {
|
|
195
|
+
let text = booking.startingPointDescription;
|
|
196
|
+
if (booking.pickupTime.indexOf('-') != -1) {
|
|
197
|
+
text +=
|
|
198
|
+
' between ' +
|
|
199
|
+
booking.pickupTime.replace(' - ', ' and ').replace('-', ' and ');
|
|
200
|
+
} else {
|
|
201
|
+
text += ' at ' + booking.pickupTime;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
let now = dayjs().tz("Asia/Bangkok");
|
|
205
|
+
let dayjsDate = dayjs.tz(booking.departureDate.toDate(), "Asia/Bangkok");
|
|
206
|
+
let date = dayjsDate.format('Do MMM');
|
|
207
|
+
|
|
208
|
+
if (
|
|
209
|
+
now.add(1, 'day').isSame(dayjsDate, 'day')
|
|
210
|
+
) {
|
|
211
|
+
text += ' tomorrow the ' + date;
|
|
212
|
+
} else if (now.isSame(dayjsDate, 'day')) {
|
|
213
|
+
text += ' today the ' + date;
|
|
214
|
+
} else {
|
|
215
|
+
text += ' on the ' + date;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
text += '. Please watch out for the staff of ' + booking.operator + '.';
|
|
219
|
+
|
|
220
|
+
if (booking.specialRequirements) {
|
|
221
|
+
text +=
|
|
222
|
+
'\n\nSPECIAL REQUIREMENTS: ' +
|
|
223
|
+
booking.specialRequirements.toUpperCase();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (booking.nationalParkFee == 'Pay on tour') {
|
|
227
|
+
text += '\n\nAs stated on the website, there is an entrance fee';
|
|
228
|
+
|
|
229
|
+
if (product?.nationalPark) {
|
|
230
|
+
text += ' to ' + product?.nationalPark.title;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (product?.nationalPark?.pricing
|
|
234
|
+
) {
|
|
235
|
+
text +=
|
|
236
|
+
' of ' +
|
|
237
|
+
product.nationalPark.pricing.adult +
|
|
238
|
+
' THB per adult and ' +
|
|
239
|
+
product.nationalPark.pricing.child +
|
|
240
|
+
' THB per child';
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
text +=
|
|
244
|
+
' to be paid at point of entry. Please bring the required amount in cash to the trip.';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return text;
|
|
192
248
|
}
|