@escalated-dev/escalated 0.6.0 → 0.7.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 (187) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +125 -2
  3. package/package.json +40 -5
  4. package/src/components/ActiveChatsPanel.vue +246 -0
  5. package/src/components/ActivityTimeline.stories.js +55 -0
  6. package/src/components/ActivityTimeline.vue +83 -66
  7. package/src/components/AdminDashboard.stories.js +1423 -0
  8. package/src/components/AgentLoadIndicator.stories.js +37 -0
  9. package/src/components/AgentLoadIndicator.vue +49 -0
  10. package/src/components/AgentPerformanceCard.vue +44 -0
  11. package/src/components/ArticleEditor.vue +82 -0
  12. package/src/components/AssigneeSelect.vue +37 -23
  13. package/src/components/AttachmentList.vue +65 -37
  14. package/src/components/AuditLogEntry.vue +95 -0
  15. package/src/components/BulkActionBar.vue +166 -97
  16. package/src/components/CategoryTree.vue +89 -0
  17. package/src/components/ChartWidget.vue +46 -0
  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 -0
  24. package/src/components/CollisionWarning.vue +68 -0
  25. package/src/components/ConditionalFieldRules.vue +135 -0
  26. package/src/components/ContextPanel.vue +66 -0
  27. package/src/components/ContextPanelSection.vue +65 -0
  28. package/src/components/CustomFieldRenderer.vue +159 -0
  29. package/src/components/EscalatedLayout.vue +424 -70
  30. package/src/components/FileDropzone.vue +57 -41
  31. package/src/components/FollowButton.stories.js +30 -0
  32. package/src/components/FollowButton.vue +88 -63
  33. package/src/components/KeyboardShortcutHelp.vue +213 -123
  34. package/src/components/KnowledgePanel.vue +122 -0
  35. package/src/components/KpiCard.stories.js +32 -0
  36. package/src/components/KpiCard.vue +88 -0
  37. package/src/components/MacroDropdown.vue +150 -90
  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 -0
  43. package/src/components/PinnedNotes.vue +129 -90
  44. package/src/components/PluginSlot.vue +68 -62
  45. package/src/components/PresenceIndicator.vue +138 -28
  46. package/src/components/PriorityBadge.stories.js +33 -0
  47. package/src/components/PriorityBadge.vue +46 -39
  48. package/src/components/QuickFilters.vue +65 -49
  49. package/src/components/ReplyComposer.vue +207 -30
  50. package/src/components/ReplyThread.vue +111 -21
  51. package/src/components/ReportChart.vue +395 -0
  52. package/src/components/ReportExportButton.vue +108 -0
  53. package/src/components/SatisfactionRating.vue +180 -128
  54. package/src/components/SaveViewDialog.vue +172 -0
  55. package/src/components/SavedViewSidebar.vue +208 -0
  56. package/src/components/ScheduleEditor.vue +104 -0
  57. package/src/components/SideConversation.vue +165 -0
  58. package/src/components/SideConversationList.vue +147 -0
  59. package/src/components/SkillTagManager.vue +79 -0
  60. package/src/components/SlaComplianceChart.vue +46 -0
  61. package/src/components/SlaTimer.stories.js +35 -0
  62. package/src/components/SlaTimer.vue +62 -49
  63. package/src/components/SnoozeButton.vue +247 -0
  64. package/src/components/StatsCard.stories.js +24 -0
  65. package/src/components/StatsCard.vue +18 -6
  66. package/src/components/StatusBadge.stories.js +53 -0
  67. package/src/components/StatusBadge.vue +78 -46
  68. package/src/components/TagSelect.vue +84 -53
  69. package/src/components/TicketFilters.vue +247 -46
  70. package/src/components/TicketLinkPanel.vue +193 -0
  71. package/src/components/TicketList.vue +536 -74
  72. package/src/components/TicketMergeDialog.vue +157 -0
  73. package/src/components/TicketSidebar.vue +167 -99
  74. package/src/components/TicketSplitDialog.vue +98 -0
  75. package/src/components/TicketTypeSelector.vue +21 -0
  76. package/src/components/TotpInput.stories.js +9 -0
  77. package/src/components/TotpInput.vue +81 -0
  78. package/src/components/TwoFactorSetup.vue +113 -0
  79. package/src/components/VariableTokenInput.vue +111 -0
  80. package/src/components/WorkflowActionConfig.vue +287 -0
  81. package/src/components/WorkflowActionList.vue +350 -0
  82. package/src/components/WorkflowConditionBuilder.vue +265 -0
  83. package/src/components/WorkflowTriggerSelector.vue +125 -0
  84. package/src/composables/useChat.js +187 -0
  85. package/src/composables/useDebouncedSearch.js +38 -0
  86. package/src/composables/useI18n.js +80 -80
  87. package/src/composables/useKeyboardShortcuts.js +46 -46
  88. package/src/composables/useMentions.js +134 -0
  89. package/src/composables/usePluginExtensions.js +159 -67
  90. package/src/composables/usePluginHooks.js +65 -0
  91. package/src/composables/useRealtime.js +182 -0
  92. package/src/defineEscalatedPlugin.js +76 -50
  93. package/src/index.js +77 -28
  94. package/src/locales/ar.json +727 -0
  95. package/src/locales/de.json +678 -430
  96. package/src/locales/en.json +717 -430
  97. package/src/locales/es.json +679 -430
  98. package/src/locales/fr.json +680 -431
  99. package/src/locales/index.js +12 -2
  100. package/src/locales/it.json +727 -0
  101. package/src/locales/ja.json +727 -0
  102. package/src/locales/ko.json +727 -0
  103. package/src/locales/nl.json +727 -0
  104. package/src/locales/pl.json +727 -0
  105. package/src/locales/pt-BR.json +727 -0
  106. package/src/locales/ru.json +727 -0
  107. package/src/locales/tr.json +727 -0
  108. package/src/locales/zh-CN.json +727 -0
  109. package/src/pages/Admin/ApiTokens/Index.vue +381 -217
  110. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  111. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  112. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  113. package/src/pages/Admin/CannedResponses/Index.vue +82 -25
  114. package/src/pages/Admin/Capacity/Index.vue +134 -0
  115. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  116. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  117. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  118. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  119. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  120. package/src/pages/Admin/Departments/Form.vue +35 -11
  121. package/src/pages/Admin/Departments/Index.vue +74 -21
  122. package/src/pages/Admin/EscalationRules/Form.vue +86 -25
  123. package/src/pages/Admin/EscalationRules/Index.vue +158 -37
  124. package/src/pages/Admin/Import/Connect.vue +95 -0
  125. package/src/pages/Admin/Import/Index.vue +102 -0
  126. package/src/pages/Admin/Import/Mapping.vue +110 -0
  127. package/src/pages/Admin/Import/Progress.vue +153 -0
  128. package/src/pages/Admin/Import/Review.vue +76 -0
  129. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  130. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  131. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  132. package/src/pages/Admin/Macros/Index.vue +448 -287
  133. package/src/pages/Admin/Plugins/Index.vue +327 -197
  134. package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
  135. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  136. package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
  137. package/src/pages/Admin/Reports/Cohorts.vue +180 -0
  138. package/src/pages/Admin/Reports/Comparison.vue +141 -0
  139. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  140. package/src/pages/Admin/Reports/Dashboard.vue +226 -0
  141. package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
  142. package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
  143. package/src/pages/Admin/Reports/SlaReport.vue +162 -0
  144. package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
  145. package/src/pages/Admin/Reports.vue +206 -101
  146. package/src/pages/Admin/Roles/Form.vue +71 -0
  147. package/src/pages/Admin/Roles/Index.vue +122 -0
  148. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  149. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  150. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  151. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  152. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  153. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  154. package/src/pages/Admin/Settings.vue +847 -99
  155. package/src/pages/Admin/Skills/Form.vue +53 -0
  156. package/src/pages/Admin/Skills/Index.vue +94 -0
  157. package/src/pages/Admin/SlaPolicies/Form.vue +62 -19
  158. package/src/pages/Admin/SlaPolicies/Index.vue +85 -23
  159. package/src/pages/Admin/Statuses/Form.vue +114 -0
  160. package/src/pages/Admin/Statuses/Index.vue +153 -0
  161. package/src/pages/Admin/Tags/Index.vue +121 -35
  162. package/src/pages/Admin/Tickets/Index.vue +96 -9
  163. package/src/pages/Admin/Tickets/Show.vue +130 -37
  164. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  165. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  166. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  167. package/src/pages/Admin/Workflows/Builder.vue +207 -0
  168. package/src/pages/Admin/Workflows/Index.vue +235 -0
  169. package/src/pages/Admin/Workflows/Logs.vue +286 -0
  170. package/src/pages/Agent/Dashboard.vue +311 -186
  171. package/src/pages/Agent/TicketIndex.vue +80 -6
  172. package/src/pages/Agent/TicketShow.vue +399 -60
  173. package/src/pages/Customer/Create.vue +37 -10
  174. package/src/pages/Customer/Index.vue +9 -2
  175. package/src/pages/Customer/KnowledgeBase/Article.vue +129 -0
  176. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  177. package/src/pages/Customer/Show.vue +69 -63
  178. package/src/pages/Guest/Create.vue +40 -15
  179. package/src/pages/Guest/Show.vue +124 -93
  180. package/src/plugin.js +111 -1
  181. package/src/utils/constants.js +30 -0
  182. package/src/utils/formatting.js +35 -0
  183. package/src/utils/mentionHighlight.js +24 -0
  184. package/src/utils/sanitizeHtml.js +78 -64
  185. package/src/widget/EscalatedWidget.vue +804 -0
  186. package/src/widget/index.js +254 -0
  187. package/src/pages/Admin/Plugins.vue +0 -129
