@dragonmastery/dragoncore-vue 0.0.4 → 0.0.5

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 (56) hide show
  1. package/dist/{CreateTeamForm-zVlGgmL9.js → CreateTeamForm-O_viMOrD.js} +5 -5
  2. package/dist/{CreateTeamMemberForm-DkCbsJDn.js → CreateTeamMemberForm-BzwDug0x.js} +5 -5
  3. package/dist/{CreditBalanceDashboard-BTW4IK66.js → CreditBalanceDashboard-CBaQsjyo.js} +5 -5
  4. package/dist/{CreditManagement-0JxmCIAd.js → CreditManagement-Bal5mbQC.js} +5 -5
  5. package/dist/CustomerCreateSupportTicketForm-CpnbsCqr.js +27 -0
  6. package/dist/{CustomerSupportTicketDetailPage-DQa_Zvfe.js → CustomerSupportTicketDetailPage-DZQCplSM.js} +197 -183
  7. package/dist/CustomerSupportTicketDetailPage-DZQCplSM.js.map +1 -0
  8. package/dist/CustomerSupportTicketList-CKf8Kyzu.js +27 -0
  9. package/dist/{CustomerSupportTicketParent-BOYIren9.js → CustomerSupportTicketParent-BnmTFigo.js} +1 -1
  10. package/dist/{CustomerSupportTicketParent-sT8hpgrA.js → CustomerSupportTicketParent-BzY4pmBk.js} +2 -2
  11. package/dist/{CustomerSupportTicketParent-sT8hpgrA.js.map → CustomerSupportTicketParent-BzY4pmBk.js.map} +1 -1
  12. package/dist/CustomerSupportTicketSuccess-B-1n0gP-.js +27 -0
  13. package/dist/{EditTeamForm-BM90JTjr.js → EditTeamForm-CKnK07nF.js} +5 -5
  14. package/dist/{ResetPassword-DAn7dYAp.js → ResetPassword-Q8vhelQz.js} +5 -5
  15. package/dist/{SavedFiltersPage-BNasEKOY.js → SavedFiltersPage-DhhcU1R1.js} +51 -23
  16. package/dist/SavedFiltersPage-DhhcU1R1.js.map +1 -0
  17. package/dist/StaffCreateSupportTicketForm-D5ne_W9A.js +27 -0
  18. package/dist/{StaffSupportTicketDetailPage-D49ibqrO.js → StaffSupportTicketDetailPage-DY07Ez0R.js} +176 -132
  19. package/dist/StaffSupportTicketDetailPage-DY07Ez0R.js.map +1 -0
  20. package/dist/StaffSupportTicketList-xD3FaXkS.js +27 -0
  21. package/dist/{StaffSupportTicketParent-CxrPxXSH.js → StaffSupportTicketParent-CWWhaM37.js} +2 -2
  22. package/dist/{StaffSupportTicketParent-CxrPxXSH.js.map → StaffSupportTicketParent-CWWhaM37.js.map} +1 -1
  23. package/dist/{StaffSupportTicketParent-C7Mm7W_0.js → StaffSupportTicketParent-Dp1G85wc.js} +1 -1
  24. package/dist/StaffSupportTicketSuccess-D1nBsbcC.js +27 -0
  25. package/dist/{SupportTicketDevLifecycleBadge-Cl4y47Sy.js → SupportTicketDevLifecycleBadge-Ba-Rm6QW.js} +1 -1
  26. package/dist/{SupportTicketDevLifecycleBadge-Cl4y47Sy.js.map → SupportTicketDevLifecycleBadge-Ba-Rm6QW.js.map} +1 -1
  27. package/dist/{TeamAttachmentsTab-BoOIuTU1.js → TeamAttachmentsTab-DaCRkUsF.js} +5 -5
  28. package/dist/{ViewTeam-Bb1WH_Us.js → TeamList-BaZfSOG4.js} +6 -6
  29. package/dist/{TeamMemberList-CQTxcWNS.js → TeamMemberList-DOG48Y0Q.js} +5 -5
  30. package/dist/{TeamMemberParent-Bt0kbyKQ.js → TeamMemberParent-CTrhsG1K.js} +5 -5
  31. package/dist/{TeamParent-BvLiiJq6.js → TeamParent-myjqz30R.js} +5 -5
  32. package/dist/{TimelineNoteInput-BRsQ2QTz.js → TimelineNoteInput-BVqF4MtZ.js} +31 -8
  33. package/dist/TimelineNoteInput-BVqF4MtZ.js.map +1 -0
  34. package/dist/{TimelineSystemEvent-B69B3eeL.js → TimelineSystemEvent-D58zN850.js} +288 -205
  35. package/dist/TimelineSystemEvent-D58zN850.js.map +1 -0
  36. package/dist/{TeamList-TpS3BhPd.js → ViewTeam-DRQuV1A3.js} +6 -6
  37. package/dist/{ViewTeamMember-CBTAnAhS.js → ViewTeamMember-DjbxMkB4.js} +5 -5
  38. package/dist/{displayIdFormatter-BoKcrgF5.js → displayIdFormatter-B1ZKgofu.js} +1 -1
  39. package/dist/{displayIdFormatter-BoKcrgF5.js.map → displayIdFormatter-B1ZKgofu.js.map} +1 -1
  40. package/dist/index.d.ts +1114 -1090
  41. package/dist/index.js +6 -6
  42. package/dist/{src-ChwBeNHB.js → src-wQ7pAFHx.js} +1488 -1416
  43. package/dist/src-wQ7pAFHx.js.map +1 -0
  44. package/package.json +1 -1
  45. package/dist/CustomerCreateSupportTicketForm-CQcv4vrX.js +0 -27
  46. package/dist/CustomerSupportTicketDetailPage-DQa_Zvfe.js.map +0 -1
  47. package/dist/CustomerSupportTicketList-CMPRQ_7O.js +0 -27
  48. package/dist/CustomerSupportTicketSuccess-CnRWm6gX.js +0 -27
  49. package/dist/SavedFiltersPage-BNasEKOY.js.map +0 -1
  50. package/dist/StaffCreateSupportTicketForm-DoHCw60c.js +0 -27
  51. package/dist/StaffSupportTicketDetailPage-D49ibqrO.js.map +0 -1
  52. package/dist/StaffSupportTicketList-BgCIa_9v.js +0 -27
  53. package/dist/StaffSupportTicketSuccess-DZF2WpZc.js +0 -27
  54. package/dist/TimelineNoteInput-BRsQ2QTz.js.map +0 -1
  55. package/dist/TimelineSystemEvent-B69B3eeL.js.map +0 -1
  56. package/dist/src-ChwBeNHB.js.map +0 -1
