@quoreadmin/ui 1.6.4 → 1.6.6

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 (171) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index139.js +386 -347
  3. package/dist/index15.js +19 -19
  4. package/dist/index181.js +8 -8
  5. package/dist/index183.js +8 -8
  6. package/dist/index187.js +17 -17
  7. package/dist/index190.js +7 -7
  8. package/dist/index201.js +4 -4
  9. package/dist/index205.js +2 -2
  10. package/dist/index206.js +1 -1
  11. package/dist/index207.js +1 -1
  12. package/dist/index208.js +1 -1
  13. package/dist/index209.js +1 -1
  14. package/dist/index210.js +4 -4
  15. package/dist/index212.js +4 -4
  16. package/dist/index215.js +1 -1
  17. package/dist/index223.js +121 -155
  18. package/dist/index224.js +37 -19
  19. package/dist/index225.js +80 -20
  20. package/dist/index226.js +13 -15
  21. package/dist/index227.js +19 -198
  22. package/dist/index228.js +18 -68
  23. package/dist/index229.js +20 -34
  24. package/dist/index23.js +7 -6
  25. package/dist/index230.js +19 -39
  26. package/dist/index231.js +155 -121
  27. package/dist/index232.js +19 -37
  28. package/dist/index233.js +22 -80
  29. package/dist/index234.js +198 -19
  30. package/dist/index235.js +68 -18
  31. package/dist/index236.js +34 -20
  32. package/dist/index237.js +39 -19
  33. package/dist/index238.js +1 -1
  34. package/dist/index239.js +1 -1
  35. package/dist/index240.js +1 -1
  36. package/dist/index241.js +6 -6
  37. package/dist/index242.js +1 -1
  38. package/dist/index244.js +1 -1
  39. package/dist/index245.js +1 -1
  40. package/dist/index246.js +1 -1
  41. package/dist/index248.js +1 -1
  42. package/dist/index249.js +1 -1
  43. package/dist/index250.js +6 -6
  44. package/dist/index251.js +1 -1
  45. package/dist/index252.js +1 -1
  46. package/dist/index253.js +1 -1
  47. package/dist/index254.js +1 -1
  48. package/dist/index255.js +1 -1
  49. package/dist/index256.js +1 -1
  50. package/dist/index259.js +6 -6
  51. package/dist/index260.js +1 -1
  52. package/dist/index261.js +1 -1
  53. package/dist/index274.js +2 -2
  54. package/dist/index279.js +3 -54
  55. package/dist/index280.js +25 -77
  56. package/dist/index281.js +2 -26
  57. package/dist/index282.js +78 -21
  58. package/dist/index283.js +53 -21
  59. package/dist/index284.js +26 -16
  60. package/dist/index285.js +22 -17
  61. package/dist/index286.js +21 -22
  62. package/dist/index287.js +16 -2
  63. package/dist/index288.js +17 -235
  64. package/dist/index289.js +23 -6
  65. package/dist/index290.js +76 -131
  66. package/dist/index291.js +21 -67
  67. package/dist/index292.js +926 -78
  68. package/dist/index293.js +21 -28
  69. package/dist/index294.js +18 -7
  70. package/dist/index295.js +19 -74
  71. package/dist/index296.js +68 -3
  72. package/dist/index297.js +19 -2
  73. package/dist/index298.js +18 -82
  74. package/dist/index299.js +21 -53
  75. package/dist/index300.js +21 -5
  76. package/dist/index301.js +63 -5
  77. package/dist/index302.js +1488 -149
  78. package/dist/index303.js +378 -55
  79. package/dist/index304.js +2731 -75
  80. package/dist/index305.js +86 -3
  81. package/dist/index306.js +3764 -21
  82. package/dist/index307.js +55 -1513
  83. package/dist/index308.js +14 -385
  84. package/dist/index309.js +67 -2714
  85. package/dist/index310.js +189 -73
  86. package/dist/index311.js +222 -3746
  87. package/dist/index312.js +227 -52
  88. package/dist/index313.js +5 -78
  89. package/dist/index314.js +133 -21
  90. package/dist/index315.js +62 -929
  91. package/dist/index316.js +86 -21
  92. package/dist/index317.js +28 -19
  93. package/dist/index318.js +7 -18
  94. package/dist/index319.js +73 -67
  95. package/dist/index320.js +4 -19
  96. package/dist/index321.js +2 -19
  97. package/dist/index322.js +82 -21
  98. package/dist/index323.js +53 -21
  99. package/dist/index324.js +6 -63
  100. package/dist/index325.js +5 -15
  101. package/dist/index326.js +166 -71
  102. package/dist/index327.js +57 -196
  103. package/dist/index328.js +75 -246
  104. package/dist/index329.js +8 -36
  105. package/dist/index330.js +12 -20
  106. package/dist/index331.js +53 -54
  107. package/dist/index332.js +10 -27
  108. package/dist/index333.js +13 -6
  109. package/dist/index334.js +54 -48
  110. package/dist/index335.js +52 -6
  111. package/dist/index336.js +30 -11
  112. package/dist/index337.js +2 -7
  113. package/dist/index338.js +4 -27
  114. package/dist/index339.js +2 -2
  115. package/dist/index340.js +22 -69
  116. package/dist/index341.js +38 -164
  117. package/dist/index342.js +2 -9
  118. package/dist/index343.js +11 -13
  119. package/dist/index344.js +16 -51
  120. package/dist/index345.js +16 -11
  121. package/dist/index346.js +10 -14
  122. package/dist/index347.js +10 -58
  123. package/dist/index348.js +2 -52
  124. package/dist/index349.js +9 -31
  125. package/dist/index350.js +10 -2
  126. package/dist/index351.js +13 -4
  127. package/dist/index352.js +37 -2
  128. package/dist/index353.js +20 -23
  129. package/dist/index354.js +19 -40
  130. package/dist/index355.js +64 -2
  131. package/dist/index356.js +36 -10
  132. package/dist/index357.js +18 -17
  133. package/dist/index358.js +55 -16
  134. package/dist/index359.js +29 -10
  135. package/dist/index360.js +7 -10
  136. package/dist/index361.js +52 -2
  137. package/dist/index362.js +5 -8
  138. package/dist/index363.js +11 -9
  139. package/dist/index364.js +6 -13
  140. package/dist/index365.js +28 -20
  141. package/dist/index366.js +2 -20
  142. package/dist/index367.js +67 -61
  143. package/dist/index368.js +166 -36
  144. package/dist/index369.js +17 -31
  145. package/dist/index370.js +100 -10
  146. package/dist/index371.js +90 -3
  147. package/dist/index372.js +98 -4
  148. package/dist/index373.js +30 -12
  149. package/dist/index374.js +11 -7
  150. package/dist/index375.js +3 -11
  151. package/dist/index376.js +3 -4
  152. package/dist/index377.js +13 -33
  153. package/dist/index378.js +7 -31
  154. package/dist/index379.js +12 -28
  155. package/dist/index380.js +5 -61
  156. package/dist/index381.js +33 -91
  157. package/dist/index382.js +29 -99
  158. package/dist/index383.js +27 -16
  159. package/dist/index384.js +59 -96
  160. package/dist/index385.js +1 -1
  161. package/dist/index390.js +1 -1
  162. package/dist/index391.js +2 -2
  163. package/dist/index43.js +247 -217
  164. package/dist/index85.js +21 -17
  165. package/dist/src/components/data-filter/data-filter.d.ts +9 -0
  166. package/dist/src/components/data-list/data-list.d.ts +9 -0
  167. package/dist/src/components/grid/grid.stories.d.ts +9 -0
  168. package/dist/src/components/room-details-popover/room-details-popover.d.ts +18 -3
  169. package/dist/src/views/lists.vue.d.ts +18 -0
  170. package/dist/src/views/tables.vue.d.ts +9 -0
  171. package/package.json +1 -1
