@escalated-dev/escalated 0.8.0 → 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 -361
- package/package.json +85 -84
- 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 -604
- 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 +3 -0
- 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 +102 -102
- 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 -13
- 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 +30 -10
- 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 -145
- 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 +56 -56
- 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
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
exportUrl: { type: String, default: '' },
|
|
6
|
-
reportName: { type: String, default: 'report' },
|
|
7
|
-
periodDays: { type: Number, default: 30 },
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const open = ref(false);
|
|
11
|
-
const loading = ref(false);
|
|
12
|
-
|
|
13
|
-
async function exportAs(format) {
|
|
14
|
-
loading.value = true;
|
|
15
|
-
try {
|
|
16
|
-
const separator = props.exportUrl.includes('?') ? '&' : '?';
|
|
17
|
-
const url = props.exportUrl ? `${props.exportUrl}${separator}format=${format}&days=${props.periodDays}` : '#';
|
|
18
|
-
|
|
19
|
-
if (!props.exportUrl) {
|
|
20
|
-
const data = { report: props.reportName, format, period_days: props.periodDays };
|
|
21
|
-
const blob = new Blob([format === 'json' ? JSON.stringify(data, null, 2) : 'No export URL configured'], {
|
|
22
|
-
type: format === 'json' ? 'application/json' : 'text/csv',
|
|
23
|
-
});
|
|
24
|
-
const a = document.createElement('a');
|
|
25
|
-
a.href = URL.createObjectURL(blob);
|
|
26
|
-
a.download = `${props.reportName}-${props.periodDays}d.${format}`;
|
|
27
|
-
a.click();
|
|
28
|
-
URL.revokeObjectURL(a.href);
|
|
29
|
-
} else {
|
|
30
|
-
const response = await fetch(url);
|
|
31
|
-
const blob = await response.blob();
|
|
32
|
-
const a = document.createElement('a');
|
|
33
|
-
a.href = URL.createObjectURL(blob);
|
|
34
|
-
a.download = `${props.reportName}-${props.periodDays}d.${format}`;
|
|
35
|
-
a.click();
|
|
36
|
-
URL.revokeObjectURL(a.href);
|
|
37
|
-
}
|
|
38
|
-
} finally {
|
|
39
|
-
loading.value = false;
|
|
40
|
-
open.value = false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<template>
|
|
46
|
-
<div class="relative">
|
|
47
|
-
<button
|
|
48
|
-
class="flex items-center gap-2 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] px-3.5 py-1.5 text-sm font-medium text-[var(--esc-panel-text-tertiary)] transition-all hover:text-[var(--esc-panel-text-secondary)]"
|
|
49
|
-
@click="open = !open"
|
|
50
|
-
>
|
|
51
|
-
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
52
|
-
<path
|
|
53
|
-
stroke-linecap="round"
|
|
54
|
-
stroke-linejoin="round"
|
|
55
|
-
d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
|
|
56
|
-
/>
|
|
57
|
-
</svg>
|
|
58
|
-
<span>Export</span>
|
|
59
|
-
<svg v-if="loading" class="h-3.5 w-3.5 animate-spin" fill="none" viewBox="0 0 24 24">
|
|
60
|
-
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
|
61
|
-
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
|
|
62
|
-
</svg>
|
|
63
|
-
</button>
|
|
64
|
-
<div
|
|
65
|
-
v-if="open"
|
|
66
|
-
class="absolute right-0 top-full z-10 mt-1 w-44 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] py-1 shadow-xl"
|
|
67
|
-
>
|
|
68
|
-
<button
|
|
69
|
-
class="flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-hover)]"
|
|
70
|
-
@click="exportAs('csv')"
|
|
71
|
-
>
|
|
72
|
-
<svg
|
|
73
|
-
class="h-4 w-4 text-[var(--esc-panel-text-muted)]"
|
|
74
|
-
fill="none"
|
|
75
|
-
stroke="currentColor"
|
|
76
|
-
stroke-width="1.5"
|
|
77
|
-
viewBox="0 0 24 24"
|
|
78
|
-
>
|
|
79
|
-
<path
|
|
80
|
-
stroke-linecap="round"
|
|
81
|
-
stroke-linejoin="round"
|
|
82
|
-
d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
|
|
83
|
-
/>
|
|
84
|
-
</svg>
|
|
85
|
-
Export as CSV
|
|
86
|
-
</button>
|
|
87
|
-
<button
|
|
88
|
-
class="flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-hover)]"
|
|
89
|
-
@click="exportAs('json')"
|
|
90
|
-
>
|
|
91
|
-
<svg
|
|
92
|
-
class="h-4 w-4 text-[var(--esc-panel-text-muted)]"
|
|
93
|
-
fill="none"
|
|
94
|
-
stroke="currentColor"
|
|
95
|
-
stroke-width="1.5"
|
|
96
|
-
viewBox="0 0 24 24"
|
|
97
|
-
>
|
|
98
|
-
<path
|
|
99
|
-
stroke-linecap="round"
|
|
100
|
-
stroke-linejoin="round"
|
|
101
|
-
d="M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"
|
|
102
|
-
/>
|
|
103
|
-
</svg>
|
|
104
|
-
Export as JSON
|
|
105
|
-
</button>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
exportUrl: { type: String, default: '' },
|
|
6
|
+
reportName: { type: String, default: 'report' },
|
|
7
|
+
periodDays: { type: Number, default: 30 },
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const open = ref(false);
|
|
11
|
+
const loading = ref(false);
|
|
12
|
+
|
|
13
|
+
async function exportAs(format) {
|
|
14
|
+
loading.value = true;
|
|
15
|
+
try {
|
|
16
|
+
const separator = props.exportUrl.includes('?') ? '&' : '?';
|
|
17
|
+
const url = props.exportUrl ? `${props.exportUrl}${separator}format=${format}&days=${props.periodDays}` : '#';
|
|
18
|
+
|
|
19
|
+
if (!props.exportUrl) {
|
|
20
|
+
const data = { report: props.reportName, format, period_days: props.periodDays };
|
|
21
|
+
const blob = new Blob([format === 'json' ? JSON.stringify(data, null, 2) : 'No export URL configured'], {
|
|
22
|
+
type: format === 'json' ? 'application/json' : 'text/csv',
|
|
23
|
+
});
|
|
24
|
+
const a = document.createElement('a');
|
|
25
|
+
a.href = URL.createObjectURL(blob);
|
|
26
|
+
a.download = `${props.reportName}-${props.periodDays}d.${format}`;
|
|
27
|
+
a.click();
|
|
28
|
+
URL.revokeObjectURL(a.href);
|
|
29
|
+
} else {
|
|
30
|
+
const response = await fetch(url);
|
|
31
|
+
const blob = await response.blob();
|
|
32
|
+
const a = document.createElement('a');
|
|
33
|
+
a.href = URL.createObjectURL(blob);
|
|
34
|
+
a.download = `${props.reportName}-${props.periodDays}d.${format}`;
|
|
35
|
+
a.click();
|
|
36
|
+
URL.revokeObjectURL(a.href);
|
|
37
|
+
}
|
|
38
|
+
} finally {
|
|
39
|
+
loading.value = false;
|
|
40
|
+
open.value = false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<div class="relative">
|
|
47
|
+
<button
|
|
48
|
+
class="flex items-center gap-2 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] px-3.5 py-1.5 text-sm font-medium text-[var(--esc-panel-text-tertiary)] transition-all hover:text-[var(--esc-panel-text-secondary)]"
|
|
49
|
+
@click="open = !open"
|
|
50
|
+
>
|
|
51
|
+
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24">
|
|
52
|
+
<path
|
|
53
|
+
stroke-linecap="round"
|
|
54
|
+
stroke-linejoin="round"
|
|
55
|
+
d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"
|
|
56
|
+
/>
|
|
57
|
+
</svg>
|
|
58
|
+
<span>Export</span>
|
|
59
|
+
<svg v-if="loading" class="h-3.5 w-3.5 animate-spin" fill="none" viewBox="0 0 24 24">
|
|
60
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
|
61
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" />
|
|
62
|
+
</svg>
|
|
63
|
+
</button>
|
|
64
|
+
<div
|
|
65
|
+
v-if="open"
|
|
66
|
+
class="absolute right-0 top-full z-10 mt-1 w-44 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] py-1 shadow-xl"
|
|
67
|
+
>
|
|
68
|
+
<button
|
|
69
|
+
class="flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-hover)]"
|
|
70
|
+
@click="exportAs('csv')"
|
|
71
|
+
>
|
|
72
|
+
<svg
|
|
73
|
+
class="h-4 w-4 text-[var(--esc-panel-text-muted)]"
|
|
74
|
+
fill="none"
|
|
75
|
+
stroke="currentColor"
|
|
76
|
+
stroke-width="1.5"
|
|
77
|
+
viewBox="0 0 24 24"
|
|
78
|
+
>
|
|
79
|
+
<path
|
|
80
|
+
stroke-linecap="round"
|
|
81
|
+
stroke-linejoin="round"
|
|
82
|
+
d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
|
|
83
|
+
/>
|
|
84
|
+
</svg>
|
|
85
|
+
Export as CSV
|
|
86
|
+
</button>
|
|
87
|
+
<button
|
|
88
|
+
class="flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-[var(--esc-panel-text-secondary)] hover:bg-[var(--esc-panel-hover)]"
|
|
89
|
+
@click="exportAs('json')"
|
|
90
|
+
>
|
|
91
|
+
<svg
|
|
92
|
+
class="h-4 w-4 text-[var(--esc-panel-text-muted)]"
|
|
93
|
+
fill="none"
|
|
94
|
+
stroke="currentColor"
|
|
95
|
+
stroke-width="1.5"
|
|
96
|
+
viewBox="0 0 24 24"
|
|
97
|
+
>
|
|
98
|
+
<path
|
|
99
|
+
stroke-linecap="round"
|
|
100
|
+
stroke-linejoin="round"
|
|
101
|
+
d="M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"
|
|
102
|
+
/>
|
|
103
|
+
</svg>
|
|
104
|
+
Export as JSON
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { ref, computed, inject } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
show: { type: Boolean, default: false },
|
|
6
|
-
filters: { type: Object, default: () => ({}) },
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const emit = defineEmits(['close', 'saved']);
|
|
10
|
-
const escDark = inject(
|
|
11
|
-
'esc-dark',
|
|
12
|
-
computed(() => false),
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const name = ref('');
|
|
16
|
-
const isShared = ref(false);
|
|
17
|
-
const saving = ref(false);
|
|
18
|
-
const error = ref('');
|
|
19
|
-
|
|
20
|
-
function reset() {
|
|
21
|
-
name.value = '';
|
|
22
|
-
isShared.value = false;
|
|
23
|
-
error.value = '';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function save() {
|
|
27
|
-
if (!name.value.trim()) {
|
|
28
|
-
error.value = 'Name is required.';
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const nonEmptyFilters = {};
|
|
33
|
-
for (const [key, value] of Object.entries(props.filters)) {
|
|
34
|
-
if (value !== '' && value !== null && value !== undefined) {
|
|
35
|
-
nonEmptyFilters[key] = value;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (Object.keys(nonEmptyFilters).length === 0) {
|
|
40
|
-
error.value = 'Apply some filters first before saving a view.';
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
saving.value = true;
|
|
45
|
-
error.value = '';
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
const response = await fetch(route('escalated.admin.saved-views.store'), {
|
|
49
|
-
method: 'POST',
|
|
50
|
-
headers: {
|
|
51
|
-
'Content-Type': 'application/json',
|
|
52
|
-
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
53
|
-
Accept: 'application/json',
|
|
54
|
-
'X-Requested-With': 'XMLHttpRequest',
|
|
55
|
-
},
|
|
56
|
-
body: JSON.stringify({
|
|
57
|
-
name: name.value.trim(),
|
|
58
|
-
filters: nonEmptyFilters,
|
|
59
|
-
is_shared: isShared.value,
|
|
60
|
-
}),
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
if (!response.ok) {
|
|
64
|
-
const data = await response.json();
|
|
65
|
-
error.value = data.message || 'Failed to save view.';
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
emit('saved');
|
|
70
|
-
reset();
|
|
71
|
-
emit('close');
|
|
72
|
-
} catch {
|
|
73
|
-
error.value = 'Failed to save view.';
|
|
74
|
-
} finally {
|
|
75
|
-
saving.value = false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function cancel() {
|
|
80
|
-
reset();
|
|
81
|
-
emit('close');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const overlayClass = computed(() => (escDark.value ? 'bg-black/60' : 'bg-black/30'));
|
|
85
|
-
|
|
86
|
-
const panelClass = computed(() =>
|
|
87
|
-
escDark.value
|
|
88
|
-
? 'border border-white/10 bg-[var(--esc-panel-surface)] text-neutral-200 shadow-xl'
|
|
89
|
-
: 'bg-white text-gray-900 shadow-xl',
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const inputClass = computed(() =>
|
|
93
|
-
escDark.value
|
|
94
|
-
? 'rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm text-neutral-200 placeholder-neutral-500 focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40'
|
|
95
|
-
: 'rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500',
|
|
96
|
-
);
|
|
97
|
-
</script>
|
|
98
|
-
|
|
99
|
-
<template>
|
|
100
|
-
<Teleport to="body">
|
|
101
|
-
<div v-if="show" class="fixed inset-0 z-50 flex items-center justify-center" @click.self="cancel">
|
|
102
|
-
<div :class="['absolute inset-0', overlayClass]" @click="cancel"></div>
|
|
103
|
-
<div :class="['relative w-full max-w-md rounded-lg p-6', panelClass]">
|
|
104
|
-
<h3 :class="['mb-4 text-lg font-semibold', escDark ? 'text-neutral-100' : 'text-gray-900']">
|
|
105
|
-
Save Current View
|
|
106
|
-
</h3>
|
|
107
|
-
|
|
108
|
-
<div class="space-y-4">
|
|
109
|
-
<div>
|
|
110
|
-
<label
|
|
111
|
-
:class="['mb-1 block text-sm font-medium', escDark ? 'text-neutral-400' : 'text-gray-700']"
|
|
112
|
-
>
|
|
113
|
-
Name
|
|
114
|
-
</label>
|
|
115
|
-
<input
|
|
116
|
-
v-model="name"
|
|
117
|
-
type="text"
|
|
118
|
-
placeholder="e.g. My Open Tickets"
|
|
119
|
-
:class="['w-full', inputClass]"
|
|
120
|
-
@keydown.enter="save"
|
|
121
|
-
/>
|
|
122
|
-
</div>
|
|
123
|
-
|
|
124
|
-
<label class="flex items-center gap-2">
|
|
125
|
-
<input
|
|
126
|
-
v-model="isShared"
|
|
127
|
-
type="checkbox"
|
|
128
|
-
:class="
|
|
129
|
-
escDark
|
|
130
|
-
? 'h-4 w-4 rounded border-white/10 bg-white/5 text-cyan-500 focus:ring-cyan-500/20'
|
|
131
|
-
: 'h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500'
|
|
132
|
-
"
|
|
133
|
-
/>
|
|
134
|
-
<span :class="['text-sm', escDark ? 'text-neutral-400' : 'text-gray-600']">
|
|
135
|
-
Share with all agents
|
|
136
|
-
</span>
|
|
137
|
-
</label>
|
|
138
|
-
|
|
139
|
-
<p v-if="error" :class="['text-sm', escDark ? 'text-red-400' : 'text-red-600']">
|
|
140
|
-
{{ error }}
|
|
141
|
-
</p>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<div class="mt-6 flex justify-end gap-3">
|
|
145
|
-
<button
|
|
146
|
-
type="button"
|
|
147
|
-
:class="[
|
|
148
|
-
'rounded-md px-4 py-2 text-sm font-medium',
|
|
149
|
-
escDark ? 'text-neutral-400 hover:text-neutral-200' : 'text-gray-600 hover:text-gray-800',
|
|
150
|
-
]"
|
|
151
|
-
@click="cancel"
|
|
152
|
-
>
|
|
153
|
-
Cancel
|
|
154
|
-
</button>
|
|
155
|
-
<button
|
|
156
|
-
type="button"
|
|
157
|
-
:disabled="saving"
|
|
158
|
-
:class="[
|
|
159
|
-
'rounded-md px-4 py-2 text-sm font-medium disabled:opacity-50',
|
|
160
|
-
escDark
|
|
161
|
-
? 'bg-cyan-600 text-white hover:bg-cyan-500'
|
|
162
|
-
: 'bg-blue-600 text-white hover:bg-blue-700',
|
|
163
|
-
]"
|
|
164
|
-
@click="save"
|
|
165
|
-
>
|
|
166
|
-
{{ saving ? 'Saving...' : 'Save View' }}
|
|
167
|
-
</button>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</Teleport>
|
|
172
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
show: { type: Boolean, default: false },
|
|
6
|
+
filters: { type: Object, default: () => ({}) },
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['close', 'saved']);
|
|
10
|
+
const escDark = inject(
|
|
11
|
+
'esc-dark',
|
|
12
|
+
computed(() => false),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const name = ref('');
|
|
16
|
+
const isShared = ref(false);
|
|
17
|
+
const saving = ref(false);
|
|
18
|
+
const error = ref('');
|
|
19
|
+
|
|
20
|
+
function reset() {
|
|
21
|
+
name.value = '';
|
|
22
|
+
isShared.value = false;
|
|
23
|
+
error.value = '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function save() {
|
|
27
|
+
if (!name.value.trim()) {
|
|
28
|
+
error.value = 'Name is required.';
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const nonEmptyFilters = {};
|
|
33
|
+
for (const [key, value] of Object.entries(props.filters)) {
|
|
34
|
+
if (value !== '' && value !== null && value !== undefined) {
|
|
35
|
+
nonEmptyFilters[key] = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (Object.keys(nonEmptyFilters).length === 0) {
|
|
40
|
+
error.value = 'Apply some filters first before saving a view.';
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
saving.value = true;
|
|
45
|
+
error.value = '';
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const response = await fetch(route('escalated.admin.saved-views.store'), {
|
|
49
|
+
method: 'POST',
|
|
50
|
+
headers: {
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
53
|
+
Accept: 'application/json',
|
|
54
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
55
|
+
},
|
|
56
|
+
body: JSON.stringify({
|
|
57
|
+
name: name.value.trim(),
|
|
58
|
+
filters: nonEmptyFilters,
|
|
59
|
+
is_shared: isShared.value,
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
const data = await response.json();
|
|
65
|
+
error.value = data.message || 'Failed to save view.';
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
emit('saved');
|
|
70
|
+
reset();
|
|
71
|
+
emit('close');
|
|
72
|
+
} catch {
|
|
73
|
+
error.value = 'Failed to save view.';
|
|
74
|
+
} finally {
|
|
75
|
+
saving.value = false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function cancel() {
|
|
80
|
+
reset();
|
|
81
|
+
emit('close');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const overlayClass = computed(() => (escDark.value ? 'bg-black/60' : 'bg-black/30'));
|
|
85
|
+
|
|
86
|
+
const panelClass = computed(() =>
|
|
87
|
+
escDark.value
|
|
88
|
+
? 'border border-white/10 bg-[var(--esc-panel-surface)] text-neutral-200 shadow-xl'
|
|
89
|
+
: 'bg-white text-gray-900 shadow-xl',
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const inputClass = computed(() =>
|
|
93
|
+
escDark.value
|
|
94
|
+
? 'rounded-lg border border-white/10 bg-white/5 px-3 py-2 text-sm text-neutral-200 placeholder-neutral-500 focus:border-cyan-500/40 focus:outline-none focus:ring-1 focus:ring-cyan-500/40'
|
|
95
|
+
: 'rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500',
|
|
96
|
+
);
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<template>
|
|
100
|
+
<Teleport to="body">
|
|
101
|
+
<div v-if="show" class="fixed inset-0 z-50 flex items-center justify-center" @click.self="cancel">
|
|
102
|
+
<div :class="['absolute inset-0', overlayClass]" @click="cancel"></div>
|
|
103
|
+
<div :class="['relative w-full max-w-md rounded-lg p-6', panelClass]">
|
|
104
|
+
<h3 :class="['mb-4 text-lg font-semibold', escDark ? 'text-neutral-100' : 'text-gray-900']">
|
|
105
|
+
Save Current View
|
|
106
|
+
</h3>
|
|
107
|
+
|
|
108
|
+
<div class="space-y-4">
|
|
109
|
+
<div>
|
|
110
|
+
<label
|
|
111
|
+
:class="['mb-1 block text-sm font-medium', escDark ? 'text-neutral-400' : 'text-gray-700']"
|
|
112
|
+
>
|
|
113
|
+
Name
|
|
114
|
+
</label>
|
|
115
|
+
<input
|
|
116
|
+
v-model="name"
|
|
117
|
+
type="text"
|
|
118
|
+
placeholder="e.g. My Open Tickets"
|
|
119
|
+
:class="['w-full', inputClass]"
|
|
120
|
+
@keydown.enter="save"
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<label class="flex items-center gap-2">
|
|
125
|
+
<input
|
|
126
|
+
v-model="isShared"
|
|
127
|
+
type="checkbox"
|
|
128
|
+
:class="
|
|
129
|
+
escDark
|
|
130
|
+
? 'h-4 w-4 rounded border-white/10 bg-white/5 text-cyan-500 focus:ring-cyan-500/20'
|
|
131
|
+
: 'h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500'
|
|
132
|
+
"
|
|
133
|
+
/>
|
|
134
|
+
<span :class="['text-sm', escDark ? 'text-neutral-400' : 'text-gray-600']">
|
|
135
|
+
Share with all agents
|
|
136
|
+
</span>
|
|
137
|
+
</label>
|
|
138
|
+
|
|
139
|
+
<p v-if="error" :class="['text-sm', escDark ? 'text-red-400' : 'text-red-600']">
|
|
140
|
+
{{ error }}
|
|
141
|
+
</p>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div class="mt-6 flex justify-end gap-3">
|
|
145
|
+
<button
|
|
146
|
+
type="button"
|
|
147
|
+
:class="[
|
|
148
|
+
'rounded-md px-4 py-2 text-sm font-medium',
|
|
149
|
+
escDark ? 'text-neutral-400 hover:text-neutral-200' : 'text-gray-600 hover:text-gray-800',
|
|
150
|
+
]"
|
|
151
|
+
@click="cancel"
|
|
152
|
+
>
|
|
153
|
+
Cancel
|
|
154
|
+
</button>
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
:disabled="saving"
|
|
158
|
+
:class="[
|
|
159
|
+
'rounded-md px-4 py-2 text-sm font-medium disabled:opacity-50',
|
|
160
|
+
escDark
|
|
161
|
+
? 'bg-cyan-600 text-white hover:bg-cyan-500'
|
|
162
|
+
: 'bg-blue-600 text-white hover:bg-blue-700',
|
|
163
|
+
]"
|
|
164
|
+
@click="save"
|
|
165
|
+
>
|
|
166
|
+
{{ saving ? 'Saving...' : 'Save View' }}
|
|
167
|
+
</button>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</Teleport>
|
|
172
|
+
</template>
|