@@ -2,13 +2,14 @@ import { t as BATCH_MODE } from "./useRpcAuth-Dp2sec-X.js";
2
2
  import "./useQueryCache-DqcDMsxb.js";
3
3
  import { t as useMutation } from "./useMutation-B4_S4Xoa.js";
4
4
  import { t as useQuery } from "./useQuery-B7ndu5_P.js";
5
- import { c as SupportTicketTypeBadge_default, i as SupportTicketApprovalBadge_default, l as SupportTicketPriorityBadge_default, n as TimelineItem_default, o as formatCustomerCreditValue, r as formatTicketDate, t as TimelineSystemEvent_default } from "./TimelineSystemEvent-B69B3eeL.js";
5
+ import { a as SupportTicketTypeBadge_default, c as formatCustomerCreditValue, i as SupportTicketApprovalBadge_default, n as TimelineItem_default, o as SupportTicketPriorityBadge_default, r as formatTicketDate, t as TimelineSystemEvent_default } from "./TimelineSystemEvent-D58zN850.js";
6
6
  import { t as extractRpcErrorMessage } from "./extractRpcErrorMessage-C_UbKgHL.js";
7
- import { t as formatTicketDisplayId } from "./displayIdFormatter-BoKcrgF5.js";
8
- import { a as SupportTicketAttachmentsCollapsible_default, i as parseRecordVersions, n as MetadataField_default, r as ActionBannerAlert_default, t as TimelineNoteInput_default } from "./TimelineNoteInput-BRsQ2QTz.js";
9
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, openBlock, reactive, ref, renderList, resolveComponent, toDisplayString, unref, vModelSelect, vModelText, watch, withCtx, withDirectives } from "vue";
7
+ import { t as formatTicketDisplayId } from "./displayIdFormatter-B1ZKgofu.js";
8
+ import { a as SupportTicketAttachmentsCollapsible_default, i as parseRecordVersions, n as MetadataField_default, r as ActionBannerAlert_default, t as TimelineNoteInput_default } from "./TimelineNoteInput-BVqF4MtZ.js";
9
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, openBlock, ref, renderList, resolveComponent, toDisplayString, unref, watch, withCtx } from "vue";
10
10
  import { useRoute, useRouter } from "vue-router";
11
- import { OPERATORS, RecordConst, supportTicketPriorityToNumber } from "@dragonmastery/dragoncore-shared";
11
+ import { CustomerSupportTicketUpdateSchema, OPERATORS, RecordConst, SUPPORT_TICKET_PRIORITY_NUMBER_TO_LABEL, supportTicketPriorityToNumber } from "@dragonmastery/dragoncore-shared";
12
+ import { useForm, withMetadata } from "@dragonmastery/zinia-forms-core";
12
13
  import { toast } from "vue3-toastify";
13
14
 
14
15
  //#region src/slices/support_ticket/customer/components/CustomerActionBanner.vue
@@ -72,13 +73,19 @@ const _hoisted_5$3 = {
72
73
  key: 0,
73
74
  class: "text-base-content/50"
74
75
  };
75
- const _hoisted_6$2 = { class: "text-base-content/50" };
76
- const _hoisted_7$2 = { class: "text-base-content/50" };
76
+ const _hoisted_6$3 = { class: "text-base-content/50" };
77
+ const _hoisted_7$3 = { class: "text-base-content/50" };
78
+ const _hoisted_8$2 = {
79
+ key: 0,
80
+ class: "flex justify-end gap-2 mt-4"
81
+ };
77
82
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
78
83
  __name: "CustomerMetadataCard",