package/dist/index139.js CHANGED
@@ -1,29 +1,29 @@
1
- import { defineComponent as Fe, ref as s, computed as p, watch as G, onMounted as je, onUnmounted as $e } from "vue";
2
- import { useI18n as ze } from "vue-i18n";
3
- import { DateTime as h } from "./index162.js";
1
+ import { defineComponent as $e, ref as u, computed as h, watch as P, onMounted as Ye, onUnmounted as ze } from "vue";
2
+ import { useI18n as Xe } from "vue-i18n";
3
+ import { DateTime as g } from "./index162.js";
4
4
  import "./index185.js";
5
- import We from "./index2.js";
6
- import Xe from "./index3.js";
7
- import Je from "./index13.js";
8
- import Ke from "./index21.js";
9
- import Ve from "./index28.js";
10
- import Ze from "./index39.js";
11
- import et from "./index186.js";
12
- import tt from "./index46.js";
13
- import at from "./index49.js";
5
+ import Ke from "./index2.js";
6
+ import Ve from "./index3.js";
7
+ import Ze from "./index13.js";
8
+ import et from "./index21.js";
9
+ import tt from "./index28.js";
10
+ import at from "./index39.js";
11
+ import ot from "./index186.js";
12
+ import st from "./index46.js";
13
+ import nt from "./index49.js";
14
14
  import Q from "./index187.js";
