@escalated-dev/escalated 0.7.0 → 0.8.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/LICENSE +21 -21
- package/README.md +36 -1
- package/package.json +16 -7
- 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 +35 -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 +83 -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 +30 -8
- 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/README.md +13 -0
- 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 +193 -53
- package/src/pages/Admin/Skills/Index.vue +105 -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/Users/Index.vue +145 -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 +26 -1
- 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 +26 -1
- 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 { ref, watch, onMounted } from 'vue';
|
|
3
|
-
import { router } from '@inertiajs/vue3';
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
ticketReference: { type: String, required: true },
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const links = ref([]);
|
|
10
|
-
const searchTerm = ref('');
|
|
11
|
-
const searchResults = ref([]);
|
|
12
|
-
const linkType = ref('related');
|
|
13
|
-
const loading = ref(false);
|
|
14
|
-
const expanded = ref(true);
|
|
15
|
-
let debounceTimer = null;
|
|
16
|
-
|
|
17
|
-
const linkTypeLabels = {
|
|
18
|
-
problem_incident: 'Problem/Incident',
|
|
19
|
-
parent_child: 'Parent/Child',
|
|
20
|
-
related: 'Related',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
onMounted(() => {
|
|
24
|
-
fetchLinks();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
async function fetchLinks() {
|
|
28
|
-
try {
|
|
29
|
-
const response = await fetch(route('escalated.admin.tickets.links.index', props.ticketReference), {
|
|
30
|
-
headers: {
|
|
31
|
-
Accept: 'application/json',
|
|
32
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
33
|
-
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
if (response.ok) {
|
|
37
|
-
const data = await response.json();
|
|
38
|
-
links.value = data.links || [];
|
|
39
|
-
}
|
|
40
|
-
} catch {
|
|
41
|
-
// silently ignore
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
watch(searchTerm, (val) => {
|
|
46
|
-
window.clearTimeout(debounceTimer);
|
|
47
|
-
if (!val || val.length < 2) {
|
|
48
|
-
searchResults.value = [];
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
debounceTimer = window.setTimeout(() => searchTickets(val), 300);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
async function searchTickets(term) {
|
|
55
|
-
loading.value = true;
|
|
56
|
-
try {
|
|
57
|
-
const response = await fetch(route('escalated.admin.tickets.merge-search', { q: term }), {
|
|
58
|
-
headers: {
|
|
59
|
-
Accept: 'application/json',
|
|
60
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
61
|
-
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
if (response.ok) {
|
|
65
|
-
const data = await response.json();
|
|
66
|
-
searchResults.value = (data.tickets || []).filter((t) => t.reference !== props.ticketReference);
|
|
67
|
-
}
|
|
68
|
-
} catch {
|
|
69
|
-
// silently ignore
|
|
70
|
-
} finally {
|
|
71
|
-
loading.value = false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function addLink(targetRef) {
|
|
76
|
-
router.post(
|
|
77
|
-
route('escalated.admin.tickets.links.store', props.ticketReference),
|
|
78
|
-
{
|
|
79
|
-
target_reference: targetRef,
|
|
80
|
-
link_type: linkType.value,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
preserveScroll: true,
|
|
84
|
-
onSuccess: () => {
|
|
85
|
-
searchTerm.value = '';
|
|
86
|
-
searchResults.value = [];
|
|
87
|
-
fetchLinks();
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function removeLink(linkId) {
|
|
94
|
-
router.delete(route('escalated.admin.tickets.links.destroy', [props.ticketReference, linkId]), {
|
|
95
|
-
preserveScroll: true,
|
|
96
|
-
onSuccess: () => {
|
|
97
|
-
fetchLinks();
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function groupedLinks() {
|
|
103
|
-
const groups = {};
|
|
104
|
-
for (const link of links.value) {
|
|
105
|
-
const type = link.link_type;
|
|
106
|
-
if (!groups[type]) groups[type] = [];
|
|
107
|
-
groups[type].push(link);
|
|
108
|
-
}
|
|
109
|
-
return groups;
|
|
110
|
-
}
|
|
111
|
-
</script>
|
|
112
|
-
|
|
113
|
-
<template>
|
|
114
|
-
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
|
|
115
|
-
<button
|
|
116
|
-
class="flex w-full items-center justify-between text-sm font-semibold text-neutral-200"
|
|
117
|
-
@click="expanded = !expanded"
|
|
118
|
-
>
|
|
119
|
-
<span>Linked Tickets</span>
|
|
120
|
-
<svg
|
|
121
|
-
:class="['h-4 w-4 transition-transform text-neutral-500', expanded && 'rotate-180']"
|
|
122
|
-
fill="none"
|
|
123
|
-
stroke="currentColor"
|
|
124
|
-
stroke-width="1.5"
|
|
125
|
-
viewBox="0 0 24 24"
|
|
126
|
-
>
|
|
127
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
|
128
|
-
</svg>
|
|
129
|
-
</button>
|
|
130
|
-
|
|
131
|
-
<div v-if="expanded" class="mt-3 space-y-3">
|
|
132
|
-
<!-- Grouped links -->
|
|
133
|
-
<div v-for="(groupLinks, type) in groupedLinks()" :key="type">
|
|
134
|
-
<p class="text-xs font-semibold uppercase tracking-wider text-neutral-500">
|
|
135
|
-
{{ linkTypeLabels[type] || type }}
|
|
136
|
-
</p>
|
|
137
|
-
<div class="mt-1 space-y-1">
|
|
138
|
-
<div
|
|
139
|
-
v-for="link in groupLinks"
|
|
140
|
-
:key="link.id"
|
|
141
|
-
class="flex items-center justify-between rounded-lg bg-white/[0.02] px-2 py-1.5"
|
|
142
|
-
>
|
|
143
|
-
<div class="text-sm">
|
|
144
|
-
<span class="font-mono text-xs text-neutral-400">{{ link.ticket.reference }}</span>
|
|
145
|
-
<span class="ml-1 text-neutral-300">{{ link.ticket.subject }}</span>
|
|
146
|
-
</div>
|
|
147
|
-
<button
|
|
148
|
-
aria-label="Remove link"
|
|
149
|
-
class="text-rose-400 hover:text-rose-300 text-xs"
|
|
150
|
-
@click="removeLink(link.id)"
|
|
151
|
-
>
|
|
152
|
-
Unlink
|
|
153
|
-
</button>
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
<div v-if="!links.length" class="text-xs text-neutral-500">No linked tickets.</div>
|
|
159
|
-
|
|
160
|
-
<!-- Add link form -->
|
|
161
|
-
<div class="border-t border-white/[0.06] pt-3">
|
|
162
|
-
<div class="flex gap-2 mb-2">
|
|
163
|
-
<select
|
|
164
|
-
v-model="linkType"
|
|
165
|
-
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-xs text-neutral-300 focus:border-white/20 focus:outline-none"
|
|
166
|
-
>
|
|
167
|
-
<option value="related">Related</option>
|
|
168
|
-
<option value="problem_incident">Problem/Incident</option>
|
|
169
|
-
<option value="parent_child">Parent/Child</option>
|
|
170
|
-
</select>
|
|
171
|
-
</div>
|
|
172
|
-
<input
|
|
173
|
-
v-model="searchTerm"
|
|
174
|
-
type="text"
|
|
175
|
-
placeholder="Search ticket to link..."
|
|
176
|
-
class="w-full rounded-lg border border-white/10 bg-neutral-950 px-2 py-1.5 text-xs text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
177
|
-
/>
|
|
178
|
-
<div v-if="loading" class="mt-2 text-xs text-neutral-500">Searching...</div>
|
|
179
|
-
<div v-else-if="searchResults.length" class="mt-2 max-h-32 space-y-1 overflow-y-auto">
|
|
180
|
-
<button
|
|
181
|
-
v-for="ticket in searchResults"
|
|
182
|
-
:key="ticket.id"
|
|
183
|
-
class="w-full rounded-lg px-2 py-1 text-left text-xs text-neutral-300 transition-colors hover:bg-white/[0.04]"
|
|
184
|
-
@click="addLink(ticket.reference)"
|
|
185
|
-
>
|
|
186
|
-
<span class="font-mono text-neutral-400">{{ ticket.reference }}</span>
|
|
187
|
-
<span class="ml-1">{{ ticket.subject }}</span>
|
|
188
|
-
</button>
|
|
189
|
-
</div>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
</div>
|
|
193
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, watch, onMounted } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
ticketReference: { type: String, required: true },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const links = ref([]);
|
|
10
|
+
const searchTerm = ref('');
|
|
11
|
+
const searchResults = ref([]);
|
|
12
|
+
const linkType = ref('related');
|
|
13
|
+
const loading = ref(false);
|
|
14
|
+
const expanded = ref(true);
|
|
15
|
+
let debounceTimer = null;
|
|
16
|
+
|
|
17
|
+
const linkTypeLabels = {
|
|
18
|
+
problem_incident: 'Problem/Incident',
|
|
19
|
+
parent_child: 'Parent/Child',
|
|
20
|
+
related: 'Related',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
fetchLinks();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
async function fetchLinks() {
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(route('escalated.admin.tickets.links.index', props.ticketReference), {
|
|
30
|
+
headers: {
|
|
31
|
+
Accept: 'application/json',
|
|
32
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
33
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
if (response.ok) {
|
|
37
|
+
const data = await response.json();
|
|
38
|
+
links.value = data.links || [];
|
|
39
|
+
}
|
|
40
|
+
} catch {
|
|
41
|
+
// silently ignore
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
watch(searchTerm, (val) => {
|
|
46
|
+
window.clearTimeout(debounceTimer);
|
|
47
|
+
if (!val || val.length < 2) {
|
|
48
|
+
searchResults.value = [];
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
debounceTimer = window.setTimeout(() => searchTickets(val), 300);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
async function searchTickets(term) {
|
|
55
|
+
loading.value = true;
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(route('escalated.admin.tickets.merge-search', { q: term }), {
|
|
58
|
+
headers: {
|
|
59
|
+
Accept: 'application/json',
|
|
60
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
61
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
if (response.ok) {
|
|
65
|
+
const data = await response.json();
|
|
66
|
+
searchResults.value = (data.tickets || []).filter((t) => t.reference !== props.ticketReference);
|
|
67
|
+
}
|
|
68
|
+
} catch {
|
|
69
|
+
// silently ignore
|
|
70
|
+
} finally {
|
|
71
|
+
loading.value = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function addLink(targetRef) {
|
|
76
|
+
router.post(
|
|
77
|
+
route('escalated.admin.tickets.links.store', props.ticketReference),
|
|
78
|
+
{
|
|
79
|
+
target_reference: targetRef,
|
|
80
|
+
link_type: linkType.value,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
preserveScroll: true,
|
|
84
|
+
onSuccess: () => {
|
|
85
|
+
searchTerm.value = '';
|
|
86
|
+
searchResults.value = [];
|
|
87
|
+
fetchLinks();
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function removeLink(linkId) {
|
|
94
|
+
router.delete(route('escalated.admin.tickets.links.destroy', [props.ticketReference, linkId]), {
|
|
95
|
+
preserveScroll: true,
|
|
96
|
+
onSuccess: () => {
|
|
97
|
+
fetchLinks();
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function groupedLinks() {
|
|
103
|
+
const groups = {};
|
|
104
|
+
for (const link of links.value) {
|
|
105
|
+
const type = link.link_type;
|
|
106
|
+
if (!groups[type]) groups[type] = [];
|
|
107
|
+
groups[type].push(link);
|
|
108
|
+
}
|
|
109
|
+
return groups;
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<template>
|
|
114
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
|
|
115
|
+
<button
|
|
116
|
+
class="flex w-full items-center justify-between text-sm font-semibold text-neutral-200"
|
|
117
|
+
@click="expanded = !expanded"
|
|
118
|
+
>
|
|
119
|
+
<span>Linked Tickets</span>
|
|
120
|
+
<svg
|
|
121
|
+
:class="['h-4 w-4 transition-transform text-neutral-500', expanded && 'rotate-180']"
|
|
122
|
+
fill="none"
|
|
123
|
+
stroke="currentColor"
|
|
124
|
+
stroke-width="1.5"
|
|
125
|
+
viewBox="0 0 24 24"
|
|
126
|
+
>
|
|
127
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
|
128
|
+
</svg>
|
|
129
|
+
</button>
|
|
130
|
+
|
|
131
|
+
<div v-if="expanded" class="mt-3 space-y-3">
|
|
132
|
+
<!-- Grouped links -->
|
|
133
|
+
<div v-for="(groupLinks, type) in groupedLinks()" :key="type">
|
|
134
|
+
<p class="text-xs font-semibold uppercase tracking-wider text-neutral-500">
|
|
135
|
+
{{ linkTypeLabels[type] || type }}
|
|
136
|
+
</p>
|
|
137
|
+
<div class="mt-1 space-y-1">
|
|
138
|
+
<div
|
|
139
|
+
v-for="link in groupLinks"
|
|
140
|
+
:key="link.id"
|
|
141
|
+
class="flex items-center justify-between rounded-lg bg-white/[0.02] px-2 py-1.5"
|
|
142
|
+
>
|
|
143
|
+
<div class="text-sm">
|
|
144
|
+
<span class="font-mono text-xs text-neutral-400">{{ link.ticket.reference }}</span>
|
|
145
|
+
<span class="ml-1 text-neutral-300">{{ link.ticket.subject }}</span>
|
|
146
|
+
</div>
|
|
147
|
+
<button
|
|
148
|
+
aria-label="Remove link"
|
|
149
|
+
class="text-rose-400 hover:text-rose-300 text-xs"
|
|
150
|
+
@click="removeLink(link.id)"
|
|
151
|
+
>
|
|
152
|
+
Unlink
|
|
153
|
+
</button>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div v-if="!links.length" class="text-xs text-neutral-500">No linked tickets.</div>
|
|
159
|
+
|
|
160
|
+
<!-- Add link form -->
|
|
161
|
+
<div class="border-t border-white/[0.06] pt-3">
|
|
162
|
+
<div class="flex gap-2 mb-2">
|
|
163
|
+
<select
|
|
164
|
+
v-model="linkType"
|
|
165
|
+
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-xs text-neutral-300 focus:border-white/20 focus:outline-none"
|
|
166
|
+
>
|
|
167
|
+
<option value="related">Related</option>
|
|
168
|
+
<option value="problem_incident">Problem/Incident</option>
|
|
169
|
+
<option value="parent_child">Parent/Child</option>
|
|
170
|
+
</select>
|
|
171
|
+
</div>
|
|
172
|
+
<input
|
|
173
|
+
v-model="searchTerm"
|
|
174
|
+
type="text"
|
|
175
|
+
placeholder="Search ticket to link..."
|
|
176
|
+
class="w-full rounded-lg border border-white/10 bg-neutral-950 px-2 py-1.5 text-xs text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
177
|
+
/>
|
|
178
|
+
<div v-if="loading" class="mt-2 text-xs text-neutral-500">Searching...</div>
|
|
179
|
+
<div v-else-if="searchResults.length" class="mt-2 max-h-32 space-y-1 overflow-y-auto">
|
|
180
|
+
<button
|
|
181
|
+
v-for="ticket in searchResults"
|
|
182
|
+
:key="ticket.id"
|
|
183
|
+
class="w-full rounded-lg px-2 py-1 text-left text-xs text-neutral-300 transition-colors hover:bg-white/[0.04]"
|
|
184
|
+
@click="addLink(ticket.reference)"
|
|
185
|
+
>
|
|
186
|
+
<span class="font-mono text-neutral-400">{{ ticket.reference }}</span>
|
|
187
|
+
<span class="ml-1">{{ ticket.subject }}</span>
|
|
188
|
+
</button>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
</template>
|