@escalated-dev/escalated 0.3.5 → 0.5.0

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 (32) hide show
  1. package/README.md +35 -1
  2. package/package.json +9 -2
  3. package/src/components/BulkActionBar.vue +97 -0
  4. package/src/components/EscalatedLayout.vue +244 -219
  5. package/src/components/FollowButton.vue +63 -0
  6. package/src/components/KeyboardShortcutHelp.vue +123 -0
  7. package/src/components/MacroDropdown.vue +90 -0
  8. package/src/components/PinnedNotes.vue +87 -0
  9. package/src/components/PluginSlot.vue +62 -0
  10. package/src/components/PresenceIndicator.vue +103 -0
  11. package/src/components/QuickFilters.vue +49 -0
  12. package/src/components/ReplyThread.vue +60 -38
  13. package/src/components/SatisfactionRating.vue +128 -0
  14. package/src/components/TicketFilters.vue +69 -58
  15. package/src/components/TicketList.vue +193 -94
  16. package/src/components/TicketSidebar.vue +99 -77
  17. package/src/composables/useKeyboardShortcuts.js +46 -0
  18. package/src/composables/usePluginExtensions.js +67 -0
  19. package/src/defineEscalatedPlugin.js +50 -0
  20. package/src/index.js +16 -0
  21. package/src/pages/Admin/ApiTokens/Index.vue +217 -0
  22. package/src/pages/Admin/Macros/Index.vue +287 -0
  23. package/src/pages/Admin/Plugins/Index.vue +197 -0
  24. package/src/pages/Admin/Plugins.vue +129 -0
  25. package/src/pages/Admin/Reports.vue +101 -66
  26. package/src/pages/Admin/Tickets/Index.vue +39 -22
  27. package/src/pages/Admin/Tickets/Show.vue +156 -109
  28. package/src/pages/Agent/Dashboard.vue +186 -63
  29. package/src/pages/Agent/TicketIndex.vue +38 -21
  30. package/src/pages/Agent/TicketShow.vue +155 -108
  31. package/src/pages/Customer/Show.vue +63 -55
  32. package/src/pages/Guest/Show.vue +93 -86