79
84
  props: { ticket: {} },
85
+ emits: ["edit"],
80
86
  setup(__props) {
81
87
  const props = __props;
88
+ const canEdit = computed(() => !props.ticket.is_locked && !props.ticket.archived_at);
82
89
  const displayApprovalStatus = computed(() => {
83
90
  const s = props.ticket.status;
84
91
  if (s === "PENDING") return "PENDING";
@@ -130,7 +137,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
130
137
  _: 1
131
138
  }),
132
139
  createElementVNode("div", _hoisted_3$3, [createVNode(MetadataField_default, { label: "Description" }, {
133
- empty: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "text-base-content/50 italic text-sm" }, "No description provided", -1)])]),
140
+ empty: withCtx(() => [..._cache[1] || (_cache[1] = [createElementVNode("span", { class: "text-base-content/50 italic text-sm" }, "No description provided", -1)])]),
134
141
  default: withCtx(() => [__props.ticket.description?.trim() ? (openBlock(), createElementBlock("p", _hoisted_4$3, toDisplayString(__props.ticket.description), 1)) : createCommentVNode("v-if", true)]),
135
142
  _: 1
136
143
  })]),
@@ -156,17 +163,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
156
163
  key: 1,
157
164
  label: "Target"
158
165
  }, {
159
- default: withCtx(() => [createTextVNode(toDisplayString(targetFormatted.value) + " ", 1), createElementVNode("span", _hoisted_6$2, "· " + toDisplayString(targetRelative.value), 1)]),
166
+ default: withCtx(() => [createTextVNode(toDisplayString(targetFormatted.value) + " ", 1), createElementVNode("span", _hoisted_6$3, "· " + toDisplayString(targetRelative.value), 1)]),
160
167
  _: 1
161
168
  })) : createCommentVNode("v-if", true),
162
169
  __props.ticket.completed_at ? (openBlock(), createBlock(MetadataField_default, {
163
170
  key: 2,
164
171
  label: "Completed"
165
172
  }, {
166
- default: withCtx(() => [createTextVNode(toDisplayString(completedFormatted.value) + " ", 1), createElementVNode("span", _hoisted_7$2, "· " + toDisplayString(completedRelative.value), 1)]),
173
+ default: withCtx(() => [createTextVNode(toDisplayString(completedFormatted.value) + " ", 1), createElementVNode("span", _hoisted_7$3, "· " + toDisplayString(completedRelative.value), 1)]),
167
174
  _: 1
168
175
  })) : createCommentVNode("v-if", true)
169
- ])]);
176
+ ]), canEdit.value ? (openBlock(), createElementBlock("div", _hoisted_8$2, [createElementVNode("button", {
177
+ type: "button",
178
+ class: "btn btn-sm",
179
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("edit"))
180
+ }, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
181
+ xmlns: "http://www.w3.org/2000/svg",
182
+ fill: "none",
183
+ viewBox: "0 0 24 24",
184
+ "stroke-width": "1.5",
185
+ stroke: "currentColor",
186
+ class: "w-4 h-4 mr-2"
187
+ }, [createElementVNode("path", {
188
+ "stroke-linecap": "round",
189
+ "stroke-linejoin": "round",
190
+ d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
191
+ })], -1), createTextVNode(" Edit ", -1)])])])) : createCommentVNode("v-if", true)]);
170
192
  };
171
193
  }
172
194
  });
@@ -176,15 +198,25 @@ var CustomerMetadataCard_default = _sfc_main$4;
176
198
  //#region src/slices/support_ticket/customer/components/CustomerSupportTicketSubscribeControl.vue
177
199
  const _hoisted_1$3 = {
178
200
  key: 0,
179
- class: "flex flex-wrap items-center gap-2"
201
+ class: "flex flex-wrap items-center justify-between gap-3 rounded-lg border border-base-200 bg-base-200/30 px-4 py-3"
180
202
  };
181
- const _hoisted_2$3 = { class: "text-sm text-base-content/70" };
182
- const _hoisted_3$2 = ["disabled"];
183
- const _hoisted_4$2 = {
203
+ const _hoisted_2$3 = { class: "flex items-center gap-3 min-w-0" };
204
+ const _hoisted_3$2 = {
205
+ key: 0,
206
+ xmlns: "http://www.w3.org/2000/svg",
207
+ class: "h-5 w-5",
208
+ fill: "none",
209
+ viewBox: "0 0 24 24",
210
+ stroke: "currentColor",
211
+ "stroke-width": "2"
212
+ };
213
+ const _hoisted_4$2 = { class: "text-sm text-base-content/80 min-w-0" };
214
+ const _hoisted_5$2 = ["disabled"];
215
+ const _hoisted_6$2 = {
184
216
  key: 0,
185
217
  class: "loading loading-spinner loading-xs"
186
218
  };
187
- const _hoisted_5$2 = { key: 1 };
219
+ const _hoisted_7$2 = { key: 1 };
188
220
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
189
221
  __name: "CustomerSupportTicketSubscribeControl",
190
222
  props: { ticket: {} },
@@ -210,134 +242,158 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
210
242
  }
