@quoreadmin/ui 1.6.6 → 1.6.8

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 (233) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index102.js +2 -2
  3. package/dist/index109.js +1 -1
  4. package/dist/index113.js +2 -2
  5. package/dist/index117.js +3 -3
  6. package/dist/index129.js +1 -1
  7. package/dist/index131.js +116 -59
  8. package/dist/index140.js +896 -0
  9. package/dist/{index143.js → index144.js} +2 -2
  10. package/dist/{index151.js → index152.js} +1 -1
  11. package/dist/{index157.js → index158.js} +2 -2
  12. package/dist/index161.js +111 -492
  13. package/dist/index162.js +471 -5498
  14. package/dist/index163.js +5511 -80
  15. package/dist/index164.js +86 -856
  16. package/dist/index165.js +844 -21
  17. package/dist/index166.js +23 -265
  18. package/dist/index167.js +256 -126
  19. package/dist/index168.js +146 -1195
  20. package/dist/index169.js +1139 -712
  21. package/dist/index170.js +704 -1240
  22. package/dist/index171.js +1280 -248
  23. package/dist/index172.js +266 -96
  24. package/dist/index173.js +106 -2
  25. package/dist/index174.js +2 -1376
  26. package/dist/index175.js +1378 -0
  27. package/dist/index177.js +12 -12
  28. package/dist/index178.js +10 -10
  29. package/dist/index179.js +12 -12
  30. package/dist/index180.js +14 -21
  31. package/dist/index181.js +23 -757
  32. package/dist/index182.js +759 -1100
  33. package/dist/index183.js +1117 -1234
  34. package/dist/index184.js +1205 -11248
  35. package/dist/index185.js +11277 -36
  36. package/dist/index186.js +36 -115
  37. package/dist/index190.js +29 -29
  38. package/dist/index191.js +2 -2
  39. package/dist/index192.js +2 -2
  40. package/dist/index193.js +1 -1
  41. package/dist/index195.js +2 -2
  42. package/dist/index197.js +14 -14
  43. package/dist/index198.js +1 -1
  44. package/dist/index199.js +1 -1
  45. package/dist/index20.js +4 -4
  46. package/dist/index200.js +3 -3
  47. package/dist/index201.js +3 -3
  48. package/dist/index202.js +84 -29
  49. package/dist/index203.js +400 -109
  50. package/dist/index204.js +22 -36
  51. package/dist/index205.js +33 -26
  52. package/dist/index206.js +111 -31
  53. package/dist/index207.js +36 -9
  54. package/dist/index208.js +26 -19
  55. package/dist/index209.js +36 -10
  56. package/dist/index210.js +9 -10
  57. package/dist/index211.js +18 -50
  58. package/dist/index212.js +10 -43
  59. package/dist/index213.js +10 -4
  60. package/dist/index214.js +48 -36
  61. package/dist/index215.js +43 -21
  62. package/dist/index216.js +3 -87
  63. package/dist/index217.js +35 -403
  64. package/dist/index218.js +21 -22
  65. package/dist/index219.js +122 -156
  66. package/dist/index220.js +35 -225
  67. package/dist/index221.js +80 -37
  68. package/dist/index222.js +20 -10
  69. package/dist/index223.js +19 -126
  70. package/dist/index224.js +16 -34
  71. package/dist/index225.js +20 -80
  72. package/dist/index226.js +9 -9
  73. package/dist/index227.js +160 -19
  74. package/dist/index228.js +11 -11
  75. package/dist/index229.js +15 -13
  76. package/dist/index230.js +198 -19
  77. package/dist/index231.js +49 -140
  78. package/dist/index232.js +34 -20
  79. package/dist/index233.js +39 -21
  80. package/dist/index234.js +21 -198
  81. package/dist/index235.js +21 -69
  82. package/dist/index236.js +20 -34
  83. package/dist/index237.js +823 -27
  84. package/dist/index238.js +701 -21
  85. package/dist/index239.js +176 -22
  86. package/dist/index240.js +15 -13
  87. package/dist/index241.js +20 -836
  88. package/dist/index242.js +19 -701
  89. package/dist/index243.js +3 -176
  90. package/dist/index244.js +186 -21
  91. package/dist/index245.js +132 -19
  92. package/dist/index246.js +1223 -20
  93. package/dist/index247.js +20 -3
  94. package/dist/index248.js +21 -186
  95. package/dist/index249.js +21 -132
  96. package/dist/index250.js +29 -1223
  97. package/dist/index251.js +12 -12
  98. package/dist/index252.js +13 -15
  99. package/dist/index253.js +2 -22
  100. package/dist/index254.js +2 -29
  101. package/dist/index255.js +3632 -20
  102. package/dist/index256.js +55 -20
  103. package/dist/index257.js +77 -2
  104. package/dist/index258.js +52 -2
  105. package/dist/index259.js +182 -3599
  106. package/dist/index260.js +8 -53
  107. package/dist/index261.js +40 -60
  108. package/dist/index262.js +44 -35
  109. package/dist/index263.js +32 -193
  110. package/dist/index264.js +74 -9
  111. package/dist/index265.js +704 -38
  112. package/dist/index266.js +22 -44
  113. package/dist/index267.js +46 -36
  114. package/dist/index268.js +10 -74
  115. package/dist/index269.js +680 -698
  116. package/dist/index270.js +818 -37
  117. package/dist/index271.js +160 -63
  118. package/dist/index272.js +227 -10
  119. package/dist/index273.js +36 -704
  120. package/dist/index274.js +9 -819
  121. package/dist/index275.js +1 -1
  122. package/dist/index278.js +1 -1
  123. package/dist/index279.js +2 -3
  124. package/dist/index280.js +77 -25
  125. package/dist/index281.js +3 -2
  126. package/dist/index282.js +25 -77
  127. package/dist/index284.js +1 -1
  128. package/dist/index285.js +1 -1
  129. package/dist/index286.js +1 -1
  130. package/dist/index289.js +1 -1
  131. package/dist/index290.js +1518 -79
  132. package/dist/index291.js +386 -22
  133. package/dist/index292.js +2698 -902
  134. package/dist/index293.js +85 -21
  135. package/dist/index294.js +3770 -20
  136. package/dist/index295.js +59 -19
  137. package/dist/index296.js +77 -67
  138. package/dist/index297.js +21 -18
  139. package/dist/index298.js +934 -18
  140. package/dist/index299.js +16 -16
  141. package/dist/index300.js +11 -13
  142. package/dist/index301.js +19 -62
  143. package/dist/index302.js +69 -1518
  144. package/dist/index303.js +19 -386
  145. package/dist/index304.js +19 -2731
  146. package/dist/index305.js +21 -85
  147. package/dist/index306.js +22 -3770
  148. package/dist/index307.js +63 -60
  149. package/dist/index309.js +2 -2
  150. package/dist/index310.js +4 -4
  151. package/dist/index311.js +2 -2
  152. package/dist/index329.js +36 -8
  153. package/dist/index330.js +8 -12
  154. package/dist/index331.js +12 -54
  155. package/dist/index332.js +52 -9
  156. package/dist/index333.js +11 -13
  157. package/dist/index334.js +9 -53
  158. package/dist/index335.js +55 -49
  159. package/dist/index336.js +49 -28
  160. package/dist/index337.js +31 -2
  161. package/dist/index338.js +2 -5
  162. package/dist/index339.js +5 -2
  163. package/dist/index340.js +2 -23
  164. package/dist/index341.js +21 -39
  165. package/dist/index342.js +41 -2
  166. package/dist/index343.js +2 -11
  167. package/dist/index344.js +11 -20
  168. package/dist/index345.js +18 -15
  169. package/dist/index346.js +16 -9
  170. package/dist/index347.js +9 -9
  171. package/dist/index348.js +10 -2
  172. package/dist/index349.js +2 -9
  173. package/dist/index350.js +9 -10
  174. package/dist/index351.js +10 -14
  175. package/dist/index352.js +14 -37
  176. package/dist/index353.js +1 -1
  177. package/dist/index354.js +1 -1
  178. package/dist/index355.js +2 -2
  179. package/dist/index369.js +100 -16
  180. package/dist/index370.js +90 -100
  181. package/dist/index371.js +17 -91
  182. package/dist/index39.js +44 -14
  183. package/dist/index40.js +1 -1
  184. package/dist/index41.js +1 -1
  185. package/dist/index42.js +1 -1
  186. package/dist/index43.js +348 -318
  187. package/dist/index44.js +1 -1
  188. package/dist/index45.js +1 -1
  189. package/dist/index46.js +1 -1
  190. package/dist/index47.js +6 -6
  191. package/dist/index48.js +2 -2
  192. package/dist/index49.js +1 -1
  193. package/dist/index50.js +1 -1
  194. package/dist/index51.js +1 -1
  195. package/dist/index52.js +1 -1
  196. package/dist/index54.js +2 -2
  197. package/dist/index56.js +1 -1
  198. package/dist/index58.js +5 -5
  199. package/dist/index59.js +1 -1
  200. package/dist/index71.js +2 -2
  201. package/dist/index75.js +1 -1
  202. package/dist/index80.js +1 -1
  203. package/dist/index85.js +1 -1
  204. package/dist/index87.js +3 -3
  205. package/dist/index89.js +2 -2
  206. package/dist/index95.js +2 -2
  207. package/dist/src/components/comment/comment.d.ts +32 -0
  208. package/dist/src/components/comment/comment.stories.d.ts +32 -0
  209. package/dist/src/components/comment-section/comment-section.d.ts +32 -0
  210. package/dist/src/components/comment-section/comment-section.stories.d.ts +32 -0
  211. package/dist/src/components/data-filter/data-filter.d.ts +32 -0
  212. package/dist/src/components/data-list/data-list.d.ts +32 -0
  213. package/dist/src/components/grid/grid.stories.d.ts +64 -0
  214. package/dist/src/components/popover/popover.d.ts +36 -0
  215. package/dist/src/components/popover/popover.stories.d.ts +128 -0
  216. package/dist/src/components/room-details-popover/room-details-popover.d.ts +197 -5
  217. package/dist/src/components/textarea/textarea.d.ts +1 -1
  218. package/dist/src/components/textarea/textarea.stories.d.ts +1 -1
  219. package/dist/src/views/lists.vue.d.ts +64 -0
  220. package/dist/src/views/tables.vue.d.ts +32 -0
  221. package/package.json +1 -1
  222. package/dist/index139.js +0 -855
  223. package/dist/index160.js +0 -116
  224. package/dist/index176.js +0 -20
  225. /package/dist/{index133.js → index134.js} +0 -0
  226. /package/dist/{index135.js → index136.js} +0 -0
  227. /package/dist/{index137.js → index138.js} +0 -0
  228. /package/dist/{index141.js → index142.js} +0 -0
  229. /package/dist/{index145.js → index146.js} +0 -0
  230. /package/dist/{index147.js → index148.js} +0 -0
  231. /package/dist/{index149.js → index150.js} +0 -0
  232. /package/dist/{index153.js → index154.js} +0 -0
  233. /package/dist/{index155.js → index156.js} +0 -0
