@escalated-dev/escalated 0.2.1 → 0.4.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 (45) hide show
  1. package/package.json +1 -1
  2. package/src/components/ActivityTimeline.vue +8 -4
  3. package/src/components/AssigneeSelect.vue +6 -2
  4. package/src/components/AttachmentList.vue +9 -3
  5. package/src/components/BulkActionBar.vue +97 -0
  6. package/src/components/EscalatedLayout.vue +101 -94
  7. package/src/components/FileDropzone.vue +9 -4
  8. package/src/components/FollowButton.vue +63 -0
  9. package/src/components/KeyboardShortcutHelp.vue +123 -0
  10. package/src/components/MacroDropdown.vue +90 -0
  11. package/src/components/PinnedNotes.vue +87 -0
  12. package/src/components/PresenceIndicator.vue +103 -0
  13. package/src/components/PriorityBadge.vue +20 -2
  14. package/src/components/QuickFilters.vue +49 -0
  15. package/src/components/ReplyComposer.vue +52 -3
  16. package/src/components/ReplyThread.vue +60 -30
  17. package/src/components/SatisfactionRating.vue +128 -0
  18. package/src/components/SlaTimer.vue +12 -6
  19. package/src/components/StatsCard.vue +26 -6
  20. package/src/components/StatusBadge.vue +24 -2
  21. package/src/components/TagSelect.vue +8 -4
  22. package/src/components/TicketFilters.vue +69 -52
  23. package/src/components/TicketList.vue +193 -51
  24. package/src/components/TicketSidebar.vue +99 -70
  25. package/src/composables/useKeyboardShortcuts.js +46 -0
  26. package/src/index.js +11 -0
  27. package/src/pages/Admin/CannedResponses/Index.vue +29 -17
  28. package/src/pages/Admin/Departments/Form.vue +12 -11
  29. package/src/pages/Admin/Departments/Index.vue +26 -18
  30. package/src/pages/Admin/EscalationRules/Form.vue +21 -20
  31. package/src/pages/Admin/EscalationRules/Index.vue +26 -18
  32. package/src/pages/Admin/Macros/Index.vue +287 -0
  33. package/src/pages/Admin/Reports.vue +101 -52
  34. package/src/pages/Admin/Settings.vue +260 -0
  35. package/src/pages/Admin/SlaPolicies/Form.vue +21 -20
  36. package/src/pages/Admin/SlaPolicies/Index.vue +28 -20
  37. package/src/pages/Admin/Tags/Index.vue +48 -23
  38. package/src/pages/Admin/Tickets/Index.vue +39 -0
  39. package/src/pages/Admin/Tickets/Show.vue +145 -0
  40. package/src/pages/Agent/Dashboard.vue +156 -51
  41. package/src/pages/Agent/TicketIndex.vue +38 -21
  42. package/src/pages/Agent/TicketShow.vue +144 -108
  43. package/src/pages/Customer/Show.vue +63 -55
  44. package/src/pages/Guest/Create.vue +97 -0
  45. package/src/pages/Guest/Show.vue +93 -0
@@ -8,7 +8,7 @@ defineProps({ tags: Array });
8
8
  const showForm = ref(false);
9
9
  const editingTag = ref(null);
10
10
 
11
- const form = useForm({ name: '', color: '#6B7280' });
11
+ const form = useForm({ name: '', color: '#06b6d4' });
12
12
 