211
243
  }
212
244
  return (_ctx, _cache) => {
213
- return __props.ticket ? (openBlock(), createElementBlock("div", _hoisted_1$3, [createElementVNode("span", _hoisted_2$3, toDisplayString(isSubscribed.value ? "You will receive notifications for updates." : "Get notified when there are updates or new comments."), 1), createElementVNode("button", {
214
- type: "button",
215
- class: normalizeClass(isSubscribed.value ? "btn btn-sm btn-ghost" : "btn btn-sm btn-primary"),
216
- disabled: isToggling.value,
217
- onClick: handleToggle
218
- }, [isToggling.value ? (openBlock(), createElementBlock("span", _hoisted_4$2)) : (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString(isSubscribed.value ? "Unsubscribe" : "Subscribe"), 1))], 10, _hoisted_3$2)])) : createCommentVNode("v-if", true);
245
+ return __props.ticket ? (openBlock(), createElementBlock("div", _hoisted_1$3, [createElementVNode("div", _hoisted_2$3, [
246
+ createElementVNode("div", { class: normalizeClass(["flex h-9 w-9 shrink-0 items-center justify-center rounded-lg", isSubscribed.value ? "bg-info/20 text-info" : "bg-base-300 text-base-content/60"]) }, [createCommentVNode(" Bell (subscribed) "), isSubscribed.value ? (openBlock(), createElementBlock("svg", _hoisted_3$2, [..._cache[0] || (_cache[0] = [createElementVNode("path", {
247
+ "stroke-linecap": "round",
248
+ "stroke-linejoin": "round",
249
+ d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
250
+ }, null, -1)])])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Bell with slash (unsubscribed) "), _cache[1] || (_cache[1] = createElementVNode("svg", {
251
+ xmlns: "http://www.w3.org/2000/svg",
252
+ class: "h-5 w-5",
253
+ fill: "none",
254
+ viewBox: "0 0 24 24",
255
+ stroke: "currentColor",
256
+ "stroke-width": "2"
257
+ }, [createElementVNode("path", {
258
+ "stroke-linecap": "round",
259
+ "stroke-linejoin": "round",
260
+ d: "M9.143 17.082a24.248 24.248 0 0 0 3.844.148m-3.844-.148a23.856 23.856 0 0 1-5.455-1.31 8.964 8.964 0 0 0 2.3-5.542m3.155 6.852a3 3 0 0 0 5.667 1.97m1.965-2.277L21 21m-4.225-4.225a23.81 23.81 0 0 0 3.536-1.003A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6.53 6.53m10.245 10.245L6.53 6.53M3 3l3.53 3.53"
261
+ })], -1))], 2112))], 2),
262
+ createElementVNode("p", _hoisted_4$2, toDisplayString(isSubscribed.value ? "You will receive notifications for updates." : "Get notified when there are updates or new comments."), 1),
263
+ createElementVNode("button", {
264
+ type: "button",
265
+ class: normalizeClass(["btn btn-sm shrink-0 font-medium", isSubscribed.value ? "btn-outline" : "btn-info"]),
266
+ disabled: isToggling.value,
267
+ onClick: handleToggle
268
+ }, [isToggling.value ? (openBlock(), createElementBlock("span", _hoisted_6$2)) : (openBlock(), createElementBlock("span", _hoisted_7$2, toDisplayString(isSubscribed.value ? "Unsubscribe" : "Subscribe"), 1))], 10, _hoisted_5$2)
269
+ ])])) : createCommentVNode("v-if", true);
219
270
  };
220
271
  }
221
272
  });
222
273
  var CustomerSupportTicketSubscribeControl_default = _sfc_main$3;
223
274
 
275
+ //#endregion
276
+ //#region src/slices/support_ticket/customer/customerMetadataCardEditFormMetadata.ts
277
+ const customerMetadataCardEditFormMetadata = withMetadata(CustomerSupportTicketUpdateSchema, "customerMetadataCardEditForm", {
278
+ title: {
279
+ label: "Title",
280
+ placeholder: "Enter ticket title"
281
+ },
282
+ description: {
283
+ label: "Description",
284
+ inputType: "textarea",
285
+ placeholder: "Describe the ticket in detail"
286
+ },
287
+ type: { label: "Type" },
288
+ priority: {
289
+ label: "Priority",
290
+ inputType: "select",
291
+ valueToLabel: SUPPORT_TICKET_PRIORITY_NUMBER_TO_LABEL,
292
+ valueType: "number"
293
+ }
294
+ });
295
+
224
296
  //#endregion
225
297
  //#region src/slices/support_ticket/customer/components/CustomerMetadataCardEdit.vue
226
298
  const _hoisted_1$2 = { class: "border border-base-200 rounded-lg p-4 md:p-6" };
227
299
  const _hoisted_2$2 = { class: "grid grid-cols-1 md:grid-cols-2 gap-4" };