@@ -0,0 +1,287 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { useForm, router } from '@inertiajs/vue3';
4
+ import { ref, computed } from 'vue';
5
+
6
+ defineProps({ macros: Array });
7
+
8
+ const showForm = ref(false);
9
+ const editingMacro = ref(null);
10
+
11
+ const form = useForm({
12
+ name: '',
13
+ description: '',
14
+ is_shared: false,
15
+ actions: [],
16
+ });
17
+
18
+ const actionTypes = [
19
+ { value: 'status', label: 'Set Status' },
20
+ { value: 'priority', label: 'Set Priority' },
21
+ { value: 'assign', label: 'Assign To' },
22
+ { value: 'tags', label: 'Add Tags' },
23
+ { value: 'department', label: 'Move to Department' },
24
+ { value: 'reply', label: 'Send Reply' },
25
+ { value: 'note', label: 'Add Internal Note' },
26
+ ];
27
+
28
+ const statusOptions = ['open', 'in_progress', 'waiting_on_customer', 'resolved', 'closed'];
29
+ const priorityOptions = ['low', 'medium', 'high', 'urgent', 'critical'];
30
+
31
+ function addAction() {
32
+ form.actions.push({ type: 'status', value: '', order: form.actions.length });
33
+ }
34
+
35
+ function removeAction(index) {
36
+ form.actions.splice(index, 1);
37
+ form.actions.forEach((a, i) => { a.order = i; });
38
+ }
39
+
40
+ function moveAction(index, direction) {
41
+ const newIndex = index + direction;
42
+ if (newIndex < 0 || newIndex >= form.actions.length) return;
43
+ const temp = form.actions[index];
44
+ form.actions[index] = form.actions[newIndex];
45
+ form.actions[newIndex] = temp;
46
+ form.actions.forEach((a, i) => { a.order = i; });
47
+ }
48
+
49
+ function create() {
50
+ form.post(route('escalated.admin.macros.store'), {
51
+ onSuccess: () => { form.reset(); showForm.value = false; },
52
+ });
53
+ }
54
+
55
+ function startEdit(macro) {
56
+ editingMacro.value = macro.id;
57
+ form.name = macro.name;
58
+ form.description = macro.description || '';
59
+ form.is_shared = macro.is_shared || false;
60
+ form.actions = (macro.actions || []).map((a, i) => ({
61
+ type: a.type,
62
+ value: a.value || '',
63
+ order: a.order ?? i,
64
+ }));
65
+ showForm.value = true;
66
+ }
67
+
68
+ function update() {
69
+ form.put(route('escalated.admin.macros.update', editingMacro.value), {
70
+ onSuccess: () => { editingMacro.value = null; form.reset(); showForm.value = false; },
71
+ });
72
+ }
73
+
74
+ function destroy(id) {
75
+ if (confirm('Delete this macro? This cannot be undone.')) {
76
+ router.delete(route('escalated.admin.macros.destroy', id));
77
+ }
78
+ }
79
+
80
+ function cancelEdit() {
81
+ editingMacro.value = null;
82
+ form.reset();
83
+ showForm.value = false;
84
+ }
85
+
86
+ function handleSubmit() {
87
+ if (editingMacro.value) {
88
+ update();
89
+ } else {
90
+ create();
91
+ }
92
+ }
93
+
94
+ const inputClass = 'w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 placeholder-neutral-600 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10';
95
+ const selectClass = 'rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10';
96
+ </script>
97
+
98
+ <template>
99
+ <EscalatedLayout title="Macros">
100
+ <!-- Top bar -->
101
+ <div class="mb-4 flex items-center justify-between">
102
+ <p class="text-sm text-neutral-500">
103
+ Macros automate repetitive actions on tickets.
104
+ </p>
105
+ <button @click="showForm ? cancelEdit() : (showForm = true)"
106
+ :class="showForm
107
+ ? 'rounded-lg border border-white/10 bg-white/[0.03] px-4 py-2 text-sm font-medium text-neutral-300 transition-colors hover:bg-white/[0.06]'
108
+ : 'rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-4 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400'">
109
+ {{ showForm ? 'Cancel' : 'Create Macro' }}
110
+ </button>
111
+ </div>
112
+
113
+ <!-- Create/Edit form -->
114
+ <form v-if="showForm" @submit.prevent="handleSubmit" class="mb-6 space-y-4 rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
115
+ <div class="grid grid-cols-2 gap-4">
116
+ <div>
117
+ <label class="mb-1 block text-sm font-medium text-neutral-300">Name</label>
118
+ <input v-model="form.name" type="text" required placeholder="e.g., Close & Thank"
119
+ :class="inputClass" />
120
+ </div>
121
+ <div>
122
+ <label class="mb-1 block text-sm font-medium text-neutral-300">Description</label>
123
+ <input v-model="form.description" type="text" placeholder="Optional description"
124
+ :class="inputClass" />
125
+ </div>
126
+ </div>
127
+
128
+ <div class="flex items-center gap-3">
129
+ <label class="flex items-center gap-2">
130
+ <input v-model="form.is_shared" type="checkbox"
131
+ class="rounded border-white/20 bg-neutral-900 text-cyan-500 focus:ring-white/10" />
132
+ <span class="text-sm text-neutral-300">Shared with all agents</span>
133
+ </label>
134
+ </div>
135
+
136
+ <!-- Action builder -->
137
+ <div>
138
+ <div class="mb-2 flex items-center justify-between">
139
+ <label class="text-sm font-medium text-neutral-300">Actions</label>
140
+ <button type="button" @click="addAction"
141
+ class="rounded-lg border border-white/10 bg-white/[0.03] px-3 py-1.5 text-xs font-medium text-neutral-400 transition-colors hover:bg-white/[0.06] hover:text-neutral-200">
142
+ + Add Action
143
+ </button>
144
+ </div>
145
+
146
+ <div v-if="!form.actions.length" class="rounded-lg border border-dashed border-white/10 px-4 py-6 text-center">
147
+ <p class="text-sm text-neutral-600">No actions yet. Add actions to define what this macro does.</p>
148
+ </div>
149
+
150
+ <div v-else class="space-y-2">
151
+ <div v-for="(action, index) in form.actions" :key="index"
152
+ class="flex items-center gap-2 rounded-lg border border-white/[0.06] bg-white/[0.02] p-3">
153
+ <!-- Order controls -->
154
+ <div class="flex flex-col gap-0.5">
155
+ <button type="button" @click="moveAction(index, -1)"
156
+ :disabled="index === 0"
157
+ class="rounded p-0.5 text-neutral-600 transition-colors hover:bg-white/[0.06] hover:text-neutral-400 disabled:opacity-30">
158
+ <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
159
+ <path stroke-linecap="round" stroke-linejoin="round" d="M4.5 15.75l7.5-7.5 7.5 7.5" />
160
+ </svg>
161
+ </button>
162
+ <button type="button" @click="moveAction(index, 1)"
163
+ :disabled="index === form.actions.length - 1"
164
+ class="rounded p-0.5 text-neutral-600 transition-colors hover:bg-white/[0.06] hover:text-neutral-400 disabled:opacity-30">
165
+ <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
166
+ <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
167
+ </svg>
168
+ </button>
169
+ </div>
170
+
171
+ <!-- Action number -->
172
+ <span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-white/[0.06] text-xs font-semibold text-neutral-500">
173
+ {{ index + 1 }}
174
+ </span>
175
+
176
+ <!-- Type dropdown -->
177
+ <select v-model="action.type" :class="selectClass">
178
+ <option v-for="at in actionTypes" :key="at.value" :value="at.value">{{ at.label }}</option>
179
+ </select>
180
+
181
+ <!-- Value input (context-dependent) -->
182
+ <select v-if="action.type === 'status'" v-model="action.value" :class="[selectClass, 'flex-1']">
183
+ <option value="">Select status...</option>
184
+ <option v-for="s in statusOptions" :key="s" :value="s">{{ s.replace(/_/g, ' ') }}</option>
185
+ </select>
186
+
187
+ <select v-else-if="action.type === 'priority'" v-model="action.value" :class="[selectClass, 'flex-1']">
188
+ <option value="">Select priority...</option>
189
+ <option v-for="p in priorityOptions" :key="p" :value="p">{{ p }}</option>
190
+ </select>
191
+
192
+ <input v-else-if="action.type === 'assign'" v-model="action.value" type="text"
193
+ placeholder="Agent ID or email"
194
+ :class="[inputClass, 'flex-1']" />
195
+
196
+ <input v-else-if="action.type === 'tags'" v-model="action.value" type="text"
197
+ placeholder="Comma-separated tag names"
198
+ :class="[inputClass, 'flex-1']" />
199
+
200
+ <input v-else-if="action.type === 'department'" v-model="action.value" type="text"
201
+ placeholder="Department ID or name"
202
+ :class="[inputClass, 'flex-1']" />
203
+
204
+ <textarea v-else-if="action.type === 'reply' || action.type === 'note'"
205
+ v-model="action.value" rows="2"
206
+ :placeholder="action.type === 'reply' ? 'Reply message...' : 'Note content...'"
207
+ :class="[inputClass, 'flex-1']">
208
+ </textarea>
209
+
210
+ <input v-else v-model="action.value" type="text" placeholder="Value"
211
+ :class="[inputClass, 'flex-1']" />
212
+
213
+ <!-- Remove -->
214
+ <button type="button" @click="removeAction(index)"
215
+ class="shrink-0 rounded-lg p-1.5 text-neutral-600 transition-colors hover:bg-rose-500/10 hover:text-rose-400">
216
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
217
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
218
+ </svg>
219
+ </button>
220
+ </div>
221
+ </div>
222
+ </div>
223
+
224
+ <!-- Submit -->
225
+ <div class="flex justify-end">
226
+ <button type="submit" :disabled="form.processing"
227
+ class="rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-5 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400 disabled:opacity-50">
228
+ {{ editingMacro ? 'Update Macro' : 'Create Macro' }}
229
+ </button>
230
+ </div>
231
+ </form>
232
+
233
+ <!-- Macros table -->
234
+ <div class="overflow-hidden rounded-xl border border-white/[0.06] bg-neutral-900/60">
235
+ <table class="min-w-full divide-y divide-white/[0.06]">
236
+ <thead>
237
+ <tr class="bg-white/[0.02]">
238
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Name</th>
239
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Description</th>
240
+ <th class="px-4 py-3 text-center text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Actions</th>
241
+ <th class="px-4 py-3 text-center text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Shared</th>
242
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Creator</th>
243
+ <th class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-neutral-500"></th>
244
+ </tr>
245
+ </thead>
246
+ <tbody class="divide-y divide-white/[0.04]">
247
+ <tr v-if="!macros?.length">
248
+ <td colspan="6" class="px-4 py-12 text-center">
249
+ <svg class="mx-auto mb-3 h-8 w-8 text-neutral-700" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
250
+ <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z" />
251
+ </svg>
252
+ <p class="text-sm text-neutral-500">No macros yet</p>
253
+ <p class="mt-1 text-xs text-neutral-600">Create macros to automate repetitive ticket actions</p>
254
+ </td>
255
+ </tr>
256
+ <tr v-for="macro in macros" :key="macro.id" class="transition-colors hover:bg-white/[0.03]">
257
+ <td class="px-4 py-3">
258
+ <span class="text-sm font-medium text-neutral-200">{{ macro.name }}</span>
259
+ </td>
260
+ <td class="px-4 py-3">
261
+ <span class="text-sm text-neutral-400">{{ macro.description || '--' }}</span>
262
+ </td>
263
+ <td class="px-4 py-3 text-center">
264
+ <span class="inline-flex items-center rounded-full bg-white/[0.06] px-2 py-0.5 text-xs font-medium text-neutral-400 ring-1 ring-white/[0.06]">
265
+ {{ macro.actions?.length || 0 }}
266
+ </span>
267
+ </td>
268
+ <td class="px-4 py-3 text-center">
269
+ <span v-if="macro.is_shared"
270
+ class="inline-flex items-center rounded-full bg-cyan-500/10 px-2 py-0.5 text-xs font-medium text-cyan-400 ring-1 ring-cyan-500/20">
271
+ Shared
272
+ </span>
273
+ <span v-else class="text-xs text-neutral-600">Private</span>
274
+ </td>
275
+ <td class="px-4 py-3 text-sm text-neutral-400">
276
+ {{ macro.creator?.name || macro.user?.name || '--' }}
277
+ </td>
278
+ <td class="px-4 py-3 text-right text-sm">
279
+ <button @click="startEdit(macro)" class="text-neutral-300 hover:text-white">Edit</button>
280
+ <button @click="destroy(macro.id)" class="ml-3 text-rose-400 hover:text-rose-300">Delete</button>
281
+ </td>
282
+ </tr>
283
+ </tbody>
284
+ </table>
285
+ </div>
286
+ </EscalatedLayout>
287
+ </template>
@@ -0,0 +1,197 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { router } from '@inertiajs/vue3';
4
+ import { ref, computed } from 'vue';
5
+
6
+ const props = defineProps({
7
+ plugins: { type: Array, default: () => [] },
8
+ });
9
+
10
+ const confirmingDelete = ref(null);
11
+ const uploading = ref(false);
12
+ const fileInput = ref(null);
13
+
14
+ const activePlugins = computed(() => props.plugins.filter(p => p.active));
15
+ const inactivePlugins = computed(() => props.plugins.filter(p => !p.active));
16
+
17
+ function togglePlugin(plugin) {
18
+ router.post(route('escalated.admin.plugins.toggle', plugin.id), {}, {
19
+ preserveScroll: true,
20
+ });
21
+ }
22
+
23
+ function confirmDelete(plugin) {
24
+ confirmingDelete.value = plugin.id;
25
+ }
26
+
27
+ function cancelDelete() {
28
+ confirmingDelete.value = null;
29
+ }
30
+
31
+ function deletePlugin(plugin) {
32
+ router.delete(route('escalated.admin.plugins.destroy', plugin.id), {
33
+ preserveScroll: true,
34
+ onSuccess: () => { confirmingDelete.value = null; },
35
+ });
36
+ }
37
+
38
+ function triggerUpload() {
39
+ fileInput.value?.click();
40
+ }
41
+
42
+ function handleUpload(event) {
43
+ const file = event.target.files?.[0];
44
+ if (!file) return;
45
+
46
+ uploading.value = true;
47
+ router.post(route('escalated.admin.plugins.upload'), { file }, {
48
+ forceFormData: true,
49
+ preserveScroll: true,
50
+ onFinish: () => {
51
+ uploading.value = false;
52
+ if (fileInput.value) fileInput.value.value = '';
53
+ },
54
+ });
55
+ }
56
+
57
+ function statusColor(plugin) {
58
+ if (plugin.active) return 'bg-emerald-500';
59
+ return 'bg-neutral-600';
60
+ }
61
+
62
+ function statusLabel(plugin) {
63
+ return plugin.active ? 'Active' : 'Inactive';
64
+ }
65
+ </script>
66
+
67
+ <template>
68
+ <EscalatedLayout title="Plugins">
69
+ <!-- Header -->
70
+ <div class="mb-6 flex items-center justify-between">
71
+ <div>
72
+ <p class="text-sm text-neutral-400">
73
+ {{ activePlugins.length }} active, {{ inactivePlugins.length }} inactive
74
+ </p>
75
+ </div>
76
+ <div>
77
+ <input ref="fileInput" type="file" accept=".zip" class="hidden" @change="handleUpload" />
78
+ <button @click="triggerUpload" :disabled="uploading"
79
+ class="rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-4 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400 disabled:opacity-50">
80
+ <span v-if="uploading" class="flex items-center gap-2">
81
+ <svg class="h-4 w-4 animate-spin" fill="none" viewBox="0 0 24 24">
82
+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
83
+ <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
84
+ </svg>
85
+ Uploading...
86
+ </span>
87
+ <span v-else class="flex items-center gap-2">
88
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
89
+ <path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5" />
90
+ </svg>
91
+ Upload Plugin
92
+ </span>
93
+ </button>
94
+ </div>
95
+ </div>
96
+
97
+ <!-- Empty state -->
98
+ <div v-if="!plugins?.length" class="rounded-xl border border-white/[0.06] bg-neutral-900/60 px-6 py-16 text-center">
99
+ <svg class="mx-auto mb-4 h-12 w-12 text-neutral-700" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
100
+ <path stroke-linecap="round" stroke-linejoin="round" d="M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 01-.657.643 48.39 48.39 0 01-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 01-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 00-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 01-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 00.657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 01-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 005.427-.63 48.05 48.05 0 00.582-4.717.532.532 0 00-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 00.658-.663 48.422 48.422 0 00-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 01-.61-.58v0z" />
101
+ </svg>
102
+ <h3 class="text-sm font-medium text-neutral-300">No plugins installed</h3>
103
+ <p class="mt-1 text-xs text-neutral-500">Upload a plugin ZIP to extend Escalated with custom functionality.</p>
104
+ </div>
105
+
106
+ <!-- Plugin cards -->
107
+ <div v-else class="space-y-3">
108
+ <div v-for="plugin in plugins" :key="plugin.id"
109
+ class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5 transition-colors hover:bg-neutral-900/80">
110
+ <div class="flex items-start justify-between gap-4">
111
+ <!-- Plugin info -->
112
+ <div class="min-w-0 flex-1">
113
+ <div class="flex items-center gap-3">
114
+ <h3 class="text-sm font-semibold text-white">{{ plugin.name }}</h3>
115
+ <span :class="['inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-semibold',
116
+ plugin.active
117
+ ? 'bg-emerald-500/10 text-emerald-400'
118
+ : 'bg-neutral-500/10 text-neutral-500']">
119
+ <span :class="['h-1.5 w-1.5 rounded-full', statusColor(plugin)]"></span>
120
+ {{ statusLabel(plugin) }}
121
+ </span>
122
+ <span v-if="plugin.version" class="text-[11px] text-neutral-600">v{{ plugin.version }}</span>
123
+ </div>
124
+ <p v-if="plugin.description" class="mt-1 text-sm text-neutral-400">{{ plugin.description }}</p>
125
+ <div class="mt-2 flex flex-wrap items-center gap-4 text-xs text-neutral-600">
126
+ <span v-if="plugin.author" class="flex items-center gap-1">
127
+ <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
128
+ <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" />
129
+ </svg>
130
+ {{ plugin.author }}
131
+ </span>
132
+ <span v-if="plugin.homepage" class="flex items-center gap-1">
133
+ <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
134
+ <path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244" />
135
+ </svg>
136
+ <a :href="plugin.homepage" target="_blank" rel="noopener" class="hover:text-neutral-400">{{ plugin.homepage }}</a>
137
+ </span>
138
+ <span v-if="plugin.installed_at" class="flex items-center gap-1">
139
+ <svg class="h-3.5 w-3.5" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
140
+ <path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5" />
141
+ </svg>
142
+ Installed {{ plugin.installed_at }}
143
+ </span>
144
+ </div>
145
+
146
+ <!-- Provided extensions summary -->
147
+ <div v-if="plugin.provides" class="mt-3 flex flex-wrap gap-2">
148
+ <span v-if="plugin.provides.menu_items"
149
+ class="rounded bg-white/[0.04] px-2 py-0.5 text-[10px] text-neutral-500">
150
+ {{ plugin.provides.menu_items }} menu item{{ plugin.provides.menu_items !== 1 ? 's' : '' }}
151
+ </span>
152
+ <span v-if="plugin.provides.widgets"
153
+ class="rounded bg-white/[0.04] px-2 py-0.5 text-[10px] text-neutral-500">
154
+ {{ plugin.provides.widgets }} widget{{ plugin.provides.widgets !== 1 ? 's' : '' }}
155
+ </span>
156
+ <span v-if="plugin.provides.page_components"
157
+ class="rounded bg-white/[0.04] px-2 py-0.5 text-[10px] text-neutral-500">
158
+ {{ plugin.provides.page_components }} page component{{ plugin.provides.page_components !== 1 ? 's' : '' }}
159
+ </span>
160
+ </div>
161
+ </div>
162
+
163
+ <!-- Actions -->
164
+ <div class="flex shrink-0 items-center gap-2">
165
+ <!-- Toggle active/inactive -->
166
+ <button @click="togglePlugin(plugin)"
167
+ :class="['relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors',
168
+ plugin.active ? 'bg-emerald-500' : 'bg-neutral-700']"
169
+ :title="plugin.active ? 'Deactivate' : 'Activate'">
170
+ <span :class="['pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition-transform',
171
+ plugin.active ? 'translate-x-5' : 'translate-x-0']" />
172
+ </button>
173
+
174
+ <!-- Delete -->
175
+ <template v-if="confirmingDelete === plugin.id">
176
+ <button @click="deletePlugin(plugin)"
177
+ class="rounded-lg bg-rose-500/20 px-3 py-1.5 text-xs font-medium text-rose-400 transition-colors hover:bg-rose-500/30">
178
+ Confirm
179
+ </button>
180
+ <button @click="cancelDelete"
181
+ class="rounded-lg border border-white/10 px-3 py-1.5 text-xs font-medium text-neutral-400 transition-colors hover:bg-white/[0.04]">
182
+ Cancel
183
+ </button>
184
+ </template>
185
+ <button v-else @click="confirmDelete(plugin)"
186
+ class="rounded-lg border border-white/[0.06] p-1.5 text-neutral-600 transition-colors hover:border-rose-500/20 hover:bg-rose-500/5 hover:text-rose-400"
187
+ title="Delete plugin">
188
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
189
+ <path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
190
+ </svg>
191
+ </button>
192
+ </div>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ </EscalatedLayout>
197
+ </template>
@@ -0,0 +1,129 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../components/EscalatedLayout.vue';
3
+ import { useForm, usePage, router } from '@inertiajs/vue3';
4
+ import { computed } from 'vue';
5
+
6
+ const props = defineProps({ plugins: Array });
7
+ const page = usePage();
8
+
9
+ const flash = computed(() => ({
10
+ success: page.props.flash?.success,
11
+ error: page.props.flash?.error,
12
+ }));
13
+
14
+ const uploadForm = useForm({
15
+ plugin: null,
16
+ });
17
+
18
+ function onFileChange(e) {
19
+ uploadForm.plugin = e.target.files[0];
20
+ }
21
+
22
+ function submitUpload() {
23
+ uploadForm.post(route('escalated.admin.plugins.upload'), {
24
+ forceFormData: true,
25
+ onSuccess: () => {
26
+ uploadForm.reset();
27
+ },
28
+ });
29
+ }
30
+
31
+ function activate(slug) {
32
+ router.post(route('escalated.admin.plugins.activate', slug));
33
+ }
34
+
35
+ function deactivate(slug) {
36
+ router.post(route('escalated.admin.plugins.deactivate', slug));
37
+ }
38
+
39
+ function deletePlugin(slug) {
40
+ if (confirm('Are you sure you want to delete this plugin? This cannot be undone.')) {
41
+ router.delete(route('escalated.admin.plugins.destroy', slug));
42
+ }
43
+ }
44
+ </script>
45
+
46
+ <template>
47
+ <EscalatedLayout title="Plugins">
48
+ <div class="mx-auto max-w-4xl space-y-6">
49
+ <!-- Flash messages -->
50
+ <div v-if="flash.success" class="rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-4 py-3 text-sm text-emerald-400">
51
+ {{ flash.success }}
52
+ </div>
53
+ <div v-if="flash.error" class="rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-400">
54
+ {{ flash.error }}
55
+ </div>
56
+
57
+ <!-- Upload Plugin -->
58
+ <div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-6">
59
+ <h3 class="mb-4 text-sm font-semibold text-white">Upload Plugin</h3>
60
+ <form @submit.prevent="submitUpload" class="flex items-end gap-4">
61
+ <div class="flex-1">
62
+ <label class="block text-sm font-medium text-neutral-200">Plugin ZIP File</label>
63
+ <input type="file" accept=".zip" @change="onFileChange"
64
+ class="mt-2 w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 file:mr-3 file:rounded file:border-0 file:bg-white/10 file:px-3 file:py-1 file:text-sm file:text-neutral-300 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10" />
65
+ <p v-if="uploadForm.errors.plugin" class="mt-1 text-xs text-red-400">{{ uploadForm.errors.plugin }}</p>
66
+ </div>
67
+ <button type="submit" :disabled="uploadForm.processing || !uploadForm.plugin"
68
+ class="shrink-0 rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-5 py-2 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400 disabled:opacity-50">
69
+ {{ uploadForm.processing ? 'Uploading...' : 'Upload' }}
70
+ </button>
71
+ </form>
72
+ </div>
73
+
74
+ <!-- Plugin List -->
75
+ <div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-6">
76
+ <h3 class="mb-5 text-sm font-semibold text-white">Installed Plugins</h3>
77
+
78
+ <div v-if="!plugins || plugins.length === 0" class="py-8 text-center text-sm text-neutral-500">
79
+ No plugins installed yet.
80
+ </div>
81
+
82
+ <div v-else class="divide-y divide-white/[0.06]">
83
+ <div v-for="plugin in plugins" :key="plugin.slug" class="flex items-start justify-between gap-4 py-4 first:pt-0 last:pb-0">
84
+ <!-- Plugin info -->
85
+ <div class="min-w-0 flex-1">
86
+ <div class="flex items-center gap-2.5">
87
+ <span class="text-sm font-medium text-white">{{ plugin.name }}</span>
88
+ <span class="rounded bg-white/[0.06] px-1.5 py-0.5 text-[10px] font-medium text-neutral-500">
89
+ v{{ plugin.version }}
90
+ </span>
91
+ <span :class="[
92
+ 'rounded px-1.5 py-0.5 text-[10px] font-medium',
93
+ plugin.source === 'composer'
94
+ ? 'bg-violet-500/10 text-violet-400'
95
+ : 'bg-cyan-500/10 text-cyan-400'
96
+ ]">
97
+ {{ plugin.source }}
98
+ </span>
99
+ </div>
100
+ <p v-if="plugin.description" class="mt-1 text-xs text-neutral-500">{{ plugin.description }}</p>
101
+ <p class="mt-1 text-xs text-neutral-600">by {{ plugin.author }}</p>
102
+ </div>
103
+
104
+ <!-- Actions -->
105
+ <div class="flex shrink-0 items-center gap-2">
106
+ <!-- Active status toggle -->
107
+ <button v-if="plugin.is_active" @click="deactivate(plugin.slug)"
108
+ class="rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-3 py-1.5 text-xs font-medium text-emerald-400 transition-colors hover:bg-emerald-500/20">
109
+ Active
110
+ </button>
111
+ <button v-else @click="activate(plugin.slug)"
112
+ class="rounded-lg border border-white/10 bg-white/[0.04] px-3 py-1.5 text-xs font-medium text-neutral-500 transition-colors hover:bg-white/[0.08] hover:text-neutral-300">
113
+ Inactive
114
+ </button>
115
+
116
+ <!-- Delete (local only) -->
117
+ <button v-if="plugin.source === 'local'" @click="deletePlugin(plugin.slug)"
118
+ class="rounded-lg border border-white/10 bg-white/[0.04] p-1.5 text-neutral-600 transition-colors hover:border-red-500/20 hover:bg-red-500/10 hover:text-red-400">
119
+ <svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
120
+ <path stroke-linecap="round" stroke-linejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" />
121
+ </svg>
122
+ </button>
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </EscalatedLayout>
129
+ </template>