@escalated-dev/escalated 0.6.0 → 0.7.0

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 (130) hide show
  1. package/README.md +94 -2
  2. package/package.json +31 -2
  3. package/src/components/ActivityTimeline.stories.js +55 -0
  4. package/src/components/ActivityTimeline.vue +24 -7
  5. package/src/components/AdminDashboard.stories.js +1095 -0
  6. package/src/components/AgentLoadIndicator.stories.js +37 -0
  7. package/src/components/AgentLoadIndicator.vue +49 -0
  8. package/src/components/AgentPerformanceCard.vue +44 -0
  9. package/src/components/ArticleEditor.vue +82 -0
  10. package/src/components/AssigneeSelect.vue +19 -5
  11. package/src/components/AttachmentList.vue +53 -37
  12. package/src/components/AuditLogEntry.vue +95 -0
  13. package/src/components/BulkActionBar.vue +99 -30
  14. package/src/components/CategoryTree.vue +89 -0
  15. package/src/components/ChartWidget.vue +46 -0
  16. package/src/components/CollisionWarning.stories.js +30 -0
  17. package/src/components/CollisionWarning.vue +68 -0
  18. package/src/components/ConditionalFieldRules.vue +135 -0
  19. package/src/components/ContextPanel.vue +66 -0
  20. package/src/components/ContextPanelSection.vue +65 -0
  21. package/src/components/CustomFieldRenderer.vue +159 -0
  22. package/src/components/EscalatedLayout.vue +400 -69
  23. package/src/components/FileDropzone.vue +26 -10
  24. package/src/components/FollowButton.stories.js +30 -0
  25. package/src/components/FollowButton.vue +53 -28
  26. package/src/components/KeyboardShortcutHelp.vue +129 -39
  27. package/src/components/KnowledgePanel.vue +122 -0
  28. package/src/components/KpiCard.stories.js +32 -0
  29. package/src/components/KpiCard.vue +88 -0
  30. package/src/components/MacroDropdown.vue +95 -35
  31. package/src/components/PermissionMatrix.vue +107 -0
  32. package/src/components/PinnedNotes.vue +70 -31
  33. package/src/components/PresenceIndicator.vue +93 -27
  34. package/src/components/PriorityBadge.stories.js +33 -0
  35. package/src/components/PriorityBadge.vue +9 -2
  36. package/src/components/QuickFilters.vue +65 -49
  37. package/src/components/ReplyComposer.vue +144 -30
  38. package/src/components/ReplyThread.vue +72 -20
  39. package/src/components/SatisfactionRating.vue +98 -46
  40. package/src/components/ScheduleEditor.vue +104 -0
  41. package/src/components/SideConversation.vue +165 -0
  42. package/src/components/SideConversationList.vue +147 -0
  43. package/src/components/SkillTagManager.vue +79 -0
  44. package/src/components/SlaComplianceChart.vue +53 -0
  45. package/src/components/SlaTimer.stories.js +35 -0
  46. package/src/components/SlaTimer.vue +17 -4
  47. package/src/components/StatsCard.stories.js +24 -0
  48. package/src/components/StatsCard.vue +58 -46
  49. package/src/components/StatusBadge.stories.js +53 -0
  50. package/src/components/StatusBadge.vue +36 -4
  51. package/src/components/TagSelect.vue +43 -12
  52. package/src/components/TicketFilters.vue +225 -69
  53. package/src/components/TicketLinkPanel.vue +193 -0
  54. package/src/components/TicketList.vue +594 -193
  55. package/src/components/TicketMergeDialog.vue +157 -0
  56. package/src/components/TicketSidebar.vue +167 -99
  57. package/src/components/TicketTypeSelector.vue +21 -0
  58. package/src/components/TotpInput.stories.js +9 -0
  59. package/src/components/TotpInput.vue +81 -0
  60. package/src/components/TwoFactorSetup.vue +113 -0
  61. package/src/composables/useDebouncedSearch.js +38 -0
  62. package/src/composables/usePluginExtensions.js +95 -3
  63. package/src/composables/usePluginHooks.js +65 -0
  64. package/src/defineEscalatedPlugin.js +34 -8
  65. package/src/index.js +72 -35
  66. package/src/locales/en.json +25 -0
  67. package/src/pages/Admin/ApiTokens/Index.vue +231 -67
  68. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  69. package/src/pages/Admin/Automations/Form.vue +184 -0
  70. package/src/pages/Admin/Automations/Index.vue +129 -0
  71. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  72. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  73. package/src/pages/Admin/CannedResponses/Index.vue +127 -70
  74. package/src/pages/Admin/Capacity/Index.vue +134 -0
  75. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  76. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  77. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  78. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  79. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  80. package/src/pages/Admin/Departments/Form.vue +75 -51
  81. package/src/pages/Admin/Departments/Index.vue +109 -57
  82. package/src/pages/Admin/EscalationRules/Form.vue +157 -96
  83. package/src/pages/Admin/EscalationRules/Index.vue +178 -57
  84. package/src/pages/Admin/Import/Connect.vue +96 -0
  85. package/src/pages/Admin/Import/Index.vue +102 -0
  86. package/src/pages/Admin/Import/Mapping.vue +110 -0
  87. package/src/pages/Admin/Import/Progress.vue +153 -0
  88. package/src/pages/Admin/Import/Review.vue +76 -0
  89. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  90. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  91. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  92. package/src/pages/Admin/Macros/Index.vue +250 -89
  93. package/src/pages/Admin/Plugins/Index.vue +205 -75
  94. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  95. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  96. package/src/pages/Admin/Reports/Dashboard.vue +211 -0
  97. package/src/pages/Admin/Reports/SlaReport.vue +166 -0
  98. package/src/pages/Admin/Reports.vue +139 -34
  99. package/src/pages/Admin/Roles/Form.vue +71 -0
  100. package/src/pages/Admin/Roles/Index.vue +122 -0
  101. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  102. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  103. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  104. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  105. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  106. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  107. package/src/pages/Admin/Settings.vue +468 -260
  108. package/src/pages/Admin/Skills/Form.vue +53 -0
  109. package/src/pages/Admin/Skills/Index.vue +94 -0
  110. package/src/pages/Admin/SlaPolicies/Form.vue +118 -75
  111. package/src/pages/Admin/SlaPolicies/Index.vue +120 -59
  112. package/src/pages/Admin/Statuses/Form.vue +114 -0
  113. package/src/pages/Admin/Statuses/Index.vue +153 -0
  114. package/src/pages/Admin/Tags/Index.vue +191 -105
  115. package/src/pages/Admin/Tickets/Index.vue +91 -39
  116. package/src/pages/Admin/Tickets/Show.vue +101 -37
  117. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  118. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  119. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  120. package/src/pages/Agent/Dashboard.vue +311 -186
  121. package/src/pages/Agent/TicketIndex.vue +88 -38
  122. package/src/pages/Agent/TicketShow.vue +258 -51
  123. package/src/pages/Customer/Create.vue +36 -9
  124. package/src/pages/Customer/Index.vue +31 -24
  125. package/src/pages/Customer/KnowledgeBase/Article.vue +127 -0
  126. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  127. package/src/plugin.js +86 -1
  128. package/src/utils/constants.js +30 -0
  129. package/src/utils/formatting.js +35 -0
  130. package/src/pages/Admin/Plugins.vue +0 -129
@@ -13,7 +13,10 @@ const props = defineProps({
13
13
  pinnable: { type: Boolean, default: false },
14
14
  });
15
15
 
16
- const escDark = inject('esc-dark', computed(() => false));
16
+ const escDark = inject(
17
+ 'esc-dark',
18
+ computed(() => false),
19
+ );
17
20
  const { t } = useI18n();
18
21
 
19
22
  function formatDate(date) {
@@ -22,42 +25,91 @@ function formatDate(date) {
22
25
 
23
26
  function togglePin(reply) {
24
27
  if (!props.routePrefix || !props.ticketReference) return;
25
- router.post(route(`${props.routePrefix}.tickets.pin`, [props.ticketReference, reply.id]), {}, { preserveScroll: true });
28
+ router.post(
29
+ route(`${props.routePrefix}.tickets.pin`, [props.ticketReference, reply.id]),
30
+ {},
31
+ { preserveScroll: true },
32
+ );
26
33
  }
27
34
  </script>
28
35
 
29
36
  <template>
30
- <div class="space-y-4">
31
- <div v-for="reply in replies" :key="reply.id"
32
- :class="['rounded-xl border p-4', escDark
33
- ? (reply.is_internal_note ? 'border-amber-500/20 bg-amber-500/5' : 'border-white/[0.06] bg-neutral-900/60')
34
- : (reply.is_internal_note ? 'border-yellow-200 bg-yellow-50' : 'border-gray-200 bg-white')]">
37
+ <div class="space-y-4" role="feed" aria-label="Reply thread">
38
+ <div
39
+ v-for="reply in replies"
40
+ :key="reply.id"
41
+ :class="[
42
+ 'rounded-xl border p-4',
43
+ escDark
44
+ ? reply.is_internal_note
45
+ ? 'border-amber-500/20 bg-amber-500/5'
46
+ : 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]'
47
+ : reply.is_internal_note
48
+ ? 'border-yellow-200 bg-yellow-50'
49
+ : 'border-gray-200 bg-white',
50
+ ]"
51
+ >
35
52
  <div class="mb-2 flex items-center justify-between">
36
53
  <div class="flex items-center gap-2">
37
- <span :class="['font-medium', escDark ? 'text-gray-200' : 'text-gray-900']">{{ reply.author?.name || t('ticket.unknown') }}</span>
38
- <span v-if="reply.is_internal_note"
39
- :class="['rounded px-1.5 py-0.5 text-xs font-medium', escDark ? 'bg-amber-500/15 text-amber-400' : 'bg-yellow-200 text-yellow-800']">
54
+ <span
55
+ :class="['font-medium', escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-900']"
56
+ >{{ reply.author?.name || t('ticket.unknown') }}</span
57
+ >
58
+ <span
59
+ v-if="reply.is_internal_note"
60
+ :class="[
61
+ 'rounded px-1.5 py-0.5 text-xs font-medium',
62
+ escDark ? 'bg-amber-500/15 text-amber-400' : 'bg-yellow-200 text-yellow-800',
63
+ ]"
64
+ >
40
65
  {{ t('reply.internal_note') }}
41
66
  </span>
42
- <span v-if="reply.is_pinned"
43
- :class="['rounded px-1.5 py-0.5 text-xs font-medium', escDark ? 'bg-cyan-500/15 text-cyan-400' : 'bg-blue-100 text-blue-700']">
67
+ <span
68
+ v-if="reply.is_pinned"
69
+ :class="[
70
+ 'rounded px-1.5 py-0.5 text-xs font-medium',
71
+ escDark ? 'bg-cyan-500/15 text-cyan-400' : 'bg-blue-100 text-blue-700',
72
+ ]"
73
+ >
44
74
  {{ t('reply.pinned') }}
45
75
  </span>
46
76
  </div>
47
77
  <div class="flex items-center gap-2">
48
- <button v-if="pinnable && reply.is_internal_note" @click="togglePin(reply)"
49
- :class="['rounded px-2 py-0.5 text-xs font-medium transition-colors',
50
- escDark
51
- ? (reply.is_pinned ? 'bg-cyan-500/15 text-cyan-400 hover:bg-cyan-500/25' : 'text-neutral-500 hover:bg-white/[0.06] hover:text-neutral-300')
52
- : (reply.is_pinned ? 'bg-blue-100 text-blue-700 hover:bg-blue-200' : 'text-gray-400 hover:bg-gray-100 hover:text-gray-600')]">
78
+ <button
79
+ v-if="pinnable && reply.is_internal_note"
80
+ :class="[
81
+ 'rounded px-2 py-0.5 text-xs font-medium transition-colors',
82
+ escDark
83
+ ? reply.is_pinned
84
+ ? 'bg-cyan-500/15 text-cyan-400 hover:bg-cyan-500/25'
85
+ : 'text-[var(--esc-panel-text-muted)] hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]'
86
+ : reply.is_pinned
87
+ ? 'bg-blue-100 text-blue-700 hover:bg-blue-200'
88
+ : 'text-gray-400 hover:bg-gray-100 hover:text-gray-600',
89
+ ]"
90
+ @click="togglePin(reply)"
91
+ >
53
92
  {{ reply.is_pinned ? t('reply.unpin') : t('reply.pin') }}
