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