tripstorekrabi-shared 1.12.1 → 1.12.3
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 +59 -3
- package/package.json +1 -1
package/booking.js
CHANGED
|
@@ -126,13 +126,13 @@ export function addBookingFromInvoice(firestore, admin, invoice, paymentData, co
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
export function getOperatorSignature(agent, operatorName) {
|
|
129
|
+
export function getOperatorSignature(agent, operatorName, contact) {
|
|
130
130
|
let signature =
|
|
131
131
|
'<br><br>Warm regards,<br><br>' + (agent ? agent + ' - ' : "") + operatorName;
|
|
132
132
|
signature +=
|
|
133
|
-
|
|
133
|
+
`<br>WhatsApp chat: <a href='https://wa.me/${contact.respondNumber.replace(/\D/g, '')}'>${contact.respondNumber}</a>`;
|
|
134
134
|
signature +=
|
|
135
|
-
|
|
135
|
+
`<br>WhatsApp call: <a href='https://wa.me/${contact.whatsappNumber.replace(/\D/g, '')}'>${contact.whatsappNumber}</a>`;
|
|
136
136
|
signature +=
|
|
137
137
|
"<br>Telegram chat: <a href='https://t.me/tripstorekrabi_bot'>@tripstorekrabi_bot</a>";
|
|
138
138
|
return signature;
|
|
@@ -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
|
}
|