54
93
  </button>
55
- <span :class="['text-xs', escDark ? 'text-gray-500' : 'text-gray-500']">{{ formatDate(reply.created_at) }}</span>
94
+ <span :class="['text-xs', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']">{{
95
+ formatDate(reply.created_at)
96
+ }}</span>
56
97
  </div>
57
98
  </div>
58
- <div :class="['prose prose-sm max-w-none', escDark ? 'prose-invert text-gray-300' : 'text-gray-700']" v-html="sanitizeHtml(reply.body)"></div>
99
+ <div
100
+ :class="[
101
+ 'prose prose-sm max-w-none',
102
+ escDark ? 'prose-invert text-[var(--esc-panel-text-secondary)]' : 'text-gray-700',
103
+ ]"
104
+ v-html="sanitizeHtml(reply.body)"
105
+ ></div>
59
106
  <AttachmentList v-if="reply.attachments?.length" :attachments="reply.attachments" class="mt-3" />
60
107
  </div>
61
- <div v-if="!replies?.length" :class="['py-8 text-center text-sm', escDark ? 'text-gray-500' : 'text-gray-500']">{{ t('ticket.no_replies') }}</div>
108
+ <div
109
+ v-if="!replies?.length"
110
+ :class="['py-8 text-center text-sm', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']"
111
+ >
112
+ {{ t('ticket.no_replies') }}
113
+ </div>
62
114
  </div>
63
115
  </template>
@@ -7,7 +7,10 @@ const props = defineProps({
7
7
  existingRating: { type: Object, default: null },
8
8
  });
9
9
 
10
- const escDark = inject('esc-dark', computed(() => false));
10
+ const escDark = inject(
11
+ 'esc-dark',
12
+ computed(() => false),
13
+ );
11
14
  const hoveredStar = ref(0);
12
15
  const selectedRating = ref(props.existingRating?.rating || 0);
13
16
  const comment = ref(props.existingRating?.comment || '');
@@ -41,86 +44,135 @@ function leaveStars() {
41
44
  function submit() {
42
45
  if (!selectedRating.value || processing.value || isReadOnly.value) return;
43
46
  processing.value = true;
44
- router.post(props.action, {
45
- rating: selectedRating.value,
46
- comment: comment.value || null,
47
- }, {
48
- preserveScroll: true,
49
- onSuccess: () => {
50
- submitted.value = true;
47
+ router.post(
48
+ props.action,
49
+ {
50
+ rating: selectedRating.value,
51
+ comment: comment.value || null,
51
52
  },
52
- onFinish: () => {
53
- processing.value = false;
53
+ {
54
+ preserveScroll: true,
55
+ onSuccess: () => {
56
+ submitted.value = true;
57
+ },
58
+ onFinish: () => {
59
+ processing.value = false;
60
+ },
54
61
  },
55
- });
62
+ );
56
63
  }
57
64
  </script>
58
65
 
59
66
  <template>
60
- <div :class="['rounded-xl border p-5',
61
- escDark ? 'border-white/[0.06] bg-neutral-900/60' : 'border-gray-200 bg-white']">
62
- <h3 :class="['text-sm font-semibold',
63
- escDark ? 'text-neutral-200' : 'text-gray-900']">
67
+ <div
68
+ :class="[
69
+ 'rounded-xl border p-5',
70
+ escDark ? 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]' : 'border-gray-200 bg-white',
71
+ ]"
72
+ >
73
+ <h3 :class="['text-sm font-semibold', escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-900']">
64
74
  {{ isReadOnly ? 'Customer Rating' : 'How was your experience?' }}
65
75
  </h3>
66
76
 
67
77
  <!-- Stars -->
68
78
  <div class="mt-3 flex items-center gap-1" @mouseleave="leaveStars">
