tripstorekrabi-shared 1.10.1 → 1.10.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.
Files changed (2) hide show
  1. package/booking.js +45 -0
  2. package/package.json +1 -1
package/booking.js CHANGED
@@ -115,4 +115,49 @@ export function addBookingFromInvoice(firestore, admin, invoice, paymentData, co
115
115
  );
116
116
  });
117
117
  });
118
+ }
119
+
120
+ export function getStartingPointMessage(booking) {
121
+ let text = booking.startingPointDescription;
122
+ if (booking.pickupTime.indexOf('-') != -1) {
123
+ text +=
124
+ ' between ' +
125
+ booking.pickupTime.replace(' - ', ' and ').replace('-', ' and ');
126
+ } else {
127
+ text += ' at ' + booking.pickupTime;
128
+ }
129
+
130
+ let date = dayjs(booking.departureDate.toDate()).format('Do MMM');
131
+
132
+ if (
133
+ dayjs().add(1, 'day').isSame(dayjs(booking.departureDate.toDate()), 'day')
134
+ ) {
135
+ text += ' tomorrow the ' + date;
136
+ } else if (dayjs().isSame(dayjs(booking.departureDate.toDate()), 'day')) {
137
+ text += ' today the ' + date;
138
+ } else {
139
+ text += ' on the ' + date;
140
+ }
141
+
142
+ text += '. Please watch out for the staff of ' + booking.operator + '.';
143
+
144
+ if (booking.specialRequirements) {
145
+ text +=
146
+ '\n\nSPECIAL REQUIREMENTS: ' +
147
+ booking.specialRequirements.toUpperCase();
148
+ }
149
+
150
+ return text;
151
+ }
152
+
153
+ export function getOperatorSignature(agent, operatorName) {
154
+ let signature =
155
+ '<br><br>Warm regards,<br><br>' + (agent ? agent + ' - ' : "") + operatorName;
156
+ signature +=
157
+ "<br>WhatsApp chat: <a href='https://wa.me/66840679979'>+66 (0) 840 679 979</a>";
158
+ signature +=
159
+ "<br>WhatsApp call: <a href='https://wa.me/66967215940'>+66 (0) 967 215 940</a>";
160
+ signature +=
161
+ "<br>Telegram chat: <a href='https://t.me/tripstorekrabi_bot'>@tripstorekrabi_bot</a>";
162
+ return signature;
118
163
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {