@escalated-dev/escalated 0.6.0 → 0.7.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 +94 -2
- package/package.json +31 -2
- package/src/components/ActivityTimeline.stories.js +55 -0
- package/src/components/ActivityTimeline.vue +24 -7
- package/src/components/AdminDashboard.stories.js +1095 -0
- package/src/components/AgentLoadIndicator.stories.js +37 -0
- package/src/components/AgentLoadIndicator.vue +49 -0
- package/src/components/AgentPerformanceCard.vue +44 -0
- package/src/components/ArticleEditor.vue +82 -0
- package/src/components/AssigneeSelect.vue +19 -5
- package/src/components/AttachmentList.vue +53 -37
- package/src/components/AuditLogEntry.vue +95 -0
- package/src/components/BulkActionBar.vue +99 -30
- package/src/components/CategoryTree.vue +89 -0
- package/src/components/ChartWidget.vue +46 -0
- package/src/components/CollisionWarning.stories.js +30 -0
- package/src/components/CollisionWarning.vue +68 -0
- package/src/components/ConditionalFieldRules.vue +135 -0
- package/src/components/ContextPanel.vue +66 -0
- package/src/components/ContextPanelSection.vue +65 -0
- package/src/components/CustomFieldRenderer.vue +159 -0
- package/src/components/EscalatedLayout.vue +400 -69
- package/src/components/FileDropzone.vue +26 -10
- package/src/components/FollowButton.stories.js +30 -0
- package/src/components/FollowButton.vue +53 -28
- package/src/components/KeyboardShortcutHelp.vue +129 -39
- package/src/components/KnowledgePanel.vue +122 -0
- package/src/components/KpiCard.stories.js +32 -0
- package/src/components/KpiCard.vue +88 -0
- package/src/components/MacroDropdown.vue +95 -35
- package/src/components/PermissionMatrix.vue +107 -0
- package/src/components/PinnedNotes.vue +70 -31
- package/src/components/PresenceIndicator.vue +93 -27
- package/src/components/PriorityBadge.stories.js +33 -0
- package/src/components/PriorityBadge.vue +9 -2
- package/src/components/QuickFilters.vue +65 -49
- package/src/components/ReplyComposer.vue +144 -30
- package/src/components/ReplyThread.vue +72 -20
- package/src/components/SatisfactionRating.vue +98 -46
- package/src/components/ScheduleEditor.vue +104 -0
- package/src/components/SideConversation.vue +165 -0
- package/src/components/SideConversationList.vue +147 -0
- package/src/components/SkillTagManager.vue +79 -0
- package/src/components/SlaComplianceChart.vue +53 -0
- package/src/components/SlaTimer.stories.js +35 -0
- package/src/components/SlaTimer.vue +17 -4
- package/src/components/StatsCard.stories.js +24 -0
- package/src/components/StatsCard.vue +58 -46
- package/src/components/StatusBadge.stories.js +53 -0
- package/src/components/StatusBadge.vue +36 -4
- package/src/components/TagSelect.vue +43 -12
- package/src/components/TicketFilters.vue +225 -69
- package/src/components/TicketLinkPanel.vue +193 -0
- package/src/components/TicketList.vue +594 -193
- package/src/components/TicketMergeDialog.vue +157 -0
- package/src/components/TicketSidebar.vue +167 -99
- package/src/components/TicketTypeSelector.vue +21 -0
- package/src/components/TotpInput.stories.js +9 -0
- package/src/components/TotpInput.vue +81 -0
- package/src/components/TwoFactorSetup.vue +113 -0
- package/src/composables/useDebouncedSearch.js +38 -0
- package/src/composables/usePluginExtensions.js +95 -3
- package/src/composables/usePluginHooks.js +65 -0
- package/src/defineEscalatedPlugin.js +34 -8
- package/src/index.js +72 -35
- package/src/locales/en.json +25 -0
- package/src/pages/Admin/ApiTokens/Index.vue +231 -67
- package/src/pages/Admin/AuditLog/Index.vue +154 -0
- package/src/pages/Admin/Automations/Form.vue +184 -0
- package/src/pages/Admin/Automations/Index.vue +129 -0
- package/src/pages/Admin/BusinessHours/Form.vue +172 -0
- package/src/pages/Admin/BusinessHours/Index.vue +113 -0
- package/src/pages/Admin/CannedResponses/Index.vue +127 -70
- package/src/pages/Admin/Capacity/Index.vue +134 -0
- package/src/pages/Admin/CustomFields/Form.vue +195 -0
- package/src/pages/Admin/CustomFields/Index.vue +134 -0
- package/src/pages/Admin/CustomObjects/Form.vue +202 -0
- package/src/pages/Admin/CustomObjects/Index.vue +127 -0
- package/src/pages/Admin/CustomObjects/Records.vue +228 -0
- package/src/pages/Admin/Departments/Form.vue +75 -51
- package/src/pages/Admin/Departments/Index.vue +109 -57
- package/src/pages/Admin/EscalationRules/Form.vue +157 -96
- package/src/pages/Admin/EscalationRules/Index.vue +178 -57
- package/src/pages/Admin/Import/Connect.vue +96 -0
- package/src/pages/Admin/Import/Index.vue +102 -0
- package/src/pages/Admin/Import/Mapping.vue +110 -0
- package/src/pages/Admin/Import/Progress.vue +153 -0
- package/src/pages/Admin/Import/Review.vue +76 -0
- package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
- package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
- package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
- package/src/pages/Admin/Macros/Index.vue +250 -89
- package/src/pages/Admin/Plugins/Index.vue +205 -75
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
- package/src/pages/Admin/Reports/CsatReport.vue +127 -0
- package/src/pages/Admin/Reports/Dashboard.vue +211 -0
- package/src/pages/Admin/Reports/SlaReport.vue +166 -0
- package/src/pages/Admin/Reports.vue +139 -34
- package/src/pages/Admin/Roles/Form.vue +71 -0
- package/src/pages/Admin/Roles/Index.vue +122 -0
- package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
- package/src/pages/Admin/Settings/DataRetention.vue +182 -0
- package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
- package/src/pages/Admin/Settings/Sandbox.vue +135 -0
- package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
- package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
- package/src/pages/Admin/Settings.vue +468 -260
- package/src/pages/Admin/Skills/Form.vue +53 -0
- package/src/pages/Admin/Skills/Index.vue +94 -0
- package/src/pages/Admin/SlaPolicies/Form.vue +118 -75
- package/src/pages/Admin/SlaPolicies/Index.vue +120 -59
- package/src/pages/Admin/Statuses/Form.vue +114 -0
- package/src/pages/Admin/Statuses/Index.vue +153 -0
- package/src/pages/Admin/Tags/Index.vue +191 -105
- package/src/pages/Admin/Tickets/Index.vue +91 -39
- package/src/pages/Admin/Tickets/Show.vue +101 -37
- package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
- package/src/pages/Admin/Webhooks/Form.vue +110 -0
- package/src/pages/Admin/Webhooks/Index.vue +136 -0
- package/src/pages/Agent/Dashboard.vue +311 -186
- package/src/pages/Agent/TicketIndex.vue +88 -38
- package/src/pages/Agent/TicketShow.vue +258 -51
- package/src/pages/Customer/Create.vue +36 -9
- package/src/pages/Customer/Index.vue +31 -24
- package/src/pages/Customer/KnowledgeBase/Article.vue +127 -0
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
- package/src/plugin.js +86 -1
- package/src/utils/constants.js +30 -0
- package/src/utils/formatting.js +35 -0
- package/src/pages/Admin/Plugins.vue +0 -129
|
@@ -7,14 +7,17 @@ const props = defineProps({
|
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
const emit = defineEmits(['update:modelValue']);
|
|
10
|
-
const dark = inject(
|
|
10
|
+
const dark = inject(
|
|
11
|
+
'esc-dark',
|
|
12
|
+
computed(() => false),
|
|
13
|
+
);
|
|
11
14
|
|
|
12
15
|
const search = ref('');
|
|
13
16
|
|
|
14
17
|
const filteredTags = computed(() => {
|
|
15
18
|
if (!search.value) return props.tags;
|
|
16
19
|
const q = search.value.toLowerCase();
|
|
17
|
-
return props.tags.filter(t => t.name.toLowerCase().includes(q));
|
|
20
|
+
return props.tags.filter((t) => t.name.toLowerCase().includes(q));
|
|
18
21
|
});
|
|
19
22
|
|
|
20
23
|
function toggle(tagId) {
|
|
@@ -35,17 +38,45 @@ function isSelected(tagId) {
|
|
|
35
38
|
|
|
36
39
|
<template>
|
|
37
40
|
<div>
|
|
38
|
-
<label
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
<label
|
|
42
|
+
:class="['mb-1 block text-xs font-medium', dark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-600']"
|
|
43
|
+
>Tags</label
|
|
44
|
+
>
|
|
45
|
+
<input
|
|
46
|
+
v-model="search"
|
|
47
|
+
type="text"
|
|
48
|
+
placeholder="Filter tags..."
|
|
49
|
+
:class="[
|
|
50
|
+
'mb-2 w-full rounded-md border px-2 py-1 text-xs focus:outline-none',
|
|
51
|
+
dark
|
|
52
|
+
? 'border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-border-input)] focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
|
|
53
|
+
: 'border-gray-300 focus:border-blue-500',
|
|
54
|
+
]"
|
|
55
|
+
/>
|
|
42
56
|
<div class="flex flex-wrap gap-1">
|
|
43
|
-
<button
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
<button
|
|
58
|
+
v-for="tag in filteredTags"
|
|
59
|
+
:key="tag.id"
|
|
60
|
+
:class="[
|
|
61
|
+
'rounded-full px-2 py-0.5 text-xs font-medium transition-colors',
|
|
62
|
+
dark
|
|
63
|
+
? isSelected(tag.id)
|
|
64
|
+
? 'bg-[var(--esc-panel-active)] text-[var(--esc-panel-text)] ring-1 ring-[var(--esc-panel-border-input)]'
|
|
65
|
+
: 'bg-[var(--esc-panel-hover)] text-[var(--esc-panel-text-muted)] hover:bg-[var(--esc-panel-active)]'
|
|
66
|
+
: isSelected(tag.id)
|
|
67
|
+
? 'bg-blue-100 text-blue-700 ring-1 ring-blue-300'
|
|
68
|
+
: 'bg-gray-100 text-gray-600 hover:bg-gray-200',
|
|
69
|
+
]"
|
|
70
|
+
:style="
|
|
71
|
+
tag.color
|
|
72
|
+
? {
|
|
73
|
+
backgroundColor: isSelected(tag.id) ? tag.color + '33' : undefined,
|
|
74
|
+
color: isSelected(tag.id) ? tag.color : undefined,
|
|
75
|
+
}
|
|
76
|
+
: {}
|
|
77
|
+
"
|
|
78
|
+
@click="toggle(tag.id)"
|
|
79
|
+
>
|
|
49
80
|
{{ tag.name }}
|
|
50
81
|
</button>
|
|
51
82
|
</div>
|
|
@@ -1,69 +1,225 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { inject, computed, reactive, watch } from 'vue';
|
|
3
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { inject, computed, reactive, ref, watch } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
import { TICKET_STATUSES, TICKET_PRIORITIES } from '../utils/constants';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
statuses: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => TICKET_STATUSES,
|
|
10
|
+
},
|
|
11
|
+
priorities: { type: Array, default: () => TICKET_PRIORITIES },
|
|
12
|
+
agents: { type: Array, default: () => [] },
|
|
13
|
+
departments: { type: Array, default: () => [] },
|
|
14
|
+
tags: { type: Array, default: () => [] },
|
|
15
|
+
filters: { type: Object, default: () => ({}) },
|
|
16
|
+
route: { type: String, required: true },
|
|
17
|
+
modelValue: { type: Object, default: () => ({}) },
|
|
18
|
+
showFollowing: { type: Boolean, default: false },
|
|
19
|
+
showAssignee: { type: Boolean, default: false },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const emit = defineEmits(['update:modelValue']);
|
|
23
|
+
const escDark = inject(
|
|
24
|
+
'esc-dark',
|
|
25
|
+
computed(() => false),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const initial = { ...props.filters, ...props.modelValue };
|
|
29
|
+
|
|
30
|
+
const filterData = reactive({
|
|
31
|
+
status: initial.status || '',
|
|
32
|
+
priority: initial.priority || '',
|
|
33
|
+
assigned_to: initial.assigned_to || '',
|
|
34
|
+
department_id: initial.department_id || '',
|
|
35
|
+
search: initial.search || '',
|
|
36
|
+
following: initial.following || '',
|
|
37
|
+
created_after: initial.created_after || '',
|
|
38
|
+
created_before: initial.created_before || '',
|
|
39
|
+
tag: initial.tag || '',
|
|
40
|
+
has_attachments: initial.has_attachments || '',
|
|
41
|
+
requester: initial.requester || '',
|
|
42
|
+
ticket_type: initial.ticket_type || '',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const showAdvanced = ref(
|
|
46
|
+
!!(initial.created_after || initial.created_before || initial.tag || initial.has_attachments || initial.requester),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
// Debounced watcher that navigates via Inertia router
|
|
50
|
+
let debounceTimer = null;
|
|
51
|
+
|
|
52
|
+
watch(
|
|
53
|
+
filterData,
|
|
54
|
+
(val) => {
|
|
55
|
+
emit('update:modelValue', { ...val });
|
|
56
|
+
|
|
57
|
+
if (debounceTimer) {
|
|
58
|
+
clearTimeout(debounceTimer);
|
|
59
|
+
}
|
|
60
|
+
debounceTimer = setTimeout(() => {
|
|
61
|
+
// Strip empty values to keep the URL clean
|
|
62
|
+
const params = {};
|
|
63
|
+
for (const [key, value] of Object.entries(val)) {
|
|
64
|
+
if (value !== '' && value !== null && value !== undefined) {
|
|
65
|
+
params[key] = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
router.get(props.route, params, { preserveState: true, preserveScroll: true });
|
|
69
|
+
}, 300);
|
|
70
|
+
},
|
|
71
|
+
{ deep: true },
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const inputClass = computed(() =>
|
|
75
|
+
escDark.value
|
|
76
|
+
? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-3 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
|
|
77
|
+
: 'rounded-md border border-gray-300 px-3 py-1.5 text-sm focus:border-blue-500 focus:outline-none',
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const selectClass = computed(() =>
|
|
81
|
+
escDark.value
|
|
82
|
+
? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]'
|
|
83
|
+
: 'rounded-md border border-gray-300 px-2 py-1.5 text-sm',
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const checkboxClass = computed(() =>
|
|
87
|
+
escDark.value
|
|
88
|
+
? 'h-4 w-4 rounded border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-[var(--esc-panel-accent)] focus:ring-[var(--esc-panel-accent)]/20'
|
|
89
|
+
: 'h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500',
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const toggleBtnClass = computed(() =>
|
|
93
|
+
escDark.value
|
|
94
|
+
? 'rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] px-3 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-surface-alt)] transition-colors'
|
|
95
|
+
: 'rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-600 hover:bg-gray-50 transition-colors',
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const labelClass = computed(() =>
|
|
99
|
+
escDark.value ? 'text-xs font-medium text-[var(--esc-panel-text-tertiary)]' : 'text-xs font-medium text-gray-500',
|
|
100
|
+
);
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<div class="space-y-3">
|
|
105
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
106
|
+
<input
|
|
107
|
+
v-model="filterData.search"
|
|
108
|
+
type="text"
|
|
109
|
+
placeholder="Search tickets..."
|
|
110
|
+
aria-label="Search tickets"
|
|
111
|
+
:class="inputClass"
|
|
112
|
+
/>
|
|
113
|
+
<button type="button" :class="toggleBtnClass" @click="showAdvanced = !showAdvanced">
|
|
114
|
+
{{ showAdvanced ? 'Simple' : 'Advanced' }}
|
|
115
|
+
</button>
|
|
116
|
+
<select v-model="filterData.status" aria-label="Filter by status" :class="selectClass">
|
|
117
|
+
<option value="">All Statuses</option>
|
|
118
|
+
<option v-for="s in statuses" :key="s" :value="s">{{ s.replace(/_/g, ' ') }}</option>
|
|
119
|
+
</select>
|
|
120
|
+
<select v-model="filterData.priority" aria-label="Filter by priority" :class="selectClass">
|
|
121
|
+
<option value="">All Priorities</option>
|
|
122
|
+
<option v-for="p in priorities" :key="p" :value="p">{{ p }}</option>
|
|
123
|
+
</select>
|
|
124
|
+
<select v-model="filterData.ticket_type" aria-label="Filter by type" :class="selectClass">
|
|
125
|
+
<option value="">All Types</option>
|
|
126
|
+
<option value="question">Question</option>
|
|
127
|
+
<option value="problem">Problem</option>
|
|
128
|
+
<option value="incident">Incident</option>
|
|
129
|
+
<option value="task">Task</option>
|
|
130
|
+
</select>
|
|
131
|
+
<select
|
|
132
|
+
v-if="agents.length"
|
|
133
|
+
v-model="filterData.assigned_to"
|
|
134
|
+
aria-label="Filter by agent"
|
|
135
|
+
:class="selectClass"
|
|
136
|
+
>
|
|
137
|
+
<option value="">All Agents</option>
|
|
138
|
+
<option v-for="a in agents" :key="a.id" :value="a.id">{{ a.name }}</option>
|
|
139
|
+
</select>
|
|
140
|
+
<select
|
|
141
|
+
v-if="departments.length"
|
|
142
|
+
v-model="filterData.department_id"
|
|
143
|
+
aria-label="Filter by department"
|
|
144
|
+
:class="selectClass"
|
|
145
|
+
>
|
|
146
|
+
<option value="">All Departments</option>
|
|
147
|
+
<option v-for="d in departments" :key="d.id" :value="d.id">{{ d.name }}</option>
|
|
148
|
+
</select>
|
|
149
|
+
<label v-if="showFollowing" class="flex items-center gap-2">
|
|
150
|
+
<input
|
|
151
|
+
v-model="filterData.following"
|
|
152
|
+
type="checkbox"
|
|
153
|
+
true-value="1"
|
|
154
|
+
false-value=""
|
|
155
|
+
:class="checkboxClass"
|
|
156
|
+
/>
|
|
157
|
+
<span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
|
|
158
|
+
>Following</span
|
|
159
|
+
>
|
|
160
|
+
</label>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<!-- Advanced filters -->
|
|
164
|
+
<div
|
|
165
|
+
v-if="showAdvanced"
|
|
166
|
+
class="flex flex-wrap items-end gap-4 rounded-lg border p-3"
|
|
167
|
+
:class="
|
|
168
|
+
escDark
|
|
169
|
+
? 'border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)]'
|
|
170
|
+
: 'border-gray-200 bg-gray-50'
|
|
171
|
+
"
|
|
172
|
+
>
|
|
173
|
+
<div class="flex flex-col gap-1">
|
|
174
|
+
<label :class="labelClass">Created after</label>
|
|
175
|
+
<input
|
|
176
|
+
v-model="filterData.created_after"
|
|
177
|
+
type="date"
|
|
178
|
+
aria-label="Created after date"
|
|
179
|
+
:class="inputClass"
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
<div class="flex flex-col gap-1">
|
|
183
|
+
<label :class="labelClass">Created before</label>
|
|
184
|
+
<input
|
|
185
|
+
v-model="filterData.created_before"
|
|
186
|
+
type="date"
|
|
187
|
+
aria-label="Created before date"
|
|
188
|
+
:class="inputClass"
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
<div class="flex flex-col gap-1">
|
|
192
|
+
<label :class="labelClass">Tag</label>
|
|
193
|
+
<input
|
|
194
|
+
v-model="filterData.tag"
|
|
195
|
+
type="text"
|
|
196
|
+
placeholder="Tag name..."
|
|
197
|
+
aria-label="Filter by tag name"
|
|
198
|
+
:class="inputClass"
|
|
199
|
+
/>
|
|
200
|
+
</div>
|
|
201
|
+
<div class="flex flex-col gap-1">
|
|
202
|
+
<label :class="labelClass">Requester</label>
|
|
203
|
+
<input
|
|
204
|
+
v-model="filterData.requester"
|
|
205
|
+
type="text"
|
|
206
|
+
placeholder="Name or email..."
|
|
207
|
+
aria-label="Filter by requester"
|
|
208
|
+
:class="inputClass"
|
|
209
|
+
/>
|
|
210
|
+
</div>
|
|
211
|
+
<label class="flex items-center gap-2 self-center pt-4">
|
|
212
|
+
<input
|
|
213
|
+
v-model="filterData.has_attachments"
|
|
214
|
+
type="checkbox"
|
|
215
|
+
true-value="1"
|
|
216
|
+
false-value=""
|
|
217
|
+
:class="checkboxClass"
|
|
218
|
+
/>
|
|
219
|
+
<span :class="['text-sm', escDark ? 'text-[var(--esc-panel-text-tertiary)]' : 'text-gray-600']"
|
|
220
|
+
>Has attachments</span
|
|
221
|
+
>
|
|
222
|
+
</label>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
</template>
|
|
@@ -0,0 +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>
|