228
300
  const _hoisted_3$1 = { class: "form-control md:col-span-2" };
229
- const _hoisted_4$1 = ["disabled"];
230
- const _hoisted_5$1 = {
301
+ const _hoisted_4$1 = { class: "form-control md:col-span-2" };
302
+ const _hoisted_5$1 = { class: "form-control" };
303
+ const _hoisted_6$1 = { class: "form-control" };
304
+ const _hoisted_7$1 = {
231
305
  key: 0,
232
- class: "label"
233
- };
234
- const _hoisted_6$1 = { class: "form-control md:col-span-2" };
235
- const _hoisted_7$1 = ["disabled"];
236
- const _hoisted_8$1 = { class: "form-control" };
237
- const _hoisted_9$1 = ["disabled"];
238
- const _hoisted_10$1 = { class: "form-control" };
239
- const _hoisted_11$1 = ["disabled"];
240
- const _hoisted_12$1 = { class: "flex justify-end gap-2 mt-4" };
241
- const _hoisted_13$1 = ["disabled"];
242
- const _hoisted_14$1 = ["disabled"];
243
- const _hoisted_15 = {
244
- key: 0,
245
- class: "loading loading-spinner loading-xs mr-2"
306
+ class: "alert alert-error py-2 mt-4"
246
307
  };
308
+ const _hoisted_8$1 = { class: "text-sm" };
309
+ const _hoisted_9$1 = { class: "flex justify-end gap-2 mt-4" };
310
+ const _hoisted_10$1 = ["disabled"];
247
311
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
248
312
  __name: "CustomerMetadataCardEdit",
249
313
  props: {
250
314
  ticket: {},
251
315
  saving: { type: Boolean }
252
316
  },
253
- emits: ["save", "cancel"],
317
+ emits: ["success", "cancel"],
254
318
  setup(__props, { emit: __emit }) {
255
319
  const props = __props;
256
320
  const emit = __emit;
257
- const formData = reactive({
258
- title: props.ticket.title || "",
259
- description: props.ticket.description || "",
260
- type: props.ticket.type,
261
- priority: supportTicketPriorityToNumber(props.ticket.priority)
262
- });
263
- const titleError = computed(() => {
264
- return formData.title.trim() === "";
321
+ const { mutate: updateTicket, loading: isSaving } = useMutation((api, input) => api.supportTickets.updateTicket(input), { invalidate: /^support-tickets?:/ });
322
+ const saving = computed(() => props.saving ?? isSaving.value);
323
+ const { form, zinia, ZiniaForm, ZiniaSubmitButton, ZiniaFormErrorsSummary } = useForm(customerMetadataCardEditFormMetadata, {
324
+ storeName: `customer-metadata-card-edit-${props.ticket.id}`,
325
+ persistToLocalStorage: false,
326
+ renderStyle: "daisy_ui",
327
+ fetchData: async () => {
328
+ const t = props.ticket;
329
+ return {
330
+ id: t.id,
331
+ title: t.title || "",
332
+ description: t.description ?? "",
333
+ type: t.type,
334
+ priority: supportTicketPriorityToNumber(t.priority)
335
+ };
336
+ }
265
337
  });
266
- function handleSave() {
267
- if (titleError.value) return;
268
- emit("save", {
338
+ function buildPayload(formData) {
339
+ return {
269
340
  id: props.ticket.id,
270
- title: formData.title.trim(),
341
+ title: String(formData.title ?? "").trim(),
271
342
  description: formData.description || "",
272
343
  type: formData.type,
273
344
  priority: formData.priority
274
- });
345
+ };
346
+ }
347
+ async function handleSubmit(formData) {
348
+ await updateTicket(buildPayload(formData));
349
+ }
350
+ function handleSuccess() {
351
+ emit("success");
352
+ }
353
+ function handleError(error) {
354
+ const message = extractRpcErrorMessage(error, "Failed to update ticket");
355
+ form.setSubmitError(message);
275
356
  }
276
357
  function handleCancel() {
277
358
  emit("cancel");
278
359
  }
279
360
  return (_ctx, _cache) => {
280
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
281
- createElementVNode("div", _hoisted_2$2, [
282
- createCommentVNode(" Title - full width "),
283
- createElementVNode("div", _hoisted_3$1, [
284
- _cache[5] || (_cache[5] = createElementVNode("label", { class: "label" }, [createElementVNode("span", { class: "label-text font-medium" }, "Title")], -1)),
285
- withDirectives(createElementVNode("input", {
286
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.title = $event),
287
- type: "text",
288
- class: normalizeClass(["input input-bordered w-full", { "input-error": titleError.value }]),
289
- placeholder: "Enter ticket title",
290
- disabled: __props.saving
291
- }, null, 10, _hoisted_4$1), [[vModelText, formData.title]]),
292
- titleError.value ? (openBlock(), createElementBlock("label", _hoisted_5$1, [..._cache[4] || (_cache[4] = [createElementVNode("span", { class: "label-text-alt text-error" }, "Title is required.", -1)])])) : createCommentVNode("v-if", true)
361
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [createVNode(unref(ZiniaForm), {
362
+ onHandleSubmit: handleSubmit,
363
+ onSuccess: handleSuccess,
364
+ onError: handleError,
365
+ title: "",
366
+ subtitle: ""
367
+ }, {
368
+ default: withCtx(() => [
369
+ createElementVNode("div", _hoisted_2$2, [
370
+ createCommentVNode(" Title - full width "),
371
+ createElementVNode("div", _hoisted_3$1, [createVNode(unref(zinia).TitleField, { placeholder: "Enter ticket title" })]),
372
+ createCommentVNode(" Description - full width "),
373
+ createElementVNode("div", _hoisted_4$1, [createVNode(unref(zinia).DescriptionField, {
374
+ class: "w-full",
375
+ placeholder: "Describe the ticket in detail"
376
+ })]),
377
+ createCommentVNode(" Type "),
378
+ createElementVNode("div", _hoisted_5$1, [createVNode(unref(zinia).TypeField)]),
379
+ createCommentVNode(" Priority "),
380
+ createElementVNode("div", _hoisted_6$1, [createVNode(unref(zinia).PriorityField)])
293
381
  ]),
294
- createCommentVNode(" Description - full width "),
295
- createElementVNode("div", _hoisted_6$1, [_cache[6] || (_cache[6] = createElementVNode("label", { class: "label" }, [createElementVNode("span", { class: "label-text font-medium" }, "Description")], -1)), withDirectives(createElementVNode("textarea", {
296
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => formData.description = $event),
297
- class: "textarea textarea-bordered w-full",
298
- rows: "6",
299
- placeholder: "Describe the ticket in detail",
300
- disabled: __props.saving
301
- }, null, 8, _hoisted_7$1), [[vModelText, formData.description]])]),
302
- createCommentVNode(" Type "),
303
- createElementVNode("div", _hoisted_8$1, [_cache[8] || (_cache[8] = createElementVNode("label", { class: "label" }, [createElementVNode("span", { class: "label-text font-medium" }, "Type")], -1)), withDirectives(createElementVNode("select", {
304
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => formData.type = $event),
305
- class: "select select-bordered w-full",
306
- disabled: __props.saving
307
- }, [..._cache[7] || (_cache[7] = [
308
- createElementVNode("option", { value: "IMPROVEMENT" }, "Improvement", -1),
309
- createElementVNode("option", { value: "BUG" }, "Bug", -1),
310
- createElementVNode("option", { value: "FEATURE_REQUEST" }, "Feature Request", -1),
311
- createElementVNode("option", { value: "OPERATIONAL" }, "Operational", -1)
312
- ])], 8, _hoisted_9$1), [[vModelSelect, formData.type]])]),
313
- createCommentVNode(" Priority "),
314
- createElementVNode("div", _hoisted_10$1, [_cache[10] || (_cache[10] = createElementVNode("label", { class: "label" }, [createElementVNode("span", { class: "label-text font-medium" }, "Priority")], -1)), withDirectives(createElementVNode("select", {
315
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => formData.priority = $event),
316
- class: "select select-bordered w-full",
317
- disabled: __props.saving
318
- }, [..._cache[9] || (_cache[9] = [
319
- createElementVNode("option", { value: 1 }, "Low", -1),
320
- createElementVNode("option", { value: 2 }, "Medium", -1),
321
- createElementVNode("option", { value: 3 }, "High", -1),
322
- createElementVNode("option", { value: 4 }, "Critical", -1)
323
- ])], 8, _hoisted_11$1), [[
324
- vModelSelect,
325
- formData.priority,
326
- void 0,
327
- { number: true }
328
- ]])])
382
+ unref(form).submitError ? (openBlock(), createElementBlock("div", _hoisted_7$1, [createElementVNode("span", _hoisted_8$1, toDisplayString(unref(form).submitError), 1)])) : createCommentVNode("v-if", true),
383
+ createVNode(unref(ZiniaFormErrorsSummary), { title: "Please fix the following errors:" }),
384
+ createCommentVNode(" Action Buttons "),
385
+ createElementVNode("div", _hoisted_9$1, [createElementVNode("button", {
386
+ type: "button",
387
+ class: "btn btn-ghost",
388
+ onClick: handleCancel,
389
+ disabled: saving.value
390
+ }, " Cancel ", 8, _hoisted_10$1), createVNode(unref(ZiniaSubmitButton), {
391
+ submitText: "Save",
392
+ submittingText: "Saving..."
393
+ })])
329
394
  ]),
330
- createCommentVNode(" Action Buttons "),
331
- createElementVNode("div", _hoisted_12$1, [createElementVNode("button", {
332
- class: "btn btn-ghost",
333
- onClick: handleCancel,
334
- disabled: __props.saving
335
- }, "Cancel", 8, _hoisted_13$1), createElementVNode("button", {
336
- class: "btn btn-primary",
337
- onClick: handleSave,
338
- disabled: __props.saving
339
- }, [__props.saving ? (openBlock(), createElementBlock("span", _hoisted_15)) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(__props.saving ? "Saving..." : "Save"), 1)], 8, _hoisted_14$1)])
340
- ]);
395
+ _: 1
396
+ })]);
341
397
  };
342
398
  }
