@escalated-dev/escalated 0.5.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 +102 -0
- package/package.json +37 -6
- package/src/components/ActivityTimeline.stories.js +55 -0
- package/src/components/ActivityTimeline.vue +83 -66
- 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 +37 -23
- 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 +57 -41
- 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 +75 -33
- package/src/components/PresenceIndicator.vue +93 -27
- package/src/components/PriorityBadge.stories.js +33 -0
- package/src/components/PriorityBadge.vue +46 -39
- package/src/components/QuickFilters.vue +65 -49
- package/src/components/ReplyComposer.vue +273 -159
- package/src/components/ReplyThread.vue +78 -23
- 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 +62 -49
- 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 +78 -46
- package/src/components/TagSelect.vue +84 -53
- 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/useI18n.js +80 -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/de.json +442 -0
- package/src/locales/en.json +467 -0
- package/src/locales/es.json +442 -0
- package/src/locales/fr.json +442 -0
- package/src/locales/index.js +6 -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/utils/sanitizeHtml.js +64 -0
- package/src/pages/Admin/Plugins.vue +0 -129
|
@@ -1,159 +1,273 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, computed, inject } from 'vue';
|
|
3
|
-
import { router } from '@inertiajs/vue3';
|
|
4
|
-
import FileDropzone from './FileDropzone.vue';
|
|
5
|
-
|
|
6
|
-
const props = defineProps({
|
|
7
|
-
action: { type: String, required: true },
|
|
8
|
-
cannedResponses: { type: Array, default: () => [] },
|
|
9
|
-
allowNotes: { type: Boolean, default: false },
|
|
10
|
-
placeholder: { type: String, default: 'Type your reply...' },
|
|
11
|
-
submitLabel: { type: String, default: null },
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, inject } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
import FileDropzone from './FileDropzone.vue';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
action: { type: String, required: true },
|
|
8
|
+
cannedResponses: { type: Array, default: () => [] },
|
|
9
|
+
allowNotes: { type: Boolean, default: false },
|
|
10
|
+
placeholder: { type: String, default: 'Type your reply...' },
|
|
11
|
+
submitLabel: { type: String, default: null },
|
|
12
|
+
typingEndpoint: { type: String, default: '' },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits(['submit']);
|
|
16
|
+
const escDark = inject(
|
|
17
|
+
'esc-dark',
|
|
18
|
+
computed(() => false),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const body = ref('');
|
|
22
|
+
const isNote = ref(false);
|
|
23
|
+
const files = ref([]);
|
|
24
|
+
const submitting = ref(false);
|
|
25
|
+
|
|
26
|
+
// Typing indicator: debounced POST every 5 seconds while typing
|
|
27
|
+
let lastTypingSent = 0;
|
|
28
|
+
let typingTimer = null;
|
|
29
|
+
|
|
30
|
+
function onTyping() {
|
|
31
|
+
if (!props.typingEndpoint) return;
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
if (now - lastTypingSent < 5000) return;
|
|
34
|
+
lastTypingSent = now;
|
|
35
|
+
sendTypingIndicator();
|
|
36
|
+
|
|
37
|
+
// Clear typing after 6 seconds of inactivity
|
|
38
|
+
window.clearTimeout(typingTimer);
|
|
39
|
+
typingTimer = window.setTimeout(() => {
|
|
40
|
+
lastTypingSent = 0;
|
|
41
|
+
}, 6000);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function sendTypingIndicator() {
|
|
45
|
+
try {
|
|
46
|
+
await fetch(props.typingEndpoint, {
|
|
47
|
+
method: 'POST',
|
|
48
|
+
headers: {
|
|
49
|
+
Accept: 'application/json',
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
52
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
} catch {
|
|
56
|
+
// silently ignore
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function onBlur() {
|
|
61
|
+
window.clearTimeout(typingTimer);
|
|
62
|
+
lastTypingSent = 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function insertCanned(response) {
|
|
66
|
+
body.value += response.body;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function handleFiles(newFiles) {
|
|
70
|
+
files.value = [...files.value, ...newFiles];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function removeFile(index) {
|
|
74
|
+
files.value.splice(index, 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function submit() {
|
|
78
|
+
if (!body.value.trim() || submitting.value) return;
|
|
79
|
+
submitting.value = true;
|
|
80
|
+
window.clearTimeout(typingTimer);
|
|
81
|
+
lastTypingSent = 0;
|
|
82
|
+
|
|
83
|
+
const payload = {
|
|
84
|
+
body: body.value,
|
|
85
|
+
is_internal_note: isNote.value,
|
|
86
|
+
attachments: files.value,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
emit('submit', payload);
|
|
90
|
+
|
|
91
|
+
router.post(props.action, payload, {
|
|
92
|
+
preserveScroll: true,
|
|
93
|
+
onSuccess: () => {
|
|
94
|
+
body.value = '';
|
|
95
|
+
files.value = [];
|
|
96
|
+
isNote.value = false;
|
|
97
|
+
},
|
|
98
|
+
onFinish: () => {
|
|
99
|
+
submitting.value = false;
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const buttonLabel = computed(() => {
|
|
105
|
+
if (props.submitLabel) return props.submitLabel;
|
|
106
|
+
return isNote.value ? 'Add Note' : 'Send Reply';
|
|
107
|
+
});
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<!-- Dark mode -->
|
|
112
|
+
<div v-if="escDark" class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
|
|
113
|
+
<div v-if="allowNotes" class="mb-3 flex gap-2">
|
|
114
|
+
<button
|
|
115
|
+
:class="[
|
|
116
|
+
'rounded-lg px-3 py-1.5 text-sm font-medium transition-colors',
|
|
117
|
+
!isNote
|
|
118
|
+
? 'bg-cyan-500/15 text-white ring-1 ring-cyan-500/20'
|
|
119
|
+
: 'text-gray-400 hover:bg-white/[0.04]',
|
|
120
|
+
]"
|
|
121
|
+
@click="isNote = false"
|
|
122
|
+
>
|
|
123
|
+
Reply
|
|
124
|
+
</button>
|
|
125
|
+
<button
|
|
126
|
+
:class="[
|
|
127
|
+
'rounded-lg px-3 py-1.5 text-sm font-medium transition-colors',
|
|
128
|
+
isNote
|
|
129
|
+
? 'bg-amber-500/15 text-amber-400 ring-1 ring-amber-500/20'
|
|
130
|
+
: 'text-gray-400 hover:bg-white/[0.04]',
|
|
131
|
+
]"
|
|
132
|
+
aria-label="Internal note"
|
|
133
|
+
@click="isNote = true"
|
|
134
|
+
>
|
|
135
|
+
Internal Note
|
|
136
|
+
</button>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div
|
|
140
|
+
v-if="isNote"
|
|
141
|
+
class="mb-2 rounded-lg bg-amber-500/10 px-3 py-1.5 text-xs text-amber-400 ring-1 ring-amber-500/20"
|
|
142
|
+
>
|
|
143
|
+
This note is only visible to agents.
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<textarea
|
|
147
|
+
v-model="body"
|
|
148
|
+
rows="4"
|
|
149
|
+
:placeholder="placeholder"
|
|
150
|
+
aria-label="Reply message"
|
|
151
|
+
class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
152
|
+
@keydown="onTyping"
|
|
153
|
+
@blur="onBlur"
|
|
154
|
+
></textarea>
|
|
155
|
+
|
|
156
|
+
<FileDropzone class="mt-2" @files="handleFiles" />
|
|
157
|
+
|
|
158
|
+
<div v-if="files.length" class="mt-2 space-y-1">
|
|
159
|
+
<div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-400">
|
|
160
|
+
<span>{{ file.name }}</span>
|
|
161
|
+
<button aria-label="Remove attachment" class="text-rose-400 hover:text-rose-300" @click="removeFile(i)">
|
|
162
|
+
×
|
|
163
|
+
</button>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div class="mt-3 flex items-center justify-between">
|
|
168
|
+
<div v-if="cannedResponses.length">
|
|
169
|
+
<select
|
|
170
|
+
class="rounded-lg border border-white/10 bg-gray-900 px-2 py-1 text-xs text-gray-400"
|
|
171
|
+
@change="
|
|
172
|
+
insertCanned(cannedResponses[$event.target.value]);
|
|
173
|
+
$event.target.value = '';
|
|
174
|
+
"
|
|
175
|
+
>
|
|
176
|
+
<option value="">Canned responses...</option>
|
|
177
|
+
<option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
|
|
178
|
+
</select>
|
|
179
|
+
</div>
|
|
180
|
+
<div v-else></div>
|
|
181
|
+
<button
|
|
182
|
+
:disabled="!body.trim() || submitting"
|
|
183
|
+
:class="[
|
|
184
|
+
'rounded-lg px-4 py-2 text-sm font-medium text-white transition-all',
|
|
185
|
+
isNote
|
|
186
|
+
? 'bg-amber-500 hover:bg-amber-400'
|
|
187
|
+
: 'bg-gradient-to-r from-cyan-500 to-violet-500 hover:from-cyan-400 hover:to-violet-400',
|
|
188
|
+
(!body.trim() || submitting) && 'cursor-not-allowed opacity-40',
|
|
189
|
+
]"
|
|
190
|
+
@click="submit"
|
|
191
|
+
>
|
|
192
|
+
{{ buttonLabel }}
|
|
193
|
+
</button>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<!-- Light mode -->
|
|
198
|
+
<div v-else class="rounded-lg border border-gray-200 bg-white p-4">
|
|
199
|
+
<div v-if="allowNotes" class="mb-3 flex gap-2">
|
|
200
|
+
<button
|
|
201
|
+
:class="[
|
|
202
|
+
'rounded-md px-3 py-1 text-sm font-medium',
|
|
203
|
+
!isNote ? 'bg-blue-100 text-blue-700' : 'text-gray-500 hover:bg-gray-100',
|
|
204
|
+
]"
|
|
205
|
+
@click="isNote = false"
|
|
206
|
+
>
|
|
207
|
+
Reply
|
|
208
|
+
</button>
|
|
209
|
+
<button
|
|
210
|
+
:class="[
|
|
211
|
+
'rounded-md px-3 py-1 text-sm font-medium',
|
|
212
|
+
isNote ? 'bg-yellow-100 text-yellow-700' : 'text-gray-500 hover:bg-gray-100',
|
|
213
|
+
]"
|
|
214
|
+
aria-label="Internal note"
|
|
215
|
+
@click="isNote = true"
|
|
216
|
+
>
|
|
217
|
+
Internal Note
|
|
218
|
+
</button>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<div v-if="isNote" class="mb-2 rounded bg-yellow-50 px-3 py-1.5 text-xs text-yellow-700">
|
|
222
|
+
This note is only visible to agents.
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<textarea
|
|
226
|
+
v-model="body"
|
|
227
|
+
rows="4"
|
|
228
|
+
:placeholder="placeholder"
|
|
229
|
+
aria-label="Reply message"
|
|
230
|
+
class="w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"
|
|
231
|
+
@keydown="onTyping"
|
|
232
|
+
@blur="onBlur"
|
|
233
|
+
></textarea>
|
|
234
|
+
|
|
235
|
+
<FileDropzone class="mt-2" @files="handleFiles" />
|
|
236
|
+
|
|
237
|
+
<div v-if="files.length" class="mt-2 space-y-1">
|
|
238
|
+
<div v-for="(file, i) in files" :key="i" class="flex items-center gap-2 text-sm text-gray-600">
|
|
239
|
+
<span>{{ file.name }}</span>
|
|
240
|
+
<button aria-label="Remove attachment" class="text-red-500 hover:text-red-700" @click="removeFile(i)">
|
|
241
|
+
×
|
|
242
|
+
</button>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
<div class="mt-3 flex items-center justify-between">
|
|
247
|
+
<div v-if="cannedResponses.length">
|
|
248
|
+
<select
|
|
249
|
+
class="rounded border border-gray-300 px-2 py-1 text-xs text-gray-600"
|
|
250
|
+
@change="
|
|
251
|
+
insertCanned(cannedResponses[$event.target.value]);
|
|
252
|
+
$event.target.value = '';
|
|
253
|
+
"
|
|
254
|
+
>
|
|
255
|
+
<option value="">Canned responses...</option>
|
|
256
|
+
<option v-for="(cr, i) in cannedResponses" :key="cr.id" :value="i">{{ cr.title }}</option>
|
|
257
|
+
</select>
|
|
258
|
+
</div>
|
|
259
|
+
<div v-else></div>
|
|
260
|
+
<button
|
|
261
|
+
:disabled="!body.trim() || submitting"
|
|
262
|
+
:class="[
|
|
263
|
+
'rounded-md px-4 py-2 text-sm font-medium text-white',
|
|
264
|
+
isNote ? 'bg-yellow-500 hover:bg-yellow-600' : 'bg-blue-600 hover:bg-blue-700',
|
|
265
|
+
(!body.trim() || submitting) && 'cursor-not-allowed opacity-50',
|
|
266
|
+
]"
|
|
267
|
+
@click="submit"
|
|
268
|
+
>
|
|
269
|
+
{{ buttonLabel }}
|
|
270
|
+
</button>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
</template>
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { inject, computed } from 'vue';
|
|
3
3
|
import { router } from '@inertiajs/vue3';
|
|
4
4
|
import AttachmentList from './AttachmentList.vue';
|
|
5
|
+
import { sanitizeHtml } from '../utils/sanitizeHtml';
|
|
6
|
+
import { useI18n } from '../composables/useI18n';
|
|
5
7
|
|
|
6
8
|
const props = defineProps({
|
|
7
9
|
replies: { type: Array, required: true },
|
|
@@ -11,7 +13,11 @@ const props = defineProps({
|
|
|
11
13
|
pinnable: { type: Boolean, default: false },
|
|
12
14
|
});
|
|
13
15
|
|
|
14
|
-
const escDark = inject(
|
|
16
|
+
const escDark = inject(
|
|
17
|
+
'esc-dark',
|
|
18
|
+
computed(() => false),
|
|
19
|
+
);
|
|
20
|
+
const { t } = useI18n();
|
|
15
21
|
|
|
16
22
|
function formatDate(date) {
|
|
17
23
|
return new Date(date).toLocaleString();
|
|
@@ -19,42 +25,91 @@ function formatDate(date) {
|
|
|
19
25
|
|
|
20
26
|
function togglePin(reply) {
|
|
21
27
|
if (!props.routePrefix || !props.ticketReference) return;
|
|
22
|
-
router.post(
|
|
28
|
+
router.post(
|
|
29
|
+
route(`${props.routePrefix}.tickets.pin`, [props.ticketReference, reply.id]),
|
|
30
|
+
{},
|
|
31
|
+
{ preserveScroll: true },
|
|
32
|
+
);
|
|
23
33
|
}
|
|
24
34
|
</script>
|
|
25
35
|
|
|
26
36
|
<template>
|
|
27
|
-
<div class="space-y-4">
|
|
28
|
-
<div
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
<div class="space-y-4" role="feed" aria-label="Reply thread">
|
|
38
|
+
<div
|
|
39
|
+
v-for="reply in replies"
|
|
40
|
+
:key="reply.id"
|
|
41
|
+
:class="[
|
|
42
|
+
'rounded-xl border p-4',
|
|
43
|
+
escDark
|
|
44
|
+
? reply.is_internal_note
|
|
45
|
+
? 'border-amber-500/20 bg-amber-500/5'
|
|
46
|
+
: 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]'
|
|
47
|
+
: reply.is_internal_note
|
|
48
|
+
? 'border-yellow-200 bg-yellow-50'
|
|
49
|
+
: 'border-gray-200 bg-white',
|
|
50
|
+
]"
|
|
51
|
+
>
|
|
32
52
|
<div class="mb-2 flex items-center justify-between">
|
|
33
53
|
<div class="flex items-center gap-2">
|
|
34
|
-
<span
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
<span
|
|
55
|
+
:class="['font-medium', escDark ? 'text-[var(--esc-panel-text-secondary)]' : 'text-gray-900']"
|
|
56
|
+
>{{ reply.author?.name || t('ticket.unknown') }}</span
|
|
57
|
+
>
|
|
58
|
+
<span
|
|
59
|
+
v-if="reply.is_internal_note"
|
|
60
|
+
:class="[
|
|
61
|
+
'rounded px-1.5 py-0.5 text-xs font-medium',
|
|
62
|
+
escDark ? 'bg-amber-500/15 text-amber-400' : 'bg-yellow-200 text-yellow-800',
|
|
63
|
+
]"
|
|
64
|
+
>
|
|
65
|
+
{{ t('reply.internal_note') }}
|
|
38
66
|
</span>
|
|
39
|
-
<span
|
|
40
|
-
|
|
41
|
-
|
|
67
|
+
<span
|
|
68
|
+
v-if="reply.is_pinned"
|
|
69
|
+
:class="[
|
|
70
|
+
'rounded px-1.5 py-0.5 text-xs font-medium',
|
|
71
|
+
escDark ? 'bg-cyan-500/15 text-cyan-400' : 'bg-blue-100 text-blue-700',
|
|
72
|
+
]"
|
|
73
|
+
>
|
|
74
|
+
{{ t('reply.pinned') }}
|
|
42
75
|
</span>
|
|
43
76
|
</div>
|
|
44
77
|
<div class="flex items-center gap-2">
|
|
45
|
-
<button
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
78
|
+
<button
|
|
79
|
+
v-if="pinnable && reply.is_internal_note"
|
|
80
|
+
:class="[
|
|
81
|
+
'rounded px-2 py-0.5 text-xs font-medium transition-colors',
|
|
82
|
+
escDark
|
|
83
|
+
? reply.is_pinned
|
|
84
|
+
? 'bg-cyan-500/15 text-cyan-400 hover:bg-cyan-500/25'
|
|
85
|
+
: 'text-[var(--esc-panel-text-muted)] hover:bg-[var(--esc-panel-hover)] hover:text-[var(--esc-panel-text-secondary)]'
|
|
86
|
+
: reply.is_pinned
|
|
87
|
+
? 'bg-blue-100 text-blue-700 hover:bg-blue-200'
|
|
88
|
+
: 'text-gray-400 hover:bg-gray-100 hover:text-gray-600',
|
|
89
|
+
]"
|
|
90
|
+
@click="togglePin(reply)"
|
|
91
|
+
>
|
|
92
|
+
{{ reply.is_pinned ? t('reply.unpin') : t('reply.pin') }}
|
|
51
93
|
</button>
|
|
52
|
-
<span :class="['text-xs', escDark ? 'text-
|
|
94
|
+
<span :class="['text-xs', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']">{{
|
|
95
|
+
formatDate(reply.created_at)
|
|
96
|
+
}}</span>
|
|
53
97
|
</div>
|
|
54
98
|
</div>
|
|
55
|
-
<div
|
|
99
|
+
<div
|
|
100
|
+
:class="[
|
|
101
|
+
'prose prose-sm max-w-none',
|
|
102
|
+
escDark ? 'prose-invert text-[var(--esc-panel-text-secondary)]' : 'text-gray-700',
|
|
103
|
+
]"
|
|
104
|
+
v-html="sanitizeHtml(reply.body)"
|
|
105
|
+
></div>
|
|
56
106
|
<AttachmentList v-if="reply.attachments?.length" :attachments="reply.attachments" class="mt-3" />
|
|
57
107
|
</div>
|
|
58
|
-
<div
|
|
108
|
+
<div
|
|
109
|
+
v-if="!replies?.length"
|
|
110
|
+
:class="['py-8 text-center text-sm', escDark ? 'text-[var(--esc-panel-text-muted)]' : 'text-gray-500']"
|
|
111
|
+
>
|
|
112
|
+
{{ t('ticket.no_replies') }}
|
|
113
|
+
</div>
|
|
59
114
|
</div>
|
|
60
115
|
</template>
|