69
- <button v-for="star in 5" :key="star"
70
- @click="selectStar(star)"
71
- @mouseenter="hoverStar(star)"
72
- :disabled="isReadOnly"
73
- :class="['transition-transform', !isReadOnly && 'hover:scale-110', isReadOnly && 'cursor-default']">
79
+ <button
80
+ v-for="star in 5"
81
+ :key="star"
82
+ :disabled="isReadOnly"
83
+ :aria-label="'Rate ' + star + ' star' + (star !== 1 ? 's' : '')"
84
+ :class="['transition-transform', !isReadOnly && 'hover:scale-110', isReadOnly && 'cursor-default']"
85
+ @click="selectStar(star)"
86
+ @mouseenter="hoverStar(star)"
87
+ >
74
88
  <!-- Filled star -->
75
- <svg v-if="star <= displayRating" class="h-7 w-7" viewBox="0 0 24 24" fill="currentColor"
76
- :class="escDark ? 'text-amber-400' : 'text-yellow-400'">
77
- <path d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z" />
89
+ <svg
90
+ v-if="star <= displayRating"
91
+ class="h-7 w-7"
92
+ viewBox="0 0 24 24"
93
+ fill="currentColor"
94
+ :class="escDark ? 'text-amber-400' : 'text-yellow-400'"
95
+ >
96
+ <path
97
+ d="M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z"
98
+ />
78
99
  </svg>
79
100
  <!-- Empty star -->
80
- <svg v-else class="h-7 w-7" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"
81
- :class="escDark ? 'text-neutral-600' : 'text-gray-300'">
82
- <path stroke-linecap="round" stroke-linejoin="round" d="M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z" />
101
+ <svg
102
+ v-else
103
+ class="h-7 w-7"
104
+ fill="none"
105
+ stroke="currentColor"
106
+ stroke-width="1.5"
107
+ viewBox="0 0 24 24"
108
+ :class="escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-300'"
109
+ >
110
+ <path
111
+ stroke-linecap="round"
112
+ stroke-linejoin="round"
113
+ d="M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"
114
+ />
83
115
  </svg>
84
116
  </button>
85
- <span v-if="displayRating > 0"
86
- :class="['ml-2 text-sm font-medium',
87
- escDark ? 'text-neutral-400' : 'text-gray-500']">
117
+ <span
118
+ v-if="displayRating > 0"
119
+ :class="[
120
+ 'ml-2 text-sm font-medium',
121
+ escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-500',
122
+ ]"
123
+ >
88
124
  {{ ratingLabels[displayRating] }}
89
125
  </span>
90
126
  </div>
91
127
 
92
128
  <!-- Comment -->
93
129
  <div v-if="!isReadOnly" class="mt-4">
94
- <textarea v-model="comment" rows="3"
95
- placeholder="Any additional feedback? (optional)"
96
- :class="['w-full rounded-lg border px-3 py-2 text-sm focus:outline-none',
97
- escDark
98
- ? 'border-white/10 bg-neutral-950 text-neutral-200 placeholder-neutral-600 focus:border-white/20 focus:ring-1 focus:ring-white/10'
99
- : 'border-gray-300 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500']">
130
+ <textarea
131
+ v-model="comment"
132
+ rows="3"
133
+ placeholder="Any additional feedback? (optional)"
134
+ :class="[
135
+ 'w-full rounded-lg border px-3 py-2 text-sm focus:outline-none',
136
+ escDark
137
+ ? 'border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-border-input)] focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
138
+ : 'border-gray-300 text-gray-900 placeholder-gray-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500',
139
+ ]"
140
+ >
100
141
  </textarea>
101
142
  </div>
102
143
 
103
144
  <!-- Read-only comment display -->
104
145
  <div v-if="isReadOnly && existingRating.comment" class="mt-3">
105
- <p :class="['text-sm italic', escDark ? 'text-neutral-400' : 'text-gray-600']">
146
+ <p :class="['text-sm italic', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']">
106
147
  "{{ existingRating.comment }}"
107
148
  </p>
108
149
  </div>
109
150
 
