@quoreadmin/ui 1.6.6 → 1.6.7

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