@escalated-dev/escalated 0.8.0 → 0.11.1

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 (124) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +388 -361
  3. package/package.json +85 -84
  4. package/src/components/ActiveChatsPanel.vue +246 -246
  5. package/src/components/AdminDashboard.stories.js +1423 -1423
  6. package/src/components/AttachmentList.vue +65 -65
  7. package/src/components/ChatActionBar.vue +226 -226
  8. package/src/components/ChatBubble.vue +162 -162
  9. package/src/components/ChatComposer.vue +308 -308
  10. package/src/components/ChatQueue.vue +222 -222
  11. package/src/components/ChatThread.vue +197 -197
  12. package/src/components/CustomTicketActions.stories.js +71 -0
  13. package/src/components/CustomTicketActions.vue +101 -0
  14. package/src/components/EscalatedLayout.vue +628 -604
  15. package/src/components/FollowButton.vue +20 -1
  16. package/src/components/MentionDropdown.vue +154 -154
  17. package/src/components/MetricComparison.vue +89 -89
  18. package/src/components/PercentileChart.vue +67 -67
  19. package/src/components/PeriodSelector.vue +98 -98
  20. package/src/components/PresenceIndicator.vue +228 -213
  21. package/src/components/ReplyComposer.vue +336 -336
  22. package/src/components/ReplyThread.vue +153 -153
  23. package/src/components/ReportChart.vue +395 -395
  24. package/src/components/ReportExportButton.vue +108 -108
  25. package/src/components/SaveViewDialog.vue +172 -172
  26. package/src/components/SavedViewSidebar.vue +208 -208
  27. package/src/components/SkillTagManager.vue +3 -0
  28. package/src/components/SnoozeButton.vue +247 -247
  29. package/src/components/TicketFilters.vue +270 -270
  30. package/src/components/TicketList.vue +655 -655
  31. package/src/components/TicketSidebar.vue +4 -0
  32. package/src/components/TicketSplitDialog.vue +98 -98
  33. package/src/components/TicketSubjects.stories.js +63 -0
  34. package/src/components/TicketSubjects.vue +107 -0
  35. package/src/components/TwoFactorSetup.vue +1 -37
  36. package/src/components/VariableTokenInput.vue +111 -111
  37. package/src/components/WorkflowActionConfig.vue +287 -287
  38. package/src/components/WorkflowActionList.vue +350 -350
  39. package/src/components/WorkflowConditionBuilder.vue +265 -265
  40. package/src/components/WorkflowTriggerSelector.vue +125 -125
  41. package/src/components/admin/newsletters/AnalyticsTiles.stories.js +14 -0
  42. package/src/components/admin/newsletters/AnalyticsTiles.vue +55 -0
  43. package/src/components/admin/newsletters/DeliveriesTable.stories.js +28 -0
  44. package/src/components/admin/newsletters/DeliveriesTable.vue +104 -0
  45. package/src/components/admin/newsletters/DynamicFilterBuilder.stories.js +11 -0
  46. package/src/components/admin/newsletters/DynamicFilterBuilder.vue +53 -0
  47. package/src/components/admin/newsletters/ListMemberTable.stories.js +12 -0
  48. package/src/components/admin/newsletters/ListMemberTable.vue +53 -0
  49. package/src/components/admin/newsletters/MarkdownEditor.stories.js +6 -0
  50. package/src/components/admin/newsletters/MarkdownEditor.vue +53 -0
  51. package/src/components/admin/newsletters/MergeFieldDropdown.stories.js +6 -0
  52. package/src/components/admin/newsletters/MergeFieldDropdown.vue +84 -0
  53. package/src/components/admin/newsletters/PreviewIframe.stories.js +7 -0
  54. package/src/components/admin/newsletters/PreviewIframe.vue +40 -0
  55. package/src/components/admin/newsletters/SummaryTiles.stories.js +8 -0
  56. package/src/components/admin/newsletters/SummaryTiles.vue +63 -0
  57. package/src/composables/useChat.js +187 -187
  58. package/src/composables/useI18n.js +102 -102
  59. package/src/composables/useMentions.js +134 -134
  60. package/src/composables/usePermissions.js +31 -0
  61. package/src/composables/useRealtime.js +182 -182
  62. package/src/index.js +85 -84
  63. package/src/locales/README.md +13 -13
  64. package/src/locales/ar.json +727 -727
  65. package/src/locales/de.json +690 -690
  66. package/src/locales/en.json +889 -729
  67. package/src/locales/es.json +691 -691
  68. package/src/locales/fr.json +691 -691
  69. package/src/locales/index.js +16 -16
  70. package/src/locales/it.json +727 -727
  71. package/src/locales/ja.json +727 -727
  72. package/src/locales/ko.json +727 -727
  73. package/src/locales/nl.json +727 -727
  74. package/src/locales/pl.json +727 -727
  75. package/src/locales/pt-BR.json +727 -727
  76. package/src/locales/ru.json +727 -727
  77. package/src/locales/tr.json +727 -727
  78. package/src/locales/zh-CN.json +727 -727
  79. package/src/pages/Admin/Automations/Form.vue +280 -0
  80. package/src/pages/Admin/Automations/Index.vue +230 -0
  81. package/src/pages/Admin/Newsletters/Compose.vue +192 -0
  82. package/src/pages/Admin/Newsletters/Edit.vue +24 -0
  83. package/src/pages/Admin/Newsletters/Index.vue +141 -0
  84. package/src/pages/Admin/Newsletters/Lists/Create.vue +64 -0
  85. package/src/pages/Admin/Newsletters/Lists/Index.vue +59 -0
  86. package/src/pages/Admin/Newsletters/Lists/Show.vue +53 -0
  87. package/src/pages/Admin/Newsletters/Settings.vue +85 -0
  88. package/src/pages/Admin/Newsletters/Show.vue +140 -0
  89. package/src/pages/Admin/Newsletters/Templates/Create.vue +11 -0
  90. package/src/pages/Admin/Newsletters/Templates/Index.vue +54 -0
  91. package/src/pages/Admin/Newsletters/Templates/Show.vue +65 -0
  92. package/src/pages/Admin/Newsletters/usePreview.js +44 -0
  93. package/src/pages/Admin/Plugins/Index.vue +10 -2
  94. package/src/pages/Admin/Reports/AgentDetail.vue +132 -132
  95. package/src/pages/Admin/Reports/AgentRanking.vue +246 -246
  96. package/src/pages/Admin/Reports/Cohorts.vue +180 -180
  97. package/src/pages/Admin/Reports/Comparison.vue +141 -141
  98. package/src/pages/Admin/Reports/Dashboard.vue +226 -226
  99. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -164
  100. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -164
  101. package/src/pages/Admin/Reports/SlaTrends.vue +183 -183
  102. package/src/pages/Admin/Settings/DatabaseConnection.vue +228 -0
  103. package/src/pages/Admin/Settings/PublicTickets.vue +163 -0
  104. package/src/pages/Admin/Settings/SsoSettings.vue +157 -4
  105. package/src/pages/Admin/Settings/TwoFactor.vue +32 -6
  106. package/src/pages/Admin/Settings.vue +1008 -1008
  107. package/src/pages/Admin/Skills/Form.vue +30 -10
  108. package/src/pages/Admin/Tickets/Index.vue +126 -126
  109. package/src/pages/Admin/Tickets/Show.vue +254 -249
  110. package/src/pages/Admin/Users/Index.vue +145 -145
  111. package/src/pages/Admin/Webhooks/DeliveryLog.vue +1 -2
  112. package/src/pages/Admin/Workflows/Builder.vue +207 -207
  113. package/src/pages/Admin/Workflows/Form.vue +24 -0
  114. package/src/pages/Admin/Workflows/Index.vue +235 -235
  115. package/src/pages/Admin/Workflows/Logs.vue +286 -286
  116. package/src/pages/Agent/TicketIndex.vue +112 -112
  117. package/src/pages/Agent/TicketShow.vue +547 -494
  118. package/src/pages/Customer/Index.vue +56 -56
  119. package/src/pages/Customer/KnowledgeBase/Article.vue +129 -129
  120. package/src/pages/Plugin/Page.vue +61 -0
  121. package/src/plugin.js +175 -175
  122. package/src/utils/mentionHighlight.js +24 -24
  123. package/src/widget/EscalatedWidget.vue +804 -804
  124. package/src/widget/index.js +254 -254
@@ -1,180 +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>
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>
@@ -1,141 +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
+ <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>