@@ -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>
@@ -0,0 +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
+ 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>
@@ -0,0 +1,226 @@
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 PeriodSelector from '../../../components/PeriodSelector.vue';
6
+ import ReportExportButton from '../../../components/ReportExportButton.vue';
7
+ import { router, Link } from '@inertiajs/vue3';
8
+ import { ref } from 'vue';
9
+
10
+ defineProps({
11
+ period_days: Number,
12
+ volume: Array,
13
+ by_status: Array,
14
+ by_priority: Array,
15
+ avg_response_hours: Number,
16
+ avg_resolution_hours: Number,
17
+ sla_compliance: Number,
18
+ csat_average: Number,
19
+ agent_performance: Array,
20
+ });
21
+
22
+ const activeTab = ref('overview');
23
+
24
+ const tabs = [
25
+ { key: 'overview', label: 'Overview' },
26
+ { key: 'agents', label: 'Agents' },
27
+ { key: 'sla', label: 'SLA' },
28
+ { key: 'csat', label: 'CSAT' },
29
+ ];
30
+
31
+ const advancedReports = [
32
+ { label: 'SLA Trends', route: 'escalated.admin.reports.sla-trends' },
33
+ { label: 'Response Times', route: 'escalated.admin.reports.response-times' },
34
+ { label: 'Resolution Times', route: 'escalated.admin.reports.resolution-times' },
35
+ { label: 'Agent Rankings', route: 'escalated.admin.reports.agent-ranking' },
36
+ { label: 'Cohorts', route: 'escalated.admin.reports.cohorts' },
37
+ { label: 'Comparison', route: 'escalated.admin.reports.comparison' },
38
+ ];
39
+
40
+ function changePeriod(days) {
41
+ router.get(route('escalated.admin.reports.dashboard'), { days }, { preserveState: true });
42
+ }
43
+ </script>
44
+
45
+ <template>
46
+ <EscalatedLayout title="Reports Dashboard">
47
+ <!-- Period selector & export -->
48
+ <div class="mb-6 flex items-center justify-between">
49
+ <PeriodSelector :model-value="period_days" @update:model-value="changePeriod" />
50
+ <div class="flex items-center gap-3">
51
+ <ReportExportButton report-name="dashboard" :period-days="period_days" />
52
+ <Link
53
+ :href="route('escalated.admin.reports')"
54
+ class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
55
+ >
56
+ Classic View
57
+ </Link>
58
+ </div>
59
+ </div>
60
+
61
+ <!-- Tabs -->
62
+ <div class="mb-6 flex gap-1 rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] p-1">
63
+ <button
64
+ v-for="tab in tabs"
65
+ :key="tab.key"
66
+ :class="[
67
+ 'rounded-md px-4 py-2 text-sm font-medium transition-all',
68
+ activeTab === tab.key
69
+ ? 'bg-[var(--esc-panel-active)] text-[var(--esc-panel-text)]'
70
+ : 'text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]',
71
+ ]"
72
+ @click="activeTab = tab.key"
73
+ >
74
+ {{ tab.label }}
75
+ </button>
76
+ </div>
77
+
78
+ <!-- Overview Tab -->
79
+ <div v-if="activeTab === 'overview'">
80
+ <!-- KPI Cards -->
81
+ <div class="mb-6 grid grid-cols-2 gap-4 md:grid-cols-4">
82
+ <KpiCard
83
+ label="Avg Response Time"
84
+ :value="`${avg_response_hours}h`"
85
+ :icon="'M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z'"
86
+ />
87
+ <KpiCard
88
+ label="Avg Resolution Time"
89
+ :value="`${avg_resolution_hours}h`"
90
+ :icon="'M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z'"
91
+ />
92
+ <KpiCard
93
+ label="SLA Compliance"
94
+ :value="`${sla_compliance}%`"
95
+ :icon="'M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z'"
96
+ />
97
+ <KpiCard
98
+ label="CSAT Average"
99
+ :value="csat_average || '—'"
100
+ :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'"
101
+ />
102
+ </div>
103
+
104
+ <!-- Charts -->
105
+ <div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
106
+ <ChartWidget title="Ticket Volume" :data="volume" color="cyan" />
107
+ <ChartWidget title="By Status" :data="by_status" color="violet" />
108
+ <ChartWidget title="By Priority" :data="by_priority" color="amber" />
109
+ </div>
110
+ </div>
111
+
112
+ <!-- Agents Tab -->
113
+ <div v-if="activeTab === 'agents'">
114
+ <div class="mb-4 text-right">
115
+ <Link
116
+ :href="route('escalated.admin.reports.agents', { days: period_days })"
117
+ class="text-sm text-[var(--esc-panel-accent)] hover:text-[var(--esc-panel-accent)]"
118
+ >
119
+ Full Agent Report &rarr;
120
+ </Link>
121
+ </div>
122
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)]">
123
+ <table class="w-full">
124
+ <thead>
125
+ <tr class="border-b border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)]">
126
+ <th
127
+ class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
128
+ >
129
+ Agent
130
+ </th>
131
+ <th
132
+ class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
133
+ >
134
+ Tickets
135
+ </th>
136
+ <th
137
+ class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
138
+ >
139
+ Resolved
140
+ </th>
141
+ <th
142
+ class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
143
+ >
144
+ Avg Response
145
+ </th>
146
+ <th
147
+ class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
148
+ >
149
+ Avg Resolution
150
+ </th>
151
+ </tr>
152
+ </thead>
153
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
154
+ <tr
155
+ v-for="agent in agent_performance"
156
+ :key="agent.agent_id"
157
+ class="hover:bg-[var(--esc-panel-hover)]"
158
+ >
159
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
160
+ {{ agent.agent_name }}
161
+ </td>
162
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
163
+ {{ agent.total_tickets }}
164
+ </td>
165
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
166
+ {{ agent.resolved_tickets }}
167
+ </td>
168
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
169
+ {{ agent.avg_response_hours ?? '—' }}h
170
+ </td>
171
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
172
+ {{ agent.avg_resolution_hours ?? '—' }}h
173
+ </td>
174
+ </tr>
175
+ <tr v-if="!agent_performance?.length">
176
+ <td colspan="5" class="px-4 py-8 text-center text-sm text-[var(--esc-panel-text-muted)]">
177
+ No agent data for this period.
178
+ </td>
179
+ </tr>
180
+ </tbody>
181
+ </table>
182
+ </div>
183
+ </div>
184
+
185
+ <!-- SLA Tab -->
186
+ <div v-if="activeTab === 'sla'">
187
+ <div class="mb-4 flex items-center justify-between">
188
+ <KpiCard label="Overall SLA Compliance" :value="`${sla_compliance}%`" />
189
+ <Link
190
+ :href="route('escalated.admin.reports.sla', { days: period_days })"
191
+ class="text-sm text-[var(--esc-panel-accent)] hover:text-[var(--esc-panel-accent)]"
192
+ >
193
+ Full SLA Report &rarr;
194
+ </Link>
195
+ </div>
196
+ </div>
197
+
198
+ <!-- CSAT Tab -->
199
+ <div v-if="activeTab === 'csat'">
200
+ <div class="mb-4 flex items-center justify-between">
201
+ <KpiCard label="Average CSAT" :value="csat_average || '—'" />
202
+ <Link
203
+ :href="route('escalated.admin.reports.csat', { days: period_days })"
204
+ class="text-sm text-[var(--esc-panel-accent)] hover:text-[var(--esc-panel-accent)]"
205
+ >
206
+ Full CSAT Report &rarr;
207
+ </Link>
208
+ </div>
209
+ </div>
210
+
211
+ <!-- Advanced Reports Navigation -->
212
+ <div class="mt-8 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
213
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">Advanced Reports</h3>
214
+ <div class="grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-6">
215
+ <Link
216
+ v-for="report in advancedReports"
217
+ :key="report.route"
218
+ :href="route(report.route, { days: period_days })"
219
+ class="rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-4 py-3 text-center text-sm font-medium text-[var(--esc-panel-text-tertiary)] transition-all hover:border-[var(--esc-panel-accent)]/30 hover:text-[var(--esc-panel-text-secondary)]"
220
+ >
221
+ {{ report.label }}
222
+ </Link>
223
+ </div>
224
+ </div>
225
+ </EscalatedLayout>
226
+ </template>
@@ -0,0 +1,164 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import KpiCard from '../../../components/KpiCard.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
+ avg_resolution: { type: Number, default: 0 },
13
+ median_resolution: { type: Number, default: 0 },
14
+ p90_resolution: { type: Number, default: 0 },
15
+ pct_under_target: { type: Number, default: 0 },
16
+ distribution: { type: Array, default: () => [] },
17
+ trend: { type: Array, default: () => [] },
18
+ by_agent: { type: Array, default: () => [] },
19
+ by_department: { type: Array, default: () => [] },
20
+ by_channel: { type: Array, default: () => [] },
21
+ target_hours: { type: Number, default: 24 },
22
+ });
23
+
24
+ const periodDays = ref(props.period_days);
25
+ const sortColumn = ref('avg');
26
+ const sortDir = ref('asc');
27
+
28
+ function changePeriod(days) {
29
+ periodDays.value = days;
30
+ router.get(route('escalated.admin.reports.resolution-times'), { days }, { preserveState: true });
31
+ }
32
+
33
+ function resColor(value) {
34
+ if (value <= props.target_hours * 0.5) return 'text-emerald-400';
35
+ if (value <= props.target_hours) return 'text-amber-400';
36
+ return 'text-red-400';
37
+ }
38
+
39
+ const sortedAgents = computed(() => {
40
+ const agents = [...(props.by_agent || [])];
41
+ agents.sort((a, b) => {
42
+ const aVal = a[sortColumn.value] ?? 0;
43
+ const bVal = b[sortColumn.value] ?? 0;
44
+ return sortDir.value === 'asc' ? aVal - bVal : bVal - aVal;
45
+ });
46
+ return agents;
47
+ });
48
+
49
+ function toggleSort(col) {
50
+ if (sortColumn.value === col) {
51
+ sortDir.value = sortDir.value === 'asc' ? 'desc' : 'asc';
52
+ } else {
53
+ sortColumn.value = col;
54
+ sortDir.value = 'asc';
55
+ }
56
+ }
57
+ </script>
58
+
59
+ <template>
60
+ <EscalatedLayout title="Resolution Time Analysis">
61
+ <div class="mb-6 flex items-center justify-between">
62
+ <PeriodSelector :model-value="periodDays" @update:model-value="changePeriod" />
63
+ <div class="flex items-center gap-3">
64
+ <ReportExportButton report-name="resolution-times" :period-days="periodDays" />
65
+ <Link
66
+ :href="route('escalated.admin.reports')"
67
+ class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
68
+ >
69
+ &larr; Back
70
+ </Link>
71
+ </div>
72
+ </div>
73
+
74
+ <!-- KPI Cards -->
75
+ <div class="mb-6 grid grid-cols-2 gap-4 md:grid-cols-4">
76
+ <KpiCard
77
+ label="Avg Resolution"
78
+ :value="`${avg_resolution}h`"
79
+ :icon="'M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z'"
80
+ />
81
+ <KpiCard
82
+ label="Median Resolution"
83
+ :value="`${median_resolution}h`"
84
+ :icon="'M3.75 3v11.25A2.25 2.25 0 006 16.5h2.25M3.75 3h-1.5m1.5 0h16.5m0 0h1.5m-1.5 0v11.25A2.25 2.25 0 0118 16.5h-2.25m-7.5 0h7.5m-7.5 0l-1 3m8.5-3l1 3m0 0l.5 1.5m-.5-1.5h-9.5m0 0l-.5 1.5'"
85
+ />
86
+ <KpiCard
87
+ label="P90 Resolution"
88
+ :value="`${p90_resolution}h`"
89
+ :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.75z'"
90
+ />
91
+ <KpiCard
92
+ label="Under Target"
93
+ :value="`${pct_under_target}%`"
94
+ :icon="'M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z'"
95
+ />
96
+ </div>
97
+
98
+ <!-- Charts -->
99
+ <div class="mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2">
100
+ <ReportChart
101
+ type="histogram"
102
+ title="Resolution Time Distribution"
103
+ :data="distribution"
104
+ :colors="['#8b5cf6']"
105
+ x-label="Resolution Time Buckets"
106
+ />
107
+ <ReportChart type="line" title="Avg Resolution Time Trend" :data="trend" :colors="['#06b6d4']" />
108
+ <ReportChart type="bar" title="Resolution by Department" :data="by_department" :colors="['#f59e0b']" />
109
+ <ReportChart type="bar" title="Resolution by Channel" :data="by_channel" :colors="['#10b981']" />
110
+ </div>
111
+
112
+ <!-- Agent Table -->
113
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)]">
114
+ <div class="border-b border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-4 py-3">
115
+ <h3 class="text-sm font-semibold text-[var(--esc-panel-text-secondary)]">Resolution Time by Agent</h3>
116
+ </div>
117
+ <table class="w-full">
118
+ <thead>
119
+ <tr class="border-b border-[var(--esc-panel-border)]">
120
+ <th
121
+ class="px-4 py-3 text-left text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
122
+ >
123
+ Agent
124
+ </th>
125
+ <th
126
+ v-for="col in [
127
+ { key: 'avg', label: 'Avg' },
128
+ { key: 'median', label: 'Median' },
129
+ { key: 'p90', label: 'P90' },
130
+ ]"
131
+ :key="col.key"
132
+ 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)]"
133
+ @click="toggleSort(col.key)"
134
+ >
135
+ {{ col.label }}
136
+ <span v-if="sortColumn === col.key">{{ sortDir === 'asc' ? ' &#9650;' : ' &#9660;' }}</span>
137
+ </th>
138
+ </tr>
139
+ </thead>
140
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
141
+ <tr v-for="agent in sortedAgents" :key="agent.agent_id" class="hover:bg-[var(--esc-panel-hover)]">
142
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
143
+ {{ agent.agent_name }}
144
+ </td>
145
+ <td class="px-4 py-3 text-sm font-medium" :class="resColor(agent.avg)">
146
+ {{ agent.avg ?? '—' }}h
147
+ </td>
148
+ <td class="px-4 py-3 text-sm font-medium" :class="resColor(agent.median)">
149
+ {{ agent.median ?? '—' }}h
150
+ </td>
151
+ <td class="px-4 py-3 text-sm font-medium" :class="resColor(agent.p90)">
152
+ {{ agent.p90 ?? '—' }}h
153
+ </td>
154
+ </tr>
155
+ <tr v-if="!sortedAgents.length">
156
+ <td colspan="4" class="px-4 py-8 text-center text-sm text-[var(--esc-panel-text-muted)]">
157
+ No agent data for this period.
158
+ </td>
159
+ </tr>
160
+ </tbody>
161
+ </table>
162
+ </div>
163
+ </EscalatedLayout>
164
+ </template>