@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
@@ -1,101 +1,206 @@
1
- <script setup>
2
- import EscalatedLayout from '../../components/EscalatedLayout.vue';
3
- import StatsCard from '../../components/StatsCard.vue';
4
- import { router } from '@inertiajs/vue3';
5
-
6
- const props = defineProps({
7
- period_days: Number,
8
- total_tickets: Number,
9
- resolved_tickets: Number,
10
- avg_first_response_hours: Number,
11
- sla_breach_count: Number,
12
- by_status: Object,
13
- by_priority: Object,
14
- csat: { type: Object, default: () => ({}) },
15
- });
16
-
17
- function changePeriod(days) {
18
- router.get(route('escalated.admin.reports'), { days }, { preserveState: true });
19
- }
20
-
21
- function renderStars(rating) {
22
- return Array.from({ length: 5 }, (_, i) => i < Math.round(rating) ? 'filled' : 'empty');
23
- }
24
- </script>
25
-
26
- <template>
27
- <EscalatedLayout title="Reports">
28
- <div class="mb-6 flex gap-2">
29
- <button v-for="d in [7, 30, 90]" :key="d" @click="changePeriod(d)"
30
- :class="['rounded-lg px-3.5 py-1.5 text-sm font-medium transition-all', period_days === d
31
- ? 'bg-gradient-to-r from-cyan-500 to-violet-500 text-white shadow-lg shadow-black/20'
32
- : 'border border-white/10 bg-white/[0.03] text-neutral-400 hover:bg-white/[0.06] hover:text-neutral-200']">
33
- Last {{ d }} days
34
- </button>
35
- </div>
36
- <div class="mb-8 grid grid-cols-2 gap-4 md:grid-cols-4">
37
- <StatsCard label="Total Tickets" :value="total_tickets" color="indigo" />
38
- <StatsCard label="Resolved" :value="resolved_tickets" color="green" />
39
- <StatsCard label="Avg First Response" :value="`${avg_first_response_hours}h`" color="yellow" />
40
- <StatsCard label="SLA Breaches" :value="sla_breach_count" color="red" />
41
- </div>
42
- <div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
43
- <div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
44
- <h3 class="mb-4 text-sm font-semibold text-neutral-200">By Status</h3>
45
- <template v-if="by_status && Object.keys(by_status).length">
46
- <div v-for="(count, status) in by_status" :key="status" class="mb-2.5 flex items-center justify-between">
47
- <span class="text-sm capitalize text-neutral-400">{{ status.replace('_', ' ') }}</span>
48
- <span class="text-sm font-semibold text-white">{{ count }}</span>
49
- </div>
50
- </template>
51
- <div v-else class="flex flex-col items-center py-6 text-center">
52
- <svg class="mb-2 h-8 w-8 text-neutral-700" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="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" /></svg>
53
- <p class="text-sm text-neutral-500">No ticket data for this period</p>
54
- </div>
55
- </div>
56
- <div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
57
- <h3 class="mb-4 text-sm font-semibold text-neutral-200">By Priority</h3>
58
- <template v-if="by_priority && Object.keys(by_priority).length">
59
- <div v-for="(count, priority) in by_priority" :key="priority" class="mb-2.5 flex items-center justify-between">
60
- <span class="text-sm capitalize text-neutral-400">{{ priority }}</span>
61
- <span class="text-sm font-semibold text-white">{{ count }}</span>
62
- </div>
63
- </template>
64
- <div v-else class="flex flex-col items-center py-6 text-center">
65
- <svg class="mb-2 h-8 w-8 text-neutral-700" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12" /></svg>
66
- <p class="text-sm text-neutral-500">No ticket data for this period</p>
67
- </div>
68
- </div>
69
- <!-- CSAT -->
70
- <div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
71
- <h3 class="mb-4 text-sm font-semibold text-neutral-200">Customer Satisfaction</h3>
72
- <template v-if="csat?.total > 0">
73
- <div class="mb-3 flex items-center gap-2">
74
- <div class="flex items-center gap-0.5">
75
- <svg v-for="(star, i) in renderStars(csat.average)" :key="i"
76
- class="h-5 w-5" :class="star === 'filled' ? 'text-amber-400' : 'text-neutral-700'"
77
- fill="currentColor" viewBox="0 0 20 20">
78
- <path 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" />
79
- </svg>
80
- </div>
81
- <span class="text-lg font-bold text-white">{{ csat.average }}</span>
82
- <span class="text-sm text-neutral-500">({{ csat.total }} ratings)</span>
83
- </div>
84
- <div v-if="csat.breakdown && Object.keys(csat.breakdown).length" class="space-y-1.5">
85
- <div v-for="rating in [5, 4, 3, 2, 1]" :key="rating" class="flex items-center gap-2">
86
- <span class="w-3 text-xs text-neutral-500">{{ rating }}</span>
87
- <div class="h-2 flex-1 overflow-hidden rounded-full bg-white/[0.06]">
88
- <div class="h-full rounded-full bg-amber-400" :style="{ width: `${csat.total ? ((csat.breakdown[rating] || 0) / csat.total) * 100 : 0}%` }"></div>
89
- </div>
90
- <span class="w-6 text-right text-xs text-neutral-500">{{ csat.breakdown[rating] || 0 }}</span>
91
- </div>
92
- </div>
93
- </template>
94
- <div v-else class="flex flex-col items-center py-6 text-center">
95
- <svg class="mb-2 h-8 w-8 text-neutral-700" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z" /></svg>
96
- <p class="text-sm text-neutral-500">No ratings for this period</p>
97
- </div>
98
- </div>
99
- </div>
100
- </EscalatedLayout>
101
- </template>
1
+ <script setup>
2
+ import EscalatedLayout from '../../components/EscalatedLayout.vue';
3
+ import StatsCard from '../../components/StatsCard.vue';
4
+ import PluginSlot from '../../components/PluginSlot.vue';
5
+ import { router, Link } from '@inertiajs/vue3';
6
+ import { usePluginExtensions } from '../../composables/usePluginExtensions';
7
+
8
+ defineProps({
9
+ period_days: Number,
10
+ total_tickets: Number,
11
+ resolved_tickets: Number,
12
+ avg_first_response_hours: Number,
13
+ sla_breach_count: Number,
14
+ by_status: Object,
15
+ by_priority: Object,
16
+ csat: { type: Object, default: () => ({}) },
17
+ });
18
+
19
+ function changePeriod(days) {
20
+ router.get(route('escalated.admin.reports'), { days }, { preserveState: true });
21
+ }
22
+
23
+ function renderStars(rating) {
24
+ return Array.from({ length: 5 }, (_, i) => (i < Math.round(rating) ? 'filled' : 'empty'));
25
+ }
26
+
27
+ const { getPageComponents } = usePluginExtensions();
28
+ </script>
29
+
30
+ <template>
31
+ <EscalatedLayout title="Reports">
32
+ <!-- Sub-report navigation -->
33
+ <div
34
+ class="mb-6 flex items-center gap-3 rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] p-3"
35
+ >
36
+ <span class="text-xs font-medium uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
37
+ >Detailed Reports:</span
38
+ >
39
+ <Link
40
+ :href="route('escalated.admin.reports.dashboard')"
41
+ class="rounded-md px-3 py-1.5 text-sm text-[var(--esc-panel-text-tertiary)] transition-colors hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]"
42
+ >
43
+ Dashboard
44
+ </Link>
45
+ <Link
46
+ :href="route('escalated.admin.reports.agents')"
47
+ class="rounded-md px-3 py-1.5 text-sm text-[var(--esc-panel-text-tertiary)] transition-colors hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]"
48
+ >
49
+ Agent Metrics
50
+ </Link>
51
+ <Link
52
+ :href="route('escalated.admin.reports.sla')"
53
+ class="rounded-md px-3 py-1.5 text-sm text-[var(--esc-panel-text-tertiary)] transition-colors hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]"
54
+ >
55
+ SLA Report
56
+ </Link>
57
+ <Link
58
+ :href="route('escalated.admin.reports.csat')"
59
+ class="rounded-md px-3 py-1.5 text-sm text-[var(--esc-panel-text-tertiary)] transition-colors hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]"
60
+ >
61
+ CSAT Report
62
+ </Link>
63
+ </div>
64
+
65
+ <div class="mb-6 flex gap-2">
66
+ <button
67
+ v-for="d in [7, 30, 90]"
68
+ :key="d"
69
+ :class="[
70
+ 'rounded-lg px-3.5 py-1.5 text-sm font-medium transition-all',
71
+ period_days === d
72
+ ? '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'
73
+ : '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)]',
74
+ ]"
75
+ @click="changePeriod(d)"
76
+ >
77
+ Last {{ d }} days
78
+ </button>
79
+ </div>
80
+ <div class="mb-8 grid grid-cols-2 gap-4 md:grid-cols-4">
81
+ <StatsCard label="Total Tickets" :value="total_tickets" color="indigo" />
82
+ <StatsCard label="Resolved" :value="resolved_tickets" color="green" />
83
+ <StatsCard label="Avg First Response" :value="`${avg_first_response_hours}h`" color="yellow" />
84
+ <StatsCard label="SLA Breaches" :value="sla_breach_count" color="red" />
85
+ </div>
86
+ <div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
87
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
88
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">By Status</h3>
89
+ <template v-if="by_status && Object.keys(by_status).length">
90
+ <div
91
+ v-for="(count, status) in by_status"
92
+ :key="status"
93
+ class="mb-2.5 flex items-center justify-between"
94
+ >
95
+ <span class="text-sm capitalize text-[var(--esc-panel-text-tertiary)]">{{
96
+ status.replace('_', ' ')
97
+ }}</span>
98
+ <span class="text-sm font-semibold text-[var(--esc-panel-text)]">{{ count }}</span>
99
+ </div>
100
+ </template>
101
+ <div v-else class="flex flex-col items-center py-6 text-center">
102
+ <svg
103
+ class="mb-2 h-8 w-8 text-[var(--esc-panel-text-muted)]"
104
+ fill="none"
105
+ stroke="currentColor"
106
+ stroke-width="1.5"
107
+ viewBox="0 0 24 24"
108
+ >
109
+ <path
110
+ stroke-linecap="round"
111
+ stroke-linejoin="round"
112
+ d="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"
113
+ />
114
+ </svg>
115
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No ticket data for this period</p>
116
+ </div>
117
+ </div>
118
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
119
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">By Priority</h3>
120
+ <template v-if="by_priority && Object.keys(by_priority).length">
121
+ <div
122
+ v-for="(count, priority) in by_priority"
123
+ :key="priority"
124
+ class="mb-2.5 flex items-center justify-between"
125
+ >
126
+ <span class="text-sm capitalize text-[var(--esc-panel-text-tertiary)]">{{ priority }}</span>
127
+ <span class="text-sm font-semibold text-[var(--esc-panel-text)]">{{ count }}</span>
128
+ </div>
129
+ </template>
130
+ <div v-else class="flex flex-col items-center py-6 text-center">
131
+ <svg
132
+ class="mb-2 h-8 w-8 text-[var(--esc-panel-text-muted)]"
133
+ fill="none"
134
+ stroke="currentColor"
135
+ stroke-width="1.5"
136
+ viewBox="0 0 24 24"
137
+ >
138
+ <path
139
+ stroke-linecap="round"
140
+ stroke-linejoin="round"
141
+ d="M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12"
142
+ />
143
+ </svg>
144
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No ticket data for this period</p>
145
+ </div>
146
+ </div>
147
+ <!-- CSAT -->
148
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
149
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">Customer Satisfaction</h3>
150
+ <template v-if="csat?.total > 0">
151
+ <div class="mb-3 flex items-center gap-2">
152
+ <div class="flex items-center gap-0.5">
153
+ <svg
154
+ v-for="(star, i) in renderStars(csat.average)"
155
+ :key="i"
156
+ class="h-5 w-5"
157
+ :class="star === 'filled' ? 'text-amber-400' : 'text-[var(--esc-panel-text-muted)]'"
158
+ fill="currentColor"
159
+ viewBox="0 0 20 20"
160
+ >
161
+ <path
162
+ 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"
163
+ />
164
+ </svg>
165
+ </div>
166
+ <span class="text-lg font-bold text-[var(--esc-panel-text)]">{{ csat.average }}</span>
167
+ <span class="text-sm text-[var(--esc-panel-text-muted)]">({{ csat.total }} ratings)</span>
168
+ </div>
169
+ <div v-if="csat.breakdown && Object.keys(csat.breakdown).length" class="space-y-1.5">
170
+ <div v-for="rating in [5, 4, 3, 2, 1]" :key="rating" class="flex items-center gap-2">
171
+ <span class="w-3 text-xs text-[var(--esc-panel-text-muted)]">{{ rating }}</span>
172
+ <div class="h-2 flex-1 overflow-hidden rounded-full bg-[var(--esc-panel-hover)]">
173
+ <div
174
+ class="h-full rounded-full bg-amber-400"
175
+ :style="{
176
+ width: `${csat.total ? ((csat.breakdown[rating] || 0) / csat.total) * 100 : 0}%`,
177
+ }"
178
+ ></div>
179
+ </div>
180
+ <span class="w-6 text-right text-xs text-[var(--esc-panel-text-muted)]">{{
181
+ csat.breakdown[rating] || 0
182
+ }}</span>
183
+ </div>
184
+ </div>
185
+ </template>
186
+ <div v-else class="flex flex-col items-center py-6 text-center">
187
+ <svg
188
+ class="mb-2 h-8 w-8 text-[var(--esc-panel-text-muted)]"
189
+ fill="none"
190
+ stroke="currentColor"
191
+ stroke-width="1.5"
192
+ viewBox="0 0 24 24"
193
+ >
194
+ <path
195
+ stroke-linecap="round"
196
+ stroke-linejoin="round"
197
+ d="M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"
198
+ />
199
+ </svg>
200
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No ratings for this period</p>
201
+ </div>
202
+ </div>
203
+ </div>
204
+ <PluginSlot slot="admin.reports.footer" :components="getPageComponents('admin.reports', 'footer')" />
205
+ </EscalatedLayout>
206
+ </template>
@@ -0,0 +1,71 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import PermissionMatrix from '../../../components/PermissionMatrix.vue';
4
+ import { useForm } from '@inertiajs/vue3';
5
+
6
+ const props = defineProps({
7
+ role: { type: Object, default: null },
8
+ permissions: { type: Object, default: () => ({}) },
9
+ });
10
+
11
+ const form = useForm({
12
+ name: props.role?.name || '',
13
+ description: props.role?.description || '',
14
+ permissions: props.role?.permissions?.map((p) => p.id) || [],
15
+ });
16
+
17
+ function submit() {
18
+ if (props.role) {
19
+ form.put(route('escalated.admin.roles.update', props.role.id));
20
+ } else {
21
+ form.post(route('escalated.admin.roles.store'));
22
+ }
23
+ }
24
+ </script>
25
+
26
+ <template>
27
+ <EscalatedLayout :title="role ? 'Edit Role' : 'New Role'">
28
+ <form
29
+ class="mx-auto max-w-3xl space-y-5 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6"
30
+ @submit.prevent="submit"
31
+ >
32
+ <div>
33
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Name</label>
34
+ <input
35
+ v-model="form.name"
36
+ type="text"
37
+ required
38
+ class="mt-1 w-full rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]"
39
+ />
40
+ <div v-if="form.errors.name" class="mt-1 text-sm text-rose-400">{{ form.errors.name }}</div>
41
+ </div>
42
+
43
+ <div>
44
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Description</label>
45
+ <textarea
46
+ v-model="form.description"
47
+ rows="2"
48
+ class="mt-1 w-full rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]"
49
+ ></textarea>
50
+ </div>
51
+
52
+ <div>
53
+ <label class="mb-2 block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Permissions</label>
54
+ <PermissionMatrix v-model="form.permissions" :permissions="permissions" />
55
+ <div v-if="form.errors.permissions" class="mt-1 text-sm text-rose-400">
56
+ {{ form.errors.permissions }}
57
+ </div>
58
+ </div>
59
+
60
+ <div class="flex justify-end">
61
+ <button
62
+ type="submit"
63
+ :disabled="form.processing"
64
+ class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-5 py-2 text-sm font-medium text-white shadow-lg shadow-[var(--esc-panel-bg)]/20 transition-all hover:from-[var(--esc-panel-accent-hover)] hover:to-[var(--esc-panel-accent-secondary-hover)] disabled:opacity-50"
65
+ >
66
+ {{ role ? 'Update' : 'Create' }}
67
+ </button>
68
+ </div>
69
+ </form>
70
+ </EscalatedLayout>
71
+ </template>
@@ -0,0 +1,122 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { Link, router } from '@inertiajs/vue3';
4
+
5
+ defineProps({ roles: Array });
6
+
7
+ function destroy(role) {
8
+ if (role.is_system) return;
9
+ if (confirm('Delete this role?')) {
10
+ router.delete(route('escalated.admin.roles.destroy', role.id));
11
+ }
12
+ }
13
+ </script>
14
+
15
+ <template>
16
+ <EscalatedLayout title="Agent Roles">
17
+ <div class="mb-4 flex justify-end">
18
+ <Link
19
+ :href="route('escalated.admin.roles.create')"
20
+ class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-4 py-2 text-sm font-medium text-white shadow-lg shadow-[var(--esc-panel-bg)]/20 transition-all hover:from-[var(--esc-panel-accent-hover)] hover:to-[var(--esc-panel-accent-secondary-hover)]"
21
+ >
22
+ Add Role
23
+ </Link>
24
+ </div>
25
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
26
+ <table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
27
+ <thead>
28
+ <tr class="bg-[var(--esc-panel-hover)]">
29
+ <th
30
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
31
+ >
32
+ Name
33
+ </th>
34
+ <th
35
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
36
+ >
37
+ Description
38
+ </th>
39
+ <th
40
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
41
+ >
42
+ Users
43
+ </th>
44
+ <th
45
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
46
+ >
47
+ Type
48
+ </th>
49
+ <th
50
+ class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
51
+ >
52
+ Actions
53
+ </th>
54
+ </tr>
55
+ </thead>
56
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
57
+ <tr v-if="!roles?.length">
58
+ <td colspan="5" class="px-4 py-12 text-center">
59
+ <svg
60
+ class="mx-auto mb-3 h-8 w-8 text-[var(--esc-panel-text-muted)]"
61
+ fill="none"
62
+ stroke="currentColor"
63
+ stroke-width="1.5"
64
+ viewBox="0 0 24 24"
65
+ >
66
+ <path
67
+ stroke-linecap="round"
68
+ stroke-linejoin="round"
69
+ d="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"
70
+ />
71
+ </svg>
72
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No roles defined yet</p>
73
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
74
+ Create roles with specific permissions to control agent access
75
+ </p>
76
+ </td>
77
+ </tr>
78
+ <tr
79
+ v-for="role in roles"
80
+ :key="role.id"
81
+ class="transition-colors hover:bg-[var(--esc-panel-hover)]"
82
+ >
83
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
84
+ {{ role.name }}
85
+ </td>
86
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
87
+ {{ role.description || '-' }}
88
+ </td>
89
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">{{ role.users_count }}</td>
90
+ <td class="px-4 py-3 text-sm">
91
+ <span
92
+ v-if="role.is_system"
93
+ class="inline-flex items-center rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-400 ring-1 ring-amber-500/20"
94
+ >System</span
95
+ >
96
+ <span
97
+ v-else
98
+ class="inline-flex items-center rounded-full bg-[var(--esc-panel-hover)] px-2 py-0.5 text-xs font-medium text-[var(--esc-panel-text-secondary)]"
99
+ >Custom</span
100
+ >
101
+ </td>
102
+ <td class="px-4 py-3 text-right text-sm">
103
+ <Link
104
+ :href="route('escalated.admin.roles.edit', role.id)"
105
+ class="text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
106
+ >
107
+ Edit
108
+ </Link>
109
+ <button
110
+ v-if="!role.is_system"
111
+ class="ml-3 text-rose-400 hover:text-rose-300"
112
+ @click="destroy(role)"
113
+ >
114
+ Delete
115
+ </button>
116
+ </td>
117
+ </tr>
118
+ </tbody>
119
+ </table>
120
+ </div>
121
+ </EscalatedLayout>
122
+ </template>