13
13
  function createTag() {
14
14
  form.post(route('escalated.admin.tags.store'), {
@@ -38,39 +38,64 @@ function destroy(id) {
38
38
  <template>
39
39
  <EscalatedLayout title="Tags">
40
40
  <div class="mb-4 flex justify-end">
41
- <button @click="showForm = !showForm" class="rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700">
41
+ <button @click="showForm = !showForm"
42
+ :class="showForm
43
+ ? '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]'
44
+ : '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'">
42
45
  {{ showForm ? 'Cancel' : 'Add Tag' }}
43
46
  </button>
44
47
  </div>
45
- <form v-if="showForm" @submit.prevent="createTag" class="mb-6 flex items-end gap-3 rounded-lg border border-gray-200 bg-white p-4">
48
+ <form v-if="showForm" @submit.prevent="createTag" class="mb-6 flex items-end gap-3 rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
46
49
  <div>
47
- <label class="block text-sm font-medium text-gray-700">Name</label>
48
- <input v-model="form.name" type="text" required class="mt-1 rounded-lg border-gray-300 shadow-sm" />
50
+ <label class="block text-sm font-medium text-neutral-300">Name</label>
51
+ <input v-model="form.name" type="text" required class="mt-1 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" />
49
52
  </div>
50
53
  <div>
51
- <label class="block text-sm font-medium text-gray-700">Color</label>
52
- <input v-model="form.color" type="color" class="mt-1 h-10 w-16 rounded border-gray-300" />
54
+ <label class="block text-sm font-medium text-neutral-300">Color</label>
55
+ <input v-model="form.color" type="color" class="mt-1 h-10 w-16 rounded-lg border border-white/10 bg-neutral-950" />
53
56
  </div>
54
- <button type="submit" :disabled="form.processing" class="rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700">Create</button>
57
+ <button type="submit" :disabled="form.processing"
58
+ 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">
59
+ Create
60
+ </button>
55
61
  </form>
56
- <div class="overflow-hidden rounded-lg border border-gray-200 bg-white">
57
- <table class="min-w-full divide-y divide-gray-200">
58
- <thead class="bg-gray-50">
59
- <tr>
60
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Color</th>
61
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Name</th>
62
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Tickets</th>
63
- <th class="px-4 py-3 text-right text-xs font-medium uppercase text-gray-500">Actions</th>
62
+ <div class="overflow-hidden rounded-xl border border-white/[0.06] bg-neutral-900/60">
63
+ <table class="min-w-full divide-y divide-white/[0.06]">
64
+ <thead>
65
+ <tr class="bg-white/[0.02]">
66
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Color</th>
67
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Name</th>
68
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Tickets</th>
69
+ <th class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Actions</th>
64
70
  </tr>
65
71
  </thead>
66
- <tbody class="divide-y divide-gray-200">
67
- <tr v-for="tag in tags" :key="tag.id">
68
- <td class="px-4 py-3"><span class="inline-block h-4 w-4 rounded-full" :style="{ backgroundColor: tag.color }"></span></td>
69
- <td class="px-4 py-3 text-sm font-medium text-gray-900">{{ tag.name }}</td>
70
- <td class="px-4 py-3 text-sm text-gray-500">{{ tag.tickets_count }}</td>
72
+ <tbody class="divide-y divide-white/[0.04]">
73
+ <tr v-if="!tags?.length">
74
+ <td colspan="4" class="px-4 py-12 text-center">
75
+ <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"><path stroke-linecap="round" stroke-linejoin="round" d="M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 005.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 009.568 3z M6 6h.008v.008H6V6z" /></svg>
76
+ <p class="text-sm text-neutral-500">No tags yet</p>
77
+ <p class="mt-1 text-xs text-neutral-600">Create tags to categorize and filter tickets</p>
78
+ </td>
79
+ </tr>
80
+ <tr v-for="tag in tags" :key="tag.id" class="transition-colors hover:bg-white/[0.03]">
81
+ <td class="px-4 py-3">
82
+ <span class="inline-block h-4 w-4 rounded-full ring-1 ring-white/10" :style="{ backgroundColor: tag.color }"></span>
83
+ </td>
84
+ <td class="px-4 py-3 text-sm font-medium text-neutral-200">
85
+ <template v-if="editingTag === tag.id">
86
+ <form @submit.prevent="updateTag(tag.id)" class="flex items-center gap-2">
87
+ <input v-model="form.name" type="text" required class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10" />
88
+ <input v-model="form.color" type="color" class="h-8 w-10 rounded border border-white/10 bg-neutral-950" />
89
+ <button type="submit" class="text-sm text-neutral-300 hover:text-white">Save</button>
90
+ <button type="button" @click="editingTag = null" class="text-sm text-neutral-400 hover:text-neutral-300">Cancel</button>
91
+ </form>
92
+ </template>
93
+ <template v-else>{{ tag.name }}</template>
94
+ </td>
95
+ <td class="px-4 py-3 text-sm text-neutral-400">{{ tag.tickets_count }}</td>
71
96
  <td class="px-4 py-3 text-right text-sm">
72
- <button @click="startEdit(tag)" class="text-indigo-600 hover:text-indigo-900">Edit</button>
73
- <button @click="destroy(tag.id)" class="ml-3 text-red-600 hover:text-red-900">Delete</button>
97
+ <button @click="startEdit(tag)" class="text-neutral-300 hover:text-white">Edit</button>
98
+ <button @click="destroy(tag.id)" class="ml-3 text-rose-400 hover:text-rose-300">Delete</button>
74
99
  </td>
75
100
  </tr>
76
101
  </tbody>
@@ -0,0 +1,39 @@
1
+ <script setup>
2
+ import { ref } from 'vue';
3
+ import { usePage, router } from '@inertiajs/vue3';
4
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
5
+ import TicketList from '../../../components/TicketList.vue';
6
+ import TicketFilters from '../../../components/TicketFilters.vue';
7
+ import QuickFilters from '../../../components/QuickFilters.vue';
8
+ import BulkActionBar from '../../../components/BulkActionBar.vue';
9
+
10
+ defineProps({
11
+ tickets: Object,
12
+ filters: Object,
13
+ departments: Array,
14
+ tags: Array,
15
+ agents: Array,
16
+ });
17
+
18
+ const page = usePage();
19
+ const selectedIds = ref([]);
20
+
21
+ function applyQuickFilter(filter) {
22
+ router.get(route('escalated.admin.tickets.index'), filter, { preserveState: true });
23
+ }
24
+ </script>
25
+
26
+ <template>
27
+ <EscalatedLayout title="All Tickets">
28
+ <div class="mb-4">
29
+ <QuickFilters :current-user-id="page.props.auth?.user?.id" @filter="applyQuickFilter" />
30
+ </div>
31
+ <div class="mb-6">
32
+ <TicketFilters :filters="filters" :route="route('escalated.admin.tickets.index')" :departments="departments" :tags="tags" :agents="agents" show-assignee show-following />
33
+ </div>
34
+ <TicketList :tickets="tickets" route-prefix="escalated.admin.tickets" show-assignee
35
+ selectable v-model:selected-ids="selectedIds" />
36
+ <BulkActionBar :selected-ids="selectedIds" :bulk-route="route('escalated.admin.tickets.bulk')"
37
+ :agents="agents" :departments="departments" @clear="selectedIds = []" />
38
+ </EscalatedLayout>
39
+ </template>
@@ -0,0 +1,145 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import StatusBadge from '../../../components/StatusBadge.vue';
4
+ import PriorityBadge from '../../../components/PriorityBadge.vue';
5
+ import ReplyThread from '../../../components/ReplyThread.vue';
6
+ import ReplyComposer from '../../../components/ReplyComposer.vue';
7
+ import TicketSidebar from '../../../components/TicketSidebar.vue';
8
+ import AttachmentList from '../../../components/AttachmentList.vue';
9
+ import MacroDropdown from '../../../components/MacroDropdown.vue';
10
+ import FollowButton from '../../../components/FollowButton.vue';
11
+ import PresenceIndicator from '../../../components/PresenceIndicator.vue';
12
+ import PinnedNotes from '../../../components/PinnedNotes.vue';
13
+ import KeyboardShortcutHelp from '../../../components/KeyboardShortcutHelp.vue';
14
+ import { useKeyboardShortcuts } from '../../../composables/useKeyboardShortcuts';
15
+ import { router, useForm, usePage } from '@inertiajs/vue3';
16
+ import { ref } from 'vue';
17
+
18
+ const props = defineProps({
19
+ ticket: Object,
20
+ departments: Array,
21
+ tags: Array,
22
+ cannedResponses: Array,
23
+ agents: Array,
24
+ macros: { type: Array, default: () => [] },
25
+ is_following: { type: Boolean, default: false },
26
+ followers_count: { type: Number, default: 0 },
27
+ });
28
+
29
+ const page = usePage();
30
+ const activeTab = ref('reply');
31
+ const showShortcutHelp = ref(false);
32
+ const replyComposerRef = ref(null);
33
+ const statusSelectRef = ref(null);
34
+ const prioritySelectRef = ref(null);
35
+
36
+ const statusForm = useForm({ status: '' });
37
+ const priorityForm = useForm({ priority: '' });
38
+ const assignForm = useForm({ agent_id: '' });
39
+
40
+ function changeStatus(status) {
41
+ statusForm.status = status;
42
+ statusForm.post(route('escalated.admin.tickets.status', props.ticket.reference), { preserveScroll: true });
43
+ }
44
+
45
+ function changePriority(priority) {
46
+ priorityForm.priority = priority;
47
+ priorityForm.post(route('escalated.admin.tickets.priority', props.ticket.reference), { preserveScroll: true });
48
+ }
49
+
50
+ function assignToMe() {
51
+ assignForm.agent_id = page.props.auth.user.id;
52
+ assignForm.post(route('escalated.admin.tickets.assign', props.ticket.reference), { preserveScroll: true });
53
+ }
54
+
55
+ function toggleFollow() {
56
+ router.post(route('escalated.admin.tickets.follow', props.ticket.reference), {}, { preserveScroll: true });
57
+ }
58
+
59
+ // Keyboard shortcuts
60
+ useKeyboardShortcuts({
61
+ 'r': () => { activeTab.value = 'reply'; replyComposerRef.value?.$el?.querySelector('textarea')?.focus(); },
62
+ 'n': () => { activeTab.value = 'note'; },
63
+ 's': () => { statusSelectRef.value?.focus(); },
64
+ 'p': () => { prioritySelectRef.value?.focus(); },
65
+ 'f': () => { toggleFollow(); },
66
+ '?': () => { showShortcutHelp.value = true; },
67
+ });
68
+ </script>
69
+
70
+ <template>
71
+ <EscalatedLayout :title="ticket.subject">
72
+ <div class="mb-5 flex flex-wrap items-center gap-3">
73
+ <span class="text-sm font-mono font-medium text-white">{{ ticket.reference }}</span>
74
+ <StatusBadge :status="ticket.status" />
75
+ <PriorityBadge :priority="ticket.priority" />
76
+ <span class="text-sm text-neutral-500">by {{ ticket.requester?.name }}</span>
77
+ <PresenceIndicator :ticket-reference="ticket.reference" route-prefix="escalated.admin" />
78
+ <div class="ml-auto flex items-center gap-2">
79
+ <FollowButton :is-following="is_following" :followers-count="followers_count"
80
+ :action="route('escalated.admin.tickets.follow', ticket.reference)" />
81
+ <MacroDropdown v-if="macros.length" :macros="macros"
82
+ :action="route('escalated.admin.tickets.macro', ticket.reference)" />
83
+ <button v-if="!ticket.assigned_to" @click="assignToMe"
84
+ class="rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-3 py-1.5 text-sm font-medium text-white shadow-lg shadow-black/20 transition-all hover:from-cyan-400 hover:to-violet-400">
85
+ Assign to Me
86
+ </button>
87
+ <select ref="statusSelectRef" @change="changeStatus($event.target.value); $event.target.value = ''"
88
+ class="rounded-lg border border-white/10 bg-neutral-950 px-3 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10">
89
+ <option value="">Change Status...</option>
90
+ <option value="in_progress">In Progress</option>
91
+ <option value="waiting_on_customer">Waiting on Customer</option>
92
+ <option value="resolved">Resolved</option>
93
+ <option value="closed">Closed</option>
94
+ </select>
95
+ <select ref="prioritySelectRef" @change="changePriority($event.target.value); $event.target.value = ''"
96
+ class="rounded-lg border border-white/10 bg-neutral-950 px-3 py-1.5 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10">
97
+ <option value="">Change Priority...</option>
98
+ <option value="low">Low</option>
99
+ <option value="medium">Medium</option>
100
+ <option value="high">High</option>
101
+ <option value="urgent">Urgent</option>
102
+ <option value="critical">Critical</option>
103
+ </select>
104
+ </div>
105
+ </div>
106
+ <div class="grid grid-cols-1 gap-6 lg:grid-cols-3">
107
+ <div class="lg:col-span-2 space-y-6">
108
+ <PinnedNotes v-if="ticket.pinned_notes?.length" :notes="ticket.pinned_notes"
109
+ :ticket-reference="ticket.reference" route-prefix="escalated.admin" />
110
+ <div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
111
+ <p class="whitespace-pre-wrap text-sm text-neutral-300">{{ ticket.description }}</p>
112
+ <AttachmentList v-if="ticket.attachments?.length" :attachments="ticket.attachments" class="mt-3" />
113
+ </div>
114
+ <div>
115
+ <div class="mb-4 flex gap-4 border-b border-white/[0.06]">
116
+ <button @click="activeTab = 'reply'"
117
+ :class="['pb-2 text-sm font-medium transition-colors', activeTab === 'reply' ? 'border-b-2 border-cyan-500 text-white' : 'text-neutral-500 hover:text-neutral-300']">
118
+ Reply
119
+ </button>
120
+ <button @click="activeTab = 'note'"
121
+ :class="['pb-2 text-sm font-medium transition-colors', activeTab === 'note' ? 'border-b-2 border-amber-500 text-amber-400' : 'text-neutral-500 hover:text-neutral-300']">
122
+ Internal Note
123
+ </button>
124
+ </div>
125
+ <ReplyComposer v-if="activeTab === 'reply'" ref="replyComposerRef"
126
+ :action="route('escalated.admin.tickets.reply', ticket.reference)"
127
+ :canned-responses="cannedResponses" />
128
+ <ReplyComposer v-else
129
+ :action="route('escalated.admin.tickets.note', ticket.reference)"
130
+ placeholder="Write an internal note..."
131
+ submit-label="Add Note" />
132
+ </div>
133
+ <div>
134
+ <h2 class="mb-4 text-lg font-semibold text-neutral-200">Conversation</h2>
135
+ <ReplyThread :replies="ticket.replies || []" :current-user-id="page.props.auth?.user?.id"
136
+ :ticket-reference="ticket.reference" route-prefix="escalated.admin" pinnable />
137
+ </div>
138
+ </div>
139
+ <div>
140
+ <TicketSidebar :ticket="ticket" :tags="tags" :departments="departments" />
141
+ </div>
142
+ </div>
143
+ <KeyboardShortcutHelp v-model:show="showShortcutHelp" context="detail" />
144
+ </EscalatedLayout>
145
+ </template>
@@ -1,51 +1,156 @@
1
- <script setup>
2
- import EscalatedLayout from '../../components/EscalatedLayout.vue';
3
- import StatsCard from '../../components/StatsCard.vue';
4
- import TicketList from '../../components/TicketList.vue';
5
-
6
- defineProps({
7
- stats: Object,
8
- recentTickets: Array,
9
- });
10
- </script>
11
-
12
- <template>
13
- <EscalatedLayout title="Agent Dashboard">
14
- <div class="mb-8 grid grid-cols-2 gap-4 md:grid-cols-5">
15
- <StatsCard title="Open Tickets" :value="stats.open" color="indigo" />
16
- <StatsCard title="My Assigned" :value="stats.my_assigned" color="indigo" />
17
- <StatsCard title="Unassigned" :value="stats.unassigned" color="yellow" />
18
- <StatsCard title="SLA Breached" :value="stats.sla_breached" color="red" />
19
- <StatsCard title="Resolved Today" :value="stats.resolved_today" color="green" />
20
- </div>
21
- <h2 class="mb-4 text-lg font-semibold text-gray-900">Recent Tickets</h2>
22
- <div class="overflow-hidden rounded-lg border border-gray-200 bg-white">
23
- <table class="min-w-full divide-y divide-gray-200">
24
- <thead class="bg-gray-50">
25
- <tr>
26
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Reference</th>
27
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Subject</th>
28
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Requester</th>
29
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Status</th>
30
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Priority</th>
31
- <th class="px-4 py-3 text-left text-xs font-medium uppercase text-gray-500">Assignee</th>
32
- </tr>
33
- </thead>
34
- <tbody class="divide-y divide-gray-200">
35
- <tr v-for="ticket in recentTickets" :key="ticket.id" class="hover:bg-gray-50">
36
- <td class="px-4 py-3 text-sm">
37
- <a :href="route('escalated.agent.tickets.show', ticket.reference)" class="font-medium text-indigo-600 hover:text-indigo-900">{{ ticket.reference }}</a>
38
- </td>
39
- <td class="px-4 py-3 text-sm text-gray-900">{{ ticket.subject }}</td>
40
- <td class="px-4 py-3 text-sm text-gray-500">{{ ticket.requester?.name }}</td>
41
- <td class="px-4 py-3 text-sm">
42
- <span :class="['inline-flex rounded-full px-2 py-0.5 text-xs font-medium', { 'bg-blue-100 text-blue-800': ticket.status === 'open', 'bg-green-100 text-green-800': ticket.status === 'resolved', 'bg-red-100 text-red-800': ticket.status === 'escalated' }]">{{ ticket.status }}</span>
43
- </td>
44
- <td class="px-4 py-3 text-sm text-gray-500">{{ ticket.priority }}</td>
45
- <td class="px-4 py-3 text-sm text-gray-500">{{ ticket.assignee?.name || 'Unassigned' }}</td>
46
- </tr>
47
- </tbody>
48
- </table>
49
- </div>
50
- </EscalatedLayout>
51
- </template>
1
+ <script setup>
2
+ import { computed } from 'vue';
3
+ import { Link } from '@inertiajs/vue3';
4
+ import EscalatedLayout from '../../components/EscalatedLayout.vue';
5
+ import StatsCard from '../../components/StatsCard.vue';
6
+ import StatusBadge from '../../components/StatusBadge.vue';
7
+ import PriorityBadge from '../../components/PriorityBadge.vue';
8
+
9
+ const props = defineProps({
10
+ stats: Object,
11
+ recentTickets: Array,
12
+ needsAttention: { type: Object, default: () => ({}) },
13
+ myPerformance: { type: Object, default: () => ({}) },
14
+ });
15
+
16
+ function timeAgo(date) {
17
+ if (!date) return '';
18
+ const diff = Date.now() - new Date(date).getTime();
19
+ const mins = Math.floor(diff / 60000);
20
+ if (mins < 60) return `${mins}m ago`;
21
+ const hrs = Math.floor(mins / 60);
22
+ if (hrs < 24) return `${hrs}h ago`;
23
+ const days = Math.floor(hrs / 24);
24
+ return `${days}d ago`;
25
+ }
26
+
27
+ function slaClass(ticket) {
28
+ if (ticket.sla_first_response_breached || ticket.sla_resolution_breached) return 'bg-rose-500';
29
+ if (ticket.first_response_due_at || ticket.resolution_due_at) {
30
+ const due = ticket.resolution_due_at || ticket.first_response_due_at;
31
+ const mins = (new Date(due) - Date.now()) / 60000;
32
+ if (mins < 30) return 'bg-amber-500';
33
+ return 'bg-emerald-500';
34
+ }
35
+ return '';
36
+ }
37
+
38
+ function truncate(str, len = 50) {
39
+ if (!str) return '';
40
+ return str.length > len ? str.slice(0, len) + '...' : str;
41
+ }
42
+
43
+ const hasSlaBreaching = computed(() => needsAttention.value?.sla_breaching?.length > 0);
44
+ const hasUnassignedUrgent = computed(() => needsAttention.value?.unassigned_urgent?.length > 0);
45
+ const needsAttention = computed(() => props.needsAttention);
46
+ </script>
47
+
48
+ <template>
49
+ <EscalatedLayout title="Agent Dashboard">
50
+ <!-- Stats row -->
51
+ <div class="mb-8 grid grid-cols-2 gap-4 md:grid-cols-5">
52
+ <StatsCard label="Open Tickets" :value="stats.open" color="cyan" />
53
+ <StatsCard label="My Assigned" :value="stats.my_assigned" color="violet" />
54
+ <StatsCard label="Unassigned" :value="stats.unassigned" color="amber" />
55
+ <StatsCard label="SLA Breached" :value="stats.sla_breached" color="red" />
56
+ <StatsCard label="Resolved Today" :value="stats.resolved_today" color="green" />
57
+ </div>
58
+
59
+ <div class="grid grid-cols-1 gap-6 lg:grid-cols-3">
60
+ <div class="lg:col-span-2 space-y-6">
61
+ <!-- Needs Attention -->
62
+ <div v-if="hasSlaBreaching || hasUnassignedUrgent">
63
+ <h2 class="mb-4 text-lg font-semibold text-neutral-200">Needs Attention</h2>
64
+ <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
65
+ <div v-if="hasSlaBreaching" class="rounded-xl border border-rose-500/20 bg-rose-500/5 p-4">
66
+ <h3 class="mb-3 flex items-center gap-2 text-sm font-semibold text-rose-400">
67
+ <span class="h-2 w-2 rounded-full bg-rose-500"></span>
68
+ SLA Breaching
69
+ </h3>
70
+ <div v-for="ticket in needsAttention.sla_breaching" :key="ticket.id" class="mb-2 last:mb-0">
71
+ <Link :href="route('escalated.agent.tickets.show', ticket.reference)"
72
+ class="flex items-center justify-between rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-white/[0.04]">
73
+ <span class="font-mono text-xs text-neutral-400">{{ ticket.reference }}</span>
74
+ <span class="truncate text-neutral-300" style="max-width: 140px">{{ ticket.requester?.name }}</span>
75
+ </Link>
76
+ </div>
77
+ </div>
78
+ <div v-if="hasUnassignedUrgent" class="rounded-xl border border-amber-500/20 bg-amber-500/5 p-4">
79
+ <h3 class="mb-3 flex items-center gap-2 text-sm font-semibold text-amber-400">
80
+ <span class="h-2 w-2 rounded-full bg-amber-500"></span>
81
+ Unassigned Urgent
82
+ </h3>
83
+ <div v-for="ticket in needsAttention.unassigned_urgent" :key="ticket.id" class="mb-2 last:mb-0">
84
+ <Link :href="route('escalated.agent.tickets.show', ticket.reference)"
85
+ class="flex items-center justify-between rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-white/[0.04]">
86
+ <span class="font-mono text-xs text-neutral-400">{{ ticket.reference }}</span>
87
+ <PriorityBadge :priority="ticket.priority" />
88
+ </Link>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+
94
+ <!-- Recent Tickets -->
95
+ <div>
96
+ <h2 class="mb-4 text-lg font-semibold text-neutral-200">Recent Tickets</h2>
97
+ <div class="overflow-hidden rounded-xl border border-white/[0.06] bg-neutral-900/60">
98
+ <table class="min-w-full divide-y divide-white/[0.06]">
99
+ <thead>
100
+ <tr class="bg-white/[0.02]">
101
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Reference</th>
102
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Subject</th>
103
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Requester</th>
104
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Status</th>
105
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Priority</th>
106
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Assignee</th>
107
+ <th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Last Reply</th>
108
+ </tr>
109
+ </thead>
110
+ <tbody class="divide-y divide-white/[0.04]">
111
+ <tr v-for="ticket in recentTickets" :key="ticket.id" class="transition-colors hover:bg-white/[0.03]">
112
+ <td class="whitespace-nowrap px-4 py-3 text-sm font-medium">
113
+ <div class="flex items-center gap-2">
114
+ <span v-if="slaClass(ticket)" :class="['h-2 w-2 shrink-0 rounded-full', slaClass(ticket)]"></span>
115
+ <Link :href="route('escalated.agent.tickets.show', ticket.reference)" class="text-white hover:text-neutral-300">
116
+ {{ ticket.reference }}
117
+ </Link>
118
+ </div>
119
+ </td>
120
+ <td class="px-4 py-3 text-sm text-neutral-300">{{ truncate(ticket.subject) }}</td>
121
+ <td class="px-4 py-3 text-sm text-neutral-400">{{ ticket.requester?.name }}</td>
122
+ <td class="px-4 py-3"><StatusBadge :status="ticket.status" /></td>
123
+ <td class="px-4 py-3"><PriorityBadge :priority="ticket.priority" /></td>
124
+ <td class="px-4 py-3 text-sm text-neutral-500">{{ ticket.assignee?.name || 'Unassigned' }}</td>
125
+ <td class="whitespace-nowrap px-4 py-3 text-sm text-neutral-600">
126
+ <template v-if="ticket.latest_reply">
127
+ <div class="text-neutral-400">{{ timeAgo(ticket.latest_reply.created_at) }}</div>
128
+ <div class="text-xs text-neutral-600">{{ ticket.latest_reply.author?.name || '' }}</div>
129
+ </template>
130
+ <span v-else class="text-neutral-700">—</span>
131
+ </td>
132
+ </tr>
133
+ <tr v-if="!recentTickets?.length">
134
+ <td colspan="7" class="px-4 py-8 text-center text-sm text-neutral-500">No recent tickets</td>
135
+ </tr>
136
+ </tbody>
137
+ </table>
138
+ </div>
139
+ </div>
140
+ </div>
141
+
142
+ <!-- My Performance sidebar -->
143
+ <div class="space-y-4">
144
+ <div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
145
+ <h3 class="mb-4 text-sm font-semibold text-neutral-200">My Performance</h3>
146
+ <dl class="space-y-3">
147
+ <div class="flex items-center justify-between">
148
+ <dt class="text-sm text-neutral-500">Resolved This Week</dt>
149
+ <dd class="text-lg font-bold text-white">{{ myPerformance.resolved_this_week || 0 }}</dd>
150
+ </div>
151
+ </dl>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ </EscalatedLayout>
156
+ </template>
@@ -1,21 +1,38 @@
1
- <script setup>
2
- import EscalatedLayout from '../../components/EscalatedLayout.vue';
3
- import TicketList from '../../components/TicketList.vue';
4
- import TicketFilters from '../../components/TicketFilters.vue';
5
-
6
- defineProps({
7
- tickets: Object,
8
- filters: Object,
9
- departments: Array,
10
- tags: Array,
11
- });
12
- </script>
13
-
14
- <template>
15
- <EscalatedLayout title="Ticket Queue">
16
- <div class="mb-6">
17
- <TicketFilters :filters="filters" :route="route('escalated.agent.tickets.index')" :departments="departments" :tags="tags" show-assignee />
18
- </div>
19
- <TicketList :tickets="tickets" route-prefix="escalated.agent.tickets" show-assignee />
20
- </EscalatedLayout>
21
- </template>
1
+ <script setup>
2
+ import { ref } from 'vue';
3
+ import { usePage, router } from '@inertiajs/vue3';
4
+ import EscalatedLayout from '../../components/EscalatedLayout.vue';
5
+ import TicketList from '../../components/TicketList.vue';
6
+ import TicketFilters from '../../components/TicketFilters.vue';
7
+ import QuickFilters from '../../components/QuickFilters.vue';
8
+ import BulkActionBar from '../../components/BulkActionBar.vue';
9
+
10
+ defineProps({
11
+ tickets: Object,
12
+ filters: Object,
13
+ departments: Array,
14
+ tags: Array,
15
+ });
16
+
17
+ const page = usePage();
18
+ const selectedIds = ref([]);
19
+
20
+ function applyQuickFilter(filter) {
21
+ router.get(route('escalated.agent.tickets.index'), filter, { preserveState: true });
22
+ }
23
+ </script>
24
+
25
+ <template>
26
+ <EscalatedLayout title="Ticket Queue">
27
+ <div class="mb-4">
28
+ <QuickFilters :current-user-id="page.props.auth?.user?.id" @filter="applyQuickFilter" />
29
+ </div>
30
+ <div class="mb-6">
31
+ <TicketFilters :filters="filters" :route="route('escalated.agent.tickets.index')" :departments="departments" :tags="tags" show-assignee show-following />
32
+ </div>
33
+ <TicketList :tickets="tickets" route-prefix="escalated.agent.tickets" show-assignee
34
+ selectable v-model:selected-ids="selectedIds" />
35
+ <BulkActionBar :selected-ids="selectedIds" :bulk-route="route('escalated.agent.tickets.bulk')"
36
+ :departments="departments" @clear="selectedIds = []" />
37
+ </EscalatedLayout>
38
+ </template>