@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.
- package/README.md +35 -1
- package/package.json +9 -2
- package/src/components/BulkActionBar.vue +97 -0
- package/src/components/EscalatedLayout.vue +244 -219
- package/src/components/FollowButton.vue +63 -0
- package/src/components/KeyboardShortcutHelp.vue +123 -0
- package/src/components/MacroDropdown.vue +90 -0
- package/src/components/PinnedNotes.vue +87 -0
- package/src/components/PluginSlot.vue +62 -0
- package/src/components/PresenceIndicator.vue +103 -0
- package/src/components/QuickFilters.vue +49 -0
- package/src/components/ReplyThread.vue +60 -38
- package/src/components/SatisfactionRating.vue +128 -0
- package/src/components/TicketFilters.vue +69 -58
- package/src/components/TicketList.vue +193 -94
- package/src/components/TicketSidebar.vue +99 -77
- package/src/composables/useKeyboardShortcuts.js +46 -0
- package/src/composables/usePluginExtensions.js +67 -0
- package/src/defineEscalatedPlugin.js +50 -0
- package/src/index.js +16 -0
- package/src/pages/Admin/ApiTokens/Index.vue +217 -0
- package/src/pages/Admin/Macros/Index.vue +287 -0
- package/src/pages/Admin/Plugins/Index.vue +197 -0
- package/src/pages/Admin/Plugins.vue +129 -0
- package/src/pages/Admin/Reports.vue +101 -66
- package/src/pages/Admin/Tickets/Index.vue +39 -22
- package/src/pages/Admin/Tickets/Show.vue +156 -109
- package/src/pages/Agent/Dashboard.vue +186 -63
- package/src/pages/Agent/TicketIndex.vue +38 -21
- package/src/pages/Agent/TicketShow.vue +155 -108
- package/src/pages/Customer/Show.vue +63 -55
- package/src/pages/Guest/Show.vue +93 -86
|
@@ -1,63 +1,186 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, defineAsyncComponent } 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
|
+
import PluginSlot from '../../components/PluginSlot.vue';
|
|
9
|
+
import { usePluginExtensions } from '../../composables/usePluginExtensions';
|
|
10
|
+
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
stats: Object,
|
|
13
|
+
recentTickets: Array,
|
|
14
|
+
needsAttention: { type: Object, default: () => ({}) },
|
|
15
|
+
myPerformance: { type: Object, default: () => ({}) },
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
function timeAgo(date) {
|
|
19
|
+
if (!date) return '';
|
|
20
|
+
const diff = Date.now() - new Date(date).getTime();
|
|
21
|
+
const mins = Math.floor(diff / 60000);
|
|
22
|
+
if (mins < 60) return `${mins}m ago`;
|
|
23
|
+
const hrs = Math.floor(mins / 60);
|
|
24
|
+
if (hrs < 24) return `${hrs}h ago`;
|
|
25
|
+
const days = Math.floor(hrs / 24);
|
|
26
|
+
return `${days}d ago`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function slaClass(ticket) {
|
|
30
|
+
if (ticket.sla_first_response_breached || ticket.sla_resolution_breached) return 'bg-rose-500';
|
|
31
|
+
if (ticket.first_response_due_at || ticket.resolution_due_at) {
|
|
32
|
+
const due = ticket.resolution_due_at || ticket.first_response_due_at;
|
|
33
|
+
const mins = (new Date(due) - Date.now()) / 60000;
|
|
34
|
+
if (mins < 30) return 'bg-amber-500';
|
|
35
|
+
return 'bg-emerald-500';
|
|
36
|
+
}
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function truncate(str, len = 50) {
|
|
41
|
+
if (!str) return '';
|
|
42
|
+
return str.length > len ? str.slice(0, len) + '...' : str;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const hasSlaBreaching = computed(() => needsAttention.value?.sla_breaching?.length > 0);
|
|
46
|
+
const hasUnassignedUrgent = computed(() => needsAttention.value?.unassigned_urgent?.length > 0);
|
|
47
|
+
const needsAttention = computed(() => props.needsAttention);
|
|
48
|
+
|
|
49
|
+
const { dashboardWidgets, getPageComponents } = usePluginExtensions();
|
|
50
|
+
|
|
51
|
+
// Load a plugin widget component dynamically
|
|
52
|
+
const loadWidgetComponent = (plugin, component) => {
|
|
53
|
+
return defineAsyncComponent(() =>
|
|
54
|
+
import(`../../../../../plugins/escalated/${plugin}/resources/js/Components/${component}.vue`)
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<EscalatedLayout title="Agent Dashboard">
|
|
61
|
+
<!-- Plugin: dashboard header slot -->
|
|
62
|
+
<PluginSlot slot="dashboard.header" :components="getPageComponents('dashboard', 'header')" />
|
|
63
|
+
|
|
64
|
+
<!-- Stats row -->
|
|
65
|
+
<div class="mb-8 grid grid-cols-2 gap-4 md:grid-cols-5">
|
|
66
|
+
<StatsCard label="Open Tickets" :value="stats.open" color="cyan" />
|
|
67
|
+
<StatsCard label="My Assigned" :value="stats.my_assigned" color="violet" />
|
|
68
|
+
<StatsCard label="Unassigned" :value="stats.unassigned" color="amber" />
|
|
69
|
+
<StatsCard label="SLA Breached" :value="stats.sla_breached" color="red" />
|
|
70
|
+
<StatsCard label="Resolved Today" :value="stats.resolved_today" color="green" />
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="grid grid-cols-1 gap-6 lg:grid-cols-3">
|
|
74
|
+
<div class="lg:col-span-2 space-y-6">
|
|
75
|
+
<!-- Needs Attention -->
|
|
76
|
+
<div v-if="hasSlaBreaching || hasUnassignedUrgent">
|
|
77
|
+
<h2 class="mb-4 text-lg font-semibold text-neutral-200">Needs Attention</h2>
|
|
78
|
+
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
|
79
|
+
<div v-if="hasSlaBreaching" class="rounded-xl border border-rose-500/20 bg-rose-500/5 p-4">
|
|
80
|
+
<h3 class="mb-3 flex items-center gap-2 text-sm font-semibold text-rose-400">
|
|
81
|
+
<span class="h-2 w-2 rounded-full bg-rose-500"></span>
|
|
82
|
+
SLA Breaching
|
|
83
|
+
</h3>
|
|
84
|
+
<div v-for="ticket in needsAttention.sla_breaching" :key="ticket.id" class="mb-2 last:mb-0">
|
|
85
|
+
<Link :href="route('escalated.agent.tickets.show', ticket.reference)"
|
|
86
|
+
class="flex items-center justify-between rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-white/[0.04]">
|
|
87
|
+
<span class="font-mono text-xs text-neutral-400">{{ ticket.reference }}</span>
|
|
88
|
+
<span class="truncate text-neutral-300" style="max-width: 140px">{{ ticket.requester?.name }}</span>
|
|
89
|
+
</Link>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
<div v-if="hasUnassignedUrgent" class="rounded-xl border border-amber-500/20 bg-amber-500/5 p-4">
|
|
93
|
+
<h3 class="mb-3 flex items-center gap-2 text-sm font-semibold text-amber-400">
|
|
94
|
+
<span class="h-2 w-2 rounded-full bg-amber-500"></span>
|
|
95
|
+
Unassigned Urgent
|
|
96
|
+
</h3>
|
|
97
|
+
<div v-for="ticket in needsAttention.unassigned_urgent" :key="ticket.id" class="mb-2 last:mb-0">
|
|
98
|
+
<Link :href="route('escalated.agent.tickets.show', ticket.reference)"
|
|
99
|
+
class="flex items-center justify-between rounded-lg px-2 py-1.5 text-sm transition-colors hover:bg-white/[0.04]">
|
|
100
|
+
<span class="font-mono text-xs text-neutral-400">{{ ticket.reference }}</span>
|
|
101
|
+
<PriorityBadge :priority="ticket.priority" />
|
|
102
|
+
</Link>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<!-- Recent Tickets -->
|
|
109
|
+
<div>
|
|
110
|
+
<h2 class="mb-4 text-lg font-semibold text-neutral-200">Recent Tickets</h2>
|
|
111
|
+
<div class="overflow-hidden rounded-xl border border-white/[0.06] bg-neutral-900/60">
|
|
112
|
+
<table class="min-w-full divide-y divide-white/[0.06]">
|
|
113
|
+
<thead>
|
|
114
|
+
<tr class="bg-white/[0.02]">
|
|
115
|
+
<th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Reference</th>
|
|
116
|
+
<th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Subject</th>
|
|
117
|
+
<th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Requester</th>
|
|
118
|
+
<th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Status</th>
|
|
119
|
+
<th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Priority</th>
|
|
120
|
+
<th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Assignee</th>
|
|
121
|
+
<th class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-neutral-500">Last Reply</th>
|
|
122
|
+
</tr>
|
|
123
|
+
</thead>
|
|
124
|
+
<tbody class="divide-y divide-white/[0.04]">
|
|
125
|
+
<tr v-for="ticket in recentTickets" :key="ticket.id" class="transition-colors hover:bg-white/[0.03]">
|
|
126
|
+
<td class="whitespace-nowrap px-4 py-3 text-sm font-medium">
|
|
127
|
+
<div class="flex items-center gap-2">
|
|
128
|
+
<span v-if="slaClass(ticket)" :class="['h-2 w-2 shrink-0 rounded-full', slaClass(ticket)]"></span>
|
|
129
|
+
<Link :href="route('escalated.agent.tickets.show', ticket.reference)" class="text-white hover:text-neutral-300">
|
|
130
|
+
{{ ticket.reference }}
|
|
131
|
+
</Link>
|
|
132
|
+
</div>
|
|
133
|
+
</td>
|
|
134
|
+
<td class="px-4 py-3 text-sm text-neutral-300">{{ truncate(ticket.subject) }}</td>
|
|
135
|
+
<td class="px-4 py-3 text-sm text-neutral-400">{{ ticket.requester?.name }}</td>
|
|
136
|
+
<td class="px-4 py-3"><StatusBadge :status="ticket.status" /></td>
|
|
137
|
+
<td class="px-4 py-3"><PriorityBadge :priority="ticket.priority" /></td>
|
|
138
|
+
<td class="px-4 py-3 text-sm text-neutral-500">{{ ticket.assignee?.name || 'Unassigned' }}</td>
|
|
139
|
+
<td class="whitespace-nowrap px-4 py-3 text-sm text-neutral-600">
|
|
140
|
+
<template v-if="ticket.latest_reply">
|
|
141
|
+
<div class="text-neutral-400">{{ timeAgo(ticket.latest_reply.created_at) }}</div>
|
|
142
|
+
<div class="text-xs text-neutral-600">{{ ticket.latest_reply.author?.name || '' }}</div>
|
|
143
|
+
</template>
|
|
144
|
+
<span v-else class="text-neutral-700">—</span>
|
|
145
|
+
</td>
|
|
146
|
+
</tr>
|
|
147
|
+
<tr v-if="!recentTickets?.length">
|
|
148
|
+
<td colspan="7" class="px-4 py-8 text-center text-sm text-neutral-500">No recent tickets</td>
|
|
149
|
+
</tr>
|
|
150
|
+
</tbody>
|
|
151
|
+
</table>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<!-- My Performance sidebar -->
|
|
157
|
+
<div class="space-y-4">
|
|
158
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
|
|
159
|
+
<h3 class="mb-4 text-sm font-semibold text-neutral-200">My Performance</h3>
|
|
160
|
+
<dl class="space-y-3">
|
|
161
|
+
<div class="flex items-center justify-between">
|
|
162
|
+
<dt class="text-sm text-neutral-500">Resolved This Week</dt>
|
|
163
|
+
<dd class="text-lg font-bold text-white">{{ myPerformance.resolved_this_week || 0 }}</dd>
|
|
164
|
+
</div>
|
|
165
|
+
</dl>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
<!-- Plugin dashboard widgets -->
|
|
171
|
+
<div v-if="dashboardWidgets.length" class="mt-6 grid grid-cols-1 gap-4 md:grid-cols-2">
|
|
172
|
+
<div v-for="widget in dashboardWidgets" :key="widget.id"
|
|
173
|
+
:class="['rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5',
|
|
174
|
+
widget.width === 'full' ? 'md:col-span-2' : '']">
|
|
175
|
+
<h3 v-if="widget.title" class="mb-3 text-sm font-semibold text-neutral-200">{{ widget.title }}</h3>
|
|
176
|
+
<component
|
|
177
|
+
:is="loadWidgetComponent(widget.plugin, widget.component)"
|
|
178
|
+
v-bind="widget.data || {}"
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<!-- Plugin: dashboard footer slot -->
|
|
184
|
+
<PluginSlot slot="dashboard.footer" :components="getPageComponents('dashboard', 'footer')" />
|
|
185
|
+
</EscalatedLayout>
|
|
186
|
+
</template>
|
|
@@ -1,21 +1,38 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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>
|
|
@@ -1,108 +1,155 @@
|
|
|
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
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</
|
|
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 PluginSlot from '../../components/PluginSlot.vue';
|
|
15
|
+
import { useKeyboardShortcuts } from '../../composables/useKeyboardShortcuts';
|
|
16
|
+
import { usePluginExtensions } from '../../composables/usePluginExtensions';
|
|
17
|
+
import { router, useForm, usePage } from '@inertiajs/vue3';
|
|
18
|
+
import { ref } from 'vue';
|
|
19
|
+
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
ticket: Object,
|
|
22
|
+
departments: Array,
|
|
23
|
+
tags: Array,
|
|
24
|
+
cannedResponses: Array,
|
|
25
|
+
macros: { type: Array, default: () => [] },
|
|
26
|
+
is_following: { type: Boolean, default: false },
|
|
27
|
+
followers_count: { type: Number, default: 0 },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const page = usePage();
|
|
31
|
+
const activeTab = ref('reply');
|
|
32
|
+
const showShortcutHelp = ref(false);
|
|
33
|
+
const replyComposerRef = ref(null);
|
|
34
|
+
const statusSelectRef = ref(null);
|
|
35
|
+
const prioritySelectRef = ref(null);
|
|
36
|
+
|
|
37
|
+
const statusForm = useForm({ status: '' });
|
|
38
|
+
const priorityForm = useForm({ priority: '' });
|
|
39
|
+
const assignForm = useForm({ agent_id: '' });
|
|
40
|
+
|
|
41
|
+
function changeStatus(status) {
|
|
42
|
+
statusForm.status = status;
|
|
43
|
+
statusForm.post(route('escalated.agent.tickets.status', props.ticket.reference), { preserveScroll: true });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function changePriority(priority) {
|
|
47
|
+
priorityForm.priority = priority;
|
|
48
|
+
priorityForm.post(route('escalated.agent.tickets.priority', props.ticket.reference), { preserveScroll: true });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function assignToMe() {
|
|
52
|
+
assignForm.agent_id = page.props.auth.user.id;
|
|
53
|
+
assignForm.post(route('escalated.agent.tickets.assign', props.ticket.reference), { preserveScroll: true });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function toggleFollow() {
|
|
57
|
+
router.post(route('escalated.agent.tickets.follow', props.ticket.reference), {}, { preserveScroll: true });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const { getPageComponents } = usePluginExtensions();
|
|
61
|
+
|
|
62
|
+
// Keyboard shortcuts
|
|
63
|
+
useKeyboardShortcuts({
|
|
64
|
+
'r': () => { activeTab.value = 'reply'; replyComposerRef.value?.$el?.querySelector('textarea')?.focus(); },
|
|
65
|
+
'n': () => { activeTab.value = 'note'; },
|
|
66
|
+
's': () => { statusSelectRef.value?.focus(); },
|
|
67
|
+
'p': () => { prioritySelectRef.value?.focus(); },
|
|
68
|
+
'f': () => { toggleFollow(); },
|
|
69
|
+
'?': () => { showShortcutHelp.value = true; },
|
|
70
|
+
});
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<EscalatedLayout :title="ticket.subject">
|
|
75
|
+
<!-- Plugin: ticket show header slot -->
|
|
76
|
+
<PluginSlot slot="ticket.show.header" :components="getPageComponents('ticket.show', 'header')" />
|
|
77
|
+
|
|
78
|
+
<div class="mb-5 flex flex-wrap items-center gap-3">
|
|
79
|
+
<span class="text-sm font-mono font-medium text-white">{{ ticket.reference }}</span>
|
|
80
|
+
<StatusBadge :status="ticket.status" />
|
|
81
|
+
<PriorityBadge :priority="ticket.priority" />
|
|
82
|
+
<span class="text-sm text-neutral-500">by {{ ticket.requester?.name }}</span>
|
|
83
|
+
<PresenceIndicator :ticket-reference="ticket.reference" route-prefix="escalated.agent" />
|
|
84
|
+
<div class="ml-auto flex items-center gap-2">
|
|
85
|
+
<FollowButton :is-following="is_following" :followers-count="followers_count"
|
|
86
|
+
:action="route('escalated.agent.tickets.follow', ticket.reference)" />
|
|
87
|
+
<MacroDropdown v-if="macros.length" :macros="macros"
|
|
88
|
+
:action="route('escalated.agent.tickets.macro', ticket.reference)" />
|
|
89
|
+
<button v-if="!ticket.assigned_to" @click="assignToMe"
|
|
90
|
+
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">
|
|
91
|
+
Assign to Me
|
|
92
|
+
</button>
|
|
93
|
+
<select ref="statusSelectRef" @change="changeStatus($event.target.value); $event.target.value = ''"
|
|
94
|
+
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">
|
|
95
|
+
<option value="">Change Status...</option>
|
|
96
|
+
<option value="in_progress">In Progress</option>
|
|
97
|
+
<option value="waiting_on_customer">Waiting on Customer</option>
|
|
98
|
+
<option value="resolved">Resolved</option>
|
|
99
|
+
<option value="closed">Closed</option>
|
|
100
|
+
</select>
|
|
101
|
+
<select ref="prioritySelectRef" @change="changePriority($event.target.value); $event.target.value = ''"
|
|
102
|
+
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">
|
|
103
|
+
<option value="">Change Priority...</option>
|
|
104
|
+
<option value="low">Low</option>
|
|
105
|
+
<option value="medium">Medium</option>
|
|
106
|
+
<option value="high">High</option>
|
|
107
|
+
<option value="urgent">Urgent</option>
|
|
108
|
+
<option value="critical">Critical</option>
|
|
109
|
+
</select>
|
|
110
|
+
<!-- Plugin: ticket show actions slot -->
|
|
111
|
+
<PluginSlot slot="ticket.show.actions" :components="getPageComponents('ticket.show', 'actions')" />
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="grid grid-cols-1 gap-6 lg:grid-cols-3">
|
|
115
|
+
<div class="lg:col-span-2 space-y-6">
|
|
116
|
+
<PinnedNotes v-if="ticket.pinned_notes?.length" :notes="ticket.pinned_notes"
|
|
117
|
+
:ticket-reference="ticket.reference" route-prefix="escalated.agent" />
|
|
118
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-5">
|
|
119
|
+
<p class="whitespace-pre-wrap text-sm text-neutral-300">{{ ticket.description }}</p>
|
|
120
|
+
<AttachmentList v-if="ticket.attachments?.length" :attachments="ticket.attachments" class="mt-3" />
|
|
121
|
+
</div>
|
|
122
|
+
<div>
|
|
123
|
+
<div class="mb-4 flex gap-4 border-b border-white/[0.06]">
|
|
124
|
+
<button @click="activeTab = 'reply'"
|
|
125
|
+
: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']">
|
|
126
|
+
Reply
|
|
127
|
+
</button>
|
|
128
|
+
<button @click="activeTab = 'note'"
|
|
129
|
+
: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']">
|
|
130
|
+
Internal Note
|
|
131
|
+
</button>
|
|
132
|
+
</div>
|
|
133
|
+
<ReplyComposer v-if="activeTab === 'reply'" ref="replyComposerRef"
|
|
134
|
+
:action="route('escalated.agent.tickets.reply', ticket.reference)"
|
|
135
|
+
:canned-responses="cannedResponses" />
|
|
136
|
+
<ReplyComposer v-else
|
|
137
|
+
:action="route('escalated.agent.tickets.note', ticket.reference)"
|
|
138
|
+
placeholder="Write an internal note..."
|
|
139
|
+
submit-label="Add Note" />
|
|
140
|
+
</div>
|
|
141
|
+
<div>
|
|
142
|
+
<h2 class="mb-4 text-lg font-semibold text-neutral-200">Conversation</h2>
|
|
143
|
+
<ReplyThread :replies="ticket.replies || []" :current-user-id="page.props.auth?.user?.id"
|
|
144
|
+
:ticket-reference="ticket.reference" route-prefix="escalated.agent" pinnable />
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="space-y-6">
|
|
148
|
+
<TicketSidebar :ticket="ticket" :tags="tags" :departments="departments" />
|
|
149
|
+
<!-- Plugin: ticket show sidebar slot -->
|
|
150
|
+
<PluginSlot slot="ticket.show.sidebar" :components="getPageComponents('ticket.show', 'sidebar')" />
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
<KeyboardShortcutHelp v-model:show="showShortcutHelp" context="detail" />
|
|
154
|
+
</EscalatedLayout>
|
|
155
|
+
</template>
|