@escalated-dev/escalated 0.7.1 → 0.9.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 +380 -357
- package/package.json +85 -81
- package/src/components/ActiveChatsPanel.vue +246 -246
- package/src/components/AdminDashboard.stories.js +1423 -1423
- package/src/components/AttachmentList.vue +65 -65
- package/src/components/ChatActionBar.vue +226 -226
- package/src/components/ChatBubble.vue +162 -162
- package/src/components/ChatComposer.vue +308 -308
- package/src/components/ChatQueue.vue +222 -222
- package/src/components/ChatThread.vue +197 -197
- package/src/components/CustomTicketActions.stories.js +71 -0
- package/src/components/CustomTicketActions.vue +101 -0
- package/src/components/EscalatedLayout.vue +619 -598
- package/src/components/FollowButton.vue +20 -1
- package/src/components/MentionDropdown.vue +154 -154
- package/src/components/MetricComparison.vue +89 -89
- package/src/components/PercentileChart.vue +67 -67
- package/src/components/PeriodSelector.vue +98 -98
- package/src/components/PresenceIndicator.vue +228 -213
- package/src/components/ReplyComposer.vue +336 -336
- package/src/components/ReplyThread.vue +153 -153
- package/src/components/ReportChart.vue +395 -395
- package/src/components/ReportExportButton.vue +108 -108
- package/src/components/SaveViewDialog.vue +172 -172
- package/src/components/SavedViewSidebar.vue +208 -208
- package/src/components/SkillTagManager.vue +29 -22
- package/src/components/SnoozeButton.vue +247 -247
- package/src/components/TicketFilters.vue +270 -270
- package/src/components/TicketList.vue +655 -655
- package/src/components/TicketSidebar.vue +4 -0
- package/src/components/TicketSplitDialog.vue +98 -98
- package/src/components/TicketSubjects.stories.js +63 -0
- package/src/components/TicketSubjects.vue +107 -0
- package/src/components/TwoFactorSetup.vue +1 -37
- package/src/components/VariableTokenInput.vue +111 -111
- package/src/components/WorkflowActionConfig.vue +287 -287
- package/src/components/WorkflowActionList.vue +350 -350
- package/src/components/WorkflowConditionBuilder.vue +265 -265
- package/src/components/WorkflowTriggerSelector.vue +125 -125
- package/src/components/admin/newsletters/AnalyticsTiles.stories.js +14 -0
- package/src/components/admin/newsletters/AnalyticsTiles.vue +55 -0
- package/src/components/admin/newsletters/DeliveriesTable.stories.js +28 -0
- package/src/components/admin/newsletters/DeliveriesTable.vue +104 -0
- package/src/components/admin/newsletters/DynamicFilterBuilder.stories.js +11 -0
- package/src/components/admin/newsletters/DynamicFilterBuilder.vue +53 -0
- package/src/components/admin/newsletters/ListMemberTable.stories.js +12 -0
- package/src/components/admin/newsletters/ListMemberTable.vue +53 -0
- package/src/components/admin/newsletters/MarkdownEditor.stories.js +6 -0
- package/src/components/admin/newsletters/MarkdownEditor.vue +53 -0
- package/src/components/admin/newsletters/MergeFieldDropdown.stories.js +6 -0
- package/src/components/admin/newsletters/MergeFieldDropdown.vue +84 -0
- package/src/components/admin/newsletters/PreviewIframe.stories.js +7 -0
- package/src/components/admin/newsletters/PreviewIframe.vue +40 -0
- package/src/components/admin/newsletters/SummaryTiles.stories.js +8 -0
- package/src/components/admin/newsletters/SummaryTiles.vue +63 -0
- package/src/composables/useChat.js +187 -187
- package/src/composables/useI18n.js +30 -8
- package/src/composables/useMentions.js +134 -134
- package/src/composables/usePermissions.js +31 -0
- package/src/composables/useRealtime.js +182 -182
- package/src/index.js +85 -84
- package/src/locales/README.md +13 -0
- package/src/locales/ar.json +727 -727
- package/src/locales/de.json +690 -690
- package/src/locales/en.json +889 -729
- package/src/locales/es.json +691 -691
- package/src/locales/fr.json +691 -691
- package/src/locales/index.js +16 -16
- package/src/locales/it.json +727 -727
- package/src/locales/ja.json +727 -727
- package/src/locales/ko.json +727 -727
- package/src/locales/nl.json +727 -727
- package/src/locales/pl.json +727 -727
- package/src/locales/pt-BR.json +727 -727
- package/src/locales/ru.json +727 -727
- package/src/locales/tr.json +727 -727
- package/src/locales/zh-CN.json +727 -727
- package/src/pages/Admin/Newsletters/Compose.vue +192 -0
- package/src/pages/Admin/Newsletters/Edit.vue +24 -0
- package/src/pages/Admin/Newsletters/Index.vue +141 -0
- package/src/pages/Admin/Newsletters/Lists/Create.vue +64 -0
- package/src/pages/Admin/Newsletters/Lists/Index.vue +59 -0
- package/src/pages/Admin/Newsletters/Lists/Show.vue +53 -0
- package/src/pages/Admin/Newsletters/Settings.vue +85 -0
- package/src/pages/Admin/Newsletters/Show.vue +140 -0
- package/src/pages/Admin/Newsletters/Templates/Create.vue +11 -0
- package/src/pages/Admin/Newsletters/Templates/Index.vue +54 -0
- package/src/pages/Admin/Newsletters/Templates/Show.vue +65 -0
- package/src/pages/Admin/Newsletters/usePreview.js +44 -0
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -132
- package/src/pages/Admin/Reports/AgentRanking.vue +246 -246
- package/src/pages/Admin/Reports/Cohorts.vue +180 -180
- package/src/pages/Admin/Reports/Comparison.vue +141 -141
- package/src/pages/Admin/Reports/Dashboard.vue +226 -226
- package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -164
- package/src/pages/Admin/Reports/ResponseTimes.vue +164 -164
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -183
- package/src/pages/Admin/Settings/SsoSettings.vue +157 -4
- package/src/pages/Admin/Settings/TwoFactor.vue +32 -6
- package/src/pages/Admin/Settings.vue +1008 -1008
- package/src/pages/Admin/Skills/Form.vue +164 -4
- package/src/pages/Admin/Skills/Index.vue +14 -3
- package/src/pages/Admin/Tickets/Index.vue +126 -126
- package/src/pages/Admin/Tickets/Show.vue +254 -249
- package/src/pages/Admin/Users/Index.vue +145 -0
- package/src/pages/Admin/Workflows/Builder.vue +207 -207
- package/src/pages/Admin/Workflows/Index.vue +235 -235
- package/src/pages/Admin/Workflows/Logs.vue +286 -286
- package/src/pages/Agent/TicketIndex.vue +112 -112
- package/src/pages/Agent/TicketShow.vue +547 -494
- package/src/pages/Customer/Index.vue +26 -1
- package/src/pages/Customer/KnowledgeBase/Article.vue +129 -129
- package/src/plugin.js +175 -175
- package/src/utils/mentionHighlight.js +24 -24
- package/src/widget/EscalatedWidget.vue +804 -804
- package/src/widget/index.js +254 -254
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
import EscalatedLayout from '../../../components/EscalatedLayout.vue';
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
users: Object,
|
|
8
|
+
filters: { type: Object, default: () => ({}) },
|
|
9
|
+
currentUserId: { type: [Number, String], default: null },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const search = ref(props.filters?.search ?? '');
|
|
13
|
+
|
|
14
|
+
function applySearch() {
|
|
15
|
+
router.get(
|
|
16
|
+
route('escalated.admin.users.index'),
|
|
17
|
+
{ search: search.value },
|
|
18
|
+
{ preserveState: true, preserveScroll: true },
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function toggleRole(user, role) {
|
|
23
|
+
const value = role === 'admin' ? !user.is_admin : !user.is_agent;
|
|
24
|
+
router.patch(route('escalated.admin.users.role', user.id), { role, value }, { preserveScroll: true });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isSelf(user) {
|
|
28
|
+
return props.currentUserId !== null && String(user.id) === String(props.currentUserId);
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<EscalatedLayout title="Users">
|
|
34
|
+
<div class="mb-4 flex items-center justify-between gap-4">
|
|
35
|
+
<form class="flex-1 max-w-sm" @submit.prevent="applySearch">
|
|
36
|
+
<input
|
|
37
|
+
v-model="search"
|
|
38
|
+
type="search"
|
|
39
|
+
placeholder="Search by name or email"
|
|
40
|
+
class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] px-3 py-2 text-sm text-[var(--esc-panel-text)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-accent)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-accent)]"
|
|
41
|
+
/>
|
|
42
|
+
</form>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
|
|
46
|
+
<table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
|
|
47
|
+
<thead>
|
|
48
|
+
<tr class="bg-[var(--esc-panel-hover)]">
|
|
49
|
+
<th
|
|
50
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
51
|
+
>
|
|
52
|
+
User
|
|
53
|
+
</th>
|
|
54
|
+
<th
|
|
55
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
56
|
+
>
|
|
57
|
+
Email
|
|
58
|
+
</th>
|
|
59
|
+
<th
|
|
60
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
61
|
+
>
|
|
62
|
+
Admin
|
|
63
|
+
</th>
|
|
64
|
+
<th
|
|
65
|
+
class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
|
|
66
|
+
>
|
|
67
|
+
Agent
|
|
68
|
+
</th>
|
|
69
|
+
</tr>
|
|
70
|
+
</thead>
|
|
71
|
+
<tbody class="divide-y divide-[var(--esc-panel-border)]">
|
|
72
|
+
<tr v-if="!users?.data?.length">
|
|
73
|
+
<td colspan="4" class="px-4 py-12 text-center text-sm text-[var(--esc-panel-text-muted)]">
|
|
74
|
+
No users found.
|
|
75
|
+
</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr v-for="user in users?.data || []" :key="user.id" class="hover:bg-[var(--esc-panel-hover)]">
|
|
78
|
+
<td class="whitespace-nowrap px-4 py-3 text-sm text-[var(--esc-panel-text)]">
|
|
79
|
+
<span>{{ user.name || '—' }}</span>
|
|
80
|
+
<span
|
|
81
|
+
v-if="isSelf(user)"
|
|
82
|
+
class="ml-2 rounded-full bg-[var(--esc-panel-accent)]/15 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-[var(--esc-panel-accent)]"
|
|
83
|
+
>
|
|
84
|
+
You
|
|
85
|
+
</span>
|
|
86
|
+
</td>
|
|
87
|
+
<td class="whitespace-nowrap px-4 py-3 text-sm text-[var(--esc-panel-text-muted)]">
|
|
88
|
+
{{ user.email }}
|
|
89
|
+
</td>
|
|
90
|
+
<td class="px-4 py-3">
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
:disabled="isSelf(user) && user.is_admin"
|
|
94
|
+
:title="isSelf(user) && user.is_admin ? 'You cannot remove your own admin role.' : ''"
|
|
95
|
+
class="inline-flex h-6 w-11 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-50"
|
|
96
|
+
:class="user.is_admin ? 'bg-indigo-600' : 'bg-gray-300'"
|
|
97
|
+
@click="toggleRole(user, 'admin')"
|
|
98
|
+
>
|
|
99
|
+
<span
|
|
100
|
+
class="inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform"
|
|
101
|
+
:class="user.is_admin ? 'translate-x-6' : 'translate-x-1'"
|
|
102
|
+
/>
|
|
103
|
+
</button>
|
|
104
|
+
</td>
|
|
105
|
+
<td class="px-4 py-3">
|
|
106
|
+
<button
|
|
107
|
+
type="button"
|
|
108
|
+
class="inline-flex h-6 w-11 items-center rounded-full transition-colors"
|
|
109
|
+
:class="user.is_agent ? 'bg-indigo-600' : 'bg-gray-300'"
|
|
110
|
+
@click="toggleRole(user, 'agent')"
|
|
111
|
+
>
|
|
112
|
+
<span
|
|
113
|
+
class="inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform"
|
|
114
|
+
:class="user.is_agent ? 'translate-x-6' : 'translate-x-1'"
|
|
115
|
+
/>
|
|
116
|
+
</button>
|
|
117
|
+
</td>
|
|
118
|
+
</tr>
|
|
119
|
+
</tbody>
|
|
120
|
+
</table>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div v-if="users?.links?.length > 3" class="mt-4 flex items-center justify-end gap-1">
|
|
124
|
+
<template v-for="(link, idx) in users.links" :key="idx">
|
|
125
|
+
<button
|
|
126
|
+
v-if="link.url"
|
|
127
|
+
type="button"
|
|
128
|
+
class="rounded-md px-3 py-1 text-sm"
|
|
129
|
+
:class="
|
|
130
|
+
link.active
|
|
131
|
+
? 'bg-[var(--esc-panel-accent)] text-white'
|
|
132
|
+
: 'text-[var(--esc-panel-text-muted)] hover:bg-[var(--esc-panel-hover)]'
|
|
133
|
+
"
|
|
134
|
+
@click="router.get(link.url, {}, { preserveState: true, preserveScroll: true })"
|
|
135
|
+
v-html="link.label"
|
|
136
|
+
/>
|
|
137
|
+
<span
|
|
138
|
+
v-else
|
|
139
|
+
class="rounded-md px-3 py-1 text-sm text-[var(--esc-panel-text-muted)]/40"
|
|
140
|
+
v-html="link.label"
|
|
141
|
+
/>
|
|
142
|
+
</template>
|
|
143
|
+
</div>
|
|
144
|
+
</EscalatedLayout>
|
|
145
|
+
</template>
|
|
@@ -1,207 +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>
|
|
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>
|