15
- const ht = Fe({
15
+ const _t = $e({
16
16
  name: "QRoomDetailsPopover",
17
17
  components: {
18
- QAccordion: We,
19
- QActivityItem: Xe,
20
- QCommentSection: Je,
21
- QDatePicker: et,
22
- QDivider: Ke,
23
- QIcon: Ve,
24
- QPopover: Ze,
25
- QTag: tt,
26
- QTooltip: at
18
+ QAccordion: Ke,
19
+ QActivityItem: Ve,
20
+ QCommentSection: Ze,
21
+ QDatePicker: ot,
22
+ QDivider: et,
23
+ QIcon: tt,
24
+ QPopover: at,
25
+ QTag: st,
26
+ QTooltip: nt
27
27
  },
28
28
  props: {
29
29
  id: {
@@ -117,27 +117,31 @@ const ht = Fe({
117
117
  type: String,
118
118
  default: "",
119
119
  required: !0
120
+ },
121
+ allowWhenWhere: {
122
+ type: Boolean,
123
+ default: !1
120
124
  }
121
125
  },
122
126
  emits: ["create:callback", "create:todo", "refresh:pms", "toggle"],
123
- setup(n, { emit: w }) {
124
- const { t: d } = ze(), r = s(null), F = s(!1), j = s("left"), A = s([
127
+ setup(s, { emit: k }) {
128
+ const { t: v } = Xe(), i = u(null), J = u(!1), $ = u("left"), L = u([
125
129
  {
126
130
  id: 1,
127
- label: d("HC_DEPARTMENT")
131
+ label: v("HC_DEPARTMENT")
128
132
  // need to localize
129
133
  },
130
134
  {
131
135
  id: 2,
132
- label: d("HC_PERSON")
136
+ label: v("HC_PERSON")
133
137
  // need to localize
134
138
  },
135
139
  {
136
140
  id: 0,
137
- label: d("HC_ANYONE")
141
+ label: v("HC_ANYONE")
138
142
  // need to localize
139
143
  }
140
- ]), k = s(""), i = s({
144
+ ]), b = u(""), p = u({
141
145
  checkInDate: /* @__PURE__ */ new Date(),
142
146
  checkOutDate: /* @__PURE__ */ new Date(),
143
147
  guestEmail: "",
@@ -145,60 +149,62 @@ const ht = Fe({
145
149
  guestMood: null,
146
150
  guestName: "",
147
151
  guestPhone: "",
148
- inHouse: !!r.value?.tokenId || !1,
152
+ inHouse: !!i.value?.tokenId || !1,
149
153
  problem: null,
150
154
  notes: "",
151
- tokenId: r.value?.tokenId
152
- }), E = s(250), M = s(290), O = s([]), me = s([]), $ = s(!0), B = s(!0), b = s({
155
+ tokenId: i.value?.tokenId
156
+ }), N = u(250), M = u(290), I = u([]), ne = u([]), Y = u(!0), x = u(!0), O = u({
153
157
  info: !0,
154
158
  tickets: !0,
155
159
  comments: !0
156
- }), P = s(!0), pe = s(n.guestDetails), D = s([]), T = s({
160
+ }), W = u(!0), he = u(s.guestDetails), w = u([]), T = u({
157
161
  pms: !1,
158
162
  roomNotices: !1,
159
163
  tickets: !1
160
- }), oe = s([]), z = s([]), W = s("bottom"), C = s(null), X = s([]), R = s(!1), u = s({
164
+ }), le = u([]), z = u([]), X = u("bottom"), C = u(null), K = u([]), R = u(!1), l = u({
161
165
  assignType: null,
162
166
  department: null,
163
167
  due: /* @__PURE__ */ new Date(),
164
168
  item: null,
165
169
  notes: "",
166
170
  person: null,
167
- requestedBy: null
168
- }), N = s([
171
+ requestedBy: null,
172
+ when: null,
173
+ where: null
174
+ }), q = u([
169
175
  {
170
176
  id: 0,
171
- label: d("HC_STAFF_MEMBER")
177
+ label: v("HC_STAFF_MEMBER")
172
178
  // need to localize
173
179
  },
174
180
  {
175
181
  id: 1,
176
- label: d("HC_HOTEL_GUEST")
182
+ label: v("HC_HOTEL_GUEST")
177
183
  // need to localize
178
184
  }
179
- ]), ve = s(!1), g = s(null), v = s({
185
+ ]), ye = u(!1), _ = u(null), y = u({
180
186
  endDate: /* @__PURE__ */ new Date(),
181
187
  issue: null,
182
188
  notes: "",
183
189
  startDate: /* @__PURE__ */ new Date()
184
- }), L = s([]), x = s(!1), _ = s([]), S = s([]), fe = s([
190
+ }), F = u([]), G = u(!1), D = u([]), H = u([]), ge = u([
185
191
  {
186
- label: d("HC_COMPLAINT"),
192
+ label: v("HC_COMPLAINT"),
187
193
  id: "complaint"
188
194
  },
189
195
  {
190
- label: d("HC_REQUEST"),
196
+ label: v("HC_REQUEST"),
191
197
  id: "request"
192
198
  },
193
199
  {
194
- label: d("HC_ROOM_NOTICE"),
200
+ label: v("HC_ROOM_NOTICE"),
195
201
  id: "room_notice"
196
202
  },
197
203
  {
198
- label: d("HC_WORK_ORDER"),
204
+ label: v("HC_WORK_ORDER"),
199
205
  id: "work_order"
200
206
  }
201
- ]), q = s(), Y = s(null), l = s({
207
+ ]), A = u(), U = u(null), c = u({
202
208
  assignType: null,
203
209
  department: null,
204
210
  due: /* @__PURE__ */ new Date(),
@@ -207,8 +213,8 @@ const ht = Fe({
207
213
  notes: "",
208
214
  person: null,
209
215
  requestedBy: null
210
- }), J = s([]), K = p(() => {
211
- switch (r.value.cleaning?.name) {
216
+ }), V = u([]), E = u([]), S = u([]), Z = h(() => {
217
+ switch (i.value.cleaning?.name) {
212
218
  case "CLEAN":
213
219
  case "INSPECTED":
214
220
  return "CLEAN";
@@ -220,84 +226,86 @@ const ht = Fe({
220
226
  default:
221
227
  return "";
222
228
  }
223
- }), ye = p(() => K.value === "CLEAN" ? "blue-10" : K.value === "DIRTY" ? "red-10" : "gray-30"), he = p(() => d(`HC_${r.value.cleaning?.name}`) || ""), ge = p(() => {
224
- const e = k.value.toLowerCase();
225
- return X.value.filter((a) => a.toLowerCase().match(e));
226
- }), se = p(() => _.value.length ? !!_.value.find(
229
+ }), we = h(() => Z.value === "CLEAN" ? "blue-10" : Z.value === "DIRTY" ? "red-10" : "gray-30"), _e = h(() => v(`HC_${i.value.cleaning?.name}`) || ""), De = h(() => {
230
+ const e = b.value.toLowerCase();
231
+ return K.value.filter((a) => a.toLowerCase().match(e));
232
+ }), re = h(() => D.value.length ? !!D.value.find(
227
233
  (a) => a.type === "complaint"
228
- ) : !1), _e = p(() => _.value.length ? !!_.value.find(
234
+ ) : !1), ke = h(() => D.value.length ? !!D.value.find(
229
235
  (a) => a.type === "callback"
230
- ) : !1), we = p(() => {
236
+ ) : !1), be = h(() => {
231
237
  let e = [];
232
- return D.value[0] && D.value[0].options === void 0 ? D.value.forEach((a) => {
238
+ return w.value[0] && w.value[0].options === void 0 ? w.value.forEach((a) => {
233
239
  e.push({
234
240
  id: parseInt(a.id),
235
241
  label: a.display_name
236
242
  });
237
- }) : e = D.value, e;
238
- }), ne = p(() => r.value.occupancy?.name === "OCCUPIED"), ke = p(() => ne.value && se.value ? "HK_ROOM_STATUS_Occupied_Complaint" : "HK_ROOM_STATUS_Occupied"), De = p(() => {
239
- switch (g.value?.id) {
243
+ }) : e = w.value, e;
244
+ }), ue = h(() => i.value.occupancy?.name === "OCCUPIED"), Te = h(() => ue.value && re.value ? "HK_ROOM_STATUS_Occupied_Complaint" : "HK_ROOM_STATUS_Occupied"), Ie = h(() => {
245
+ switch (_.value?.id) {
240
246
  case "request":
241
247
  case "work_order":
242
- return A.value[0];
248
+ return L.value[0];
243
249
  default:
244
250
  return null;
245
251
  }
246
- }), Te = p(() => {
247
- if (O.value)
248
- switch (g.value?.id) {
252
+ }), Oe = h(() => {
253
+ if (I.value)
254
+ switch (_.value?.id) {
249
255
  case "request":
250
- return O.value.find((e) => parseInt(e.id) === 4);
256
+ return I.value.find((e) => parseInt(e.id) === 4);
251
257
  case "work_order":
252
- return O.value.find((e) => parseInt(e.id) === 2);
258
+ return I.value.find((e) => parseInt(e.id) === 2);
253
259
  default:
254
260
  return null;
255
261
  }
256
262
  return null;
257
- }), be = p(() => {
258
- switch (g.value?.id) {
263
+ }), Ce = h(() => {
264
+ switch (_.value?.id) {
259
265
  case "request":
260
- return N.value[1];
266
+ return q.value[1];
261
267
  case "work_order":
262
- return N.value[0];
268
+ return q.value[0];
263
269
  default:
264
270
  return null;
265
271
  }
266
- }), Ie = p(() => {
272
+ }), Re = h(() => {
267
273
  let e = "";
268
- if (r.value && r.value.reservations[0]) {
269
- const a = h.fromISO(
270
- r.value.reservations[0].arrivalDate
271
- ), t = a.toFormat("MMM"), o = a.day, c = a.year, m = h.fromISO(
272
- r.value.reservations[0].departureDate
273
- ), f = m.toFormat("MMM"), y = m.day, I = m.year;
274
- e += t + " " + o, c !== I && (e += ", " + c), t === f ? e += "-" + y : e += " - " + f + " " + y, e += ", " + I;
274
+ if (i.value && i.value.reservations[0]) {
275
+ const a = g.fromISO(
276
+ i.value.reservations[0].arrivalDate
277
+ ), t = a.toFormat("MMM"), o = a.day, n = a.year, r = g.fromISO(
278
+ i.value.reservations[0].departureDate
279
+ ), d = r.toFormat("MMM"), m = r.day, f = r.year;
280
+ e += t + " " + o, n !== f && (e += ", " + n), t === d ? e += "-" + m : e += " - " + d + " " + m, e += ", " + f;
275
281
  }
276
282
  return e;
277
- }), Oe = p(() => {
278
- let e = L.value;
283
+ }), Ee = h(() => {
284
+ let e = F.value;
279
285
  return e = [...new Set(e)], e;
280
- }), Ce = p(() => {
281
- const e = g.value?.id;
286
+ }), Se = h(() => {
287
+ const e = _.value?.id;
282
288
  if (!e)
283
289
  return !1;
284
- switch (e.value) {
290
+ switch (e) {
285
291
  case "room_notice":
286
- return v.value.issue && v.value.startDate && v.value.endDate;
292
+ return y.value.issue && y.value.startDate && y.value.endDate;
287
293
  case "complaint":
288
- return i.value.problem && i.value.guestName && i.value.guestMood;
294
+ return p.value.problem && p.value.guestName && p.value.guestMood;
289
295
  case "work_order":
290
- return l.value.item && l.value.issue && l.value.requestedBy && l.value.due && (l.value.assignType && l.value.assignType.id === 0 || l.value.assignType && l.value.assignType.id === 1 && l.value.department || l.value.assignType && l.value.assignType.id === 2 && l.value.person);
291
- case "request":
292
- return u.value.item && u.value.requestedBy && u.value.due && (u.value.assignType && u.value.assignType.id === 0 || u.value.assignType && u.value.assignType.id === 1 && u.value.department || u.value.assignType && u.value.assignType.id === 2 && u.value.person);
296
+ return c.value.item && c.value.issue && c.value.requestedBy && c.value.due && (c.value.assignType && c.value.assignType.id === 0 || c.value.assignType && c.value.assignType.id === 1 && c.value.department || c.value.assignType && c.value.assignType.id === 2 && c.value.person);
297
+ case "request": {
298
+ const a = l.value.item && l.value.requestedBy && l.value.due && (l.value.assignType && l.value.assignType.id === 0 || l.value.assignType && l.value.assignType.id === 1 && l.value.department || l.value.assignType && l.value.assignType.id === 2 && l.value.person), t = s.allowWhenWhere ? l.value.when && l.value.where : !0;
299
+ return a && t;
300
+ }
293
301
  default:
294
302
  return !1;
295
303
  }
296
- }), le = () => {
297
- x.value = !1, R.value = !1, F.value = !1, D.value = [], z.value = [], J.value = [], g.value = null, v.value.issue = null, v.value.startDate = /* @__PURE__ */ new Date(), v.value.endDate = /* @__PURE__ */ new Date(), v.value.notes = "", i.value.guestName = "", i.value.guestEmail = "", i.value.guestPhone = "", i.value.guestMood = null, i.value.guestLoyalty = "", i.value.problem = null, i.value.checkInDate = /* @__PURE__ */ new Date(), i.value.checkOutDate = /* @__PURE__ */ new Date(), i.value.notes = "", l.value.assignType = null, l.value.department = null, l.value.person = null, l.value.due = /* @__PURE__ */ new Date(), l.value.item = null, l.value.issue = null, l.value.notes = "", u.value.assignType = null, u.value.department = null, u.value.person = null, u.value.due = /* @__PURE__ */ new Date(), u.value.item = null, u.value.notes = "";
298
- }, Re = async () => {
299
- w("create:callback", r.value), w("toggle", !1);
300
- }, Ee = (e) => {
304
+ }), ie = () => {
305
+ G.value = !1, R.value = !1, J.value = !1, w.value = [], z.value = [], V.value = [], E.value = [], S.value = [], _.value = null, y.value.issue = null, y.value.startDate = /* @__PURE__ */ new Date(), y.value.endDate = /* @__PURE__ */ new Date(), y.value.notes = "", p.value.guestName = "", p.value.guestEmail = "", p.value.guestPhone = "", p.value.guestMood = null, p.value.guestLoyalty = "", p.value.problem = null, p.value.checkInDate = /* @__PURE__ */ new Date(), p.value.checkOutDate = /* @__PURE__ */ new Date(), p.value.notes = "", c.value.assignType = null, c.value.department = null, c.value.person = null, c.value.due = /* @__PURE__ */ new Date(), c.value.item = null, c.value.issue = null, c.value.notes = "", l.value.assignType = null, l.value.department = null, l.value.person = null, l.value.due = /* @__PURE__ */ new Date(), l.value.item = null, l.value.notes = "", l.value.when = null, l.value.where = null;
306
+ }, Ne = async () => {
307
+ k("create:callback", i.value), k("toggle", !1);
308
+ }, Me = (e) => {
301
309
  const a = [];
302
310
  Object.values(e).forEach((t) => {
303
311
  let o = {
@@ -318,10 +326,10 @@ const ht = Fe({
318
326
  };
319
327
  t.sender_type === "user" && (o.user.firstName = t.user_first_name, o.user.lastName = t.user_last_name, o.user.initials = o.user.firstName[0] + o.user.lastName[0]), t.sender_type === "guest" && (o.user.firstName = t.guest_first_name, o.user.lastName = t.guest_last_name), o.user.initials = o.user.firstName[0] + o.user.lastName[0], o.user.src = "", o.isSystemMessage && (o.user.icon = "property-fill"), t.sender_id && (o.user.id = t.sender_id), a.push(o);
320
328
  }), e.value = a;
321
- }, re = async () => {
322
- n.showComments && r.value.tokenId;
323
- }, Me = (e) => {
324
- const a = h.utc(), t = h.fromFormat(e, "yyyy-MM-dd HH:mm:ss", { zone: "utc" }), o = a.diff(
329
+ }, ce = async () => {
330
+ s.showComments && i.value.tokenId;
331
+ }, qe = (e) => {
332
+ const a = g.utc(), t = g.fromFormat(e, "yyyy-MM-dd HH:mm:ss", { zone: "utc" }), o = a.diff(
325
333
  t,
326
334
  [
327
335
  "years",
@@ -330,69 +338,70 @@ const ht = Fe({
330
338
  "hours",
331
339
  "minutes"
332
340
  ]
333
- ), c = Math.floor(o.years), m = Math.floor(o.months), f = Math.floor(o.days), y = Math.floor(o.hours), I = Math.floor(o.minutes);
334
- if (c)
335
- return c === 1 ? d("HC_ONE_YEAR_AGO") : d("HC_X_YEARS_AGO", { years: c });
341
+ ), n = Math.floor(o.years), r = Math.floor(o.months), d = Math.floor(o.days), m = Math.floor(o.hours), f = Math.floor(o.minutes);
342
+ if (n)
343
+ return n === 1 ? v("HC_ONE_YEAR_AGO") : v("HC_X_YEARS_AGO", { years: n });
344
+ if (r)
345
+ return r === 1 ? v("HC_ONE_MONTH_AGO") : v("HC_X_MONTHS_AGO", { months: r });
346
+ if (d)
347
+ return d === 1 ? v("HC_ONE_DAY_AGO") : v("HC_X_DAYS_AGO", { days: d });
336
348
  if (m)
337
- return m === 1 ? d("HC_ONE_MONTH_AGO") : d("HC_X_MONTHS_AGO", { months: m });
349
+ return m === 1 ? v("HC_ONE_HOUR_AGO") : v("HC_X_HOURS_AGO", { hours: m });
338
350
  if (f)
339
- return f === 1 ? d("HC_ONE_DAY_AGO") : d("HC_X_DAYS_AGO", { days: f });
340
- if (y)
341
- return y === 1 ? d("HC_ONE_HOUR_AGO") : d("HC_X_HOURS_AGO", { hours: y });
342
- if (I)
343
- return I === 1 ? d("HC_ONE_MINUTE_AGO") : d("HC_X_MINUTES_AGO", { minutes: I });
344
- if (I === 0)
345
- return d("HC_A_MOMENT_AGO");
346
- }, Ne = async () => {
347
- n.showGuestDetails && V(), U(), H(), w("refresh:pms", r.value);
348
- }, V = async () => {
351
+ return f === 1 ? v("HC_ONE_MINUTE_AGO") : v("HC_X_MINUTES_AGO", { minutes: f });
352
+ if (f === 0)
353
+ return v("HC_A_MOMENT_AGO");
354
+ }, He = async () => {
355
+ s.showGuestDetails && ee(), j(), B(), k("refresh:pms", i.value);
356
+ }, ee = async () => {
349
357
  try {
350
358
  T.value.pms = !0;
351
359
  const e = new AbortController(), a = setTimeout(() => e.abort(), 45e3);
352
- S.value.push(a);
353
- const t = n.pmsBaseUrl;
360
+ H.value.push(a);
361
+ const t = s.pmsBaseUrl;
354
362
  if (!t)
355
363
  throw new Error("PMS base URL is required");
356
364
  const o = {
357
365
  Authorization: "Bearer " + (() => {
358
- const y = `; ${document.cookie}`.split("; QV2Auth=");
359
- return y.length === 2 && y.pop()?.split(";").shift() || "";
366
+ const m = `; ${document.cookie}`.split("; QV2Auth=");
367
+ return m.length === 2 && m.pop()?.split(";").shift() || "";
360
368
  })(),
361
369
  "Content-Type": "application/json"
362
- }, c = await fetch(
363
- `${t}/vendors/properties/statuses/${n.propertyId}/rooms`,
370
+ }, n = await fetch(
371
+ `${t}/vendors/properties/statuses/${s.propertyId}/rooms`,
364
372
  {
365
373
  method: "GET",
366
374
  headers: o,
367
375
  signal: e.signal
368
376
  }
369
377
  );
370
- clearTimeout(a), c.ok || ie(c);
371
- const m = await c.json();
372
- C.value = m.data.pmsRooms, r.value = C.value.find(
373
- (f) => f.qv2Rooms.qRoomId === n.room.id
374
- ), r.value || (r.value = n.room), T.value.pms = !1;
378
+ clearTimeout(a), n.ok || me(n);
379
+ const r = await n.json();
380
+ C.value = r.data.pmsRooms, i.value = C.value.find(
381
+ (d) => d.qv2Rooms.qRoomId === s.room.id
382
+ ), i.value || (i.value = s.room), T.value.pms = !1;
375
383
  } catch (e) {
376
384
  return T.value.pms = !1, e;
377
385
  }
378
- }, U = async () => {
386
+ }, j = async () => {
379
387
  try {
380
388
  T.value.roomNotices = !0;
381
389
  const e = await fetch(
382
- "/api/client/common/getRoomNotices.php?propertyId=" + n.propertyId + "&roomIds=[" + n.room.id + "]"
390
+ "/api/client/common/getRoomNotices.php?propertyId=" + s.propertyId + "&roomIds=[" + s.room.id + "]"
383
391
  );
384
392
  if (!e.ok)
385
393
  throw new Error(`HTTP error! status: ${e.status}`);
386
394
  const a = await e.json();
387
- L.value = a.notices;
395
+ F.value = a.notices;
388
396
  } catch (e) {
389
- console.error("Error getting room notices:", e), L.value = [];
397
+ console.error("Error getting room notices:", e), F.value = [];
390
398
  } finally {
391
399
  T.value.roomNotices = !1;
392
400
  }
393
- }, Z = async () => {
401
+ }, te = async () => {
394
402
  const e = new FormData();
395
- e.append("property_id", n.propertyId), e.append("filter", "tasks_new"), await Promise.all([
403
+ e.append("property_id", s.propertyId), e.append("filter", "tasks_new");
404
+ const [a, t] = await Promise.all([
396
405
  fetch("/api/client/common/getDepartments.php", {
397
406
  method: "POST"
398
407
  }),
@@ -400,29 +409,38 @@ const ht = Fe({
400
409
  method: "POST",
401
410
  body: e
402
411
  })
403
- ]).then((a) => {
404
- const t = a[0], o = a[1];
405
- console.log("departmentList:", t), console.log("departmentUsersList:", o);
406
- });
407
- }, ue = async () => {
412
+ ]), o = await a.json(), n = await t.json();
413
+ if (o.departments && (o.departments.forEach((r) => {
414
+ r.label = r.display_name;
415
+ }), I.value = o.departments), n.users) {
416
+ const r = [];
417
+ let d = {
418
+ group: "",
419
+ options: []
420
+ };
421
+ n.users.forEach((m) => {
422
+ m.translated_department !== d.group && (d.group && r.push({ ...d }), d.group = m.translated_department, d.options = []), d.options.push(m);
423
+ }), d.group && r.push({ ...d }), ne.value = r;
424
+ }
425
+ }, de = async () => {
408
426
  try {
409
427
  const e = new FormData();
410
- e.append("funcname", "get_stay_details"), e.append("token_id", r.value.tokenId);
428
+ e.append("funcname", "get_stay_details"), e.append("token_id", i.value.tokenId);
411
429
  const t = (await Q.post(
412
430
  "/includes/chat_api.php",
413
431
  e
414
432
  )).data.result;
415
433
  if (t !== void 0 && t.error_message)
416
434
  throw new Error(t.error_message);
417
- t && t.user_name && (i.value.guestName = t.user_name), t && t.cell_phone && (i.value.guestPhone = t.cell_phone), t && t.email && (i.value.guestEmail = t.email), t && t.check_in && (i.value.checkInDate = h(
435
+ t && t.user_name && (p.value.guestName = t.user_name), t && t.cell_phone && (p.value.guestPhone = t.cell_phone), t && t.email && (p.value.guestEmail = t.email), t && t.check_in && (p.value.checkInDate = g.fromISO(
418
436
  t.check_in
419
- ).toDate()), t && t.check_out && (i.value.checkOutDate = h(
437
+ ).toJSDate()), t && t.check_out && (p.value.checkOutDate = g.fromISO(
420
438
  t.check_out
421
- ).toDate());
439
+ ).toJSDate());
422
440
  } catch (e) {
423
441
  console.log(e);
424
442
  }
425
- }, Se = (e) => {
443
+ }, Ae = (e) => {
426
444
  switch (e) {
427
445
  case "complaint":
428
446
  return "red-30";
@@ -435,7 +453,7 @@ const ht = Fe({
435
453
  case "task":
436
454
  return "green-20";
437
455
  }
438
- }, qe = (e) => {
456
+ }, Be = (e) => {
439
457
  switch (e) {
440
458
  case "complaint":
441
459
  return "face-frown";
@@ -448,22 +466,22 @@ const ht = Fe({
448
466
  case "task":
449
467
  return "check";
450
468
  }
451
- }, H = async () => {
469
+ }, B = async () => {
452
470
  try {
453
471
  T.value.tickets = !0;
454
472
  const e = await fetch(
455
- "/api/client/common/getAllToDos.php?propertyId=" + n.propertyId + "&roomIds=[" + n.room.id + "]"
473
+ "/api/client/common/getAllToDos.php?propertyId=" + s.propertyId + "&roomIds=[" + s.room.id + "]"
456
474
  );
457
475
  if (!e.ok)
458
476
  throw new Error(`HTTP error! status: ${e.status}`);
459
477
  const a = await e.json();
460
- _.value = a.tickets;
478
+ D.value = a.tickets;
461
479
  } catch (e) {
462
- console.error("Error getting tickets:", e), _.value = [];
480
+ console.error("Error getting tickets:", e), D.value = [];
463
481
  } finally {
464
482
  T.value.tickets = !1;
465
483
  }
466
- }, ie = async (e) => {
484
+ }, me = async (e) => {
467
485
  const a = await e.text();
468
486
  let t;
469
487
  try {
@@ -472,36 +490,34 @@ const ht = Fe({
472
490
  t = { code: e.status, message: a };
473
491
  }
474
492
  return t.code === 401 ? (window.location.href = "/logout.php?unauthorized=1", { error: t }) : t;
475
- }, He = (e) => {
493
+ }, Pe = (e) => {
476
494
  const a = document.querySelectorAll(".pulse");
477
495
  if (a && a.length) {
478
- const t = document.getElementById(
479
- "room-" + r.value.qv2Rooms.qRoomId
480
- ), o = t?.classList;
496
+ const t = i.value?.qv2Rooms?.qRoomId || i.value?.id || s.room?.id, o = document.getElementById("room-" + t), n = o?.classList;
481
497
  switch (e) {
482
498
  case "room_notice":
483
- (o?.contains("roombox_unsel") || o?.contains("roombox_unsel_active")) && (t?.classList.remove(), t?.classList.add("roomnoticeroombox_sel"));
499
+ (n?.contains("roombox_unsel") || n?.contains("roombox_unsel_active")) && (o?.classList.remove(), o?.classList.add("roomnoticeroombox_sel"));
484
500
  break;
485
501
  case "complaint":
486
- !o?.contains("smsroombox_sel") && !o?.contains("callbackroombox_sel") && (t?.classList.remove(), t?.classList.add("complaintsroombox_sel"));
502
+ !n?.contains("smsroombox_sel") && !n?.contains("callbackroombox_sel") && (o?.classList.remove(), o?.classList.add("complaintsroombox_sel"));
487
503
  break;
488
504
  case "request":
489
- !o?.contains("smsroombox_sel") && !o?.contains("callbackroombox_sel") && !o?.contains("complaintsroombox_sel") && (t?.classList.remove(), t?.classList.add("guestrequestroombox_sel"));
505
+ !n?.contains("smsroombox_sel") && !n?.contains("callbackroombox_sel") && !n?.contains("complaintsroombox_sel") && (o?.classList.remove(), o?.classList.add("guestrequestroombox_sel"));
490
506
  break;
491
507
  case "work_order":
492
- !o?.contains("smsroombox_sel") && !o?.contains("callbackroombox_sel") && !o?.contains("complaintsroombox_sel") && !o?.contains("guestrequestroombox_sel") && (t?.classList.remove(), t?.classList.add("workordersroombox_sel"));
508
+ !n?.contains("smsroombox_sel") && !n?.contains("callbackroombox_sel") && !n?.contains("complaintsroombox_sel") && !n?.contains("guestrequestroombox_sel") && (o?.classList.remove(), o?.classList.add("workordersroombox_sel"));
493
509
  break;
494
510
  }
495
- const c = setTimeout(() => {
496
- a.forEach((m) => {
497
- m.classList.remove("pulse");
511
+ const r = setTimeout(() => {
512
+ a.forEach((d) => {
513
+ d.classList.remove("pulse");
498
514
  });
499
515
  }, 4500);
500
- S.value.push(c);
516
+ H.value.push(r);
501
517
  }
502
- }, Ae = () => {
518
+ }, Le = () => {
503
519
  window.location.href = "/guest/overview.php";
504
- }, Be = (e) => {
520
+ }, xe = (e) => {
505
521
  let a = "";
506
522
  switch (e.type) {
507
523
  case "complaint":
@@ -523,294 +539,317 @@ const ht = Fe({
523
539
  return "#";
524
540
  }
525
541
  window.open(a);
526
- }, Pe = async () => {
527
- const e = {
528
- type: g.value?.id,
529
- propertyId: n.propertyId,
530
- userId: Y.value,
531
- areaId: r.value.qv2Rooms.qRoomId,
532
- areaName: r.value.qv2Rooms.qRoomName
542
+ }, We = async () => {
543
+ const e = i.value?.qv2Rooms?.qRoomId || i.value?.id || s.room?.id, a = i.value?.qv2Rooms?.qRoomName || i.value?.name || s.room?.name, t = {
544
+ type: _.value?.id,
545
+ propertyId: s.propertyId,
546
+ userId: U.value,
547
+ areaId: e,
548
+ areaName: a
533
549
  };
534
- switch (g.value?.id) {
550
+ switch (_.value?.id) {
535
551
  case "complaint":
536
- e.tokenId = r.value.tokenId, e.problem = i.value.problem.id, e.guestName = i.value.guestName, e.guestPhone = i.value.guestPhone, e.guestEmail = i.value.guestEmail, e.guestLoyalty = i.value.guestLoyalty, e.guestMood = i.value.guestMood.id, e.checkInDate = h(i.value.checkInDate).format(
537
- "YYYY-MM-DD"
538
- ), e.notes = i.value.notes, e.inHouse = "2", e.source = "dashboard", w("create:todo", e);
552
+ t.tokenId = i.value.tokenId, t.problem = p.value.problem.id, t.guestName = p.value.guestName, t.guestPhone = p.value.guestPhone, t.guestEmail = p.value.guestEmail, t.guestLoyalty = p.value.guestLoyalty, t.guestMood = p.value.guestMood.id, t.checkInDate = g.fromJSDate(p.value.checkInDate).toFormat(
553
+ "yyyy-MM-dd"
554
+ ), t.notes = p.value.notes, t.inHouse = "2", t.source = "dashboard", k("create:todo", t);
539
555
  break;
540
556
  case "request":
541
- e.itemId = u.value.item.id, e.assignType = u.value.assignType.id, e.occupied = u.value.requestedBy.id, e.notes = u.value.notes, e.dueDate = h(u.value.due).format("YYYY-MM-DD"), u.value.assignType.id === 1 && (e.department = u.value.department.id), u.value.assignType.id === 2 && (e.person = u.value.person.id), w("create:todo", e);
557
+ t.itemId = l.value.item.id, t.assignType = l.value.assignType.id, t.occupied = l.value.requestedBy.id, t.notes = l.value.notes, t.dueDate = g.fromJSDate(l.value.due).toFormat("yyyy-MM-dd"), l.value.assignType.id === 1 && (t.department = l.value.department.id), l.value.assignType.id === 2 && (t.person = l.value.person.id), s.allowWhenWhere && (t.requestWhen = l.value.when ? l.value.when.id : "", t.requestWhere = l.value.where ? l.value.where.id : ""), k("create:todo", t);
542
558
  break;
543
559
  case "room_notice":
544
- e.issue = v.value.issue.id, e.startDate = h(v.value.startDate).format("YYYY-MM-DD"), e.endDate = h(v.value.endDate).format("YYYY-MM-DD"), e.notes = v.value.notes, e.sendPush = "1", w("create:todo", e);
560
+ t.issue = y.value.issue.id, t.startDate = g.fromJSDate(y.value.startDate).toFormat("yyyy-MM-dd"), t.endDate = g.fromJSDate(y.value.endDate).toFormat("yyyy-MM-dd"), t.notes = y.value.notes, t.sendPush = "1", k("create:todo", t);
545
561
  break;
546
562
  case "work_order":
547
- e.itemId = l.value.item.id, e.issueId = l.value.issue.id, e.assignType = l.value.assignType.id, e.occupied = l.value.requestedBy.id, e.notes = l.value.notes, e.dueDate = h(l.value.due).format("YYYY-MM-DD"), l.value.assignType.id === 1 && (e.department = l.value.department.id), l.value.assignType.id === 2 && (e.person = l.value.person.id), w("create:todo", e);
563
+ t.itemId = c.value.item.id, t.issueId = c.value.issue.id, t.assignType = c.value.assignType.id, t.occupied = c.value.requestedBy.id, t.notes = c.value.notes, t.dueDate = g.fromJSDate(c.value.due).toFormat("yyyy-MM-dd"), c.value.assignType.id === 1 && (t.department = c.value.department.id), c.value.assignType.id === 2 && (t.person = c.value.person.id), k("create:todo", t);
548
564
  break;
549
565
  }
550
- }, Le = (e) => {
551
- te(), ae(), n.hover && w("toggle", e);
552
- }, xe = (e) => {
553
- de(), k.value = e;
554
- }, Ye = async (e) => {
555
- if (console.log("selected:", e), g.value = e, D.value = [], v.value.issue = null, i.value.problem = null, l.value.item = null, l.value.issue = null, u.value.item = null, !g.value)
566
+ }, Fe = (e) => {
567
+ oe(), se(), s.hover && k("toggle", e);
568
+ }, Ge = (e) => {
569
+ ve(), b.value = e;
570
+ }, Ue = async (e) => {
571
+ if (console.log("selected:", e), _.value = e, w.value = [], y.value.issue = null, p.value.problem = null, c.value.item = null, c.value.issue = null, l.value.item = null, !_.value)
556
572
  return;
557
- const a = new FormData();
558
- switch (a.append("property_id", n.propertyId), a.append("area_id", r.value.qv2Rooms.qRoomId), e.id) {
573
+ const a = i.value?.qv2Rooms?.qRoomId || i.value?.id || s.room?.id, t = new FormData();
574
+ switch (t.append("property_id", s.propertyId), t.append("area_id", a), e.id) {
559
575
  case "complaint":
560
576
  try {
561
- r.value.tokenId && await ue();
562
- const t = await fetch("/api/client/common/getComplaintProblemsByPropertyId.php", {
577
+ i.value.tokenId && await de();
578
+ const n = await (await fetch("/api/client/common/getComplaintProblemsByPropertyId.php", {
563
579
  method: "POST",
564
- body: a
565
- });
566
- console.log("complaints:", t);
567
- const o = await Q.post(
580
+ body: t
581
+ })).json();
582
+ n.items && (w.value = n.items);
583
+ const r = await Q.post(
568
584
  "/api/client/common/getComplaintMoods.php"
569
585
  );
570
- o.data.items.forEach((c) => {
571
- c.label = c.display_name;
572
- }), z.value = o.data.items;
573
- } catch (t) {
574
- console.log(t);
586
+ r.data.items.forEach((d) => {
587
+ d.label = d.display_name;
588
+ }), z.value = r.data.items;
589
+ } catch (o) {
590
+ console.log(o);
575
591
  }
576
592
  break;
577
593
  case "room_notice":
578
594
  try {
579
- const t = await fetch("/api/client/common/getRoomNoticeListByPropertyId.php", {
595
+ const n = await (await fetch("/api/client/common/getRoomNoticeIssuesByPropertyId.php", {
580
596
  method: "POST",
581
- body: a
582
- });
583
- console.log("room notices:", t);
584
- } catch (t) {
585
- console.log(t);
597
+ body: t
598
+ })).json();
599
+ n.items && (w.value = n.items);
600
+ } catch (o) {
601
+ console.log(o);
586
602
  }
587
603
  break;
588
604
  case "request":
589
605
  try {
590
- u.value.requestedBy = N.value[1], u.value.assignType = A.value[0];
591
- const t = await fetch("/api/client/common/getHousekeepingItemsByPropertyId.php", {
606
+ l.value.requestedBy = q.value[1], l.value.assignType = L.value[0];
607
+ const n = await (await fetch("/api/client/common/getHousekeepingItemsByPropertyId.php", {
592
608
  method: "POST",
593
- body: a
594
- });
595
- console.log("requests:", t), await Z(), u.value.department = O.value.find(
596
- (o) => parseInt(o.id) === 4
597
- );
598
- } catch (t) {
599
- console.log(t);
609
+ body: t
610
+ })).json();
611
+ if (n.items && (w.value = n.items), await te(), l.value.department = I.value.find(
612
+ (r) => parseInt(r.id) === 4
613
+ ), s.allowWhenWhere)
614
+ try {
615
+ const r = new FormData();
616
+ r.append("property_id", s.propertyId);
617
+ const m = await (await fetch(
618
+ "/api/client/common/getWhenWhereOptions.php",
619
+ {
620
+ method: "POST",
621
+ body: r
622
+ }
623
+ )).json();
624
+ m.when && Array.isArray(m.when) ? E.value = m.when.map((f) => ({
625
+ id: f.id,
626
+ label: f.name,
627
+ value: f.id
628
+ })) : E.value = [], m.where && Array.isArray(m.where) ? S.value = m.where.map((f) => ({
629
+ id: f.id,
630
+ label: f.name,
631
+ value: f.id
632
+ })) : S.value = [];
633
+ } catch (r) {
634
+ console.log("Error loading When/Where options:", r), E.value = [], S.value = [];
635
+ }
636
+ } catch (o) {
637
+ console.log(o);
600
638
  }
601
639
  break;
602
640
  case "work_order":
603
641
  try {
604
- l.value.requestedBy = N.value[0], l.value.assignType = A.value[0];
605
- const t = await fetch("/api/client/common/getItemsByRoomId.php", {
642
+ c.value.requestedBy = q.value[0], c.value.assignType = L.value[0];
643
+ const n = await (await fetch("/api/client/common/getItemsByRoomId.php", {
606
644
  method: "POST",
607
- body: a
608
- });
609
- console.log("work orders:", t);
610
- const o = [];
611
- let c = {
645
+ body: t
646
+ })).json(), r = [];
647
+ let d = {
612
648
  group: "",
613
649
  options: []
614
650
  };
615
- o.push({ ...c }), D.value = o, await Promise.all([
651
+ n.items && (n.items.forEach((m) => {
652
+ m.section_name !== d.group && (d.group && r.push({ ...d }), d.group = m.section_name, d.options = []), m.label && d.options.push(m);
653
+ }), d.group && r.push({ ...d })), w.value = r, await Promise.all([
616
654
  Q.post(
617
655
  "/api/client/common/getWorkOrderIssues.php"
618
656
  ),
619
- Z()
657
+ te()
620
658
  ]).then((m) => {
621
659
  const f = m[0];
622
- f.data.issues.forEach((y) => {
623
- y.label = y.display_name;
624
- }), J.value = f.data.issues;
625
- }), l.value.department = O.value.find(
660
+ f.data.issues.forEach((fe) => {
661
+ fe.label = fe.display_name;
662
+ }), V.value = f.data.issues;
663
+ }), c.value.department = I.value.find(
626
664
  (m) => parseInt(m.id) === 2
627
665
  );
628
- } catch (t) {
629
- console.log(t);
666
+ } catch (o) {
667
+ console.log(o);
630
668
  }
631
669
  break;
632
670
  default:
633
671
  return;
634
672
  }
635
- }, Ue = () => {
636
- x.value = !x.value, F.value = !1;
637
- }, ce = () => {
673
+ }, je = () => {
674
+ G.value = !G.value, J.value = !1;
675
+ }, pe = () => {
638
676
  const e = document.getElementById("comment-field"), a = document.getElementById("hidden-text");
639
677
  e.style.height = a?.offsetHeight + "px";
640
- }, ee = () => {
678
+ }, ae = () => {
641
679
  const e = document.getElementById("comments-container");
642
680
  e?.scroll({
643
681
  top: e.scrollHeight,
644
682
  behavior: "smooth"
645
683
  });
646
- }, Ge = async (e) => {
647
- if (e && e.type === "keydown" && e.preventDefault(), r.value.tokenId && k.value && !R.value)
684
+ }, Qe = async (e) => {
685
+ if (e && e.type === "keydown" && e.preventDefault(), i.value.tokenId && b.value && !R.value)
648
686
  try {
649
687
  const a = new FormData();
650
- a.append("funcname", "send_message_to_guest"), a.append("stay_id", r.value.tokenId), a.append("content", k.value), a.append("sender_id", Y.value || "");
688
+ a.append("funcname", "send_message_to_guest"), a.append("stay_id", i.value.tokenId), a.append("content", b.value), a.append("sender_id", U.value || "");
651
689
  const t = await Q.post(
652
690
  "/includes/chat_api.php",
653
691
  a
654
692
  );
655
693
  if (t.data.result.error_message)
656
694
  throw new Error(t.data.result.error_message);
657
- k.value = "", await re(), ee();
695
+ b.value = "", await ce(), ae();
658
696
  } catch (a) {
659
697
  console.log(a);
660
698
  }
661
- }, te = () => {
662
- if (n.align === "left" || n.align === "right") {
663
- const e = q.value?.getBoundingClientRect().left, a = window.innerWidth;
664
- j.value = a - e < M.value ? "right" : "left";
699
+ }, oe = () => {
700
+ if (s.align === "left" || s.align === "right") {
701
+ const e = A.value?.getBoundingClientRect().left, a = window.innerWidth;
702
+ $.value = a - e < M.value ? "right" : "left";
665
703
  } else {
666
- const e = q.value?.getBoundingClientRect().top, a = window.innerHeight;
667
- j.value = a - e < E.value ? "bottom" : "top";
704
+ const e = A.value?.getBoundingClientRect().top, a = window.innerHeight;
705
+ $.value = a - e < N.value ? "bottom" : "top";
668
706
  }
669
- }, ae = () => {
670
- if (n.position === "top" || n.position === "bottom") {
671
- const e = q.value?.getBoundingClientRect().top, a = window.innerHeight;
672
- W.value = a - e < E.value ? "top" : "bottom";
707
+ }, se = () => {
708
+ if (s.position === "top" || s.position === "bottom") {
709
+ const e = A.value?.getBoundingClientRect().top, a = window.innerHeight;
710
+ X.value = a - e < N.value ? "top" : "bottom";
673
711
  } else {
674
- const e = q.value?.getBoundingClientRect().left, a = window.innerWidth;
675
- W.value = a - e < M.value ? "left" : "right";
712
+ const e = A.value?.getBoundingClientRect().left, a = window.innerWidth;
713
+ X.value = a - e < M.value ? "left" : "right";
676
714
  }
677
- }, de = () => {
678
- R.value = !R.value, R.value ? (k.value = "", b.value.info = B.value, b.value.tickets = P.value, b.value.comments = $.value, B.value = !1, P.value = !1, document.getElementById("comment-field")?.focus()) : (B.value = b.value.info, P.value = b.value.tickets, $.value = b.value.comments);
679
- }, Qe = async (e, a) => {
680
- const t = new FormData();
681
- if (t.append("property_id", n.propertyId), t.append(
682
- "room_ids",
683
- JSON.stringify([r.value.qv2Rooms.qRoomId])
684
- ), await H(), _.value) {
685
- const o = [];
686
- _.value.forEach((c) => {
687
- c.id === e && c.type === a ? o.unshift({
688
- ...c,
715
+ }, ve = () => {
716
+ R.value = !R.value, R.value ? (b.value = "", O.value.info = x.value, O.value.tickets = W.value, O.value.comments = Y.value, x.value = !1, W.value = !1, document.getElementById("comment-field")?.focus()) : (x.value = O.value.info, W.value = O.value.tickets, Y.value = O.value.comments);
717
+ }, Je = async (e, a) => {
718
+ const t = i.value?.qv2Rooms?.qRoomId || i.value?.id || s.room?.id, o = new FormData();
719
+ if (o.append("property_id", s.propertyId), o.append("room_ids", JSON.stringify([t])), await B(), D.value) {
720
+ const n = [];
721
+ D.value.forEach((r) => {
722
+ r.id === e && r.type === a ? n.unshift({
723
+ ...r,
689
724
  isNew: !0
690
- }) : o.push({
691
- ...c,
725
+ }) : n.push({
726
+ ...r,
692
727
  isNew: !1
693
728
  });
694
- }), o.sort((c, m) => c.id === e ? -1 : m.id === e ? 1 : 0), _.value = [...o];
729
+ }), n.sort((r, d) => r.id === e ? -1 : d.id === e ? 1 : 0), D.value = [...n];
695
730
  }
696
731
  };
697
- return G(() => n.open, () => {
698
- if (n.open && n.showComments && oe.value.length) {
699
- const e = setTimeout(ee, 500);
700
- S.value.push(e);
732
+ return P(() => s.open, () => {
733
+ if (s.open && s.showComments && le.value.length) {
734
+ const e = setTimeout(ae, 500);
735
+ H.value.push(e);
701
736
  }
702
- n.open || le();
703
- }), G(k, () => {
704
- const e = setTimeout(ce, 100);
705
- S.value.push(e);
706
- }), G(() => n.open, async (e, a) => {
707
- e && !a && (n.showGuestDetails && !C.value ? await V() : r.value || (r.value = n.room), H(), U());
708
- }), G(
709
- () => n.room.id,
737
+ s.open || ie();
738
+ }), P(b, () => {
739
+ const e = setTimeout(pe, 100);
740
+ H.value.push(e);
741
+ }), P(() => s.allowWhenWhere, (e, a) => {
742
+ a === !0 && e === !1 && (l.value.when = null, l.value.where = null, E.value = [], S.value = []);
743
+ }), P(() => s.open, async (e, a) => {
744
+ e && !a && (s.showGuestDetails && !C.value ? await ee() : i.value || (i.value = s.room), B(), j());
745
+ }), P(
746
+ () => s.room.id,
710
747
  (e, a) => {
711
- e !== a && (C.value ? (r.value = C.value.find((t) => t.qv2Rooms.qRoomId === n.room.id), r.value || (r.value = n.room)) : r.value = n.room, n.open && (H(), U()));
748
+ e !== a && (C.value ? (i.value = C.value.find((t) => t.qv2Rooms.qRoomId === s.room.id), i.value || (i.value = s.room)) : i.value = s.room, s.open && (B(), j()));
712
749
  }
713
- ), je(async () => {
750
+ ), Ye(async () => {
714
751
  const e = JSON.parse(
715
752
  window.localStorage.getItem("authenticated")
716
753
  );
717
- Y.value = e?.user?.id || "", r.value = n.room, n.size === "sm" && (E.value = 140, M.value = 160), n.size === "lg" && (E.value = 250, M.value = 440), te(), ae();
754
+ U.value = e?.user?.id || "", i.value = s.room, s.size === "sm" && (N.value = 140, M.value = 160), s.size === "lg" && (N.value = 250, M.value = 440), oe(), se();
718
755
  const a = [], t = window.localStorage.getItem("quick-replies");
719
756
  t && JSON.parse(t).forEach((o) => {
720
757
  a.push(o.message);
721
- }), X.value = a;
722
- }), $e(() => {
723
- S.value.forEach((e) => {
758
+ }), K.value = a;
759
+ }), ze(() => {
760
+ H.value.forEach((e) => {
724
761
  clearTimeout(e);
725
762
  });
726
763
  }), {
727
- DateTime: h,
764
+ DateTime: g,
728
765
  // Refs
729
- actionMenuOpen: F,
730
- alignment: j,
731
- assignTypes: A,
732
- comment: k,
733
- complaint: i,
734
- componentHeight: E,
766
+ actionMenuOpen: J,
767
+ alignment: $,
768
+ assignTypes: L,
769
+ comment: b,
770
+ complaint: p,
771
+ componentHeight: N,
735
772
  componentWidth: M,
736
- departments: O,
737
- departmentUsers: me,
738
- expandComments: $,
739
- expandGuestInfo: B,
740
- expandedStates: b,
741
- expandTickets: P,
742
- guestDetailsData: pe,
743
- itemOptions: D,
773
+ departments: I,
774
+ departmentUsers: ne,
775
+ expandComments: Y,
776
+ expandGuestInfo: x,
777
+ expandedStates: O,
778
+ expandTickets: W,
779
+ guestDetailsData: he,
780
+ itemOptions: w,
744
781
  loading: T,
745
- messages: oe,
782
+ messages: le,
746
783
  moodOptions: z,
747
784
  pmsData: C,
748
- positioning: W,
749
- quickReplies: X,
785
+ positioning: X,
786
+ quickReplies: K,
750
787
  quickReplyOpen: R,
751
- request: u,
752
- requestedByOptions: N,
753
- requestLoading: ve,
754
- requestType: g,
755
- roomDetailsData: r,
756
- roomNotice: v,
757
- roomNotices: L,
758
- showCreateRequest: x,
759
- ticketsList: _,
760
- todoOptions: fe,
761
- trigger: q,
762
- userId: Y,
763
- workOrder: l,
764
- workOrderIssues: J,
788
+ request: l,
789
+ requestedByOptions: q,
790
+ requestLoading: ye,
791
+ requestType: _,
792
+ roomDetailsData: i,
793
+ roomNotice: y,
794
+ roomNotices: F,
795
+ showCreateRequest: G,
796
+ ticketsList: D,
797
+ todoOptions: ge,
798
+ trigger: A,
799
+ userId: U,
800
+ workOrder: c,
801
+ workOrderIssues: V,
802
+ whenOptions: E,
803
+ whereOptions: S,
765
804
  // Computed
766
- cleanliness: K,
767
- cleanlinessColor: ye,
768
- cleanlinessTooltipContent: he,
769
- filteredReplies: ge,
770
- hasGuestCallback: _e,
771
- hasComplaint: se,
772
- itemOptionsList: we,
773
- occupied: ne,
774
- occupancyTooltipContent: ke,
775
- selectedAssignType: De,
776
- selectedDepartment: Te,
777
- selectedRequestedBy: be,
778
- stayDetails: Ie,
779
- tagsList: Oe,
780
- validateToDo: Ce,
805
+ cleanliness: Z,
806
+ cleanlinessColor: we,
807
+ cleanlinessTooltipContent: _e,
808
+ filteredReplies: De,
809
+ hasGuestCallback: ke,
810
+ hasComplaint: re,
811
+ itemOptionsList: be,
812
+ occupied: ue,
813
+ occupancyTooltipContent: Te,
814
+ selectedAssignType: Ie,
815
+ selectedDepartment: Oe,
816
+ selectedRequestedBy: Ce,
817
+ stayDetails: Re,
818
+ tagsList: Ee,
819
+ validateToDo: Se,
781
820
  // Methods
782
- closeRequest: le,
783
- createCallback: Re,
784
- createMessageList: Ee,
785
- getChatMessages: re,
786
- getHowLongAgo: Me,
787
- getPMSData: V,
788
- getRoomNotices: U,
789
- getSharedData: Z,
790
- getStayDetails: ue,
791
- getTicketColor: Se,
792
- getTicketIcon: qe,
793
- getTickets: H,
794
- handleFailedResponse: ie,
795
- handlePulse: He,
796
- onClickEditConnectGuest: Ae,
797
- onClickTicket: Be,
798
- onCreateRequestSubmit: Pe,
799
- onHoverToggle: Le,
800
- onSelectQuickReply: xe,
801
- onSelectToDo: Ye,
802
- openRequest: Ue,
803
- refreshPMSData: Ne,
804
- resizeTextarea: ce,
805
- scrollToConnectBottom: ee,
806
- sendChatMessage: Ge,
807
- setAlignment: te,
808
- setPositioning: ae,
809
- toggleQuickReply: de,
810
- updateTickets: Qe
821
+ closeRequest: ie,
822
+ createCallback: Ne,
823
+ createMessageList: Me,
824
+ getChatMessages: ce,
825
+ getHowLongAgo: qe,
826
+ getPMSData: ee,
827
+ getRoomNotices: j,
828
+ getSharedData: te,
829
+ getStayDetails: de,
830
+ getTicketColor: Ae,
831
+ getTicketIcon: Be,
832
+ getTickets: B,
833
+ handleFailedResponse: me,
834
+ handlePulse: Pe,
835
+ onClickEditConnectGuest: Le,
836
+ onClickTicket: xe,
837
+ onCreateRequestSubmit: We,
838
+ onHoverToggle: Fe,
839
+ onSelectQuickReply: Ge,
840
+ onSelectToDo: Ue,
841
+ openRequest: je,
842
+ refreshPMSData: He,
843
+ resizeTextarea: pe,
844
+ scrollToConnectBottom: ae,
845
+ sendChatMessage: Qe,
846
+ setAlignment: oe,
847
+ setPositioning: se,
848
+ toggleQuickReply: ve,
849
+ updateTickets: Je
811
850
  };
812
851
  }
813
852
  });
814
853
  export {
815
- ht as default
854
+ _t as default
816
855
  };