343
399
  });
@@ -407,14 +463,22 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
407
463
  author: item.data.author,
408
464
  message: item.data.message,
409
465
  timestamp: item.data.timestamp,
466
+ action: item.data.action,
467
+ type: item.data.type,
468
+ details: item.data.details,
410
469
  "old-value": item.data.oldValue,
411
- "new-value": item.data.newValue
470
+ "new-value": item.data.newValue,
471
+ changes: item.data.changes
412
472
  }, null, 8, [
413
473
  "author",
414
474
  "message",
415
475
  "timestamp",
476
+ "action",
477
+ "type",
478
+ "details",
416
479
  "old-value",
417
- "new-value"
480
+ "new-value",
481
+ "changes"
418
482
  ])) : createCommentVNode("v-if", true)], 64);
419
483
  }), 128))
420
484
  ]);
@@ -436,18 +500,14 @@ const _hoisted_5 = { class: "px-4 py-6 max-w-4xl mx-auto" };
436
500
  const _hoisted_6 = { class: "mb-6" };
437
501
  const _hoisted_7 = { class: "text-2xl font-bold text-base-content break-words leading-tight mt-2" };
438
502
  const _hoisted_8 = { class: "mb-6" };
439
- const _hoisted_9 = {
440
- key: 0,
441
- class: "flex gap-2 mb-6"
442
- };
443
- const _hoisted_10 = { class: "mb-6" };
503
+ const _hoisted_9 = { class: "mb-6" };
504
+ const _hoisted_10 = { class: "mb-8" };
444
505
  const _hoisted_11 = { class: "mb-8" };
