@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,183 +1,183 @@
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
- breach_trend: { type: Array, default: () => [] },
13
- breach_by_type_trend: { type: Array, default: () => [] },
14
- breach_by_department: { type: Array, default: () => [] },
15
- breach_by_priority: { type: Array, default: () => [] },
16
- at_risk_tickets: { type: Array, default: () => [] },
17
- total_breaches: { type: Number, default: 0 },
18
- breach_rate: { type: Number, default: 0 },
19
- first_response_breaches: { type: Number, default: 0 },
20
- resolution_breaches: { type: Number, default: 0 },
21
- });
22
-
23
- const periodDays = ref(props.period_days);
24
-
25
- function changePeriod(days) {
26
- periodDays.value = days;
27
- router.get(route('escalated.admin.reports.sla-trends'), { days }, { preserveState: true });
28
- }
29
-
30
- const riskCategories = computed(() => {
31
- const tickets = props.at_risk_tickets || [];
32
- return {
33
- critical: tickets.filter((t) => t.hours_remaining <= 1),
34
- warning: tickets.filter((t) => t.hours_remaining > 1 && t.hours_remaining <= 4),
35
- watch: tickets.filter((t) => t.hours_remaining > 4 && t.hours_remaining <= 8),
36
- };
37
- });
38
- </script>
39
-
40
- <template>
41
- <EscalatedLayout title="SLA Breach Trends">
42
- <div class="mb-6 flex items-center justify-between">
43
- <PeriodSelector :model-value="periodDays" @update:model-value="changePeriod" />
44
- <div class="flex items-center gap-3">
45
- <ReportExportButton report-name="sla-trends" :period-days="periodDays" />
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
51
- </Link>
52
- </div>
53
- </div>
54
-
55
- <!-- KPI Cards -->
56
- <div class="mb-6 grid grid-cols-2 gap-4 md:grid-cols-4">
57
- <KpiCard
58
- label="Total Breaches"
59
- :value="total_breaches"
60
- :icon="'M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z'"
61
- />
62
- <KpiCard
63
- label="Breach Rate"
64
- :value="`${breach_rate}%`"
65
- :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'"
66
- />
67
- <KpiCard
68
- label="FRT Breaches"
69
- :value="first_response_breaches"
70
- :icon="'M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z'"
71
- />
72
- <KpiCard
73
- label="Resolution Breaches"
74
- :value="resolution_breaches"
75
- :icon="'M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z'"
76
- />
77
- </div>
78
-
79
- <!-- Charts -->
80
- <div class="mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2">
81
- <ReportChart type="line" title="Breach Count Over Time" :data="breach_trend" :colors="['#ef4444']" />
82
- <ReportChart
83
- type="stacked-bar"
84
- title="First Response vs Resolution Breaches"
85
- :data="breach_by_type_trend"
86
- :colors="['#f59e0b', '#ef4444']"
87
- />
88
- <ReportChart
89
- type="bar"
90
- title="Breach Rate by Department"
91
- :data="breach_by_department"
92
- :colors="['#8b5cf6']"
93
- />
94
- <ReportChart type="bar" title="Breach Rate by Priority" :data="breach_by_priority" :colors="['#06b6d4']" />
95
- </div>
96
-
97
- <!-- At Risk Panel -->
98
- <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
99
- <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">
100
- At Risk - Approaching SLA Breach
101
- </h3>
102
- <div v-if="at_risk_tickets?.length" class="space-y-4">
103
- <!-- Critical: < 1h -->
104
- <div v-if="riskCategories.critical.length">
105
- <div class="mb-2 flex items-center gap-2">
106
- <span class="inline-block h-2 w-2 rounded-full bg-red-500"></span>
107
- <span class="text-xs font-semibold uppercase tracking-wider text-red-400"
108
- >Critical (&lt;1h)</span
109
- >
110
- </div>
111
- <div class="space-y-1">
112
- <div
113
- v-for="ticket in riskCategories.critical"
114
- :key="ticket.id"
115
- class="flex items-center justify-between rounded-lg bg-red-500/5 px-3 py-2 border border-red-500/10"
116
- >
117
- <div class="flex items-center gap-3">
118
- <span class="font-mono text-xs text-red-400">{{ ticket.reference }}</span>
119
- <span class="truncate text-sm text-[var(--esc-panel-text-secondary)]">{{
120
- ticket.subject
121
- }}</span>
122
- </div>
123
- <span class="text-xs font-bold text-red-400">{{ ticket.hours_remaining }}h remaining</span>
124
- </div>
125
- </div>
126
- </div>
127
-
128
- <!-- Warning: 1-4h -->
129
- <div v-if="riskCategories.warning.length">
130
- <div class="mb-2 flex items-center gap-2">
131
- <span class="inline-block h-2 w-2 rounded-full bg-amber-500"></span>
132
- <span class="text-xs font-semibold uppercase tracking-wider text-amber-400"
133
- >Warning (1-4h)</span
134
- >
135
- </div>
136
- <div class="space-y-1">
137
- <div
138
- v-for="ticket in riskCategories.warning"
139
- :key="ticket.id"
140
- class="flex items-center justify-between rounded-lg bg-amber-500/5 px-3 py-2 border border-amber-500/10"
141
- >
142
- <div class="flex items-center gap-3">
143
- <span class="font-mono text-xs text-amber-400">{{ ticket.reference }}</span>
144
- <span class="truncate text-sm text-[var(--esc-panel-text-secondary)]">{{
145
- ticket.subject
146
- }}</span>
147
- </div>
148
- <span class="text-xs font-bold text-amber-400"
149
- >{{ ticket.hours_remaining }}h remaining</span
150
- >
151
- </div>
152
- </div>
153
- </div>
154
-
155
- <!-- Watch: 4-8h -->
156
- <div v-if="riskCategories.watch.length">
157
- <div class="mb-2 flex items-center gap-2">
158
- <span class="inline-block h-2 w-2 rounded-full bg-blue-500"></span>
159
- <span class="text-xs font-semibold uppercase tracking-wider text-blue-400">Watch (4-8h)</span>
160
- </div>
161
- <div class="space-y-1">
162
- <div
163
- v-for="ticket in riskCategories.watch"
164
- :key="ticket.id"
165
- class="flex items-center justify-between rounded-lg bg-blue-500/5 px-3 py-2 border border-blue-500/10"
166
- >
167
- <div class="flex items-center gap-3">
168
- <span class="font-mono text-xs text-blue-400">{{ ticket.reference }}</span>
169
- <span class="truncate text-sm text-[var(--esc-panel-text-secondary)]">{{
170
- ticket.subject
171
- }}</span>
172
- </div>
173
- <span class="text-xs font-bold text-blue-400">{{ ticket.hours_remaining }}h remaining</span>
174
- </div>
175
- </div>
176
- </div>
177
- </div>
178
- <div v-else class="py-6 text-center text-sm text-[var(--esc-panel-text-muted)]">
179
- No tickets currently at risk of breaching SLA.
180
- </div>
181
- </div>
182
- </EscalatedLayout>
183
- </template>
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
+ breach_trend: { type: Array, default: () => [] },
13
+ breach_by_type_trend: { type: Array, default: () => [] },
14
+ breach_by_department: { type: Array, default: () => [] },
15
+ breach_by_priority: { type: Array, default: () => [] },
16
+ at_risk_tickets: { type: Array, default: () => [] },
17
+ total_breaches: { type: Number, default: 0 },
18
+ breach_rate: { type: Number, default: 0 },
19
+ first_response_breaches: { type: Number, default: 0 },
20
+ resolution_breaches: { type: Number, default: 0 },
21
+ });
22
+
23
+ const periodDays = ref(props.period_days);
24
+
25
+ function changePeriod(days) {
26
+ periodDays.value = days;
27
+ router.get(route('escalated.admin.reports.sla-trends'), { days }, { preserveState: true });
28
+ }
29
+
30
+ const riskCategories = computed(() => {
31
+ const tickets = props.at_risk_tickets || [];
32
+ return {
33
+ critical: tickets.filter((t) => t.hours_remaining <= 1),
34
+ warning: tickets.filter((t) => t.hours_remaining > 1 && t.hours_remaining <= 4),
35
+ watch: tickets.filter((t) => t.hours_remaining > 4 && t.hours_remaining <= 8),
36
+ };
37
+ });
38
+ </script>
39
+
40
+ <template>
41
+ <EscalatedLayout title="SLA Breach Trends">
42
+ <div class="mb-6 flex items-center justify-between">
43
+ <PeriodSelector :model-value="periodDays" @update:model-value="changePeriod" />
44
+ <div class="flex items-center gap-3">
45
+ <ReportExportButton report-name="sla-trends" :period-days="periodDays" />
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
51
+ </Link>
52
+ </div>
53
+ </div>
54
+
55
+ <!-- KPI Cards -->
56
+ <div class="mb-6 grid grid-cols-2 gap-4 md:grid-cols-4">
57
+ <KpiCard
58
+ label="Total Breaches"
59
+ :value="total_breaches"
60
+ :icon="'M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z'"
61
+ />
62
+ <KpiCard
63
+ label="Breach Rate"
64
+ :value="`${breach_rate}%`"
65
+ :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'"
66
+ />
67
+ <KpiCard
68
+ label="FRT Breaches"
69
+ :value="first_response_breaches"
70
+ :icon="'M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z'"
71
+ />
72
+ <KpiCard
73
+ label="Resolution Breaches"
74
+ :value="resolution_breaches"
75
+ :icon="'M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z'"
76
+ />
77
+ </div>
78
+
79
+ <!-- Charts -->
80
+ <div class="mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2">
81
+ <ReportChart type="line" title="Breach Count Over Time" :data="breach_trend" :colors="['#ef4444']" />
82
+ <ReportChart
83
+ type="stacked-bar"
84
+ title="First Response vs Resolution Breaches"
85
+ :data="breach_by_type_trend"
86
+ :colors="['#f59e0b', '#ef4444']"
87
+ />
88
+ <ReportChart
89
+ type="bar"
90
+ title="Breach Rate by Department"
91
+ :data="breach_by_department"
92
+ :colors="['#8b5cf6']"
93
+ />
94
+ <ReportChart type="bar" title="Breach Rate by Priority" :data="breach_by_priority" :colors="['#06b6d4']" />
95
+ </div>
96
+
97
+ <!-- At Risk Panel -->
98
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5">
99
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">
100
+ At Risk - Approaching SLA Breach
101
+ </h3>
102
+ <div v-if="at_risk_tickets?.length" class="space-y-4">
103
+ <!-- Critical: < 1h -->
104
+ <div v-if="riskCategories.critical.length">
105
+ <div class="mb-2 flex items-center gap-2">
106
+ <span class="inline-block h-2 w-2 rounded-full bg-red-500"></span>
107
+ <span class="text-xs font-semibold uppercase tracking-wider text-red-400"
108
+ >Critical (&lt;1h)</span
109
+ >
110
+ </div>
111
+ <div class="space-y-1">
112
+ <div
113
+ v-for="ticket in riskCategories.critical"
114
+ :key="ticket.id"
115
+ class="flex items-center justify-between rounded-lg bg-red-500/5 px-3 py-2 border border-red-500/10"
116
+ >
117
+ <div class="flex items-center gap-3">
118
+ <span class="font-mono text-xs text-red-400">{{ ticket.reference }}</span>
119
+ <span class="truncate text-sm text-[var(--esc-panel-text-secondary)]">{{
120
+ ticket.subject
121
+ }}</span>
122
+ </div>
123
+ <span class="text-xs font-bold text-red-400">{{ ticket.hours_remaining }}h remaining</span>
124
+ </div>
125
+ </div>
126
+ </div>
127
+
128
+ <!-- Warning: 1-4h -->
129
+ <div v-if="riskCategories.warning.length">
130
+ <div class="mb-2 flex items-center gap-2">
131
+ <span class="inline-block h-2 w-2 rounded-full bg-amber-500"></span>
132
+ <span class="text-xs font-semibold uppercase tracking-wider text-amber-400"
133
+ >Warning (1-4h)</span
134
+ >
135
+ </div>
136
+ <div class="space-y-1">
137
+ <div
138
+ v-for="ticket in riskCategories.warning"
139
+ :key="ticket.id"
140
+ class="flex items-center justify-between rounded-lg bg-amber-500/5 px-3 py-2 border border-amber-500/10"
141
+ >
142
+ <div class="flex items-center gap-3">
143
+ <span class="font-mono text-xs text-amber-400">{{ ticket.reference }}</span>
144
+ <span class="truncate text-sm text-[var(--esc-panel-text-secondary)]">{{
145
+ ticket.subject
146
+ }}</span>
147
+ </div>
148
+ <span class="text-xs font-bold text-amber-400"
149
+ >{{ ticket.hours_remaining }}h remaining</span
150
+ >
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <!-- Watch: 4-8h -->
156
+ <div v-if="riskCategories.watch.length">
157
+ <div class="mb-2 flex items-center gap-2">
158
+ <span class="inline-block h-2 w-2 rounded-full bg-blue-500"></span>
159
+ <span class="text-xs font-semibold uppercase tracking-wider text-blue-400">Watch (4-8h)</span>
160
+ </div>
161
+ <div class="space-y-1">
162
+ <div
163
+ v-for="ticket in riskCategories.watch"
164
+ :key="ticket.id"
165
+ class="flex items-center justify-between rounded-lg bg-blue-500/5 px-3 py-2 border border-blue-500/10"
166
+ >
167
+ <div class="flex items-center gap-3">
168
+ <span class="font-mono text-xs text-blue-400">{{ ticket.reference }}</span>
169
+ <span class="truncate text-sm text-[var(--esc-panel-text-secondary)]">{{
170
+ ticket.subject
171
+ }}</span>
172
+ </div>
173
+ <span class="text-xs font-bold text-blue-400">{{ ticket.hours_remaining }}h remaining</span>
174
+ </div>
175
+ </div>
176
+ </div>
177
+ </div>
178
+ <div v-else class="py-6 text-center text-sm text-[var(--esc-panel-text-muted)]">
179
+ No tickets currently at risk of breaching SLA.
180
+ </div>
181
+ </div>
182
+ </EscalatedLayout>
183
+ </template>
@@ -0,0 +1,228 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { useForm, router } from '@inertiajs/vue3';
4
+ import { computed, ref } from 'vue';
5
+
6
+ /**
7
+ * Which database Escalated's own tables live on.
8
+ *
9
+ * Two things about this screen are deliberate and worth not undoing.
10
+ *
11
+ * It refuses a switch to a database with no Escalated tables. That case does
12
+ * not error at runtime — the panel simply comes up with no tickets, no
13
+ * departments and no settings, which reads exactly like data loss. The server
14
+ * refuses it, and the option is disabled here so the mistake is hard to make
15
+ * in the first place.
16
+ *
17
+ * And when `escalated.connection` is set in config or .env, the whole form is
18
+ * read-only. That value is deployed infrastructure; a web form must not be
19
+ * able to quietly disagree with it.
20
+ */
21
+ const props = defineProps({
22
+ connections: { type: Array, default: () => [] },
23
+ current: { type: String, default: null },
24
+ hostDefault: { type: String, default: null },
25
+ pinnedByConfig: { type: Boolean, default: false },
26
+ tablePrefix: { type: String, default: 'escalated_' },
27
+ });
28
+
29
+ const form = useForm({
30
+ connection: props.current ?? '',
31
+ });
32
+
33
+ const testing = ref(null);
34
+
35
+ const active = computed(() => props.connections.find((c) => c.is_current) ?? null);
36
+
37
+ const selected = computed(
38
+ () => props.connections.find((c) => c.name === (form.connection || props.hostDefault)) ?? null,
39
+ );
40
+
41
+ const isChanging = computed(() => (form.connection || null) !== (props.current || null));
42
+
43
+ function submit() {
44
+ if (props.pinnedByConfig) return;
45
+ form.post(route('escalated.admin.settings.database.update'), { preserveScroll: true });
46
+ }
47
+
48
+ function test(name) {
49
+ testing.value = name;
50
+
51
+ router.post(
52
+ route('escalated.admin.settings.database.test'),
53
+ { connection: name },
54
+ {
55
+ preserveScroll: true,
56
+ preserveState: false,
57
+ onFinish: () => {
58
+ testing.value = null;
59
+ },
60
+ },
61
+ );
62
+ }
63
+
64
+ function statusLabel(connection) {
65
+ if (!connection.reachable) return 'Unreachable';
66
+ if (!connection.migrated) return 'Not migrated';
67
+ return 'Ready';
68
+ }
69
+
70
+ function statusClass(connection) {
71
+ if (!connection.reachable) return 'text-[var(--esc-danger)]';
72
+ if (!connection.migrated) return 'text-[var(--esc-warning)]';
73
+ return 'text-[var(--esc-success)]';
74
+ }
75
+
76
+ function formatCount(value) {
77
+ return value === null || value === undefined ? null : value.toLocaleString();
78
+ }
79
+ </script>
80
+
81
+ <template>
82
+ <EscalatedLayout title="Database Connection">
83
+ <div class="mx-auto max-w-3xl space-y-6">
84
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6">
85
+ <h3 class="mb-1 text-sm font-semibold text-[var(--esc-panel-text)]">Current connection</h3>
86
+ <p class="mb-5 text-xs text-[var(--esc-panel-text-muted)]">
87
+ Where Escalated's own tables (<code>{{ tablePrefix }}*</code>) are read and written. Your users
88
+ table is not affected — it stays wherever your application keeps it.
89
+ </p>
90
+
91
+ <dl v-if="active" class="grid grid-cols-2 gap-x-6 gap-y-3 text-sm">
92
+ <dt class="text-[var(--esc-panel-text-muted)]">Connection</dt>
93
+ <dd class="font-medium text-[var(--esc-panel-text)]">
94
+ {{ active.name }}
95
+ <span v-if="active.is_host_default" class="text-xs text-[var(--esc-panel-text-muted)]">
96
+ (application default)
97
+ </span>
98
+ </dd>
99
+
100
+ <dt class="text-[var(--esc-panel-text-muted)]">Driver</dt>
101
+ <dd class="text-[var(--esc-panel-text-secondary)]">{{ active.driver ?? '—' }}</dd>
102
+
103
+ <dt class="text-[var(--esc-panel-text-muted)]">Database</dt>
104
+ <dd class="break-all text-[var(--esc-panel-text-secondary)]">{{ active.database ?? '—' }}</dd>
105
+
106
+ <dt class="text-[var(--esc-panel-text-muted)]">Tickets stored</dt>
107
+ <dd class="text-[var(--esc-panel-text-secondary)]">
108
+ {{ formatCount(active.ticket_count) ?? '—' }}
109
+ </dd>
110
+ </dl>
111
+ </div>
112
+
113
+ <div
114
+ v-if="pinnedByConfig"
115
+ class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface-alt)] p-4 text-sm text-[var(--esc-panel-text-secondary)]"
116
+ >
117
+ This connection is set in your application config (<code>escalated.connection</code> /
118
+ <code>ESCALATED_DB_CONNECTION</code>) and cannot be changed from here. Edit it where it is deployed, so
119
+ the panel and your configuration cannot disagree.
120
+ </div>
121
+
122
+ <form v-else class="space-y-6" @submit.prevent="submit">
123
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6">
124
+ <h3 class="mb-1 text-sm font-semibold text-[var(--esc-panel-text)]">Change connection</h3>
125
+ <p class="mb-5 text-xs text-[var(--esc-panel-text-muted)]">
126
+ Only connections already carrying Escalated's tables can be selected. Run the package migrations
127
+ against a database before pointing Escalated at it.
128
+ </p>
129
+
130
+ <div class="space-y-2">
131
+ <label
132
+ v-for="connection in connections"
133
+ :key="connection.name"
134
+ :class="[
135
+ 'flex items-start gap-3 rounded-lg border p-3 transition',
136
+ connection.migrated
137
+ ? 'cursor-pointer border-[var(--esc-panel-border)] hover:bg-[var(--esc-panel-surface-alt)]'
138
+ : 'cursor-not-allowed border-[var(--esc-panel-border)] opacity-60',
139
+ ]"
140
+ >
141
+ <input
142
+ v-model="form.connection"
143
+ type="radio"
144
+ :value="connection.is_host_default ? '' : connection.name"
145
+ :disabled="!connection.migrated"
146
+ class="mt-1"
147
+ />
148
+ <span class="min-w-0 flex-1">
149
+ <span class="flex flex-wrap items-center gap-2">
150
+ <span class="text-sm font-medium text-[var(--esc-panel-text)]">
151
+ {{ connection.name }}
152
+ </span>
153
+ <span
154
+ v-if="connection.is_host_default"
155
+ class="text-xs text-[var(--esc-panel-text-muted)]"
156
+ >
157
+ application default
158
+ </span>
159
+ <span :class="['text-xs font-medium', statusClass(connection)]">
160
+ {{ statusLabel(connection) }}
161
+ </span>
162
+ </span>
163
+ <span class="mt-0.5 block text-xs text-[var(--esc-panel-text-muted)]">
164
+ {{ connection.driver ?? 'unknown driver' }} ·
165
+ {{ connection.database ?? 'no database configured' }}
166
+ <template v-if="connection.ticket_count !== null">
167
+ · {{ formatCount(connection.ticket_count) }} tickets
168
+ </template>
169
+ </span>
170
+ <span
171
+ v-if="connection.error"
172
+ class="mt-1 block break-all text-xs text-[var(--esc-danger)]"
173
+ >
174
+ {{ connection.error }}
175
+ </span>
176
+ <span
177
+ v-else-if="!connection.migrated"
178
+ class="mt-1 block text-xs text-[var(--esc-panel-text-muted)]"
179
+ >
180
+ No Escalated tables here yet. Switching would show an empty panel, so it is
181
+ disabled.
182
+ </span>
183
+ </span>
184
+ <button
185
+ type="button"
186
+ class="shrink-0 rounded-md border border-[var(--esc-panel-border-input)] px-2 py-1 text-xs text-[var(--esc-panel-text-secondary)]"
187
+ :disabled="testing === connection.name"
188
+ @click.prevent="test(connection.name)"
189
+ >
190
+ {{ testing === connection.name ? 'Testing…' : 'Test' }}
191
+ </button>
192
+ </label>
193
+ </div>
194
+
195
+ <p v-if="form.errors.connection" class="mt-3 text-xs text-[var(--esc-danger)]">
196
+ {{ form.errors.connection }}
197
+ </p>
198
+ </div>
199
+
200
+ <div
201
+ v-if="isChanging"
202
+ class="rounded-xl border border-[var(--esc-warning)] bg-[var(--esc-panel-surface-alt)] p-4 text-sm text-[var(--esc-panel-text-secondary)]"
203
+ >
204
+ <p class="font-medium text-[var(--esc-panel-text)]">This does not move any data.</p>
205
+ <p class="mt-1 text-xs">
206
+ Escalated will start reading and writing
207
+ <strong>{{ selected?.name ?? hostDefault }}</strong
208
+ >, which currently holds
209
+ <strong>{{ formatCount(selected?.ticket_count) ?? 'an unknown number of' }}</strong> tickets.
210
+ The <strong>{{ formatCount(active?.ticket_count) ?? 'existing' }}</strong> tickets on
211
+ <strong>{{ active?.name }}</strong> stay where they are and will no longer be visible in the
212
+ panel.
213
+ </p>
214
+ </div>
215
+
216
+ <div class="flex justify-end">
217
+ <button
218
+ type="submit"
219
+ :disabled="form.processing || !isChanging"
220
+ class="rounded-lg bg-[var(--esc-accent)] px-4 py-2 text-sm font-medium text-white disabled:opacity-50"
221
+ >
222
+ {{ form.processing ? 'Saving…' : 'Use this connection' }}
223
+ </button>
224
+ </div>
225
+ </form>
226
+ </div>
227
+ </EscalatedLayout>
228
+ </template>