@escalated-dev/escalated 0.7.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.
- package/LICENSE +21 -21
- package/README.md +31 -0
- package/package.json +12 -6
- package/src/components/ActiveChatsPanel.vue +246 -0
- package/src/components/ActivityTimeline.stories.js +55 -55
- package/src/components/ActivityTimeline.vue +83 -83
- package/src/components/AdminDashboard.stories.js +1423 -1095
- package/src/components/AgentLoadIndicator.stories.js +37 -37
- package/src/components/AgentLoadIndicator.vue +49 -49
- package/src/components/AgentPerformanceCard.vue +44 -44
- package/src/components/ArticleEditor.vue +82 -82
- package/src/components/AssigneeSelect.vue +37 -37
- package/src/components/AttachmentList.vue +13 -1
- package/src/components/AuditLogEntry.vue +95 -95
- package/src/components/BulkActionBar.vue +166 -166
- package/src/components/CategoryTree.vue +89 -89
- package/src/components/ChartWidget.vue +46 -46
- package/src/components/ChatActionBar.vue +226 -0
- package/src/components/ChatBubble.vue +162 -0
- package/src/components/ChatComposer.vue +308 -0
- package/src/components/ChatQueue.vue +222 -0
- package/src/components/ChatThread.vue +197 -0
- package/src/components/CollisionWarning.stories.js +30 -30
- package/src/components/CollisionWarning.vue +68 -68
- package/src/components/ConditionalFieldRules.vue +135 -135
- package/src/components/ContextPanel.vue +66 -66
- package/src/components/ContextPanelSection.vue +65 -65
- package/src/components/CustomFieldRenderer.vue +159 -159
- package/src/components/EscalatedLayout.vue +29 -6
- package/src/components/FileDropzone.vue +57 -57
- package/src/components/FollowButton.stories.js +30 -30
- package/src/components/FollowButton.vue +88 -88
- package/src/components/KeyboardShortcutHelp.vue +213 -213
- package/src/components/KnowledgePanel.vue +122 -122
- package/src/components/KpiCard.stories.js +32 -32
- package/src/components/KpiCard.vue +88 -88
- package/src/components/MacroDropdown.vue +150 -150
- package/src/components/MentionDropdown.vue +154 -0
- package/src/components/MetricComparison.vue +89 -0
- package/src/components/PercentileChart.vue +67 -0
- package/src/components/PeriodSelector.vue +98 -0
- package/src/components/PermissionMatrix.vue +107 -107
- package/src/components/PinnedNotes.vue +129 -129
- package/src/components/PluginSlot.vue +68 -62
- package/src/components/PresenceIndicator.vue +46 -2
- package/src/components/PriorityBadge.stories.js +33 -33
- package/src/components/PriorityBadge.vue +46 -46
- package/src/components/ReplyComposer.vue +81 -18
- package/src/components/ReplyThread.vue +40 -2
- package/src/components/ReportChart.vue +395 -0
- package/src/components/ReportExportButton.vue +108 -0
- package/src/components/SatisfactionRating.vue +180 -180
- package/src/components/SaveViewDialog.vue +172 -0
- package/src/components/SavedViewSidebar.vue +208 -0
- package/src/components/ScheduleEditor.vue +104 -104
- package/src/components/SideConversation.vue +165 -165
- package/src/components/SideConversationList.vue +147 -147
- package/src/components/SkillTagManager.vue +79 -79
- package/src/components/SlaComplianceChart.vue +46 -53
- package/src/components/SlaTimer.stories.js +35 -35
- package/src/components/SlaTimer.vue +62 -62
- package/src/components/SnoozeButton.vue +247 -0
- package/src/components/StatsCard.stories.js +24 -24
- package/src/components/StatsCard.vue +58 -58
- package/src/components/StatusBadge.stories.js +53 -53
- package/src/components/StatusBadge.vue +78 -78
- package/src/components/TagSelect.vue +84 -84
- package/src/components/TicketFilters.vue +270 -225
- package/src/components/TicketLinkPanel.vue +193 -193
- package/src/components/TicketList.vue +655 -594
- package/src/components/TicketMergeDialog.vue +157 -157
- package/src/components/TicketSplitDialog.vue +98 -0
- package/src/components/TotpInput.stories.js +9 -9
- package/src/components/TotpInput.vue +81 -81
- package/src/components/TwoFactorSetup.vue +113 -113
- package/src/components/VariableTokenInput.vue +111 -0
- package/src/components/WorkflowActionConfig.vue +287 -0
- package/src/components/WorkflowActionList.vue +350 -0
- package/src/components/WorkflowConditionBuilder.vue +265 -0
- package/src/components/WorkflowTriggerSelector.vue +125 -0
- package/src/composables/useChat.js +187 -0
- package/src/composables/useI18n.js +80 -80
- package/src/composables/useKeyboardShortcuts.js +46 -46
- package/src/composables/useMentions.js +134 -0
- package/src/composables/usePluginExtensions.js +159 -159
- package/src/composables/usePluginHooks.js +65 -65
- package/src/composables/useRealtime.js +182 -0
- package/src/defineEscalatedPlugin.js +76 -76
- package/src/index.js +84 -72
- package/src/locales/ar.json +727 -0
- package/src/locales/de.json +678 -430
- package/src/locales/en.json +717 -455
- package/src/locales/es.json +679 -430
- package/src/locales/fr.json +680 -431
- package/src/locales/index.js +12 -2
- package/src/locales/it.json +727 -0
- package/src/locales/ja.json +727 -0
- package/src/locales/ko.json +727 -0
- package/src/locales/nl.json +727 -0
- package/src/locales/pl.json +727 -0
- package/src/locales/pt-BR.json +727 -0
- package/src/locales/ru.json +727 -0
- package/src/locales/tr.json +727 -0
- package/src/locales/zh-CN.json +727 -0
- package/src/pages/Admin/ApiTokens/Index.vue +381 -381
- package/src/pages/Admin/AuditLog/Index.vue +154 -154
- package/src/pages/Admin/BusinessHours/Form.vue +172 -172
- package/src/pages/Admin/BusinessHours/Index.vue +113 -113
- package/src/pages/Admin/CannedResponses/Index.vue +127 -127
- package/src/pages/Admin/Capacity/Index.vue +134 -134
- package/src/pages/Admin/CustomFields/Form.vue +195 -195
- package/src/pages/Admin/CustomFields/Index.vue +134 -134
- package/src/pages/Admin/CustomObjects/Form.vue +202 -202
- package/src/pages/Admin/CustomObjects/Index.vue +127 -127
- package/src/pages/Admin/CustomObjects/Records.vue +228 -228
- package/src/pages/Admin/Departments/Form.vue +75 -75
- package/src/pages/Admin/Departments/Index.vue +110 -109
- package/src/pages/Admin/EscalationRules/Form.vue +157 -157
- package/src/pages/Admin/EscalationRules/Index.vue +178 -178
- package/src/pages/Admin/Import/Connect.vue +0 -1
- package/src/pages/Admin/Import/Index.vue +1 -1
- package/src/pages/Admin/Import/Progress.vue +1 -1
- package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
- package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
- package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
- package/src/pages/Admin/Macros/Index.vue +448 -448
- package/src/pages/Admin/Plugins/Index.vue +327 -327
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
- package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
- package/src/pages/Admin/Reports/Cohorts.vue +180 -0
- package/src/pages/Admin/Reports/Comparison.vue +141 -0
- package/src/pages/Admin/Reports/CsatReport.vue +127 -127
- package/src/pages/Admin/Reports/Dashboard.vue +36 -21
- package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
- package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
- package/src/pages/Admin/Reports/SlaReport.vue +162 -166
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
- package/src/pages/Admin/Reports.vue +206 -206
- package/src/pages/Admin/Roles/Form.vue +71 -71
- package/src/pages/Admin/Roles/Index.vue +122 -122
- package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
- package/src/pages/Admin/Settings/DataRetention.vue +182 -182
- package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
- package/src/pages/Admin/Settings/Sandbox.vue +135 -135
- package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
- package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
- package/src/pages/Admin/Settings.vue +1008 -468
- package/src/pages/Admin/Skills/Form.vue +53 -53
- package/src/pages/Admin/Skills/Index.vue +94 -94
- package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
- package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
- package/src/pages/Admin/Statuses/Form.vue +114 -114
- package/src/pages/Admin/Statuses/Index.vue +153 -153
- package/src/pages/Admin/Tags/Index.vue +191 -191
- package/src/pages/Admin/Tickets/Index.vue +126 -91
- package/src/pages/Admin/Tickets/Show.vue +29 -0
- package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
- package/src/pages/Admin/Webhooks/Form.vue +110 -110
- package/src/pages/Admin/Webhooks/Index.vue +136 -136
- package/src/pages/Admin/Workflows/Builder.vue +207 -0
- package/src/pages/Admin/Workflows/Index.vue +235 -0
- package/src/pages/Admin/Workflows/Logs.vue +286 -0
- package/src/pages/Agent/TicketIndex.vue +112 -88
- package/src/pages/Agent/TicketShow.vue +192 -60
- package/src/pages/Customer/Create.vue +1 -1
- package/src/pages/Customer/Index.vue +31 -31
- package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
- package/src/pages/Customer/Show.vue +69 -63
- package/src/pages/Guest/Create.vue +40 -15
- package/src/pages/Guest/Show.vue +124 -93
- package/src/plugin.js +25 -0
- package/src/utils/mentionHighlight.js +24 -0
- package/src/utils/sanitizeHtml.js +78 -64
- package/src/widget/EscalatedWidget.vue +804 -0
- package/src/widget/index.js +254 -0
- package/src/pages/Admin/Automations/Form.vue +0 -184
- package/src/pages/Admin/Automations/Index.vue +0 -129
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import EscalatedLayout from '../../../../components/EscalatedLayout.vue';
|
|
3
|
-
import CategoryTree from '../../../../components/CategoryTree.vue';
|
|
4
|
-
import { useForm, router } from '@inertiajs/vue3';
|
|
5
|
-
import { ref, computed } from 'vue';
|
|
6
|
-
|
|
7
|
-
const props = defineProps({
|
|
8
|
-
categories: Array,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
const showForm = ref(false);
|
|
12
|
-
const editing = ref(null);
|
|
13
|
-
|
|
14
|
-
const form = useForm({
|
|
15
|
-
name: '',
|
|
16
|
-
slug: '',
|
|
17
|
-
parent_id: '',
|
|
18
|
-
position: 0,
|
|
19
|
-
description: '',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const isEditing = computed(() => !!editing.value);
|
|
23
|
-
|
|
24
|
-
function openCreate() {
|
|
25
|
-
editing.value = null;
|
|
26
|
-
form.reset();
|
|
27
|
-
showForm.value = true;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function openEdit(category) {
|
|
31
|
-
editing.value = category;
|
|
32
|
-
form.name = category.name;
|
|
33
|
-
form.slug = category.slug;
|
|
34
|
-
form.parent_id = category.parent_id || '';
|
|
35
|
-
form.position = category.position || 0;
|
|
36
|
-
form.description = category.description || '';
|
|
37
|
-
showForm.value = true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function submit() {
|
|
41
|
-
if (isEditing.value) {
|
|
42
|
-
form.put(route('escalated.admin.kb-categories.update', editing.value.id), {
|
|
43
|
-
onSuccess: () => {
|
|
44
|
-
showForm.value = false;
|
|
45
|
-
form.reset();
|
|
46
|
-
editing.value = null;
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
} else {
|
|
50
|
-
form.post(route('escalated.admin.kb-categories.store'), {
|
|
51
|
-
onSuccess: () => {
|
|
52
|
-
showForm.value = false;
|
|
53
|
-
form.reset();
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function deleteCategory(category) {
|
|
60
|
-
if (confirm(`Delete category "${category.name}"?`)) {
|
|
61
|
-
router.delete(route('escalated.admin.kb-categories.destroy', category.id));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const parentOptions = computed(() => {
|
|
66
|
-
if (!editing.value) return props.categories;
|
|
67
|
-
return props.categories.filter((c) => c.id !== editing.value.id);
|
|
68
|
-
});
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
<template>
|
|
72
|
-
<EscalatedLayout title="Knowledge Base — Categories">
|
|
73
|
-
<div class="mb-6 flex items-center justify-between">
|
|
74
|
-
<p class="text-sm text-[var(--esc-panel-text-muted)]">
|
|
75
|
-
Organize your knowledge base articles into categories.
|
|
76
|
-
</p>
|
|
77
|
-
<button
|
|
78
|
-
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-opacity hover:opacity-90"
|
|
79
|
-
@click="openCreate"
|
|
80
|
-
>
|
|
81
|
-
New Category
|
|
82
|
-
</button>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<!-- Inline form -->
|
|
86
|
-
<div
|
|
87
|
-
v-if="showForm"
|
|
88
|
-
class="mb-6 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5"
|
|
89
|
-
>
|
|
90
|
-
<h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">
|
|
91
|
-
{{ isEditing ? 'Edit Category' : 'New Category' }}
|
|
92
|
-
</h3>
|
|
93
|
-
<form class="space-y-4" @submit.prevent="submit">
|
|
94
|
-
<div class="grid grid-cols-2 gap-4">
|
|
95
|
-
<div>
|
|
96
|
-
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]">Name</label>
|
|
97
|
-
<input
|
|
98
|
-
v-model="form.name"
|
|
99
|
-
type="text"
|
|
100
|
-
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
101
|
-
placeholder="Category name"
|
|
102
|
-
/>
|
|
103
|
-
<p v-if="form.errors.name" class="mt-1 text-xs text-red-400">{{ form.errors.name }}</p>
|
|
104
|
-
</div>
|
|
105
|
-
<div>
|
|
106
|
-
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]">Slug</label>
|
|
107
|
-
<input
|
|
108
|
-
v-model="form.slug"
|
|
109
|
-
type="text"
|
|
110
|
-
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
111
|
-
placeholder="auto-generated-if-empty"
|
|
112
|
-
/>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
<div class="grid grid-cols-2 gap-4">
|
|
116
|
-
<div>
|
|
117
|
-
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]"
|
|
118
|
-
>Parent Category</label
|
|
119
|
-
>
|
|
120
|
-
<select
|
|
121
|
-
v-model="form.parent_id"
|
|
122
|
-
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
123
|
-
>
|
|
124
|
-
<option value="">None (Root)</option>
|
|
125
|
-
<option v-for="cat in parentOptions" :key="cat.id" :value="cat.id">{{ cat.name }}</option>
|
|
126
|
-
</select>
|
|
127
|
-
</div>
|
|
128
|
-
<div>
|
|
129
|
-
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]"
|
|
130
|
-
>Position</label
|
|
131
|
-
>
|
|
132
|
-
<input
|
|
133
|
-
v-model.number="form.position"
|
|
134
|
-
type="number"
|
|
135
|
-
min="0"
|
|
136
|
-
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
137
|
-
/>
|
|
138
|
-
</div>
|
|
139
|
-
</div>
|
|
140
|
-
<div>
|
|
141
|
-
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]"
|
|
142
|
-
>Description</label
|
|
143
|
-
>
|
|
144
|
-
<textarea
|
|
145
|
-
v-model="form.description"
|
|
146
|
-
rows="2"
|
|
147
|
-
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
148
|
-
placeholder="Optional description..."
|
|
149
|
-
></textarea>
|
|
150
|
-
</div>
|
|
151
|
-
<div class="flex items-center gap-3">
|
|
152
|
-
<button
|
|
153
|
-
type="submit"
|
|
154
|
-
:disabled="form.processing"
|
|
155
|
-
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-opacity hover:opacity-90 disabled:opacity-50"
|
|
156
|
-
>
|
|
157
|
-
{{ isEditing ? 'Update' : 'Create' }}
|
|
158
|
-
</button>
|
|
159
|
-
<button
|
|
160
|
-
type="button"
|
|
161
|
-
class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
|
|
162
|
-
@click="showForm = false"
|
|
163
|
-
>
|
|
164
|
-
Cancel
|
|
165
|
-
</button>
|
|
166
|
-
</div>
|
|
167
|
-
</form>
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
<!-- Category Tree -->
|
|
171
|
-
<CategoryTree :categories="categories" @edit="openEdit" @delete="deleteCategory" />
|
|
172
|
-
|
|
173
|
-
<div
|
|
174
|
-
v-if="!categories?.length && !showForm"
|
|
175
|
-
class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] py-12 text-center"
|
|
176
|
-
>
|
|
177
|
-
<svg
|
|
178
|
-
class="mx-auto mb-3 h-10 w-10 text-[var(--esc-panel-text-muted)]"
|
|
179
|
-
fill="none"
|
|
180
|
-
stroke="currentColor"
|
|
181
|
-
stroke-width="1.5"
|
|
182
|
-
viewBox="0 0 24 24"
|
|
183
|
-
>
|
|
184
|
-
<path
|
|
185
|
-
stroke-linecap="round"
|
|
186
|
-
stroke-linejoin="round"
|
|
187
|
-
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
|
188
|
-
/>
|
|
189
|
-
</svg>
|
|
190
|
-
<p class="text-sm text-[var(--esc-panel-text-muted)]">No categories yet. Create one to get started.</p>
|
|
191
|
-
</div>
|
|
192
|
-
</EscalatedLayout>
|
|
193
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../../../components/EscalatedLayout.vue';
|
|
3
|
+
import CategoryTree from '../../../../components/CategoryTree.vue';
|
|
4
|
+
import { useForm, router } from '@inertiajs/vue3';
|
|
5
|
+
import { ref, computed } from 'vue';
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
categories: Array,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const showForm = ref(false);
|
|
12
|
+
const editing = ref(null);
|
|
13
|
+
|
|
14
|
+
const form = useForm({
|
|
15
|
+
name: '',
|
|
16
|
+
slug: '',
|
|
17
|
+
parent_id: '',
|
|
18
|
+
position: 0,
|
|
19
|
+
description: '',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const isEditing = computed(() => !!editing.value);
|
|
23
|
+
|
|
24
|
+
function openCreate() {
|
|
25
|
+
editing.value = null;
|
|
26
|
+
form.reset();
|
|
27
|
+
showForm.value = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function openEdit(category) {
|
|
31
|
+
editing.value = category;
|
|
32
|
+
form.name = category.name;
|
|
33
|
+
form.slug = category.slug;
|
|
34
|
+
form.parent_id = category.parent_id || '';
|
|
35
|
+
form.position = category.position || 0;
|
|
36
|
+
form.description = category.description || '';
|
|
37
|
+
showForm.value = true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function submit() {
|
|
41
|
+
if (isEditing.value) {
|
|
42
|
+
form.put(route('escalated.admin.kb-categories.update', editing.value.id), {
|
|
43
|
+
onSuccess: () => {
|
|
44
|
+
showForm.value = false;
|
|
45
|
+
form.reset();
|
|
46
|
+
editing.value = null;
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
form.post(route('escalated.admin.kb-categories.store'), {
|
|
51
|
+
onSuccess: () => {
|
|
52
|
+
showForm.value = false;
|
|
53
|
+
form.reset();
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function deleteCategory(category) {
|
|
60
|
+
if (confirm(`Delete category "${category.name}"?`)) {
|
|
61
|
+
router.delete(route('escalated.admin.kb-categories.destroy', category.id));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const parentOptions = computed(() => {
|
|
66
|
+
if (!editing.value) return props.categories;
|
|
67
|
+
return props.categories.filter((c) => c.id !== editing.value.id);
|
|
68
|
+
});
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<template>
|
|
72
|
+
<EscalatedLayout title="Knowledge Base — Categories">
|
|
73
|
+
<div class="mb-6 flex items-center justify-between">
|
|
74
|
+
<p class="text-sm text-[var(--esc-panel-text-muted)]">
|
|
75
|
+
Organize your knowledge base articles into categories.
|
|
76
|
+
</p>
|
|
77
|
+
<button
|
|
78
|
+
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-opacity hover:opacity-90"
|
|
79
|
+
@click="openCreate"
|
|
80
|
+
>
|
|
81
|
+
New Category
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<!-- Inline form -->
|
|
86
|
+
<div
|
|
87
|
+
v-if="showForm"
|
|
88
|
+
class="mb-6 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-5"
|
|
89
|
+
>
|
|
90
|
+
<h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">
|
|
91
|
+
{{ isEditing ? 'Edit Category' : 'New Category' }}
|
|
92
|
+
</h3>
|
|
93
|
+
<form class="space-y-4" @submit.prevent="submit">
|
|
94
|
+
<div class="grid grid-cols-2 gap-4">
|
|
95
|
+
<div>
|
|
96
|
+
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]">Name</label>
|
|
97
|
+
<input
|
|
98
|
+
v-model="form.name"
|
|
99
|
+
type="text"
|
|
100
|
+
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
101
|
+
placeholder="Category name"
|
|
102
|
+
/>
|
|
103
|
+
<p v-if="form.errors.name" class="mt-1 text-xs text-red-400">{{ form.errors.name }}</p>
|
|
104
|
+
</div>
|
|
105
|
+
<div>
|
|
106
|
+
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]">Slug</label>
|
|
107
|
+
<input
|
|
108
|
+
v-model="form.slug"
|
|
109
|
+
type="text"
|
|
110
|
+
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
111
|
+
placeholder="auto-generated-if-empty"
|
|
112
|
+
/>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="grid grid-cols-2 gap-4">
|
|
116
|
+
<div>
|
|
117
|
+
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]"
|
|
118
|
+
>Parent Category</label
|
|
119
|
+
>
|
|
120
|
+
<select
|
|
121
|
+
v-model="form.parent_id"
|
|
122
|
+
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
123
|
+
>
|
|
124
|
+
<option value="">None (Root)</option>
|
|
125
|
+
<option v-for="cat in parentOptions" :key="cat.id" :value="cat.id">{{ cat.name }}</option>
|
|
126
|
+
</select>
|
|
127
|
+
</div>
|
|
128
|
+
<div>
|
|
129
|
+
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]"
|
|
130
|
+
>Position</label
|
|
131
|
+
>
|
|
132
|
+
<input
|
|
133
|
+
v-model.number="form.position"
|
|
134
|
+
type="number"
|
|
135
|
+
min="0"
|
|
136
|
+
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
<div>
|
|
141
|
+
<label class="mb-1 block text-xs font-medium text-[var(--esc-panel-text-tertiary)]"
|
|
142
|
+
>Description</label
|
|
143
|
+
>
|
|
144
|
+
<textarea
|
|
145
|
+
v-model="form.description"
|
|
146
|
+
rows="2"
|
|
147
|
+
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40"
|
|
148
|
+
placeholder="Optional description..."
|
|
149
|
+
></textarea>
|
|
150
|
+
</div>
|
|
151
|
+
<div class="flex items-center gap-3">
|
|
152
|
+
<button
|
|
153
|
+
type="submit"
|
|
154
|
+
:disabled="form.processing"
|
|
155
|
+
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-opacity hover:opacity-90 disabled:opacity-50"
|
|
156
|
+
>
|
|
157
|
+
{{ isEditing ? 'Update' : 'Create' }}
|
|
158
|
+
</button>
|
|
159
|
+
<button
|
|
160
|
+
type="button"
|
|
161
|
+
class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
|
|
162
|
+
@click="showForm = false"
|
|
163
|
+
>
|
|
164
|
+
Cancel
|
|
165
|
+
</button>
|
|
166
|
+
</div>
|
|
167
|
+
</form>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<!-- Category Tree -->
|
|
171
|
+
<CategoryTree :categories="categories" @edit="openEdit" @delete="deleteCategory" />
|
|
172
|
+
|
|
173
|
+
<div
|
|
174
|
+
v-if="!categories?.length && !showForm"
|
|
175
|
+
class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] py-12 text-center"
|
|
176
|
+
>
|
|
177
|
+
<svg
|
|
178
|
+
class="mx-auto mb-3 h-10 w-10 text-[var(--esc-panel-text-muted)]"
|
|
179
|
+
fill="none"
|
|
180
|
+
stroke="currentColor"
|
|
181
|
+
stroke-width="1.5"
|
|
182
|
+
viewBox="0 0 24 24"
|
|
183
|
+
>
|
|
184
|
+
<path
|
|
185
|
+
stroke-linecap="round"
|
|
186
|
+
stroke-linejoin="round"
|
|
187
|
+
d="M2.25 12.75V12A2.25 2.25 0 014.5 9.75h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z"
|
|
188
|
+
/>
|
|
189
|
+
</svg>
|
|
190
|
+
<p class="text-sm text-[var(--esc-panel-text-muted)]">No categories yet. Create one to get started.</p>
|
|
191
|
+
</div>
|
|
192
|
+
</EscalatedLayout>
|
|
193
|
+
</template>
|