110
151
  <!-- Submit -->
111
152
  <div v-if="!isReadOnly" class="mt-3">
112
- <div v-if="submitted"
113
- :class="['rounded-lg px-3 py-2 text-sm font-medium',
114
- escDark ? 'bg-emerald-500/10 text-emerald-400 ring-1 ring-emerald-500/20' : 'bg-green-50 text-green-700']">
153
+ <div
154
+ v-if="submitted"
155
+ :class="[
156
+ 'rounded-lg px-3 py-2 text-sm font-medium',
157
+ escDark
158
+ ? 'bg-emerald-500/10 text-emerald-400 ring-1 ring-emerald-500/20'
159
+ : 'bg-green-50 text-green-700',
160
+ ]"
161
+ >
115
162
  Thank you for your feedback!
116
163
  </div>
117
- <button v-else @click="submit"
118
- :disabled="!selectedRating || processing"
119
- :class="['rounded-lg px-4 py-2 text-sm font-medium text-white transition-all',
120
- escDark
121
- ? 'bg-gradient-to-r from-cyan-500 to-violet-500 hover:from-cyan-400 hover:to-violet-400'
122
- : 'bg-blue-600 hover:bg-blue-700',
123
- (!selectedRating || processing) && 'cursor-not-allowed opacity-40']">
164
+ <button
165
+ v-else
166
+ :disabled="!selectedRating || processing"
167
+ :class="[
168
+ 'rounded-lg px-4 py-2 text-sm font-medium text-white transition-all',
169
+ escDark
170
+ ? 'bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] hover:from-[var(--esc-panel-accent-hover)] hover:to-[var(--esc-panel-accent-secondary-hover)]'
171
+ : 'bg-blue-600 hover:bg-blue-700',
172
+ (!selectedRating || processing) && 'cursor-not-allowed opacity-40',
173
+ ]"
174
+ @click="submit"
175
+ >
124
176
  Submit Rating
125
177
  </button>
126
178
  </div>
