@escalated-dev/escalated 0.6.0 → 0.7.1
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 +125 -2
- package/package.json +40 -5
- package/src/components/ActiveChatsPanel.vue +246 -0
- package/src/components/ActivityTimeline.stories.js +55 -0
- package/src/components/ActivityTimeline.vue +83 -66
- package/src/components/AdminDashboard.stories.js +1423 -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 +65 -37
- package/src/components/AuditLogEntry.vue +95 -0
- package/src/components/BulkActionBar.vue +166 -97
- package/src/components/CategoryTree.vue +89 -0
- package/src/components/ChartWidget.vue +46 -0
- 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 -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 +424 -70
- package/src/components/FileDropzone.vue +57 -41
- package/src/components/FollowButton.stories.js +30 -0
- package/src/components/FollowButton.vue +88 -63
- package/src/components/KeyboardShortcutHelp.vue +213 -123
- 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 +150 -90
- 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 -0
- package/src/components/PinnedNotes.vue +129 -90
- package/src/components/PluginSlot.vue +68 -62
- package/src/components/PresenceIndicator.vue +138 -28
- 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 +207 -30
- package/src/components/ReplyThread.vue +111 -21
- package/src/components/ReportChart.vue +395 -0
- package/src/components/ReportExportButton.vue +108 -0
- package/src/components/SatisfactionRating.vue +180 -128
- package/src/components/SaveViewDialog.vue +172 -0
- package/src/components/SavedViewSidebar.vue +208 -0
- 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 +46 -0
- package/src/components/SlaTimer.stories.js +35 -0
- package/src/components/SlaTimer.vue +62 -49
- package/src/components/SnoozeButton.vue +247 -0
- package/src/components/StatsCard.stories.js +24 -0
- package/src/components/StatsCard.vue +18 -6
- 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 +247 -46
- package/src/components/TicketLinkPanel.vue +193 -0
- package/src/components/TicketList.vue +536 -74
- package/src/components/TicketMergeDialog.vue +157 -0
- package/src/components/TicketSidebar.vue +167 -99
- package/src/components/TicketSplitDialog.vue +98 -0
- 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/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/useDebouncedSearch.js +38 -0
- package/src/composables/useI18n.js +80 -80
- package/src/composables/useKeyboardShortcuts.js +46 -46
- package/src/composables/useMentions.js +134 -0
- package/src/composables/usePluginExtensions.js +159 -67
- package/src/composables/usePluginHooks.js +65 -0
- package/src/composables/useRealtime.js +182 -0
- package/src/defineEscalatedPlugin.js +76 -50
- package/src/index.js +77 -28
- package/src/locales/ar.json +727 -0
- package/src/locales/de.json +678 -430
- package/src/locales/en.json +717 -430
- 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 -217
- package/src/pages/Admin/AuditLog/Index.vue +154 -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 +82 -25
- 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 +35 -11
- package/src/pages/Admin/Departments/Index.vue +74 -21
- package/src/pages/Admin/EscalationRules/Form.vue +86 -25
- package/src/pages/Admin/EscalationRules/Index.vue +158 -37
- package/src/pages/Admin/Import/Connect.vue +95 -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 +448 -287
- package/src/pages/Admin/Plugins/Index.vue +327 -197
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
- 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 -0
- package/src/pages/Admin/Reports/Dashboard.vue +226 -0
- 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 -0
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
- package/src/pages/Admin/Reports.vue +206 -101
- 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 +847 -99
- 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 +62 -19
- package/src/pages/Admin/SlaPolicies/Index.vue +85 -23
- 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 +121 -35
- package/src/pages/Admin/Tickets/Index.vue +96 -9
- package/src/pages/Admin/Tickets/Show.vue +130 -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/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/Dashboard.vue +311 -186
- package/src/pages/Agent/TicketIndex.vue +80 -6
- package/src/pages/Agent/TicketShow.vue +399 -60
- package/src/pages/Customer/Create.vue +37 -10
- package/src/pages/Customer/Index.vue +9 -2
- package/src/pages/Customer/KnowledgeBase/Article.vue +129 -0
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
- 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 +111 -1
- package/src/utils/constants.js +30 -0
- package/src/utils/formatting.js +35 -0
- 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/Plugins.vue +0 -129
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, inject, nextTick } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
savedViews: { type: Array, default: () => [] },
|
|
7
|
+
currentFilters: { type: Object, default: () => ({}) },
|
|
8
|
+
route: { type: String, required: true },
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const emit = defineEmits(['apply-view']);
|
|
12
|
+
const escDark = inject(
|
|
13
|
+
'esc-dark',
|
|
14
|
+
computed(() => false),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const activeViewId = ref(null);
|
|
18
|
+
const menuOpenId = ref(null);
|
|
19
|
+
const editingView = ref(null);
|
|
20
|
+
const editName = ref('');
|
|
21
|
+
|
|
22
|
+
function applyView(view) {
|
|
23
|
+
if (view === null) {
|
|
24
|
+
activeViewId.value = null;
|
|
25
|
+
emit('apply-view', {});
|
|
26
|
+
router.get(props.route, {}, { preserveState: true, preserveScroll: true });
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
activeViewId.value = view.id;
|
|
30
|
+
emit('apply-view', view.filters);
|
|
31
|
+
router.get(props.route, view.filters || {}, { preserveState: true, preserveScroll: true });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function toggleMenu(viewId) {
|
|
35
|
+
menuOpenId.value = menuOpenId.value === viewId ? null : viewId;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function startEdit(view) {
|
|
39
|
+
editingView.value = view.id;
|
|
40
|
+
editName.value = view.name;
|
|
41
|
+
menuOpenId.value = null;
|
|
42
|
+
nextTick(() => {
|
|
43
|
+
const input = document.querySelector(`[data-edit-view="${view.id}"]`);
|
|
44
|
+
if (input) input.focus();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function saveEdit(view) {
|
|
49
|
+
if (!editName.value.trim()) {
|
|
50
|
+
editingView.value = null;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
fetch(route('escalated.admin.saved-views.update', view.id), {
|
|
54
|
+
method: 'PUT',
|
|
55
|
+
headers: {
|
|
56
|
+
'Content-Type': 'application/json',
|
|
57
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
58
|
+
Accept: 'application/json',
|
|
59
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
60
|
+
},
|
|
61
|
+
body: JSON.stringify({ name: editName.value, filters: view.filters }),
|
|
62
|
+
}).then(() => {
|
|
63
|
+
view.name = editName.value;
|
|
64
|
+
editingView.value = null;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function updateViewFilters(view) {
|
|
69
|
+
menuOpenId.value = null;
|
|
70
|
+
const nonEmptyFilters = {};
|
|
71
|
+
for (const [key, value] of Object.entries(props.currentFilters)) {
|
|
72
|
+
if (value !== '' && value !== null && value !== undefined) {
|
|
73
|
+
nonEmptyFilters[key] = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
fetch(route('escalated.admin.saved-views.update', view.id), {
|
|
77
|
+
method: 'PUT',
|
|
78
|
+
headers: {
|
|
79
|
+
'Content-Type': 'application/json',
|
|
80
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
81
|
+
Accept: 'application/json',
|
|
82
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify({ name: view.name, filters: nonEmptyFilters }),
|
|
85
|
+
}).then(() => {
|
|
86
|
+
view.filters = nonEmptyFilters;
|
|
87
|
+
router.reload({ only: ['savedViews'] });
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function deleteView(view) {
|
|
92
|
+
menuOpenId.value = null;
|
|
93
|
+
if (!confirm(`Delete view "${view.name}"?`)) return;
|
|
94
|
+
fetch(route('escalated.admin.saved-views.destroy', view.id), {
|
|
95
|
+
method: 'DELETE',
|
|
96
|
+
headers: {
|
|
97
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
98
|
+
Accept: 'application/json',
|
|
99
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
100
|
+
},
|
|
101
|
+
}).then(() => {
|
|
102
|
+
if (activeViewId.value === view.id) {
|
|
103
|
+
activeViewId.value = null;
|
|
104
|
+
}
|
|
105
|
+
router.reload({ only: ['savedViews'] });
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const itemClass = computed(
|
|
110
|
+
() => (isActive) =>
|
|
111
|
+
[
|
|
112
|
+
'flex items-center justify-between gap-2 rounded-md px-3 py-1.5 text-sm cursor-pointer transition-colors group',
|
|
113
|
+
isActive
|
|
114
|
+
? escDark.value
|
|
115
|
+
? 'bg-cyan-500/10 text-cyan-400'
|
|
116
|
+
: 'bg-blue-50 text-blue-700 font-medium'
|
|
117
|
+
: escDark.value
|
|
118
|
+
? 'text-neutral-400 hover:bg-white/[0.04] hover:text-neutral-200'
|
|
119
|
+
: 'text-gray-600 hover:bg-gray-50 hover:text-gray-900',
|
|
120
|
+
].flat(),
|
|
121
|
+
);
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<template>
|
|
125
|
+
<div class="space-y-1">
|
|
126
|
+
<div :class="itemClass(activeViewId === null)" @click="applyView(null)">
|
|
127
|
+
<span class="truncate">All Tickets</span>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div v-for="view in savedViews" :key="view.id" class="relative">
|
|
131
|
+
<div v-if="editingView === view.id" class="flex items-center gap-1 px-1">
|
|
132
|
+
<input
|
|
133
|
+
v-model="editName"
|
|
134
|
+
:data-edit-view="view.id"
|
|
135
|
+
type="text"
|
|
136
|
+
class="flex-1 rounded border px-2 py-1 text-sm"
|
|
137
|
+
:class="
|
|
138
|
+
escDark
|
|
139
|
+
? 'border-white/10 bg-white/5 text-neutral-200'
|
|
140
|
+
: 'border-gray-300 bg-white text-gray-900'
|
|
141
|
+
"
|
|
142
|
+
@keydown.enter="saveEdit(view)"
|
|
143
|
+
@keydown.escape="editingView = null"
|
|
144
|
+
@blur="saveEdit(view)"
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
<div v-else :class="itemClass(activeViewId === view.id)" @click="applyView(view)">
|
|
148
|
+
<span class="flex items-center gap-2 truncate">
|
|
149
|
+
<span
|
|
150
|
+
v-if="view.color"
|
|
151
|
+
class="inline-block h-2 w-2 shrink-0 rounded-full"
|
|
152
|
+
:style="{ backgroundColor: view.color }"
|
|
153
|
+
></span>
|
|
154
|
+
<span class="truncate">{{ view.name }}</span>
|
|
155
|
+
<span
|
|
156
|
+
v-if="view.is_shared"
|
|
157
|
+
:class="[
|
|
158
|
+
'shrink-0 rounded px-1 py-0.5 text-[10px] leading-none font-medium',
|
|
159
|
+
escDark ? 'bg-white/[0.06] text-neutral-500' : 'bg-gray-100 text-gray-400',
|
|
160
|
+
]"
|
|
161
|
+
>shared</span
|
|
162
|
+
>
|
|
163
|
+
</span>
|
|
164
|
+
<button
|
|
165
|
+
aria-label="View options"
|
|
166
|
+
class="shrink-0 rounded p-0.5 opacity-0 transition-opacity group-hover:opacity-100"
|
|
167
|
+
:class="escDark ? 'hover:bg-white/10' : 'hover:bg-gray-200'"
|
|
168
|
+
@click.stop="toggleMenu(view.id)"
|
|
169
|
+
>
|
|
170
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="currentColor" viewBox="0 0 20 20">
|
|
171
|
+
<path
|
|
172
|
+
d="M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z"
|
|
173
|
+
/>
|
|
174
|
+
</svg>
|
|
175
|
+
</button>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<!-- Kebab menu -->
|
|
179
|
+
<div
|
|
180
|
+
v-if="menuOpenId === view.id"
|
|
181
|
+
class="absolute right-0 z-20 mt-1 w-44 rounded-md border py-1 shadow-lg"
|
|
182
|
+
:class="escDark ? 'border-white/10 bg-[var(--esc-panel-surface)]' : 'border-gray-200 bg-white'"
|
|
183
|
+
>
|
|
184
|
+
<button
|
|
185
|
+
class="block w-full px-3 py-1.5 text-left text-sm"
|
|
186
|
+
:class="escDark ? 'text-neutral-300 hover:bg-white/5' : 'text-gray-700 hover:bg-gray-50'"
|
|
187
|
+
@click="startEdit(view)"
|
|
188
|
+
>
|
|
189
|
+
Rename
|
|
190
|
+
</button>
|
|
191
|
+
<button
|
|
192
|
+
class="block w-full px-3 py-1.5 text-left text-sm"
|
|
193
|
+
:class="escDark ? 'text-neutral-300 hover:bg-white/5' : 'text-gray-700 hover:bg-gray-50'"
|
|
194
|
+
@click="updateViewFilters(view)"
|
|
195
|
+
>
|
|
196
|
+
Save current filters
|
|
197
|
+
</button>
|
|
198
|
+
<button
|
|
199
|
+
class="block w-full px-3 py-1.5 text-left text-sm"
|
|
200
|
+
:class="escDark ? 'text-red-400 hover:bg-white/5' : 'text-red-600 hover:bg-red-50'"
|
|
201
|
+
@click="deleteView(view)"
|
|
202
|
+
>
|
|
203
|
+
Delete
|
|
204
|
+
</button>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</template>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: Object,
|
|
7
|
+
default: () => ({
|
|
8
|
+
monday: { start: '09:00', end: '17:00' },
|
|
9
|
+
tuesday: { start: '09:00', end: '17:00' },
|
|
10
|
+
wednesday: { start: '09:00', end: '17:00' },
|
|
11
|
+
thursday: { start: '09:00', end: '17:00' },
|
|
12
|
+
friday: { start: '09:00', end: '17:00' },
|
|
13
|
+
saturday: { start: '', end: '' },
|
|
14
|
+
sunday: { start: '', end: '' },
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits(['update:modelValue']);
|
|
20
|
+
|
|
21
|
+
const days = [
|
|
22
|
+
{ key: 'monday', label: 'Monday' },
|
|
23
|
+
{ key: 'tuesday', label: 'Tuesday' },
|
|
24
|
+
{ key: 'wednesday', label: 'Wednesday' },
|
|
25
|
+
{ key: 'thursday', label: 'Thursday' },
|
|
26
|
+
{ key: 'friday', label: 'Friday' },
|
|
27
|
+
{ key: 'saturday', label: 'Saturday' },
|
|
28
|
+
{ key: 'sunday', label: 'Sunday' },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const timeOptions = computed(() => {
|
|
32
|
+
const options = [];
|
|
33
|
+
for (let h = 0; h < 24; h++) {
|
|
34
|
+
for (let m = 0; m < 60; m += 30) {
|
|
35
|
+
const hh = String(h).padStart(2, '0');
|
|
36
|
+
const mm = String(m).padStart(2, '0');
|
|
37
|
+
options.push(`${hh}:${mm}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
options.push('24:00');
|
|
41
|
+
return options;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
function updateDay(dayKey, field, value) {
|
|
45
|
+
const updated = { ...props.modelValue };
|
|
46
|
+
updated[dayKey] = { ...(updated[dayKey] || { start: '', end: '' }), [field]: value };
|
|
47
|
+
emit('update:modelValue', updated);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function toggleDay(dayKey) {
|
|
51
|
+
const updated = { ...props.modelValue };
|
|
52
|
+
const current = updated[dayKey];
|
|
53
|
+
if (current && current.start) {
|
|
54
|
+
updated[dayKey] = { start: '', end: '' };
|
|
55
|
+
} else {
|
|
56
|
+
updated[dayKey] = { start: '09:00', end: '17:00' };
|
|
57
|
+
}
|
|
58
|
+
emit('update:modelValue', updated);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function isDayEnabled(dayKey) {
|
|
62
|
+
const day = props.modelValue[dayKey];
|
|
63
|
+
return day && day.start;
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<div class="space-y-2">
|
|
69
|
+
<div
|
|
70
|
+
v-for="day in days"
|
|
71
|
+
:key="day.key"
|
|
72
|
+
class="flex items-center gap-3 rounded-lg border border-white/[0.06] bg-neutral-950/50 px-3 py-2"
|
|
73
|
+
>
|
|
74
|
+
<label class="flex w-28 items-center gap-2">
|
|
75
|
+
<input
|
|
76
|
+
type="checkbox"
|
|
77
|
+
:checked="isDayEnabled(day.key)"
|
|
78
|
+
class="rounded border-white/20 bg-neutral-900 text-cyan-500 focus:ring-white/10"
|
|
79
|
+
@change="toggleDay(day.key)"
|
|
80
|
+
/>
|
|
81
|
+
<span class="text-sm font-medium text-neutral-300">{{ day.label }}</span>
|
|
82
|
+
</label>
|
|
83
|
+
|
|
84
|
+
<template v-if="isDayEnabled(day.key)">
|
|
85
|
+
<select
|
|
86
|
+
:value="modelValue[day.key]?.start || '09:00'"
|
|
87
|
+
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
88
|
+
@change="updateDay(day.key, 'start', $event.target.value)"
|
|
89
|
+
>
|
|
90
|
+
<option v-for="t in timeOptions" :key="'s-' + t" :value="t">{{ t }}</option>
|
|
91
|
+
</select>
|
|
92
|
+
<span class="text-xs text-neutral-500">to</span>
|
|
93
|
+
<select
|
|
94
|
+
:value="modelValue[day.key]?.end || '17:00'"
|
|
95
|
+
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
96
|
+
@change="updateDay(day.key, 'end', $event.target.value)"
|
|
97
|
+
>
|
|
98
|
+
<option v-for="t in timeOptions" :key="'e-' + t" :value="t">{{ t }}</option>
|
|
99
|
+
</select>
|
|
100
|
+
</template>
|
|
101
|
+
<span v-else class="text-xs text-neutral-500">Closed</span>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, inject, computed } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
|
|
5
|
+
const escDark = inject(
|
|
6
|
+
'esc-dark',
|
|
7
|
+
computed(() => false),
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
conversation: { type: Object, required: true },
|
|
12
|
+
ticketReference: { type: String, required: true },
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits(['updated']);
|
|
16
|
+
const replyBody = ref('');
|
|
17
|
+
const submitting = ref(false);
|
|
18
|
+
const expanded = ref(false);
|
|
19
|
+
|
|
20
|
+
function submitReply() {
|
|
21
|
+
if (!replyBody.value.trim() || submitting.value) return;
|
|
22
|
+
submitting.value = true;
|
|
23
|
+
|
|
24
|
+
router.post(
|
|
25
|
+
route('escalated.admin.tickets.side-conversations.reply', [props.ticketReference, props.conversation.id]),
|
|
26
|
+
{ body: replyBody.value },
|
|
27
|
+
{
|
|
28
|
+
preserveScroll: true,
|
|
29
|
+
onSuccess: () => {
|
|
30
|
+
replyBody.value = '';
|
|
31
|
+
emit('updated');
|
|
32
|
+
},
|
|
33
|
+
onFinish: () => {
|
|
34
|
+
submitting.value = false;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function closeConversation() {
|
|
41
|
+
router.post(
|
|
42
|
+
route('escalated.admin.tickets.side-conversations.close', [props.ticketReference, props.conversation.id]),
|
|
43
|
+
{},
|
|
44
|
+
{
|
|
45
|
+
preserveScroll: true,
|
|
46
|
+
onSuccess: () => emit('updated'),
|
|
47
|
+
},
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<div
|
|
54
|
+
:class="[
|
|
55
|
+
'rounded-lg border p-3',
|
|
56
|
+
escDark ? 'border-white/[0.06] bg-white/[0.02]' : 'border-gray-200 bg-gray-50',
|
|
57
|
+
]"
|
|
58
|
+
>
|
|
59
|
+
<button
|
|
60
|
+
class="flex w-full items-center justify-between"
|
|
61
|
+
:aria-expanded="expanded"
|
|
62
|
+
@click="expanded = !expanded"
|
|
63
|
+
>
|
|
64
|
+
<div class="flex items-center gap-2">
|
|
65
|
+
<span
|
|
66
|
+
:class="[
|
|
67
|
+
'inline-flex h-5 items-center rounded px-1.5 text-[10px] font-semibold uppercase',
|
|
68
|
+
conversation.status === 'open'
|
|
69
|
+
? escDark
|
|
70
|
+
? 'bg-emerald-500/15 text-emerald-400'
|
|
71
|
+
: 'bg-emerald-100 text-emerald-700'
|
|
72
|
+
: escDark
|
|
73
|
+
? 'bg-neutral-500/15 text-neutral-400'
|
|
74
|
+
: 'bg-gray-100 text-gray-500',
|
|
75
|
+
]"
|
|
76
|
+
>
|
|
77
|
+
{{ conversation.status }}
|
|
78
|
+
</span>
|
|
79
|
+
<span :class="['text-sm font-medium', escDark ? 'text-neutral-200' : 'text-gray-900']">
|
|
80
|
+
{{ conversation.subject }}
|
|
81
|
+
</span>
|
|
82
|
+
<span :class="['text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']">
|
|
83
|
+
{{ conversation.channel }}
|
|
84
|
+
</span>
|
|
85
|
+
</div>
|
|
86
|
+
<svg
|
|
87
|
+
:class="[
|
|
88
|
+
'h-4 w-4 transition-transform',
|
|
89
|
+
escDark ? 'text-neutral-500' : 'text-gray-400',
|
|
90
|
+
expanded && 'rotate-180',
|
|
91
|
+
]"
|
|
92
|
+
fill="none"
|
|
93
|
+
stroke="currentColor"
|
|
94
|
+
stroke-width="1.5"
|
|
95
|
+
viewBox="0 0 24 24"
|
|
96
|
+
>
|
|
97
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
|
98
|
+
</svg>
|
|
99
|
+
</button>
|
|
100
|
+
|
|
101
|
+
<div v-if="expanded" class="mt-3 space-y-3">
|
|
102
|
+
<!-- Replies -->
|
|
103
|
+
<div
|
|
104
|
+
v-for="reply in conversation.replies"
|
|
105
|
+
:key="reply.id"
|
|
106
|
+
:class="['border-l-2 pl-3', escDark ? 'border-white/[0.06]' : 'border-gray-200']"
|
|
107
|
+
>
|
|
108
|
+
<div class="flex items-center gap-2">
|
|
109
|
+
<span :class="['text-xs font-medium', escDark ? 'text-neutral-300' : 'text-gray-700']">
|
|
110
|
+
{{ reply.author?.name || 'System' }}
|
|
111
|
+
</span>
|
|
112
|
+
<span :class="['text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']">
|
|
113
|
+
{{ reply.created_at }}
|
|
114
|
+
</span>
|
|
115
|
+
</div>
|
|
116
|
+
<p :class="['mt-1 whitespace-pre-wrap text-sm', escDark ? 'text-neutral-400' : 'text-gray-600']">
|
|
117
|
+
{{ reply.body }}
|
|
118
|
+
</p>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div
|
|
122
|
+
v-if="!conversation.replies?.length"
|
|
123
|
+
:class="['text-xs', escDark ? 'text-neutral-500' : 'text-gray-400']"
|
|
124
|
+
>
|
|
125
|
+
No replies yet.
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<!-- Reply form -->
|
|
129
|
+
<div v-if="conversation.status === 'open'" class="pt-2">
|
|
130
|
+
<textarea
|
|
131
|
+
v-model="replyBody"
|
|
132
|
+
rows="2"
|
|
133
|
+
placeholder="Write a reply..."
|
|
134
|
+
:class="[
|
|
135
|
+
'w-full rounded-lg border px-3 py-2 text-sm focus:outline-none focus:ring-1',
|
|
136
|
+
escDark
|
|
137
|
+
? 'border-white/10 bg-neutral-950 text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:ring-white/10'
|
|
138
|
+
: 'border-gray-300 bg-white text-gray-900 placeholder-gray-400 focus:border-blue-400 focus:ring-blue-200',
|
|
139
|
+
]"
|
|
140
|
+
></textarea>
|
|
141
|
+
<div class="mt-2 flex items-center gap-2">
|
|
142
|
+
<button
|
|
143
|
+
:disabled="!replyBody.trim() || submitting"
|
|
144
|
+
:class="[
|
|
145
|
+
'rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-3 py-1.5 text-xs font-medium text-white transition-all hover:from-cyan-400 hover:to-violet-400',
|
|
146
|
+
(!replyBody.trim() || submitting) && 'cursor-not-allowed opacity-40',
|
|
147
|
+
]"
|
|
148
|
+
@click="submitReply"
|
|
149
|
+
>
|
|
150
|
+
Reply
|
|
151
|
+
</button>
|
|
152
|
+
<button
|
|
153
|
+
:class="[
|
|
154
|
+
'rounded-lg px-3 py-1.5 text-xs',
|
|
155
|
+
escDark ? 'text-neutral-400 hover:text-neutral-300' : 'text-gray-500 hover:text-gray-700',
|
|
156
|
+
]"
|
|
157
|
+
@click="closeConversation"
|
|
158
|
+
>
|
|
159
|
+
Close
|
|
160
|
+
</button>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</template>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, onMounted } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
import SideConversation from './SideConversation.vue';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
ticketReference: { type: String, required: true },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const conversations = ref([]);
|
|
11
|
+
const expanded = ref(true);
|
|
12
|
+
const showNew = ref(false);
|
|
13
|
+
const newSubject = ref('');
|
|
14
|
+
const newChannel = ref('internal');
|
|
15
|
+
const newBody = ref('');
|
|
16
|
+
const creating = ref(false);
|
|
17
|
+
|
|
18
|
+
onMounted(() => {
|
|
19
|
+
fetchConversations();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
async function fetchConversations() {
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch(route('escalated.admin.tickets.side-conversations.index', props.ticketReference), {
|
|
25
|
+
headers: {
|
|
26
|
+
Accept: 'application/json',
|
|
27
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
28
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
if (response.ok) {
|
|
32
|
+
const data = await response.json();
|
|
33
|
+
conversations.value = data.conversations || [];
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
// silently ignore
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createConversation() {
|
|
41
|
+
if (!newSubject.value.trim() || !newBody.value.trim() || creating.value) return;
|
|
42
|
+
creating.value = true;
|
|
43
|
+
|
|
44
|
+
router.post(
|
|
45
|
+
route('escalated.admin.tickets.side-conversations.store', props.ticketReference),
|
|
46
|
+
{
|
|
47
|
+
subject: newSubject.value,
|
|
48
|
+
channel: newChannel.value,
|
|
49
|
+
body: newBody.value,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
preserveScroll: true,
|
|
53
|
+
onSuccess: () => {
|
|
54
|
+
newSubject.value = '';
|
|
55
|
+
newBody.value = '';
|
|
56
|
+
newChannel.value = 'internal';
|
|
57
|
+
showNew.value = false;
|
|
58
|
+
fetchConversations();
|
|
59
|
+
},
|
|
60
|
+
onFinish: () => {
|
|
61
|
+
creating.value = false;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<template>
|
|
69
|
+
<div class="rounded-xl border border-white/[0.06] bg-neutral-900/60 p-4">
|
|
70
|
+
<button
|
|
71
|
+
class="flex w-full items-center justify-between text-sm font-semibold text-neutral-200"
|
|
72
|
+
@click="expanded = !expanded"
|
|
73
|
+
>
|
|
74
|
+
<span>Side Conversations ({{ conversations.length }})</span>
|
|
75
|
+
<svg
|
|
76
|
+
:class="['h-4 w-4 text-neutral-500 transition-transform', expanded && 'rotate-180']"
|
|
77
|
+
fill="none"
|
|
78
|
+
stroke="currentColor"
|
|
79
|
+
stroke-width="1.5"
|
|
80
|
+
viewBox="0 0 24 24"
|
|
81
|
+
>
|
|
82
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
|
83
|
+
</svg>
|
|
84
|
+
</button>
|
|
85
|
+
|
|
86
|
+
<div v-if="expanded" class="mt-3 space-y-3">
|
|
87
|
+
<SideConversation
|
|
88
|
+
v-for="conv in conversations"
|
|
89
|
+
:key="conv.id"
|
|
90
|
+
:conversation="conv"
|
|
91
|
+
:ticket-reference="ticketReference"
|
|
92
|
+
@updated="fetchConversations"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<div v-if="!conversations.length && !showNew" class="text-xs text-neutral-500">No side conversations.</div>
|
|
96
|
+
|
|
97
|
+
<!-- New conversation form -->
|
|
98
|
+
<div v-if="showNew" class="rounded-lg border border-white/[0.06] bg-white/[0.02] p-3 space-y-2">
|
|
99
|
+
<input
|
|
100
|
+
v-model="newSubject"
|
|
101
|
+
type="text"
|
|
102
|
+
placeholder="Subject..."
|
|
103
|
+
class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
104
|
+
/>
|
|
105
|
+
<select
|
|
106
|
+
v-model="newChannel"
|
|
107
|
+
class="rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 focus:border-white/20 focus:outline-none"
|
|
108
|
+
>
|
|
109
|
+
<option value="internal">Internal</option>
|
|
110
|
+
<option value="email">Email</option>
|
|
111
|
+
</select>
|
|
112
|
+
<textarea
|
|
113
|
+
v-model="newBody"
|
|
114
|
+
rows="3"
|
|
115
|
+
placeholder="Write the first message..."
|
|
116
|
+
class="w-full rounded-lg border border-white/10 bg-neutral-950 px-3 py-2 text-sm text-neutral-200 placeholder-neutral-500 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
117
|
+
></textarea>
|
|
118
|
+
<div class="flex gap-2">
|
|
119
|
+
<button
|
|
120
|
+
:disabled="!newSubject.trim() || !newBody.trim() || creating"
|
|
121
|
+
:class="[
|
|
122
|
+
'rounded-lg bg-gradient-to-r from-cyan-500 to-violet-500 px-3 py-1.5 text-xs font-medium text-white transition-all hover:from-cyan-400 hover:to-violet-400',
|
|
123
|
+
(!newSubject.trim() || !newBody.trim() || creating) && 'cursor-not-allowed opacity-40',
|
|
124
|
+
]"
|
|
125
|
+
@click="createConversation"
|
|
126
|
+
>
|
|
127
|
+
Create
|
|
128
|
+
</button>
|
|
129
|
+
<button
|
|
130
|
+
class="rounded-lg px-3 py-1.5 text-xs text-neutral-400 hover:text-neutral-300"
|
|
131
|
+
@click="showNew = false"
|
|
132
|
+
>
|
|
133
|
+
Cancel
|
|
134
|
+
</button>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<button
|
|
139
|
+
v-if="!showNew"
|
|
140
|
+
class="w-full rounded-lg border border-dashed border-white/[0.08] py-2 text-xs text-neutral-400 transition-colors hover:border-white/[0.15] hover:text-neutral-300"
|
|
141
|
+
@click="showNew = true"
|
|
142
|
+
>
|
|
143
|
+
+ New Side Conversation
|
|
144
|
+
</button>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
</template>
|