@escalated-dev/escalated 0.7.0 → 0.8.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 (181) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +36 -1
  3. package/package.json +16 -7
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -55
  6. package/src/components/ActivityTimeline.vue +83 -83
  7. package/src/components/AdminDashboard.stories.js +1423 -1095
  8. package/src/components/AgentLoadIndicator.stories.js +37 -37
  9. package/src/components/AgentLoadIndicator.vue +49 -49
  10. package/src/components/AgentPerformanceCard.vue +44 -44
  11. package/src/components/ArticleEditor.vue +82 -82
  12. package/src/components/AssigneeSelect.vue +37 -37
  13. package/src/components/AttachmentList.vue +13 -1
  14. package/src/components/AuditLogEntry.vue +95 -95
  15. package/src/components/BulkActionBar.vue +166 -166
  16. package/src/components/CategoryTree.vue +89 -89
  17. package/src/components/ChartWidget.vue +46 -46
  18. package/src/components/ChatActionBar.vue +226 -0
  19. package/src/components/ChatBubble.vue +162 -0
  20. package/src/components/ChatComposer.vue +308 -0
  21. package/src/components/ChatQueue.vue +222 -0
  22. package/src/components/ChatThread.vue +197 -0
  23. package/src/components/CollisionWarning.stories.js +30 -30
  24. package/src/components/CollisionWarning.vue +68 -68
  25. package/src/components/ConditionalFieldRules.vue +135 -135
  26. package/src/components/ContextPanel.vue +66 -66
  27. package/src/components/ContextPanelSection.vue +65 -65
  28. package/src/components/CustomFieldRenderer.vue +159 -159
  29. package/src/components/EscalatedLayout.vue +35 -6
  30. package/src/components/FileDropzone.vue +57 -57
  31. package/src/components/FollowButton.stories.js +30 -30
  32. package/src/components/FollowButton.vue +88 -88
  33. package/src/components/KeyboardShortcutHelp.vue +213 -213
  34. package/src/components/KnowledgePanel.vue +122 -122
  35. package/src/components/KpiCard.stories.js +32 -32
  36. package/src/components/KpiCard.vue +88 -88
  37. package/src/components/MacroDropdown.vue +150 -150
  38. package/src/components/MentionDropdown.vue +154 -0
  39. package/src/components/MetricComparison.vue +89 -0
  40. package/src/components/PercentileChart.vue +67 -0
  41. package/src/components/PeriodSelector.vue +98 -0
  42. package/src/components/PermissionMatrix.vue +107 -107
  43. package/src/components/PinnedNotes.vue +129 -129
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +46 -2
  46. package/src/components/PriorityBadge.stories.js +33 -33
  47. package/src/components/PriorityBadge.vue +46 -46
  48. package/src/components/ReplyComposer.vue +81 -18
  49. package/src/components/ReplyThread.vue +40 -2
  50. package/src/components/ReportChart.vue +395 -0
  51. package/src/components/ReportExportButton.vue +108 -0
  52. package/src/components/SatisfactionRating.vue +180 -180
  53. package/src/components/SaveViewDialog.vue +172 -0
  54. package/src/components/SavedViewSidebar.vue +208 -0
  55. package/src/components/ScheduleEditor.vue +104 -104
  56. package/src/components/SideConversation.vue +165 -165
  57. package/src/components/SideConversationList.vue +147 -147
  58. package/src/components/SkillTagManager.vue +83 -79
  59. package/src/components/SlaComplianceChart.vue +46 -53
  60. package/src/components/SlaTimer.stories.js +35 -35
  61. package/src/components/SlaTimer.vue +62 -62
  62. package/src/components/SnoozeButton.vue +247 -0
  63. package/src/components/StatsCard.stories.js +24 -24
  64. package/src/components/StatsCard.vue +58 -58
  65. package/src/components/StatusBadge.stories.js +53 -53
  66. package/src/components/StatusBadge.vue +78 -78
  67. package/src/components/TagSelect.vue +84 -84
  68. package/src/components/TicketFilters.vue +270 -225
  69. package/src/components/TicketLinkPanel.vue +193 -193
  70. package/src/components/TicketList.vue +655 -594
  71. package/src/components/TicketMergeDialog.vue +157 -157
  72. package/src/components/TicketSplitDialog.vue +98 -0
  73. package/src/components/TotpInput.stories.js +9 -9
  74. package/src/components/TotpInput.vue +81 -81
  75. package/src/components/TwoFactorSetup.vue +113 -113
  76. package/src/components/VariableTokenInput.vue +111 -0
  77. package/src/components/WorkflowActionConfig.vue +287 -0
  78. package/src/components/WorkflowActionList.vue +350 -0
  79. package/src/components/WorkflowConditionBuilder.vue +265 -0
  80. package/src/components/WorkflowTriggerSelector.vue +125 -0
  81. package/src/composables/useChat.js +187 -0
  82. package/src/composables/useI18n.js +30 -8
  83. package/src/composables/useKeyboardShortcuts.js +46 -46
  84. package/src/composables/useMentions.js +134 -0
  85. package/src/composables/usePluginExtensions.js +159 -159
  86. package/src/composables/usePluginHooks.js +65 -65
  87. package/src/composables/useRealtime.js +182 -0
  88. package/src/defineEscalatedPlugin.js +76 -76
  89. package/src/index.js +84 -72
  90. package/src/locales/README.md +13 -0
  91. package/src/locales/ar.json +727 -0
  92. package/src/locales/de.json +678 -430
  93. package/src/locales/en.json +717 -455
  94. package/src/locales/es.json +679 -430
  95. package/src/locales/fr.json +680 -431
  96. package/src/locales/index.js +12 -2
  97. package/src/locales/it.json +727 -0
  98. package/src/locales/ja.json +727 -0
  99. package/src/locales/ko.json +727 -0
  100. package/src/locales/nl.json +727 -0
  101. package/src/locales/pl.json +727 -0
  102. package/src/locales/pt-BR.json +727 -0
  103. package/src/locales/ru.json +727 -0
  104. package/src/locales/tr.json +727 -0
  105. package/src/locales/zh-CN.json +727 -0
  106. package/src/pages/Admin/ApiTokens/Index.vue +381 -381
  107. package/src/pages/Admin/AuditLog/Index.vue +154 -154
  108. package/src/pages/Admin/BusinessHours/Form.vue +172 -172
  109. package/src/pages/Admin/BusinessHours/Index.vue +113 -113
  110. package/src/pages/Admin/CannedResponses/Index.vue +127 -127
  111. package/src/pages/Admin/Capacity/Index.vue +134 -134
  112. package/src/pages/Admin/CustomFields/Form.vue +195 -195
  113. package/src/pages/Admin/CustomFields/Index.vue +134 -134
  114. package/src/pages/Admin/CustomObjects/Form.vue +202 -202
  115. package/src/pages/Admin/CustomObjects/Index.vue +127 -127
  116. package/src/pages/Admin/CustomObjects/Records.vue +228 -228
  117. package/src/pages/Admin/Departments/Form.vue +75 -75
  118. package/src/pages/Admin/Departments/Index.vue +110 -109
  119. package/src/pages/Admin/EscalationRules/Form.vue +157 -157
  120. package/src/pages/Admin/EscalationRules/Index.vue +178 -178
  121. package/src/pages/Admin/Import/Connect.vue +0 -1
  122. package/src/pages/Admin/Import/Index.vue +1 -1
  123. package/src/pages/Admin/Import/Progress.vue +1 -1
  124. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
  125. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
  126. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
  127. package/src/pages/Admin/Macros/Index.vue +448 -448
  128. package/src/pages/Admin/Plugins/Index.vue +327 -327
  129. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  130. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
  131. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  132. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  133. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  134. package/src/pages/Admin/Reports/CsatReport.vue +127 -127
  135. package/src/pages/Admin/Reports/Dashboard.vue +36 -21
  136. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  137. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  138. package/src/pages/Admin/Reports/SlaReport.vue +162 -166
  139. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  140. package/src/pages/Admin/Reports.vue +206 -206
  141. package/src/pages/Admin/Roles/Form.vue +71 -71
  142. package/src/pages/Admin/Roles/Index.vue +122 -122
  143. package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
  144. package/src/pages/Admin/Settings/DataRetention.vue +182 -182
  145. package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
  146. package/src/pages/Admin/Settings/Sandbox.vue +135 -135
  147. package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
  148. package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
  149. package/src/pages/Admin/Settings.vue +1008 -468
  150. package/src/pages/Admin/Skills/Form.vue +193 -53
  151. package/src/pages/Admin/Skills/Index.vue +105 -94
  152. package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
  153. package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
  154. package/src/pages/Admin/Statuses/Form.vue +114 -114
  155. package/src/pages/Admin/Statuses/Index.vue +153 -153
  156. package/src/pages/Admin/Tags/Index.vue +191 -191
  157. package/src/pages/Admin/Tickets/Index.vue +126 -91
  158. package/src/pages/Admin/Tickets/Show.vue +29 -0
  159. package/src/pages/Admin/Users/Index.vue +145 -0
  160. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
  161. package/src/pages/Admin/Webhooks/Form.vue +110 -110
  162. package/src/pages/Admin/Webhooks/Index.vue +136 -136
  163. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  164. package/src/pages/Admin/Workflows/Index.vue +235 -0
  165. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  166. package/src/pages/Agent/TicketIndex.vue +112 -88
  167. package/src/pages/Agent/TicketShow.vue +192 -60
  168. package/src/pages/Customer/Create.vue +1 -1
  169. package/src/pages/Customer/Index.vue +26 -1
  170. package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
  171. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
  172. package/src/pages/Customer/Show.vue +69 -63
  173. package/src/pages/Guest/Create.vue +40 -15
  174. package/src/pages/Guest/Show.vue +124 -93
  175. package/src/plugin.js +26 -1
  176. package/src/utils/mentionHighlight.js +24 -0
  177. package/src/utils/sanitizeHtml.js +78 -64
  178. package/src/widget/EscalatedWidget.vue +804 -0
  179. package/src/widget/index.js +254 -0
  180. package/src/pages/Admin/Automations/Form.vue +0 -184
  181. package/src/pages/Admin/Automations/Index.vue +0 -129