@@ -0,0 +1,104 @@
1
+ <script setup>
2
+ import { computed } from 'vue';
3
+
4
+ const props = defineProps({
5
+ modelValue: {
6
+ type: Object,
7
+ default: () => ({
8
+ monday: { start: '09:00', end: '17:00' },
9
+ tuesday: { start: '09:00', end: '17:00' },
10
+ wednesday: { start: '09:00', end: '17:00' },
11
+ thursday: { start: '09:00', end: '17:00' },
12
+ friday: { start: '09:00', end: '17:00' },
13
+ saturday: { start: '', end: '' },
14
+ sunday: { start: '', end: '' },
15
+ }),
16
+ },
17
+ });
18
+
19
+ const emit = defineEmits(['update:modelValue']);
20
+
21
+ const days = [
22
+ { key: 'monday', label: 'Monday' },
23
+ { key: 'tuesday', label: 'Tuesday' },
24
+ { key: 'wednesday', label: 'Wednesday' },
25
+ { key: 'thursday', label: 'Thursday' },
26
+ { key: 'friday', label: 'Friday' },
27
+ { key: 'saturday', label: 'Saturday' },
28
+ { key: 'sunday', label: 'Sunday' },
29
+ ];
30
+
31
+ const timeOptions = computed(() => {
32
+ const options = [];
33
+ for (let h = 0; h < 24; h++) {
34
+ for (let m = 0; m < 60; m += 30) {
35
+ const hh = String(h).padStart(2, '0');
36
+ const mm = String(m).padStart(2, '0');
37
+ options.push(`${hh}:${mm}`);
38
+ }
39
+ }
40
+ options.push('24:00');
41
+ return options;
42
+ });
43
+
44
+ function updateDay(dayKey, field, value) {
45
+ const updated = { ...props.modelValue };
46
+ updated[dayKey] = { ...(updated[dayKey] || { start: '', end: '' }), [field]: value };
47
+ emit('update:modelValue', updated);
48
+ }
49
+
50
+ function toggleDay(dayKey) {
51
+ const updated = { ...props.modelValue };
52
+ const current = updated[dayKey];
53
+ if (current && current.start) {
54
+ updated[dayKey] = { start: '', end: '' };
55
+ } else {
56
+ updated[dayKey] = { start: '09:00', end: '17:00' };
57
+ }
58
+ emit('update:modelValue', updated);
59
+ }
60
+
61
+ function isDayEnabled(dayKey) {
62
+ const day = props.modelValue[dayKey];
63
+ return day && day.start;
64
+ }
65
+ </script>
66
+
67
+ <template>
68
+ <div class="space-y-2">
69
+ <div
70
+ v-for="day in days"
71
+ :key="day.key"
72
+ class="flex items-center gap-3 rounded-lg border border-white/[0.06] bg-neutral-950/50 px-3 py-2"
73
+ >
74
+ <label class="flex w-28 items-center gap-2">
75
+ <input
76
+ type="checkbox"
77
+ :checked="isDayEnabled(day.key)"
78
+ class="rounded border-white/20 bg-neutral-900 text-cyan-500 focus:ring-white/10"
79
+ @change="toggleDay(day.key)"
80
+ />
81
+ <span class="text-sm font-medium text-neutral-300">{{ day.label }}</span>
82
+ </label>
83
+
84
+ <template v-if="isDayEnabled(day.key)">
85
+ <select
86
+ :value="modelValue[day.key]?.start || '09:00'"
87
+ class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
88
+ @change="updateDay(day.key, 'start', $event.target.value)"
89
+ >
90
+ <option v-for="t in timeOptions" :key="'s-' + t" :value="t">{{ t }}</option>
91
+ </select>
92
+ <span class="text-xs text-neutral-500">to</span>
93
+ <select
94
+ :value="modelValue[day.key]?.end || '17:00'"
95
+ class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
96
+ @change="updateDay(day.key, 'end', $event.target.value)"
97
+ >
98
+ <option v-for="t in timeOptions" :key="'e-' + t" :value="t">{{ t }}</option>
99
+ </select>
100
+ </template>
101
+ <span v-else class="text-xs text-neutral-500">Closed</span>
102
+ </div>
103
+ </div>
104
+ </template>
@@ -0,0 +1,165 @@
1
+ <script setup>
2
+ import { ref, inject, computed } from 'vue';
3
+ import { router } from '@inertiajs/vue3';
4
+
5
+ const escDark = inject(
6
+ 'esc-dark',
7
+ computed(() => false),
8
+ );
9
+
10
+ const props = defineProps({
11
+ conversation: { type: Object, required: true },
12
+ ticketReference: { type: String, required: true },
13
+ });
14
+
15
+ const emit = defineEmits(['updated']);
16
+ const replyBody = ref('');
17
+ const submitting = ref(false);
18
+ const expanded = ref(false);
19
+
20
+ function submitReply() {
21
+ if (!replyBody.value.trim() || submitting.value) return;
22
+ submitting.value = true;
23
+
24
+ router.post(
25
+ route('escalated.admin.tickets.side-conversations.reply', [props.ticketReference, props.conversation.id]),
26
+ { body: replyBody.value },
27
+ {
28
+ preserveScroll: true,
29
+ onSuccess: () => {
30
+ replyBody.value = '';
31
+ emit('updated');
32
+ },
33
+ onFinish: () => {
34
+ submitting.value = false;
35
+ },
36
+ },
37
+ );
38
+ }
39
+
40
+ function closeConversation() {
41
+ router.post(
42
+ route('escalated.admin.tickets.side-conversations.close', [props.ticketReference, props.conversation.id]),
43
+ {},
44
+ {
45
+ preserveScroll: true,
46
+ onSuccess: () => emit('updated'),
47
+ },
48
+ );
49
+ }
50
+ </script>
51
+
52
+ <template>
53
+ <div
54
+ :class="[
55
+ 'rounded-lg border p-3',
56
+ escDark ? 'border-white/[0.06] bg-white/[0.02]' : 'border-gray-200 bg-gray-50',
57
+ ]"
58
+ >
59
+ <button
60
+ class="flex w-full items-center justify-between"
61
+ :aria-expanded="expanded"
62
+ @click="expanded = !expanded"
63
+ >
64
+ <div class="flex items-center gap-2">
65
+ <span
66
+ :class="[
67
+ 'inline-flex h-5 items-center rounded px-1.5 text-[10px] font-semibold uppercase',
68
+ conversation.status === 'open'
69
+ ? escDark
70
+ ? 'bg-emerald-500/15 text-emerald-400'
71
+ : 'bg-emerald-100 text-emerald-700'
72
+ : escDark
73
+ ? 'bg-neutral-500/15 text-neutral-400'
74
+ : 'bg-gray-100 text-gray-500',
75
+ ]"
76
+ >
77
+ {{ conversation.status }}
78
+ </span>
79
+ <span :class="['text-sm font-medium', escDark ? 'text-neutral-200' : 'text-gray-900']">
80
+ {{ conversation.subject }}
81
+ </span>
82
+ <span :class="['text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']">
83
+ {{ conversation.channel }}
84
+ </span>
85
+ </div>
86
+ <svg
87
+ :class="[
88
+ 'h-4 w-4 transition-transform',
89
+ escDark ? 'text-neutral-500' : 'text-gray-400',
90
+ expanded && 'rotate-180',
91
+ ]"
92
+ fill="none"
93
+ stroke="currentColor"
94
+ stroke-width="1.5"
95
+ viewBox="0 0 24 24"
96
+ >
97
+ <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
98
+ </svg>
99
+ </button>
100
+
101
+ <div v-if="expanded" class="mt-3 space-y-3">
102
+ <!-- Replies -->
103
+ <div
104
+ v-for="reply in conversation.replies"
105
+ :key="reply.id"
106
+ :class="['border-l-2 pl-3', escDark ? 'border-white/[0.06]' : 'border-gray-200']"
107
+ >
108
+ <div class="flex items-center gap-2">
109
+ <span :class="['text-xs font-medium', escDark ? 'text-neutral-300' : 'text-gray-700']">
110
+ {{ reply.author?.name || 'System' }}
111
+ </span>
112
+ <span :class="['text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']">
113
+ {{ reply.created_at }}
114
+ </span>
115
+ </div>
116
+ <p :class="['mt-1 whitespace-pre-wrap text-sm', escDark ? 'text-neutral-400' : 'text-gray-600']">
117
+ {{ reply.body }}
118
+ </p>
119
+ </div>
120
+
121
+ <div
122
+ v-if="!conversation.replies?.length"
123
+ :class="['text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
124
+ >
125
+ No replies yet.
126
+ </div>
127
+
128
+ <!-- Reply form -->
129
+ <div v-if="conversation.status === 'open'" class="pt-2">
130
+ <textarea
131
+ v-model="replyBody"
132
+ rows="2"
133
+ placeholder="Write a reply..."
134
+ :class="[
135
+ 'w-full rounded-lg border px-3 py-2 text-sm focus:outline-none focus:ring-1',
136
+ escDark
137
+ ? 'border-white/10 bg-neutral-950 text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:ring-white/10'
138
+ : 'border-gray-300 bg-white text-gray-900 placeholder-gray-400 focus:border-blue-400 focus:ring-blue-200',
139
+ ]"
140
+ ></textarea>
141
+ <div class="mt-2 flex items-center gap-2">
142
+ <button
143
+ :disabled="!replyBody.trim() || submitting"
144
+ :class="[
145
+ 'rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-3 py-1.5 text-xs font-medium text-white transition-all hover:from-cyan-400 hover:to-violet-400',
146
+ (!replyBody.trim() || submitting) && 'cursor-not-allowed opacity-40',
147
+ ]"
148
+ @click="submitReply"
149
+ >
150
+ Reply
151
+ </button>
152
+ <button
153
+ :class="[
154
+ 'rounded-lg px-3 py-1.5 text-xs',
155
+ escDark ? 'text-neutral-400 hover:text-neutral-300' : 'text-gray-500 hover:text-gray-700',
156
+ ]"
157
+ @click="closeConversation"
158
+ >
159
+ Close
160
+ </button>
161
+ </div>
162
+ </div>
163
+ </div>
164
+ </div>
165
+ </template>