445
- const _hoisted_12 = { class: "mb-8" };
446
- const _hoisted_13 = {
506
+ const _hoisted_12 = {
447
507
  key: 1,
448
508
  class: "alert alert-error mb-4"
449
509
  };
450
- const _hoisted_14 = {
510
+ const _hoisted_13 = {
451
511
  key: 2,
452
512
  class: "flex justify-center items-center py-8"
453
513
  };
@@ -464,12 +524,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
464
524
  const router = useRouter();
465
525
  const support_ticket_id = route.params.id;
466
526
  const isEditMode = computed(() => route.query.mode === "edit");
467
- const isSaving = ref(false);
468
527
  const refreshTicket = inject("refreshTicket");
469
- const isLocked = computed(() => {
470
- if (!props.ticket) return false;
471
- return !!props.ticket.is_locked;
472
- });
473
528
  const isCommentsLocked = computed(() => {
474
529
  if (!props.ticket) return false;
475
530
  return !!props.ticket.archived_at;
@@ -541,7 +596,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
541
596
  });
542
597
  });
543
598
  const { mutate: createNote } = useMutation((api, input) => api.notes.createNote(input), { invalidate: /^notes?:/ });
544
- const { mutate: updateTicket } = useMutation((api, input) => api.supportTickets.updateTicket(input), { invalidate: /^support-tickets?:/ });
545
599
  async function handleAddNote(payload) {
546
600
  try {
547
601
  await createNote({
@@ -578,20 +632,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
578
632
  }
579
633
  });
580
634
  }
581
- async function handleSave(payload) {
582
- isSaving.value = true;
583
- try {
584
- await updateTicket(payload);
585
- await exitEditMode();
586
- await nextTick();
587
- toast.success("Ticket updated successfully");
588
- if (refreshTicket) await refreshTicket();
589
- } catch (e) {
590
- const errorMessage = e instanceof Error ? e.message : "Failed to update ticket";
591
- toast.error(errorMessage);
592
- } finally {
593
- isSaving.value = false;
594
- }
635
+ async function handleMetadataSaveSuccess() {
636
+ await exitEditMode();
637
+ await nextTick();
638
+ toast.success("Ticket updated successfully");
639
+ if (refreshTicket) await refreshTicket();
640
+ await refetchTimeline();
595
641
  }
596
642
  return (_ctx, _cache) => {
597
643
  const _component_router_link = resolveComponent("router-link");
@@ -616,53 +662,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
616
662
  createElementVNode("div", _hoisted_6, [createElementVNode("h1", _hoisted_7, toDisplayString(__props.ticket.title), 1)]),
617
663
  createCommentVNode(" Action Banner "),
618
664
  createElementVNode("div", _hoisted_8, [createVNode(CustomerActionBanner_default, { ticket: __props.ticket }, null, 8, ["ticket"])]),
619
- createCommentVNode(" Edit / Cancel "),
620
- !isLocked.value && !isCommentsLocked.value ? (openBlock(), createElementBlock("div", _hoisted_9, [!isEditMode.value ? (openBlock(), createElementBlock("button", {
621
- key: 0,
622
- onClick: enterEditMode,
623
- class: "btn btn-sm"
624
- }, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
625
- xmlns: "http://www.w3.org/2000/svg",
626
- fill: "none",
627
- viewBox: "0 0 24 24",
628
- "stroke-width": "1.5",
629
- stroke: "currentColor",
630
- class: "w-4 h-4 mr-2"
631
- }, [createElementVNode("path", {
632
- "stroke-linecap": "round",
633
- "stroke-linejoin": "round",
634
- d: "M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"
635
- })], -1), createTextVNode(" Edit ", -1)])])) : (openBlock(), createElementBlock("button", {
636
- key: 1,
637
- onClick: exitEditMode,
638
- class: "btn btn-sm"
639
- }, [..._cache[5] || (_cache[5] = [createElementVNode("svg", {
640
- xmlns: "http://www.w3.org/2000/svg",
641
- fill: "none",
642
- viewBox: "0 0 24 24",
643
- "stroke-width": "1.5",
644
- stroke: "currentColor",
645
- class: "w-4 h-4 mr-2"
646
- }, [createElementVNode("path", {
647
- "stroke-linecap": "round",
648
- "stroke-linejoin": "round",
649
- d: "M6 18L18 6M6 6l12 12"
650
- })], -1), createTextVNode(" Cancel ", -1)])]))])) : createCommentVNode("v-if", true),
651
665
  createCommentVNode(" Subscribe / Unsubscribe "),