package/dist/index139.js DELETED
@@ -1,855 +0,0 @@
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
- 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({
16
- name: "QRoomDetailsPopover",
17
- 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
27
- },
28
- props: {
29
- id: {
30
- type: String,
31
- default: ""
32
- },
33
- roomDetails: {
34
- type: Object,
35
- default: () => {
36
- }
37
- },
38
- guestDetails: {
39
- type: Object,
40
- default: () => {
41
- }
42
- },
43
- propertyId: {
44
- type: [Number, String],
45
- default: ""
46
- },
47
- propertyTimeZone: {
48
- type: String,
49
- default: "America/Chicago"
50
- },
51
- trigger: {
52
- type: [Number, String],
53
- default: ""
54
- },
55
- comments: {
56
- type: Array,
57
- default: () => []
58
- },
59
- room: {
60
- type: Object,
61
- default: () => {
62
- }
63
- },
64
- showActionMenu: {
65
- type: Boolean,
66
- default: !0
67
- },
68
- showActionsLink: {
69
- type: Boolean,
70
- default: !0
71
- },
72
- showGuestDetails: {
73
- type: Boolean,
74
- default: !1
75
- },
76
- showComments: {
77
- type: Boolean,
78
- default: !1
79
- },
80
- showTickets: {
81
- type: Boolean,
82
- default: !0
83
- },
84
- showGuestCallback: {
85
- type: Boolean,
86
- default: !0
87
- },
88
- showRoomName: {
89
- type: Boolean,
90
- default: !1
91
- },
92
- hover: {
93
- type: Boolean,
94
- default: !1
95
- },
96
- size: {
97
- type: String,
98
- default: "md"
99
- },
100
- open: {
101
- type: Boolean,
102
- default: !1
103
- },
104
- align: {
105
- type: String,
106
- default: "left"
107
- },
108
- position: {
109
- type: String,
110
- default: "bottom"
111
- },
112
- locale: {
113
- type: String,
114
- default: "en"
115
- },
116
- pmsBaseUrl: {
117
- type: String,
118
- default: "",
119
- required: !0
120
- },
121
- allowWhenWhere: {
122
- type: Boolean,
123
- default: !1
124
- }
125
- },
126
- 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
- {
130
- id: 1,
131
- label: v("HC_DEPARTMENT")
132
- // need to localize
133
- },
134
- {
135
- id: 2,
136
- label: v("HC_PERSON")
137
- // need to localize
138
- },
139
- {
140
- id: 0,
141
- label: v("HC_ANYONE")
142
- // need to localize
143
- }
144
- ]), b = u(""), p = u({
145
- checkInDate: /* @__PURE__ */ new Date(),
146
- checkOutDate: /* @__PURE__ */ new Date(),
147
- guestEmail: "",
148
- guestLoyalty: "",
149
- guestMood: null,
150
- guestName: "",
151
- guestPhone: "",
152
- inHouse: !!i.value?.tokenId || !1,
153
- problem: null,
154
- 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
- info: !0,
158
- tickets: !0,
159
- comments: !0
160
- }), W = u(!0), he = u(s.guestDetails), w = u([]), T = u({
161
- pms: !1,
162
- roomNotices: !1,
163
- tickets: !1
164
- }), le = u([]), z = u([]), X = u("bottom"), C = u(null), K = u([]), R = u(!1), l = u({
165
- assignType: null,
166
- department: null,
167
- due: /* @__PURE__ */ new Date(),
168
- item: null,
169
- notes: "",
170
- person: null,
171
- requestedBy: null,
172
- when: null,
173
- where: null
174
- }), q = u([
175
- {
176
- id: 0,
177
- label: v("HC_STAFF_MEMBER")
178
- // need to localize
179
- },
180
- {
181
- id: 1,
182
- label: v("HC_HOTEL_GUEST")
183
- // need to localize
184
- }
185
- ]), ye = u(!1), _ = u(null), y = u({
186
- endDate: /* @__PURE__ */ new Date(),
187
- issue: null,
188
- notes: "",
189
- startDate: /* @__PURE__ */ new Date()
190
- }), F = u([]), G = u(!1), D = u([]), H = u([]), ge = u([
191
- {
192
- label: v("HC_COMPLAINT"),
193
- id: "complaint"
194
- },
195
- {
196
- label: v("HC_REQUEST"),
197
- id: "request"
198
- },
199
- {
200
- label: v("HC_ROOM_NOTICE"),
201
- id: "room_notice"
202
- },
203
- {
204
- label: v("HC_WORK_ORDER"),
205
- id: "work_order"
206
- }
207
- ]), A = u(), U = u(null), c = u({
208
- assignType: null,
209
- department: null,
210
- due: /* @__PURE__ */ new Date(),
211
- item: null,
212
- issue: null,
213
- notes: "",
214
- person: null,
215
- requestedBy: null
216
- }), V = u([]), E = u([]), S = u([]), Z = h(() => {
217
- switch (i.value.cleaning?.name) {
218
- case "CLEAN":
219
- case "INSPECTED":
220
- return "CLEAN";
221
- case "DIRTY":
222
- case "PICKUP":
223
- case "OUT OF ORDER":
224
- case "OUT OF SERVICE":
225
- return "DIRTY";
226
- default:
227
- return "";
228
- }
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(
233
- (a) => a.type === "complaint"
234
- ) : !1), ke = h(() => D.value.length ? !!D.value.find(
235
- (a) => a.type === "callback"
236
- ) : !1), be = h(() => {
237
- let e = [];
238
- return w.value[0] && w.value[0].options === void 0 ? w.value.forEach((a) => {
239
- e.push({
240
- id: parseInt(a.id),
241
- label: a.display_name
242
- });
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) {
246
- case "request":
247
- case "work_order":
248
- return L.value[0];
249
- default:
250
- return null;
251
- }
252
- }), Oe = h(() => {
253
- if (I.value)
254
- switch (_.value?.id) {
255
- case "request":
256
- return I.value.find((e) => parseInt(e.id) === 4);
257
- case "work_order":
258
- return I.value.find((e) => parseInt(e.id) === 2);
259
- default:
260
- return null;
261
- }
262
- return null;
263
- }), Ce = h(() => {
264
- switch (_.value?.id) {
265
- case "request":
266
- return q.value[1];
267
- case "work_order":
268
- return q.value[0];
269
- default:
270
- return null;
271
- }
272
- }), Re = h(() => {
273
- 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;
281
- }
282
- return e;
283
- }), Ee = h(() => {
284
- let e = F.value;
285
- return e = [...new Set(e)], e;
286
- }), Se = h(() => {
287
- const e = _.value?.id;
288
- if (!e)
289
- return !1;
290
- switch (e) {
291
- case "room_notice":
292
- return y.value.issue && y.value.startDate && y.value.endDate;
293
- case "complaint":
294
- return p.value.problem && p.value.guestName && p.value.guestMood;
295
- 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);
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
- }
301
- default:
302
- return !1;
303
- }
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) => {
309
- 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,
318
- user: {
319
- firstName: "Auto-Reply",
320
- icon: "",
321
- id: "system-message",
322
- initials: "",
323
- lastName: "",
324
- src: ""
325
- }
326
- };
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(
333
- t,
334
- [
335
- "years",
336
- "months",
337
- "days",
338
- "hours",
339
- "minutes"
340
- ]
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 });
348
- if (m)
349
- return m === 1 ? v("HC_ONE_HOUR_AGO") : v("HC_X_HOURS_AGO", { hours: m });
350
- if (f)
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 () => {
357
- try {
358
- T.value.pms = !0;
359
- const e = new AbortController(), a = setTimeout(() => e.abort(), 45e3);
360
- H.value.push(a);
361
- const t = s.pmsBaseUrl;
362
- if (!t)
363
- throw new Error("PMS base URL is required");
364
- const o = {
365
- Authorization: "Bearer " + (() => {
366
- const m = `; ${document.cookie}`.split("; QV2Auth=");
367
- return m.length === 2 && m.pop()?.split(";").shift() || "";
368
- })(),
369
- "Content-Type": "application/json"
370
- }, n = await fetch(
371
- `${t}/vendors/properties/statuses/${s.propertyId}/rooms`,
372
- {
373
- method: "GET",
374
- headers: o,
375
- signal: e.signal
376
- }
377
- );
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;
383
- } catch (e) {
384
- return T.value.pms = !1, e;
385
- }
386
- }, j = async () => {
387
- try {
388
- T.value.roomNotices = !0;
389
- const e = await fetch(
390
- "/api/client/common/getRoomNotices.php?propertyId=" + s.propertyId + "&roomIds=[" + s.room.id + "]"
391
- );
392
- if (!e.ok)
393
- throw new Error(`HTTP error! status: ${e.status}`);
394
- const a = await e.json();
395
- F.value = a.notices;
396
- } catch (e) {
397
- console.error("Error getting room notices:", e), F.value = [];
398
- } finally {
399
- T.value.roomNotices = !1;
400
- }
401
- }, te = async () => {
402
- const e = new FormData();
403
- e.append("property_id", s.propertyId), e.append("filter", "tasks_new");
404
- const [a, t] = await Promise.all([
405
- fetch("/api/client/common/getDepartments.php", {
406
- method: "POST"
407
- }),
408
- fetch("/api/client/common/getDepartmentUsersByPropertyId.php", {
409
- method: "POST",
410
- body: e
411
- })
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 () => {
426
- try {
427
- const e = new FormData();
428
- e.append("funcname", "get_stay_details"), e.append("token_id", i.value.tokenId);
429
- const t = (await Q.post(
430
- "/includes/chat_api.php",
431
- e
432
- )).data.result;
433
- if (t !== void 0 && t.error_message)
434
- 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(
436
- t.check_in
437
- ).toJSDate()), t && t.check_out && (p.value.checkOutDate = g.fromISO(
438
- t.check_out
439
- ).toJSDate());
440
- } catch (e) {
441
- console.log(e);
442
- }
443
- }, Ae = (e) => {
444
- switch (e) {
445
- case "complaint":
446
- return "red-30";
447
- case "hk_request":
448
- return "maroon-30";
449
- case "callback":
450
- return "teal-10";
451
- case "workorder":
452
- return "orange-20";
453
- case "task":
454
- return "green-20";
455
- }
456
- }, Be = (e) => {
457
- switch (e) {
458
- case "complaint":
459
- return "face-frown";
460
- case "hk_request":
461
- return "concierge-bell";
462
- case "callback":
463
- return "phone";
464
- case "workorder":
465
- return "hammer";
466
- case "task":
467
- return "check";
468
- }
469
- }, B = async () => {
470
- try {
471
- T.value.tickets = !0;
472
- const e = await fetch(
473
- "/api/client/common/getAllToDos.php?propertyId=" + s.propertyId + "&roomIds=[" + s.room.id + "]"
474
- );
475
- if (!e.ok)
476
- throw new Error(`HTTP error! status: ${e.status}`);
477
- const a = await e.json();
478
- D.value = a.tickets;
479
- } catch (e) {
480
- console.error("Error getting tickets:", e), D.value = [];
481
- } finally {
482
- T.value.tickets = !1;
483
- }
484
- }, me = async (e) => {
485
- const a = await e.text();
486
- let t;
487
- try {
488
- t = JSON.parse(a).response;
489
- } catch {
490
- t = { code: e.status, message: a };
491
- }
492
- return t.code === 401 ? (window.location.href = "/logout.php?unauthorized=1", { error: t }) : t;
493
- }, Pe = (e) => {
494
- const a = document.querySelectorAll(".pulse");
495
- 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;
497
- switch (e) {
498
- case "room_notice":
499
- (n?.contains("roombox_unsel") || n?.contains("roombox_unsel_active")) && (o?.classList.remove(), o?.classList.add("roomnoticeroombox_sel"));
500
- break;
501
- case "complaint":
502
- !n?.contains("smsroombox_sel") && !n?.contains("callbackroombox_sel") && (o?.classList.remove(), o?.classList.add("complaintsroombox_sel"));
503
- break;
504
- case "request":
505
- !n?.contains("smsroombox_sel") && !n?.contains("callbackroombox_sel") && !n?.contains("complaintsroombox_sel") && (o?.classList.remove(), o?.classList.add("guestrequestroombox_sel"));
506
- break;
507
- case "work_order":
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"));
509
- break;
510
- }
511
- const r = setTimeout(() => {
512
- a.forEach((d) => {
513
- d.classList.remove("pulse");
514
- });
515
- }, 4500);
516
- H.value.push(r);
517
- }
518
- }, Le = () => {
519
- window.location.href = "/guest/overview.php";
520
- }, xe = (e) => {
521
- let a = "";
522
- switch (e.type) {
523
- case "complaint":
524
- a = `/complaints/complaints_view.php?id=${e.id}`;
525
- break;
526
- case "request":
527
- a = `/tasks/hk_request.php?id=${e.id}`;
528
- break;
529
- case "satisfaction-call":
530
- a = `/tasks/task_callback.php?id=${e.id}`;
531
- break;
532
- case "work-order":
533
- a = `/tasks/workorder.php?id=${e.id}`;
534
- break;
535
- case "task":
536
- a = `/tasks/task.php?id=${e.id}`;
537
- break;
538
- default:
539
- return "#";
540
- }
541
- 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,
545
- propertyId: s.propertyId,
546
- userId: U.value,
547
- areaId: e,
548
- areaName: a
549
- };
550
- switch (_.value?.id) {
551
- 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(
553
- "yyyy-MM-dd"
554
- ), t.notes = p.value.notes, t.inHouse = "2", t.source = "dashboard", k("create:todo", t);
555
- break;
556
- 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);
558
- break;
559
- 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);
561
- break;
562
- 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);
564
- break;
565
- }
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)
572
- return;
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) {
575
- case "complaint":
576
- try {
577
- i.value.tokenId && await de();
578
- const n = await (await fetch("/api/client/common/getComplaintProblemsByPropertyId.php", {
579
- method: "POST",
580
- body: t
581
- })).json();
582
- n.items && (w.value = n.items);
583
- const r = await Q.post(
584
- "/api/client/common/getComplaintMoods.php"
585
- );
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);
591
- }
592
- break;
593
- case "room_notice":
594
- try {
595
- const n = await (await fetch("/api/client/common/getRoomNoticeIssuesByPropertyId.php", {
596
- method: "POST",
597
- body: t
598
- })).json();
599
- n.items && (w.value = n.items);
600
- } catch (o) {
601
- console.log(o);
602
- }
603
- break;
604
- case "request":
605
- try {
606
- l.value.requestedBy = q.value[1], l.value.assignType = L.value[0];
607
- const n = await (await fetch("/api/client/common/getHousekeepingItemsByPropertyId.php", {
608
- method: "POST",
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);
638
- }
639
- break;
640
- case "work_order":
641
- try {
642
- c.value.requestedBy = q.value[0], c.value.assignType = L.value[0];
643
- const n = await (await fetch("/api/client/common/getItemsByRoomId.php", {
644
- method: "POST",
645
- body: t
646
- })).json(), r = [];
647
- let d = {
648
- group: "",
649
- options: []
650
- };
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([
654
- Q.post(
655
- "/api/client/common/getWorkOrderIssues.php"
656
- ),
657
- te()
658
- ]).then((m) => {
659
- 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(
664
- (m) => parseInt(m.id) === 2
665
- );
666
- } catch (o) {
667
- console.log(o);
668
- }
669
- break;
670
- default:
671
- return;
672
- }
673
- }, je = () => {
674
- G.value = !G.value, J.value = !1;
675
- }, pe = () => {
676
- const e = document.getElementById("comment-field"), a = document.getElementById("hidden-text");
677
- e.style.height = a?.offsetHeight + "px";
678
- }, ae = () => {
679
- const e = document.getElementById("comments-container");
680
- e?.scroll({
681
- top: e.scrollHeight,
682
- behavior: "smooth"
683
- });
684
- }, Qe = async (e) => {
685
- if (e && e.type === "keydown" && e.preventDefault(), i.value.tokenId && b.value && !R.value)
686
- try {
687
- 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",
691
- a
692
- );
693
- if (t.data.result.error_message)
694
- throw new Error(t.data.result.error_message);
695
- b.value = "", await ce(), ae();
696
- } catch (a) {
697
- console.log(a);
698
- }
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";
703
- } else {
704
- const e = A.value?.getBoundingClientRect().top, a = window.innerHeight;
705
- $.value = a - e < N.value ? "bottom" : "top";
706
- }
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";
711
- } else {
712
- const e = A.value?.getBoundingClientRect().left, a = window.innerWidth;
713
- X.value = a - e < M.value ? "left" : "right";
714
- }
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,
724
- isNew: !0
725
- }) : n.push({
726
- ...r,
727
- isNew: !1
728
- });
729
- }), n.sort((r, d) => r.id === e ? -1 : d.id === e ? 1 : 0), D.value = [...n];
730
- }
731
- };
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);
736
- }
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,
747
- (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()));
749
- }
750
- ), Ye(async () => {
751
- const e = JSON.parse(
752
- window.localStorage.getItem("authenticated")
753
- );
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();
755
- const a = [], t = window.localStorage.getItem("quick-replies");
756
- t && JSON.parse(t).forEach((o) => {
757
- a.push(o.message);
758
- }), K.value = a;
759
- }), ze(() => {
760
- H.value.forEach((e) => {
761
- clearTimeout(e);
762
- });
763
- }), {
764
- DateTime: g,
765
- // Refs
766
- actionMenuOpen: J,
767
- alignment: $,
768
- assignTypes: L,
769
- comment: b,
770
- 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,
780
- itemOptions: w,
781
- loading: T,
782
- messages: le,
783
- moodOptions: z,
784
- pmsData: C,
785
- positioning: X,
786
- quickReplies: K,
787
- 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,
796
- ticketsList: D,
797
- todoOptions: ge,
798
- trigger: A,
799
- userId: U,
800
- workOrder: c,
801
- workOrderIssues: V,
802
- whenOptions: E,
803
- whereOptions: S,
804
- // 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,
820
- // 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
850
- };
851
- }
852
- });
853
- export {
854
- _t as default
855
- };