@@ -0,0 +1,180 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import ReportChart from '../../../components/ReportChart.vue';
4
+ import PeriodSelector from '../../../components/PeriodSelector.vue';
5
+ import ReportExportButton from '../../../components/ReportExportButton.vue';
6
+ import { router, Link } from '@inertiajs/vue3';
7
+ import { ref, computed } from 'vue';
8
+
9
+ const props = defineProps({
10
+ period_days: { type: Number, default: 30 },
11
+ by_tag: { type: Array, default: () => [] },
12
+ by_department: { type: Array, default: () => [] },
13
+ by_channel: { type: Array, default: () => [] },
14
+ by_type: { type: Array, default: () => [] },
15
+ by_priority: { type: Array, default: () => [] },
16
+ });
17
+
18
+ const periodDays = ref(props.period_days);
19
+ const activeTab = ref('department');
20
+ const sortColumn = ref('volume');
21
+ const sortDir = ref('desc');
22
+
23
+ const tabs = [
24
+ { key: 'department', label: 'By Department' },
25
+ { key: 'tag', label: 'By Tag' },
26
+ { key: 'channel', label: 'By Channel' },
27
+ { key: 'type', label: 'By Type' },
28
+ { key: 'priority', label: 'By Priority' },
29
+ ];
30
+
31
+ function changePeriod(days) {
32
+ periodDays.value = days;
33
+ router.get(route('escalated.admin.reports.cohorts'), { days }, { preserveState: true });
34
+ }
35
+
36
+ const activeCohortData = computed(() => {
37
+ const map = {
38
+ tag: props.by_tag,
39
+ department: props.by_department,
40
+ channel: props.by_channel,
41
+ type: props.by_type,
42
+ priority: props.by_priority,
43
+ };
44
+ return map[activeTab.value] || [];
45
+ });
46
+
47
+ const sortedCohorts = computed(() => {
48
+ const data = [...activeCohortData.value];
49
+ data.sort((a, b) => {
50
+ const aVal = a[sortColumn.value] ?? 0;
51
+ const bVal = b[sortColumn.value] ?? 0;
52
+ return sortDir.value === 'asc' ? aVal - bVal : bVal - aVal;
53
+ });
54
+ return data;
55
+ });
56
+
57
+ const chartData = computed(() => {
58
+ return activeCohortData.value.map((c) => ({
59
+ label: c.name || c.label,
60
+ value: c.volume || 0,
61
+ }));
62
+ });
63
+
64
+ function toggleSort(col) {
65
+ if (sortColumn.value === col) {
66
+ sortDir.value = sortDir.value === 'asc' ? 'desc' : 'asc';
67
+ } else {
68
+ sortColumn.value = col;
69
+ sortDir.value = 'desc';
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <template>
75
+ <EscalatedLayout title="Cohort Analysis">
76
+ <div class="mb-6 flex items-center justify-between">
77
+ <PeriodSelector :model-value="periodDays" @update:model-value="changePeriod" />
78
+ <div class="flex items-center gap-3">
79
+ <ReportExportButton report-name="cohorts" :period-days="periodDays" />
80
+ <Link
81
+ :href="route('escalated.admin.reports')"
82
+ class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
83
+ >
84
+ &larr; Back
85
+ </Link>
86
+ </div>
87
+ </div>
88
+
89
+ <!-- Tab Selector -->
90
+ <div class="mb-6 flex gap-1 rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] p-1">
91
+ <button
92
+ v-for="tab in tabs"
93
+ :key="tab.key"
94
+ :class="[
95
+ 'rounded-md px-4 py-2 text-sm font-medium transition-all',
96
+ activeTab === tab.key
97
+ ? 'bg-[var(--esc-panel-active)] text-[var(--esc-panel-text)]'
98
+ : 'text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]',
99
+ ]"
100
+ @click="activeTab = tab.key"
101
+ >
102
+ {{ tab.label }}
103
+ </button>
104
+ </div>
105
+
106
+ <!-- Chart -->
107
+ <div class="mb-6">
108
+ <ReportChart
109
+ type="bar"
110
+ :title="`Volume ${tabs.find((t) => t.key === activeTab)?.label || ''}`"
111
+ :data="chartData"
112
+ :colors="['#8b5cf6', '#06b6d4', '#f59e0b', '#10b981', '#ef4444']"
113
+ />
114
+ </div>
115
+
116
+ <!-- Cohort Table -->
117
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)]">
118
+ <table class="w-full">
119
+ <thead>
120
+ <tr class="border-b border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)]">
121
+ <th
122
+ class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
123
+ >
124
+ Name
125
+ </th>
126
+ <th
127
+ v-for="col in [
128
+ { key: 'volume', label: 'Volume' },
129
+ { key: 'avg_resolution', label: 'Avg Resolution' },
130
+ { key: 'breach_rate', label: 'Breach Rate' },
131
+ { key: 'csat', label: 'CSAT' },
132
+ ]"
133
+ :key="col.key"
134
+ class="cursor-pointer px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
135
+ @click="toggleSort(col.key)"
136
+ >
137
+ {{ col.label }}
138
+ <span v-if="sortColumn === col.key">{{ sortDir === 'asc' ? ' &#9650;' : ' &#9660;' }}</span>
139
+ </th>
140
+ </tr>
141
+ </thead>
142
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
143
+ <tr
144
+ v-for="cohort in sortedCohorts"
145
+ :key="cohort.name || cohort.label"
146
+ class="hover:bg-[var(--esc-panel-hover)]"
147
+ >
148
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
149
+ {{ cohort.name || cohort.label }}
150
+ </td>
151
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
152
+ {{ cohort.volume ?? 0 }}
153
+ </td>
154
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
155
+ {{ cohort.avg_resolution ?? '—' }}h
156
+ </td>
157
+ <td
158
+ class="px-4 py-3 text-sm"
159
+ :class="
160
+ (cohort.breach_rate ?? 0) > 20
161
+ ? 'text-red-400'
162
+ : 'text-[var(--esc-panel-text-tertiary)]'
163
+ "
164
+ >
165
+ {{ cohort.breach_rate ?? '—' }}%
166
+ </td>
167
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
168
+ {{ cohort.csat ?? '—' }}
169
+ </td>
170
+ </tr>
171
+ <tr v-if="!sortedCohorts.length">
172
+ <td colspan="5" class="px-4 py-8 text-center text-sm text-[var(--esc-panel-text-muted)]">
173
+ No data for this cohort type.
174
+ </td>
175
+ </tr>
176
+ </tbody>
177
+ </table>
178
+ </div>
179
+ </EscalatedLayout>
180
+ </template>
@@ -0,0 +1,141 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import MetricComparison from '../../../components/MetricComparison.vue';
4
+ import ReportChart from '../../../components/ReportChart.vue';
5
+ import PeriodSelector from '../../../components/PeriodSelector.vue';
6
+ import ReportExportButton from '../../../components/ReportExportButton.vue';
7
+ import { router, Link } from '@inertiajs/vue3';
8
+ import { ref, computed } from 'vue';
9
+
10
+ const props = defineProps({
11
+ period_days: { type: Number, default: 30 },
12
+ current: {
13
+ type: Object,
14
+ default: () => ({
15
+ total_tickets: 0,
16
+ resolved_tickets: 0,
17
+ avg_frt: 0,
18
+ avg_resolution: 0,
19
+ sla_compliance: 0,
20
+ csat: 0,
21
+ breach_count: 0,
22
+ volume_trend: [],
23
+ }),
24
+ },
25
+ previous: {
26
+ type: Object,
27
+ default: () => ({
28
+ total_tickets: 0,
29
+ resolved_tickets: 0,
30
+ avg_frt: 0,
31
+ avg_resolution: 0,
32
+ sla_compliance: 0,
33
+ csat: 0,
34
+ breach_count: 0,
35
+ volume_trend: [],
36
+ }),
37
+ },
38
+ });
39
+
40
+ const periodDays = ref(props.period_days);
41
+
42
+ function changePeriod(days) {
43
+ periodDays.value = days;
44
+ router.get(route('escalated.admin.reports.comparison'), { days }, { preserveState: true });
45
+ }
46
+
47
+ const overlayCurrentData = computed(() => {
48
+ return (props.current?.volume_trend || []).map((d) => ({
49
+ ...d,
50
+ label: d.label || d.date,
51
+ }));
52
+ });
53
+
54
+ const overlayPreviousData = computed(() => {
55
+ return (props.previous?.volume_trend || []).map((d) => ({
56
+ ...d,
57
+ label: d.label || d.date,
58
+ }));
59
+ });
60
+ </script>
61
+
62
+ <template>
63
+ <EscalatedLayout title="Period Comparison">
64
+ <div class="mb-6 flex items-center justify-between">
65
+ <PeriodSelector :model-value="periodDays" @update:model-value="changePeriod" />
66
+ <div class="flex items-center gap-3">
67
+ <ReportExportButton report-name="comparison" :period-days="periodDays" />
68
+ <Link
69
+ :href="route('escalated.admin.reports')"
70
+ class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
71
+ >
72
+ &larr; Back
73
+ </Link>
74
+ </div>
75
+ </div>
76
+
77
+ <!-- Period Labels -->
78
+ <div class="mb-6 flex items-center gap-4">
79
+ <div class="flex items-center gap-2">
80
+ <span class="inline-block h-3 w-3 rounded-full bg-cyan-500"></span>
81
+ <span class="text-sm font-medium text-[var(--esc-panel-text-secondary)]"
82
+ >Current Period ({{ periodDays }}d)</span
83
+ >
84
+ </div>
85
+ <div class="flex items-center gap-2">
86
+ <span class="inline-block h-3 w-3 rounded-full bg-[var(--esc-panel-text-muted)]"></span>
87
+ <span class="text-sm font-medium text-[var(--esc-panel-text-muted)]">Previous Period</span>
88
+ </div>
89
+ </div>
90
+
91
+ <!-- Comparison Metrics -->
92
+ <div class="mb-6 grid grid-cols-2 gap-4 md:grid-cols-4">
93
+ <MetricComparison
94
+ label="Total Tickets"
95
+ :value="current?.total_tickets ?? 0"
96
+ :previous-value="previous?.total_tickets"
97
+ />
98
+ <MetricComparison
99
+ label="Resolved"
100
+ :value="current?.resolved_tickets ?? 0"
101
+ :previous-value="previous?.resolved_tickets"
102
+ />
103
+ <MetricComparison
104
+ label="Avg FRT"
105
+ :value="current?.avg_frt ?? 0"
106
+ :previous-value="previous?.avg_frt"
107
+ format="h"
108
+ :invert-color="true"
109
+ />
110
+ <MetricComparison
111
+ label="Avg Resolution"
112
+ :value="current?.avg_resolution ?? 0"
113
+ :previous-value="previous?.avg_resolution"
114
+ format="h"
115
+ :invert-color="true"
116
+ />
117
+ </div>
118
+
119
+ <div class="mb-6 grid grid-cols-2 gap-4 md:grid-cols-3">
120
+ <MetricComparison
121
+ label="SLA Compliance"
122
+ :value="current?.sla_compliance ?? 0"
123
+ :previous-value="previous?.sla_compliance"
124
+ format="%"
125
+ />
126
+ <MetricComparison label="CSAT" :value="current?.csat ?? 0" :previous-value="previous?.csat" />
127
+ <MetricComparison
128
+ label="SLA Breaches"
129
+ :value="current?.breach_count ?? 0"
130
+ :previous-value="previous?.breach_count"
131
+ :invert-color="true"
132
+ />
133
+ </div>
134
+
135
+ <!-- Volume Overlay -->
136
+ <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
137
+ <ReportChart type="line" title="Current Period Volume" :data="overlayCurrentData" :colors="['#06b6d4']" />
138
+ <ReportChart type="line" title="Previous Period Volume" :data="overlayPreviousData" :colors="['#6b7280']" />
139
+ </div>
140
+ </EscalatedLayout>
141
+ </template>
@@ -1,127 +1,127 @@
1
- <script setup>
2
- import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
- import KpiCard from '../../../components/KpiCard.vue';
4
- import ChartWidget from '../../../components/ChartWidget.vue';
5
- import { router, Link } from '@inertiajs/vue3';
6
-
7
- const props = defineProps({
8
- period_days: Number,
9
- csat_average: Number,
10
- response_rate: Number,
11
- total_ratings: Number,
12
- by_agent: Array,
13
- over_time: Array,
14
- });
15
-
16
- function changePeriod(days) {
17
- router.get(route('escalated.admin.reports.csat'), { days }, { preserveState: true });
18
- }
19
- </script>
20
-
21
- <template>
22
- <EscalatedLayout title="Customer Satisfaction Report">
23
- <div class="mb-6 flex items-center justify-between">
24
- <div class="flex gap-2">
25
- <button
26
- v-for="d in [7, 30, 90]"
27
- :key="d"
28
- :class="[
29
- 'rounded-lg px-3.5 py-1.5 text-sm font-medium transition-all',
30
- period_days === d
31
- ? 'bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] text-white shadow-lg shadow-[var(--esc-panel-bg)]/20'
32
- : 'border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] text-[var(--esc-panel-text-tertiary)] hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]',
33
- ]"
34
- @click="changePeriod(d)"
35
- >
36
- Last {{ d }} days
37
- </button>
38
- </div>
39
- <div class="flex items-center gap-3">
40
- <Link
41
- :href="route('escalated.admin.settings.csat')"
42
- class="text-sm text-[var(--esc-panel-accent)] hover:text-[var(--esc-panel-accent)]"
43
- >
44
- CSAT Settings
45
- </Link>
46
- <Link
47
- :href="route('escalated.admin.reports')"
48
- class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
49
- >
50
- &larr; Back to Reports
51
- </Link>
52
- </div>
53
- </div>
54
-
55
- <!-- KPIs -->
56
- <div class="mb-6 grid grid-cols-1 gap-4 md:grid-cols-3">
57
- <KpiCard
58
- label="Average Rating"
59
- :value="csat_average || '—'"
60
- :icon="'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'"
61
- />
62
- <KpiCard
63
- label="Response Rate"
64
- :value="`${response_rate}%`"
65
- :icon="'M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z'"
66
- />
67
- <KpiCard
68
- label="Total Ratings"
69
- :value="total_ratings"
70
- :icon="'M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z'"
71
- />
72
- </div>
73
-
74
- <!-- Charts -->
75
- <div class="mb-8 grid grid-cols-1 gap-6 md:grid-cols-2">
76
- <ChartWidget title="CSAT Over Time" :data="over_time" color="amber" />
77
-
78
- <!-- By Agent -->
79
- <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
80
- <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">Ratings by Agent</h3>
81
- <div v-if="by_agent?.length" class="space-y-3">
82
- <div v-for="agent in by_agent" :key="agent.agent_id" class="flex items-center justify-between">
83
- <div class="flex items-center gap-3">
84
- <div
85
- class="flex h-8 w-8 items-center justify-center rounded-md bg-[var(--esc-panel-hover)] text-xs font-semibold text-[var(--esc-panel-text-tertiary)]"
86
- >
87
- {{ agent.agent_name?.charAt(0)?.toUpperCase() || '?' }}
88
- </div>
89
- <div>
90
- <div class="text-sm font-medium text-[var(--esc-panel-text-secondary)]">
91
- {{ agent.agent_name }}
92
- </div>
93
- <div class="text-xs text-[var(--esc-panel-text-muted)]">
94
- {{ agent.total_ratings }} ratings
95
- </div>
96
- </div>
97
- </div>
98
- <div class="flex items-center gap-2">
99
- <div class="flex items-center gap-0.5">
100
- <svg
101
- v-for="n in 5"
102
- :key="n"
103
- class="h-3.5 w-3.5"
104
- :class="
105
- n <= Math.round(agent.avg_rating)
106
- ? 'text-amber-400'
107
- : 'text-[var(--esc-panel-text-muted)]'
108
- "
109
- fill="currentColor"
110
- viewBox="0 0 20 20"
111
- >
112
- <path
113
- d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
114
- />
115
- </svg>
116
- </div>
117
- <span class="text-sm font-bold text-[var(--esc-panel-text)]">{{ agent.avg_rating }}</span>
118
- </div>
119
- </div>
120
- </div>
121
- <div v-else class="py-6 text-center text-sm text-[var(--esc-panel-text-muted)]">
122
- No agent ratings for this period.
123
- </div>
124
- </div>
125
- </div>
126
- </EscalatedLayout>
127
- </template>
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import KpiCard from '../../../components/KpiCard.vue';
4
+ import ChartWidget from '../../../components/ChartWidget.vue';
5
+ import { router, Link } from '@inertiajs/vue3';
6
+
7
+ defineProps({
8
+ period_days: Number,
9
+ csat_average: Number,
10
+ response_rate: Number,
11
+ total_ratings: Number,
12
+ by_agent: Array,
13
+ over_time: Array,
14
+ });
15
+
16
+ function changePeriod(days) {
17
+ router.get(route('escalated.admin.reports.csat'), { days }, { preserveState: true });
18
+ }
19
+ </script>
20
+
21
+ <template>
22
+ <EscalatedLayout title="Customer Satisfaction Report">
23
+ <div class="mb-6 flex items-center justify-between">
24
+ <div class="flex gap-2">
25
+ <button
26
+ v-for="d in [7, 30, 90]"
27
+ :key="d"
28
+ :class="[
29
+ 'rounded-lg px-3.5 py-1.5 text-sm font-medium transition-all',
30
+ period_days === d
31
+ ? 'bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] text-white shadow-lg shadow-[var(--esc-panel-bg)]/20'
32
+ : 'border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] text-[var(--esc-panel-text-tertiary)] hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]',
33
+ ]"
34
+ @click="changePeriod(d)"
35
+ >
36
+ Last {{ d }} days
37
+ </button>
38
+ </div>
39
+ <div class="flex items-center gap-3">
40
+ <Link
41
+ :href="route('escalated.admin.settings.csat')"
42
+ class="text-sm text-[var(--esc-panel-accent)] hover:text-[var(--esc-panel-accent)]"
43
+ >
44
+ CSAT Settings
45
+ </Link>
46
+ <Link
47
+ :href="route('escalated.admin.reports')"
48
+ class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
49
+ >
50
+ &larr; Back to Reports
51
+ </Link>
52
+ </div>
53
+ </div>
54
+
55
+ <!-- KPIs -->
56
+ <div class="mb-6 grid grid-cols-1 gap-4 md:grid-cols-3">
57
+ <KpiCard
58
+ label="Average Rating"
59
+ :value="csat_average || '—'"
60
+ :icon="'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'"
61
+ />
62
+ <KpiCard
63
+ label="Response Rate"
64
+ :value="`${response_rate}%`"
65
+ :icon="'M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 01.865-.501 48.172 48.172 0 003.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0012 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018z'"
66
+ />
67
+ <KpiCard
68
+ label="Total Ratings"
69
+ :value="total_ratings"
70
+ :icon="'M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z'"
71
+ />
72
+ </div>
73
+
74
+ <!-- Charts -->
75
+ <div class="mb-8 grid grid-cols-1 gap-6 md:grid-cols-2">
76
+ <ChartWidget title="CSAT Over Time" :data="over_time" color="amber" />
77
+
78
+ <!-- By Agent -->
79
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
80
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">Ratings by Agent</h3>
81
+ <div v-if="by_agent?.length" class="space-y-3">
82
+ <div v-for="agent in by_agent" :key="agent.agent_id" class="flex items-center justify-between">
83
+ <div class="flex items-center gap-3">
84
+ <div
85
+ class="flex h-8 w-8 items-center justify-center rounded-md bg-[var(--esc-panel-hover)] text-xs font-semibold text-[var(--esc-panel-text-tertiary)]"
86
+ >
87
+ {{ agent.agent_name?.charAt(0)?.toUpperCase() || '?' }}
88
+ </div>
89
+ <div>
90
+ <div class="text-sm font-medium text-[var(--esc-panel-text-secondary)]">
91
+ {{ agent.agent_name }}
92
+ </div>
93
+ <div class="text-xs text-[var(--esc-panel-text-muted)]">
94
+ {{ agent.total_ratings }} ratings
95
+ </div>
96
+ </div>
97
+ </div>
98
+ <div class="flex items-center gap-2">
99
+ <div class="flex items-center gap-0.5">
100
+ <svg
101
+ v-for="n in 5"
102
+ :key="n"
103
+ class="h-3.5 w-3.5"
104
+ :class="
105
+ n <= Math.round(agent.avg_rating)
106
+ ? 'text-amber-400'
107
+ : 'text-[var(--esc-panel-text-muted)]'
108
+ "
109
+ fill="currentColor"
110
+ viewBox="0 0 20 20"
111
+ >
112
+ <path
113
+ d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"
114
+ />
115
+ </svg>
116
+ </div>
117
+ <span class="text-sm font-bold text-[var(--esc-panel-text)]">{{ agent.avg_rating }}</span>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ <div v-else class="py-6 text-center text-sm text-[var(--esc-panel-text-muted)]">
122
+ No agent ratings for this period.
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </EscalatedLayout>
127
+ </template>