652
- createElementVNode("div", _hoisted_10, [createVNode(CustomerSupportTicketSubscribeControl_default, { ticket: __props.ticket }, null, 8, ["ticket"])]),
666
+ createElementVNode("div", _hoisted_9, [createVNode(CustomerSupportTicketSubscribeControl_default, { ticket: __props.ticket }, null, 8, ["ticket"])]),
653
667
  createCommentVNode(" Metadata Card (Display or Edit) "),
654
- createElementVNode("div", _hoisted_11, [!isEditMode.value ? (openBlock(), createBlock(CustomerMetadataCard_default, {
668
+ createElementVNode("div", _hoisted_10, [!isEditMode.value ? (openBlock(), createBlock(CustomerMetadataCard_default, {
655
669
  key: 0,
656
- ticket: __props.ticket
670
+ ticket: __props.ticket,
671
+ onEdit: enterEditMode
657
672
  }, null, 8, ["ticket"])) : (openBlock(), createBlock(CustomerMetadataCardEdit_default, {
658
673
  key: 1,
659
674
  ticket: __props.ticket,
660
- saving: isSaving.value,
661
- onSave: handleSave,
675
+ onSuccess: handleMetadataSaveSuccess,
662
676
  onCancel: exitEditMode
663
- }, null, 8, ["ticket", "saving"]))]),
677
+ }, null, 8, ["ticket"]))]),
664
678
  createCommentVNode(" Attachments (separate from timeline so adding a comment doesn't cause refetch) "),
665
- createElementVNode("div", _hoisted_12, [createVNode(SupportTicketAttachmentsCollapsible_default, {
679
+ createElementVNode("div", _hoisted_11, [createVNode(SupportTicketAttachmentsCollapsible_default, {
666
680
  "record-id": __props.ticket.id,
667
681
  locked: isCommentsLocked.value,
668
682
  editable: !isCommentsLocked.value,
@@ -688,10 +702,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
688
702
  "notes",
689
703
  "system-events",
690
704
  "comments-locked"
691
- ])) : unref(timelineError) ? (openBlock(), createElementBlock("div", _hoisted_13, [createElementVNode("span", null, toDisplayString(unref(timelineError)?.message ?? "Failed to load timeline"), 1), createElementVNode("button", {
705
+ ])) : unref(timelineError) ? (openBlock(), createElementBlock("div", _hoisted_12, [createElementVNode("span", null, toDisplayString(unref(timelineError)?.message ?? "Failed to load timeline"), 1), createElementVNode("button", {
692
706
  class: "btn btn-sm btn-outline mt-2",
693
707
  onClick: _cache[0] || (_cache[0] = (...args) => unref(refetchTimeline) && unref(refetchTimeline)(...args))
694
- }, " Retry ")])) : (openBlock(), createElementBlock("div", _hoisted_14, [..._cache[6] || (_cache[6] = [createElementVNode("span", { class: "loading loading-spinner loading-lg" }, null, -1)])]))])
708
+ }, " Retry ")])) : (openBlock(), createElementBlock("div", _hoisted_13, [..._cache[4] || (_cache[4] = [createElementVNode("span", { class: "loading loading-spinner loading-lg" }, null, -1)])]))])
695
709
  ])], 2112)) : createCommentVNode("v-if", true)], 2112);
696
710
  };
697
711
  }
@@ -700,4 +714,4 @@ var CustomerSupportTicketDetailPage_default = _sfc_main;
700
714
 
701
715
  //#endregion
702
716
  export { CustomerSupportTicketDetailPage_default as default };
703
- //# sourceMappingURL=CustomerSupportTicketDetailPage-DQa_Zvfe.js.map
717
+ //# sourceMappingURL=CustomerSupportTicketDetailPage-DZQCplSM.js.map