@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
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../../components/EscalatedLayout.vue';
|
|
3
|
+
import WorkflowTriggerSelector from '../../../components/WorkflowTriggerSelector.vue';
|
|
4
|
+
import WorkflowConditionBuilder from '../../../components/WorkflowConditionBuilder.vue';
|
|
5
|
+
import WorkflowActionList from '../../../components/WorkflowActionList.vue';
|
|
6
|
+
import { useForm } from '@inertiajs/vue3';
|
|
7
|
+
import { ref, computed } from 'vue';
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
workflow: { type: Object, default: null },
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const form = useForm({
|
|
14
|
+
name: props.workflow?.name || '',
|
|
15
|
+
description: props.workflow?.description || '',
|
|
16
|
+
trigger: props.workflow?.trigger || '',
|
|
17
|
+
conditions: props.workflow?.conditions || { match: 'all', conditions: [] },
|
|
18
|
+
actions: props.workflow?.actions || [],
|
|
19
|
+
active: props.workflow?.active ?? true,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const expandedStep = ref(props.workflow ? null : 1);
|
|
23
|
+
|
|
24
|
+
function toggleStep(step) {
|
|
25
|
+
expandedStep.value = expandedStep.value === step ? null : step;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function submit() {
|
|
29
|
+
if (props.workflow) {
|
|
30
|
+
form.put(route('escalated.admin.workflows.update', props.workflow.id));
|
|
31
|
+
} else {
|
|
32
|
+
form.post(route('escalated.admin.workflows.store'));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isValid = computed(() => {
|
|
37
|
+
return form.name && form.trigger && form.actions.length > 0;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const stepBorderColors = {
|
|
41
|
+
1: 'border-l-blue-500',
|
|
42
|
+
2: 'border-l-amber-500',
|
|
43
|
+
3: 'border-l-emerald-500',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const stepDotColors = {
|
|
47
|
+
1: 'bg-blue-500',
|
|
48
|
+
2: 'bg-amber-500',
|
|
49
|
+
3: 'bg-emerald-500',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const stepLabels = {
|
|
53
|
+
1: 'Trigger Event',
|
|
54
|
+
2: 'Conditions',
|
|
55
|
+
3: 'Actions',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const stepDescriptions = {
|
|
59
|
+
1: 'When this happens...',
|
|
60
|
+
2: 'Only if these conditions are met...',
|
|
61
|
+
3: 'Then do this...',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
function stepHasData(step) {
|
|
65
|
+
switch (step) {
|
|
66
|
+
case 1:
|
|
67
|
+
return !!form.trigger;
|
|
68
|
+
case 2:
|
|
69
|
+
return form.conditions?.conditions?.length > 0;
|
|
70
|
+
case 3:
|
|
71
|
+
return form.actions?.length > 0;
|
|
72
|
+
default:
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<EscalatedLayout :title="workflow ? 'Edit Workflow' : 'Create Workflow'">
|
|
80
|
+
<form class="mx-auto max-w-3xl space-y-6" @submit.prevent="submit">
|
|
81
|
+
<!-- Header -->
|
|
82
|
+
<div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6">
|
|
83
|
+
<div class="space-y-4">
|
|
84
|
+
<div>
|
|
85
|
+
<label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
|
|
86
|
+
>Workflow Name</label
|
|
87
|
+
>
|
|
88
|
+
<input
|
|
89
|
+
v-model="form.name"
|
|
90
|
+
type="text"
|
|
91
|
+
required
|
|
92
|
+
placeholder="e.g. Auto-assign urgent tickets"
|
|
93
|
+
class="mt-1 w-full rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-3 py-2 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)]"
|
|
94
|
+
/>
|
|
95
|
+
<p v-if="form.errors.name" class="mt-1 text-xs text-rose-400">{{ form.errors.name }}</p>
|
|
96
|
+
</div>
|
|
97
|
+
<div>
|
|
98
|
+
<label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
|
|
99
|
+
>Description</label
|
|
100
|
+
>
|
|
101
|
+
<textarea
|
|
102
|
+
v-model="form.description"
|
|
103
|
+
rows="2"
|
|
104
|
+
placeholder="What does this workflow do?"
|
|
105
|
+
class="mt-1 w-full resize-y rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-3 py-2 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)]"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
<div>
|
|
109
|
+
<label class="flex items-center gap-2 text-sm text-[var(--esc-panel-text-secondary)]">
|
|
110
|
+
<input
|
|
111
|
+
v-model="form.active"
|
|
112
|
+
type="checkbox"
|
|
113
|
+
class="rounded border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-cyan-500 focus:ring-cyan-500/20"
|
|
114
|
+
/>
|
|
115
|
+
Active
|
|
116
|
+
</label>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<!-- Steps -->
|
|
122
|
+
<div class="relative space-y-4">
|
|
123
|
+
<!-- Vertical connector line -->
|
|
124
|
+
<div class="absolute top-0 bottom-0 left-6 w-px bg-[var(--esc-panel-border)]" />
|
|
125
|
+
|
|
126
|
+
<!-- Step 1: Trigger -->
|
|
127
|
+
<div
|
|
128
|
+
v-for="step in [1, 2, 3]"
|
|
129
|
+
:key="step"
|
|
130
|
+
class="relative rounded-xl border border-[var(--esc-panel-border)] border-l-4 bg-[var(--esc-panel-surface)] transition-all"
|
|
131
|
+
:class="stepBorderColors[step]"
|
|
132
|
+
>
|
|
133
|
+
<!-- Step dot -->
|
|
134
|
+
<div
|
|
135
|
+
class="absolute -left-[11px] top-4 flex h-5 w-5 items-center justify-center rounded-full"
|
|
136
|
+
:class="stepDotColors[step]"
|
|
137
|
+
>
|
|
138
|
+
<span v-if="stepHasData(step)" class="text-[10px] font-bold text-white">
|
|
139
|
+
<svg class="h-3 w-3" fill="none" stroke="currentColor" stroke-width="3" viewBox="0 0 24 24">
|
|
140
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5" />
|
|
141
|
+
</svg>
|
|
142
|
+
</span>
|
|
143
|
+
<span v-else class="text-[10px] font-bold text-white">{{ step }}</span>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<!-- Step header -->
|
|
147
|
+
<button
|
|
148
|
+
type="button"
|
|
149
|
+
class="flex w-full items-center gap-3 px-6 py-4 text-left"
|
|
150
|
+
@click="toggleStep(step)"
|
|
151
|
+
>
|
|
152
|
+
<div class="flex-1">
|
|
153
|
+
<h3 class="text-sm font-semibold text-[var(--esc-panel-text-secondary)]">
|
|
154
|
+
{{ stepLabels[step] }}
|
|
155
|
+
<span
|
|
156
|
+
v-if="step === 2"
|
|
157
|
+
class="ml-1 text-xs font-normal text-[var(--esc-panel-text-muted)]"
|
|
158
|
+
>(optional)</span
|
|
159
|
+
>
|
|
160
|
+
</h3>
|
|
161
|
+
<p class="text-xs text-[var(--esc-panel-text-muted)]">{{ stepDescriptions[step] }}</p>
|
|
162
|
+
</div>
|
|
163
|
+
<svg
|
|
164
|
+
class="h-4 w-4 text-[var(--esc-panel-text-muted)] transition-transform"
|
|
165
|
+
:class="expandedStep === step ? 'rotate-180' : ''"
|
|
166
|
+
fill="none"
|
|
167
|
+
stroke="currentColor"
|
|
168
|
+
stroke-width="2"
|
|
169
|
+
viewBox="0 0 24 24"
|
|
170
|
+
>
|
|
171
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
|
172
|
+
</svg>
|
|
173
|
+
</button>
|
|
174
|
+
|
|
175
|
+
<!-- Step content -->
|
|
176
|
+
<div v-if="expandedStep === step" class="border-t border-[var(--esc-panel-border)] px-6 py-4">
|
|
177
|
+
<!-- Trigger selector -->
|
|
178
|
+
<WorkflowTriggerSelector v-if="step === 1" v-model="form.trigger" />
|
|
179
|
+
|
|
180
|
+
<!-- Condition builder -->
|
|
181
|
+
<WorkflowConditionBuilder v-if="step === 2" v-model="form.conditions" />
|
|
182
|
+
|
|
183
|
+
<!-- Action list -->
|
|
184
|
+
<WorkflowActionList v-if="step === 3" v-model="form.actions" />
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<!-- Footer buttons -->
|
|
190
|
+
<div class="flex items-center gap-3 pt-2">
|
|
191
|
+
<button
|
|
192
|
+
type="submit"
|
|
193
|
+
:disabled="form.processing || !isValid"
|
|
194
|
+
class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-6 py-2.5 text-sm font-medium text-white shadow-lg shadow-[var(--esc-panel-bg)]/20 transition-all hover:from-[var(--esc-panel-accent-hover)] hover:to-[var(--esc-panel-accent-secondary-hover)] disabled:opacity-50"
|
|
195
|
+
>
|
|
196
|
+
{{ form.processing ? 'Saving...' : workflow ? 'Update Workflow' : 'Create Workflow' }}
|
|
197
|
+
</button>
|
|
198
|
+
<a
|
|
199
|
+
:href="route('escalated.admin.workflows.index')"
|
|
200
|
+
class="rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] px-4 py-2.5 text-sm font-medium text-[var(--esc-panel-text-secondary)] transition-colors hover:bg-[var(--esc-panel-hover)]"
|
|
201
|
+
>
|
|
202
|
+
Cancel
|
|
203
|
+
</a>
|
|
204
|
+
</div>
|
|
205
|
+
</form>
|
|
206
|
+
</EscalatedLayout>
|
|
207
|
+
</template>
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import EscalatedLayout from '../../../components/EscalatedLayout.vue';
|
|
3
|
+
import { Link, router } from '@inertiajs/vue3';
|
|
4
|
+
import { ref } from 'vue';
|
|
5
|
+
|
|
6
|
+
defineProps({
|
|
7
|
+
workflows: { type: Array, default: () => [] },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const dragIndex = ref(null);
|
|
11
|
+
|
|
12
|
+
function destroy(id) {
|
|
13
|
+
if (confirm('Delete this workflow? This cannot be undone.')) {
|
|
14
|
+
router.delete(route('escalated.admin.workflows.destroy', id));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function toggleActive(workflow) {
|
|
19
|
+
router.put(route('escalated.admin.workflows.toggle', workflow.id), {
|
|
20
|
+
active: !workflow.active,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function onDragStart(index) {
|
|
25
|
+
dragIndex.value = index;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function onDragOver(event) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function onDrop(event, workflows, targetIndex) {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
if (dragIndex.value === null || dragIndex.value === targetIndex) return;
|
|
35
|
+
const ids = workflows.map((w) => w.id);
|
|
36
|
+
const [moved] = ids.splice(dragIndex.value, 1);
|
|
37
|
+
ids.splice(targetIndex, 0, moved);
|
|
38
|
+
router.post(route('escalated.admin.workflows.reorder'), { ids });
|
|
39
|
+
dragIndex.value = null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function onDragEnd() {
|
|
43
|
+
dragIndex.value = null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function triggerBadgeClass(trigger) {
|
|
47
|
+
const classes = {
|
|
48
|
+
ticket_created: 'bg-blue-500/10 text-blue-400',
|
|
49
|
+
ticket_updated: 'bg-cyan-500/10 text-cyan-400',
|
|
50
|
+
reply_added: 'bg-emerald-500/10 text-emerald-400',
|
|
51
|
+
status_changed: 'bg-violet-500/10 text-violet-400',
|
|
52
|
+
ticket_assigned: 'bg-indigo-500/10 text-indigo-400',
|
|
53
|
+
ticket_escalated: 'bg-red-500/10 text-red-400',
|
|
54
|
+
sla_breached: 'bg-rose-500/10 text-rose-400',
|
|
55
|
+
sla_warning: 'bg-amber-500/10 text-amber-400',
|
|
56
|
+
chat_started: 'bg-teal-500/10 text-teal-400',
|
|
57
|
+
chat_ended: 'bg-gray-500/10 text-gray-400',
|
|
58
|
+
};
|
|
59
|
+
return classes[trigger] || 'bg-gray-500/10 text-gray-400';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function triggerLabel(trigger) {
|
|
63
|
+
return (trigger || '').replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<EscalatedLayout title="Workflows">
|
|
69
|
+
<div class="mb-4 flex items-center justify-between">
|
|
70
|
+
<div>
|
|
71
|
+
<h2 class="text-lg font-semibold text-[var(--esc-panel-text-secondary)]">Workflows</h2>
|
|
72
|
+
<p class="text-xs text-[var(--esc-panel-text-muted)]">
|
|
73
|
+
Event-driven automations with conditions, actions, and delays
|
|
74
|
+
</p>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="flex items-center gap-3">
|
|
77
|
+
<Link
|
|
78
|
+
:href="route('escalated.admin.workflows.logs')"
|
|
79
|
+
class="rounded-lg border border-[var(--esc-panel-border)] px-3 py-2 text-sm font-medium text-[var(--esc-panel-text-secondary)] transition-colors hover:bg-[var(--esc-panel-hover)]"
|
|
80
|
+
>
|
|
81
|
+
View Logs
|
|
82
|
+
</Link>
|
|
83
|
+
<Link
|
|
84
|
+
:href="route('escalated.admin.workflows.create')"
|
|
85
|
+
class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-4 py-2 text-sm font-medium text-white shadow-lg shadow-[var(--esc-panel-bg)]/20 transition-all hover:from-[var(--esc-panel-accent-hover)] hover:to-[var(--esc-panel-accent-secondary-hover)]"
|
|
86
|
+
>
|
|
87
|
+
Create Workflow
|
|
88
|
+
</Link>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
|
|
93
|
+
<table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
|
|
94
|
+
<thead>
|
|
95
|
+
<tr class="bg-[var(--esc-panel-hover)]">
|
|
96
|
+
<th class="w-8 px-2 py-3" />
|
|
97
|
+
<th
|
|
98
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
99
|
+
>
|
|
100
|
+
Name
|
|
101
|
+
</th>
|
|
102
|
+
<th
|
|
103
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
104
|
+
>
|
|
105
|
+
Trigger
|
|
106
|
+
</th>
|
|
107
|
+
<th
|
|
108
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
109
|
+
>
|
|
110
|
+
Status
|
|
111
|
+
</th>
|
|
112
|
+
<th
|
|
113
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
114
|
+
>
|
|
115
|
+
Last Triggered
|
|
116
|
+
</th>
|
|
117
|
+
<th
|
|
118
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
119
|
+
>
|
|
120
|
+
Runs
|
|
121
|
+
</th>
|
|
122
|
+
<th
|
|
123
|
+
class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
124
|
+
>
|
|
125
|
+
Actions
|
|
126
|
+
</th>
|
|
127
|
+
</tr>
|
|
128
|
+
</thead>
|
|
129
|
+
<tbody class="divide-y divide-[var(--esc-panel-border)]">
|
|
130
|
+
<tr v-if="!workflows?.length">
|
|
131
|
+
<td colspan="7" class="px-4 py-12 text-center">
|
|
132
|
+
<svg
|
|
133
|
+
class="mx-auto mb-3 h-8 w-8 text-[var(--esc-panel-text-muted)]"
|
|
134
|
+
fill="none"
|
|
135
|
+
stroke="currentColor"
|
|
136
|
+
stroke-width="1.5"
|
|
137
|
+
viewBox="0 0 24 24"
|
|
138
|
+
>
|
|
139
|
+
<path
|
|
140
|
+
stroke-linecap="round"
|
|
141
|
+
stroke-linejoin="round"
|
|
142
|
+
d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"
|
|
143
|
+
/>
|
|
144
|
+
<path
|
|
145
|
+
stroke-linecap="round"
|
|
146
|
+
stroke-linejoin="round"
|
|
147
|
+
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
|
148
|
+
/>
|
|
149
|
+
</svg>
|
|
150
|
+
<p class="text-sm text-[var(--esc-panel-text-muted)]">No workflows yet</p>
|
|
151
|
+
<p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
|
|
152
|
+
Create event-driven automations with conditions and actions
|
|
153
|
+
</p>
|
|
154
|
+
</td>
|
|
155
|
+
</tr>
|
|
156
|
+
<tr
|
|
157
|
+
v-for="(workflow, i) in workflows"
|
|
158
|
+
:key="workflow.id"
|
|
159
|
+
class="transition-colors hover:bg-[var(--esc-panel-hover)]"
|
|
160
|
+
draggable="true"
|
|
161
|
+
@dragstart="onDragStart(i)"
|
|
162
|
+
@dragover="onDragOver($event)"
|
|
163
|
+
@drop="onDrop($event, workflows, i)"
|
|
164
|
+
@dragend="onDragEnd"
|
|
165
|
+
>
|
|
166
|
+
<td class="px-2 py-3">
|
|
167
|
+
<div class="cursor-grab text-[var(--esc-panel-text-muted)]">
|
|
168
|
+
<svg class="h-4 w-4" fill="currentColor" viewBox="0 0 24 24">
|
|
169
|
+
<circle cx="9" cy="6" r="1.5" />
|
|
170
|
+
<circle cx="15" cy="6" r="1.5" />
|
|
171
|
+
<circle cx="9" cy="12" r="1.5" />
|
|
172
|
+
<circle cx="15" cy="12" r="1.5" />
|
|
173
|
+
<circle cx="9" cy="18" r="1.5" />
|
|
174
|
+
<circle cx="15" cy="18" r="1.5" />
|
|
175
|
+
</svg>
|
|
176
|
+
</div>
|
|
177
|
+
</td>
|
|
178
|
+
<td class="px-4 py-3">
|
|
179
|
+
<Link
|
|
180
|
+
:href="route('escalated.admin.workflows.edit', workflow.id)"
|
|
181
|
+
class="text-sm font-medium text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
|
|
182
|
+
>
|
|
183
|
+
{{ workflow.name }}
|
|
184
|
+
</Link>
|
|
185
|
+
<p
|
|
186
|
+
v-if="workflow.description"
|
|
187
|
+
class="mt-0.5 truncate text-xs text-[var(--esc-panel-text-muted)]"
|
|
188
|
+
>
|
|
189
|
+
{{ workflow.description }}
|
|
190
|
+
</p>
|
|
191
|
+
</td>
|
|
192
|
+
<td class="px-4 py-3">
|
|
193
|
+
<span
|
|
194
|
+
class="inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium"
|
|
195
|
+
:class="triggerBadgeClass(workflow.trigger)"
|
|
196
|
+
>
|
|
197
|
+
{{ triggerLabel(workflow.trigger) }}
|
|
198
|
+
</span>
|
|
199
|
+
</td>
|
|
200
|
+
<td class="px-4 py-3">
|
|
201
|
+
<button
|
|
202
|
+
type="button"
|
|
203
|
+
class="relative inline-flex h-5 w-9 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none"
|
|
204
|
+
:class="workflow.active ? 'bg-emerald-500' : 'bg-[var(--esc-panel-border)]'"
|
|
205
|
+
@click="toggleActive(workflow)"
|
|
206
|
+
>
|
|
207
|
+
<span
|
|
208
|
+
class="pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
|
|
209
|
+
:class="workflow.active ? 'translate-x-4' : 'translate-x-0'"
|
|
210
|
+
/>
|
|
211
|
+
</button>
|
|
212
|
+
</td>
|
|
213
|
+
<td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
|
|
214
|
+
{{ workflow.last_triggered_at || '---' }}
|
|
215
|
+
</td>
|
|
216
|
+
<td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
|
|
217
|
+
{{ workflow.trigger_count || 0 }}
|
|
218
|
+
</td>
|
|
219
|
+
<td class="px-4 py-3 text-right text-sm">
|
|
220
|
+
<Link
|
|
221
|
+
:href="route('escalated.admin.workflows.edit', workflow.id)"
|
|
222
|
+
class="text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
|
|
223
|
+
>
|
|
224
|
+
Edit
|
|
225
|
+
</Link>
|
|
226
|
+
<button class="ml-3 text-rose-400 hover:text-rose-300" @click="destroy(workflow.id)">
|
|
227
|
+
Delete
|
|
228
|
+
</button>
|
|
229
|
+
</td>
|
|
230
|
+
</tr>
|
|
231
|
+
</tbody>
|
|
232
|
+
</table>
|
|
233
|
+
</div>
|
|
234
|
+
</EscalatedLayout>
|
|
235
|
+
</template>
|