@escalated-dev/escalated 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +94 -2
  2. package/package.json +31 -2
  3. package/src/components/ActivityTimeline.stories.js +55 -0
  4. package/src/components/ActivityTimeline.vue +24 -7
  5. package/src/components/AdminDashboard.stories.js +1095 -0
  6. package/src/components/AgentLoadIndicator.stories.js +37 -0
  7. package/src/components/AgentLoadIndicator.vue +49 -0
  8. package/src/components/AgentPerformanceCard.vue +44 -0
  9. package/src/components/ArticleEditor.vue +82 -0
  10. package/src/components/AssigneeSelect.vue +19 -5
  11. package/src/components/AttachmentList.vue +53 -37
  12. package/src/components/AuditLogEntry.vue +95 -0
  13. package/src/components/BulkActionBar.vue +99 -30
  14. package/src/components/CategoryTree.vue +89 -0
  15. package/src/components/ChartWidget.vue +46 -0
  16. package/src/components/CollisionWarning.stories.js +30 -0
  17. package/src/components/CollisionWarning.vue +68 -0
  18. package/src/components/ConditionalFieldRules.vue +135 -0
  19. package/src/components/ContextPanel.vue +66 -0
  20. package/src/components/ContextPanelSection.vue +65 -0
  21. package/src/components/CustomFieldRenderer.vue +159 -0
  22. package/src/components/EscalatedLayout.vue +400 -69
  23. package/src/components/FileDropzone.vue +26 -10
  24. package/src/components/FollowButton.stories.js +30 -0
  25. package/src/components/FollowButton.vue +53 -28
  26. package/src/components/KeyboardShortcutHelp.vue +129 -39
  27. package/src/components/KnowledgePanel.vue +122 -0
  28. package/src/components/KpiCard.stories.js +32 -0
  29. package/src/components/KpiCard.vue +88 -0
  30. package/src/components/MacroDropdown.vue +95 -35
  31. package/src/components/PermissionMatrix.vue +107 -0
  32. package/src/components/PinnedNotes.vue +70 -31
  33. package/src/components/PresenceIndicator.vue +93 -27
  34. package/src/components/PriorityBadge.stories.js +33 -0
  35. package/src/components/PriorityBadge.vue +9 -2
  36. package/src/components/QuickFilters.vue +65 -49
  37. package/src/components/ReplyComposer.vue +144 -30
  38. package/src/components/ReplyThread.vue +72 -20
  39. package/src/components/SatisfactionRating.vue +98 -46
  40. package/src/components/ScheduleEditor.vue +104 -0
  41. package/src/components/SideConversation.vue +165 -0
  42. package/src/components/SideConversationList.vue +147 -0
  43. package/src/components/SkillTagManager.vue +79 -0
  44. package/src/components/SlaComplianceChart.vue +53 -0
  45. package/src/components/SlaTimer.stories.js +35 -0
  46. package/src/components/SlaTimer.vue +17 -4
  47. package/src/components/StatsCard.stories.js +24 -0
  48. package/src/components/StatsCard.vue +58 -46
  49. package/src/components/StatusBadge.stories.js +53 -0
  50. package/src/components/StatusBadge.vue +36 -4
  51. package/src/components/TagSelect.vue +43 -12
  52. package/src/components/TicketFilters.vue +225 -69
  53. package/src/components/TicketLinkPanel.vue +193 -0
  54. package/src/components/TicketList.vue +594 -193
  55. package/src/components/TicketMergeDialog.vue +157 -0
  56. package/src/components/TicketSidebar.vue +167 -99
  57. package/src/components/TicketTypeSelector.vue +21 -0
  58. package/src/components/TotpInput.stories.js +9 -0
  59. package/src/components/TotpInput.vue +81 -0
  60. package/src/components/TwoFactorSetup.vue +113 -0
  61. package/src/composables/useDebouncedSearch.js +38 -0
  62. package/src/composables/usePluginExtensions.js +95 -3
  63. package/src/composables/usePluginHooks.js +65 -0
  64. package/src/defineEscalatedPlugin.js +34 -8
  65. package/src/index.js +72 -35
  66. package/src/locales/en.json +25 -0
  67. package/src/pages/Admin/ApiTokens/Index.vue +231 -67
  68. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  69. package/src/pages/Admin/Automations/Form.vue +184 -0
  70. package/src/pages/Admin/Automations/Index.vue +129 -0
  71. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  72. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  73. package/src/pages/Admin/CannedResponses/Index.vue +127 -70
  74. package/src/pages/Admin/Capacity/Index.vue +134 -0
  75. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  76. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  77. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  78. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  79. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  80. package/src/pages/Admin/Departments/Form.vue +75 -51
  81. package/src/pages/Admin/Departments/Index.vue +109 -57
  82. package/src/pages/Admin/EscalationRules/Form.vue +157 -96
  83. package/src/pages/Admin/EscalationRules/Index.vue +178 -57
  84. package/src/pages/Admin/Import/Connect.vue +96 -0
  85. package/src/pages/Admin/Import/Index.vue +102 -0
  86. package/src/pages/Admin/Import/Mapping.vue +110 -0
  87. package/src/pages/Admin/Import/Progress.vue +153 -0
  88. package/src/pages/Admin/Import/Review.vue +76 -0
  89. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  90. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  91. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  92. package/src/pages/Admin/Macros/Index.vue +250 -89
  93. package/src/pages/Admin/Plugins/Index.vue +205 -75
  94. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  95. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  96. package/src/pages/Admin/Reports/Dashboard.vue +211 -0
  97. package/src/pages/Admin/Reports/SlaReport.vue +166 -0
  98. package/src/pages/Admin/Reports.vue +139 -34
  99. package/src/pages/Admin/Roles/Form.vue +71 -0
  100. package/src/pages/Admin/Roles/Index.vue +122 -0
  101. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  102. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  103. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  104. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  105. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  106. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  107. package/src/pages/Admin/Settings.vue +468 -260
  108. package/src/pages/Admin/Skills/Form.vue +53 -0
  109. package/src/pages/Admin/Skills/Index.vue +94 -0
  110. package/src/pages/Admin/SlaPolicies/Form.vue +118 -75
  111. package/src/pages/Admin/SlaPolicies/Index.vue +120 -59
  112. package/src/pages/Admin/Statuses/Form.vue +114 -0
  113. package/src/pages/Admin/Statuses/Index.vue +153 -0
  114. package/src/pages/Admin/Tags/Index.vue +191 -105
  115. package/src/pages/Admin/Tickets/Index.vue +91 -39
  116. package/src/pages/Admin/Tickets/Show.vue +101 -37
  117. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  118. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  119. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  120. package/src/pages/Agent/Dashboard.vue +311 -186
  121. package/src/pages/Agent/TicketIndex.vue +88 -38
  122. package/src/pages/Agent/TicketShow.vue +258 -51
  123. package/src/pages/Customer/Create.vue +36 -9
  124. package/src/pages/Customer/Index.vue +31 -24
  125. package/src/pages/Customer/KnowledgeBase/Article.vue +127 -0
  126. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  127. package/src/plugin.js +86 -1
  128. package/src/utils/constants.js +30 -0
  129. package/src/utils/formatting.js +35 -0
  130. package/src/pages/Admin/Plugins.vue +0 -129
@@ -0,0 +1,71 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import PermissionMatrix from '../../../components/PermissionMatrix.vue';
4
+ import { useForm } from '@inertiajs/vue3';
5
+
6
+ const props = defineProps({
7
+ role: { type: Object, default: null },
8
+ permissions: { type: Object, default: () => ({}) },
9
+ });
10
+
11
+ const form = useForm({
12
+ name: props.role?.name || '',
13
+ description: props.role?.description || '',
14
+ permissions: props.role?.permissions?.map((p) => p.id) || [],
15
+ });
16
+
17
+ function submit() {
18
+ if (props.role) {
19
+ form.put(route('escalated.admin.roles.update', props.role.id));
20
+ } else {
21
+ form.post(route('escalated.admin.roles.store'));
22
+ }
23
+ }
24
+ </script>
25
+
26
+ <template>
27
+ <EscalatedLayout :title="role ? 'Edit Role' : 'New Role'">
28
+ <form
29
+ class="mx-auto max-w-3xl space-y-5 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6"
30
+ @submit.prevent="submit"
31
+ >
32
+ <div>
33
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Name</label>
34
+ <input
35
+ v-model="form.name"
36
+ type="text"
37
+ required
38
+ 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)]"
39
+ />
40
+ <div v-if="form.errors.name" class="mt-1 text-sm text-rose-400">{{ form.errors.name }}</div>
41
+ </div>
42
+
43
+ <div>
44
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Description</label>
45
+ <textarea
46
+ v-model="form.description"
47
+ rows="2"
48
+ 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)]"
49
+ ></textarea>
50
+ </div>
51
+
52
+ <div>
53
+ <label class="mb-2 block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Permissions</label>
54
+ <PermissionMatrix v-model="form.permissions" :permissions="permissions" />
55
+ <div v-if="form.errors.permissions" class="mt-1 text-sm text-rose-400">
56
+ {{ form.errors.permissions }}
57
+ </div>
58
+ </div>
59
+
60
+ <div class="flex justify-end">
61
+ <button
62
+ type="submit"
63
+ :disabled="form.processing"
64
+ class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-5 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)] disabled:opacity-50"
65
+ >
66
+ {{ role ? 'Update' : 'Create' }}
67
+ </button>
68
+ </div>
69
+ </form>
70
+ </EscalatedLayout>
71
+ </template>
@@ -0,0 +1,122 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { Link, router } from '@inertiajs/vue3';
4
+
5
+ defineProps({ roles: Array });
6
+
7
+ function destroy(role) {
8
+ if (role.is_system) return;
9
+ if (confirm('Delete this role?')) {
10
+ router.delete(route('escalated.admin.roles.destroy', role.id));
11
+ }
12
+ }
13
+ </script>
14
+
15
+ <template>
16
+ <EscalatedLayout title="Agent Roles">
17
+ <div class="mb-4 flex justify-end">
18
+ <Link
19
+ :href="route('escalated.admin.roles.create')"
20
+ 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)]"
21
+ >
22
+ Add Role
23
+ </Link>
24
+ </div>
25
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
26
+ <table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
27
+ <thead>
28
+ <tr class="bg-[var(--esc-panel-hover)]">
29
+ <th
30
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
31
+ >
32
+ Name
33
+ </th>
34
+ <th
35
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
36
+ >
37
+ Description
38
+ </th>
39
+ <th
40
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
41
+ >
42
+ Users
43
+ </th>
44
+ <th
45
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
46
+ >
47
+ Type
48
+ </th>
49
+ <th
50
+ class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
51
+ >
52
+ Actions
53
+ </th>
54
+ </tr>
55
+ </thead>
56
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
57
+ <tr v-if="!roles?.length">
58
+ <td colspan="5" class="px-4 py-12 text-center">
59
+ <svg
60
+ class="mx-auto mb-3 h-8 w-8 text-[var(--esc-panel-text-muted)]"
61
+ fill="none"
62
+ stroke="currentColor"
63
+ stroke-width="1.5"
64
+ viewBox="0 0 24 24"
65
+ >
66
+ <path
67
+ stroke-linecap="round"
68
+ stroke-linejoin="round"
69
+ d="M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"
70
+ />
71
+ </svg>
72
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No roles defined yet</p>
73
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
74
+ Create roles with specific permissions to control agent access
75
+ </p>
76
+ </td>
77
+ </tr>
78
+ <tr
79
+ v-for="role in roles"
80
+ :key="role.id"
81
+ class="transition-colors hover:bg-[var(--esc-panel-hover)]"
82
+ >
83
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
84
+ {{ role.name }}
85
+ </td>
86
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
87
+ {{ role.description || '-' }}
88
+ </td>
89
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">{{ role.users_count }}</td>
90
+ <td class="px-4 py-3 text-sm">
91
+ <span
92
+ v-if="role.is_system"
93
+ class="inline-flex items-center rounded-full bg-amber-500/10 px-2 py-0.5 text-xs font-medium text-amber-400 ring-1 ring-amber-500/20"
94
+ >System</span
95
+ >
96
+ <span
97
+ v-else
98
+ class="inline-flex items-center rounded-full bg-[var(--esc-panel-hover)] px-2 py-0.5 text-xs font-medium text-[var(--esc-panel-text-secondary)]"
99
+ >Custom</span
100
+ >
101
+ </td>
102
+ <td class="px-4 py-3 text-right text-sm">
103
+ <Link
104
+ :href="route('escalated.admin.roles.edit', role.id)"
105
+ class="text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
106
+ >
107
+ Edit
108
+ </Link>
109
+ <button
110
+ v-if="!role.is_system"
111
+ class="ml-3 text-rose-400 hover:text-rose-300"
112
+ @click="destroy(role)"
113
+ >
114
+ Delete
115
+ </button>
116
+ </td>
117
+ </tr>
118
+ </tbody>
119
+ </table>
120
+ </div>
121
+ </EscalatedLayout>
122
+ </template>
@@ -0,0 +1,165 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { useForm, Link } from '@inertiajs/vue3';
4
+
5
+ const props = defineProps({
6
+ settings: Object,
7
+ });
8
+
9
+ const form = useForm({
10
+ csat_question_text: props.settings?.csat_question_text || 'How would you rate your support experience?',
11
+ csat_scale: props.settings?.csat_scale || '1-5',
12
+ csat_delivery_trigger: props.settings?.csat_delivery_trigger || 'on_resolve',
13
+ csat_delay_hours: props.settings?.csat_delay_hours || 0,
14
+ });
15
+
16
+ function submit() {
17
+ form.post(route('escalated.admin.settings.csat.update'));
18
+ }
19
+ </script>
20
+
21
+ <template>
22
+ <EscalatedLayout title="CSAT Survey Settings">
23
+ <div class="mx-auto max-w-2xl">
24
+ <div class="mb-6">
25
+ <Link
26
+ :href="route('escalated.admin.settings')"
27
+ class="text-sm text-[var(--esc-panel-text-muted)] hover:text-[var(--esc-panel-text-secondary)]"
28
+ >
29
+ &larr; Back to Settings
30
+ </Link>
31
+ </div>
32
+
33
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6">
34
+ <h2 class="mb-6 text-lg font-semibold text-[var(--esc-panel-text-secondary)]">
35
+ Customer Satisfaction Survey
36
+ </h2>
37
+
38
+ <form class="space-y-6" @submit.prevent="submit">
39
+ <!-- Question Text -->
40
+ <div>
41
+ <label class="mb-1.5 block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
42
+ >Survey Question</label
43
+ >
44
+ <textarea
45
+ v-model="form.csat_question_text"
46
+ rows="3"
47
+ class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2.5 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-accent)]/40 focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-accent)]/40"
48
+ placeholder="How would you rate your support experience?"
49
+ ></textarea>
50
+ <p v-if="form.errors.csat_question_text" class="mt-1 text-xs text-red-400">
51
+ {{ form.errors.csat_question_text }}
52
+ </p>
53
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
54
+ This question will be shown to customers after their ticket is resolved.
55
+ </p>
56
+ </div>
57
+
58
+ <!-- Rating Scale -->
59
+ <div>
60
+ <label class="mb-1.5 block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
61
+ >Rating Scale</label
62
+ >
63
+ <div class="flex gap-3">
64
+ <label
65
+ :class="[
66
+ 'flex cursor-pointer items-center gap-2 rounded-lg border px-4 py-3 transition-all',
67
+ form.csat_scale === '1-3'
68
+ ? 'border-[var(--esc-panel-accent)]/40 bg-[var(--esc-panel-accent)]/10 text-[var(--esc-panel-accent)]'
69
+ : 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] text-[var(--esc-panel-text-tertiary)] hover:border-[var(--esc-panel-border-input)]',
70
+ ]"
71
+ >
72
+ <input v-model="form.csat_scale" type="radio" value="1-3" class="sr-only" />
73
+ <span class="text-sm font-medium">1-3 Scale</span>
74
+ <span class="text-xs text-[var(--esc-panel-text-muted)]">(Simple)</span>
75
+ </label>
76
+ <label
77
+ :class="[
78
+ 'flex cursor-pointer items-center gap-2 rounded-lg border px-4 py-3 transition-all',
79
+ form.csat_scale === '1-5'
80
+ ? 'border-[var(--esc-panel-accent)]/40 bg-[var(--esc-panel-accent)]/10 text-[var(--esc-panel-accent)]'
81
+ : 'border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] text-[var(--esc-panel-text-tertiary)] hover:border-[var(--esc-panel-border-input)]',
82
+ ]"
83
+ >
84
+ <input v-model="form.csat_scale" type="radio" value="1-5" class="sr-only" />
85
+ <span class="text-sm font-medium">1-5 Scale</span>
86
+ <span class="text-xs text-[var(--esc-panel-text-muted)]">(Detailed)</span>
87
+ </label>
88
+ </div>
89
+ <p v-if="form.errors.csat_scale" class="mt-1 text-xs text-red-400">
90
+ {{ form.errors.csat_scale }}
91
+ </p>
92
+ </div>
93
+
94
+ <!-- Delivery Trigger -->
95
+ <div>
96
+ <label class="mb-1.5 block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
97
+ >Delivery Trigger</label
98
+ >
99
+ <select
100
+ v-model="form.csat_delivery_trigger"
101
+ class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-accent)]/40 focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-accent)]/40"
102
+ >
103
+ <option value="on_resolve">On ticket resolution</option>
104
+ <option value="delayed">Delayed after resolution</option>
105
+ <option value="manual">Manual only</option>
106
+ </select>
107
+ <p v-if="form.errors.csat_delivery_trigger" class="mt-1 text-xs text-red-400">
108
+ {{ form.errors.csat_delivery_trigger }}
109
+ </p>
110
+ </div>
111
+
112
+ <!-- Delay Hours (shown only for delayed trigger) -->
113
+ <div v-if="form.csat_delivery_trigger === 'delayed'">
114
+ <label class="mb-1.5 block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
115
+ >Delay (hours)</label
116
+ >
117
+ <input
118
+ v-model.number="form.csat_delay_hours"
119
+ type="number"
120
+ min="0"
121
+ max="168"
122
+ class="w-full rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] px-3 py-2.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-accent)]/40 focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-accent)]/40"
123
+ />
124
+ <p v-if="form.errors.csat_delay_hours" class="mt-1 text-xs text-red-400">
125
+ {{ form.errors.csat_delay_hours }}
126
+ </p>
127
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
128
+ How many hours after resolution to send the survey (max 168 = 7 days).
129
+ </p>
130
+ </div>
131
+
132
+ <!-- Submit -->
133
+ <div class="pt-2">
134
+ <button
135
+ type="submit"
136
+ :disabled="form.processing"
137
+ class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-5 py-2.5 text-sm font-medium text-white shadow-lg shadow-[var(--esc-panel-bg)]/20 transition-opacity hover:opacity-90 disabled:opacity-50"
138
+ >
139
+ Save Settings
140
+ </button>
141
+ </div>
142
+ </form>
143
+ </div>
144
+
145
+ <!-- Preview -->
146
+ <div class="mt-6 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6">
147
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text-secondary)]">Preview</h3>
148
+ <div
149
+ class="rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-hover)] p-6 text-center"
150
+ >
151
+ <p class="mb-4 text-sm text-[var(--esc-panel-text-secondary)]">{{ form.csat_question_text }}</p>
152
+ <div class="flex items-center justify-center gap-2">
153
+ <button
154
+ v-for="n in form.csat_scale === '1-3' ? 3 : 5"
155
+ :key="n"
156
+ class="flex h-10 w-10 items-center justify-center rounded-lg border border-[var(--esc-panel-border)] text-sm font-medium text-[var(--esc-panel-text-tertiary)] transition-colors hover:border-amber-500/40 hover:bg-amber-500/10 hover:text-amber-400"
157
+ >
158
+ {{ n }}
159
+ </button>
160
+ </div>
161
+ </div>
162
+ </div>
163
+ </div>
164
+ </EscalatedLayout>
165
+ </template>
@@ -0,0 +1,182 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { useForm } from '@inertiajs/vue3';
4
+
5
+ const props = defineProps({
6
+ settings: Object,
7
+ purgePreview: { type: Object, default: () => ({}) },
8
+ });
9
+
10
+ const form = useForm({
11
+ retention_closed_tickets: props.settings.retention_closed_tickets ?? 'never',
12
+ retention_attachments: props.settings.retention_attachments ?? 'never',
13
+ retention_audit_logs: props.settings.retention_audit_logs ?? 'never',
14
+ retention_user_data_gdpr: props.settings.retention_user_data_gdpr ?? false,
15
+ });
16
+
17
+ function submit() {
18
+ form.post(route('escalated.admin.settings.data-retention.update'));
19
+ }
20
+
21
+ const ticketOptions = [
22
+ { value: 'never', label: 'Never delete' },
23
+ { value: '1_year', label: '1 year' },
24
+ { value: '2_years', label: '2 years' },
25
+ { value: '3_years', label: '3 years' },
26
+ { value: '5_years', label: '5 years' },
27
+ ];
28
+
29
+ const attachmentOptions = [
30
+ { value: 'never', label: 'Never delete' },
31
+ { value: '1_year', label: '1 year' },
32
+ { value: '2_years', label: '2 years' },
33
+ { value: '3_years', label: '3 years' },
34
+ { value: '5_years', label: '5 years' },
35
+ ];
36
+
37
+ const auditLogOptions = [
38
+ { value: 'never', label: 'Never delete' },
39
+ { value: '90_days', label: '90 days' },
40
+ { value: '180_days', label: '180 days' },
41
+ { value: '365_days', label: '365 days' },
42
+ ];
43
+ </script>
44
+
45
+ <template>
46
+ <EscalatedLayout title="Data Retention">
47
+ <form class="mx-auto max-w-2xl space-y-6" @submit.prevent="submit">
48
+ <!-- Closed Tickets -->
49
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6">
50
+ <h3 class="mb-5 text-sm font-semibold text-[var(--esc-panel-text)]">Retention Policies</h3>
51
+ <p class="mb-5 text-xs text-[var(--esc-panel-text-muted)]">
52
+ Configure how long data is retained before automatic purging. Records are soft-deleted first with a
53
+ 30-day grace period before permanent removal.
54
+ </p>
55
+ <div class="space-y-5">
56
+ <div>
57
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
58
+ >Closed Tickets</label
59
+ >
60
+ <p class="mt-0.5 text-xs text-[var(--esc-panel-text-muted)]">
61
+ How long to keep closed tickets before purging
62
+ </p>
63
+ <select
64
+ v-model="form.retention_closed_tickets"
65
+ class="mt-2 w-48 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)]"
66
+ >
67
+ <option v-for="opt in ticketOptions" :key="opt.value" :value="opt.value">
68
+ {{ opt.label }}
69
+ </option>
70
+ </select>
71
+ </div>
72
+
73
+ <div>
74
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
75
+ >Attachments</label
76
+ >
77
+ <p class="mt-0.5 text-xs text-[var(--esc-panel-text-muted)]">
78
+ How long to keep attachments on closed tickets
79
+ </p>
80
+ <select
81
+ v-model="form.retention_attachments"
82
+ class="mt-2 w-48 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)]"
83
+ >
84
+ <option v-for="opt in attachmentOptions" :key="opt.value" :value="opt.value">
85
+ {{ opt.label }}
86
+ </option>
87
+ </select>
88
+ </div>
89
+
90
+ <div>
91
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
92
+ >Audit Logs</label
93
+ >
94
+ <p class="mt-0.5 text-xs text-[var(--esc-panel-text-muted)]">
95
+ How long to keep audit log entries
96
+ </p>
97
+ <select
98
+ v-model="form.retention_audit_logs"
99
+ class="mt-2 w-48 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)]"
100
+ >
101
+ <option v-for="opt in auditLogOptions" :key="opt.value" :value="opt.value">
102
+ {{ opt.label }}
103
+ </option>
104
+ </select>
105
+ </div>
106
+
107
+ <label class="flex items-center justify-between">
108
+ <div>
109
+ <span class="text-sm font-medium text-[var(--esc-panel-text-secondary)]"
110
+ >GDPR User Data Handling</span
111
+ >
112
+ <p class="mt-0.5 text-xs text-[var(--esc-panel-text-muted)]">
113
+ Anonymize user data upon account deletion to comply with GDPR
114
+ </p>
115
+ </div>
116
+ <button
117
+ type="button"
118
+ :class="[
119
+ 'relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors',
120
+ form.retention_user_data_gdpr ? 'bg-emerald-500' : 'bg-neutral-700',
121
+ ]"
122
+ @click="form.retention_user_data_gdpr = !form.retention_user_data_gdpr"
123
+ >
124
+ <span
125
+ :class="[
126
+ 'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition-transform',
127
+ form.retention_user_data_gdpr ? 'translate-x-5' : 'translate-x-0',
128
+ ]"
129
+ />
130
+ </button>
131
+ </label>
132
+ </div>
133
+ </div>
134
+
135
+ <!-- Purge Preview -->
136
+ <div class="rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6">
137
+ <h3 class="mb-4 text-sm font-semibold text-[var(--esc-panel-text)]">Purge Preview</h3>
138
+ <p class="mb-4 text-xs text-[var(--esc-panel-text-muted)]">
139
+ Estimated records that would be purged based on current settings.
140
+ </p>
141
+ <div class="grid grid-cols-3 gap-4">
142
+ <div
143
+ class="rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface-alt)] p-4 text-center"
144
+ >
145
+ <div class="text-2xl font-bold text-[var(--esc-panel-text-secondary)]">
146
+ {{ purgePreview.tickets ?? 0 }}
147
+ </div>
148
+ <div class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">Closed Tickets</div>
149
+ </div>
150
+ <div
151
+ class="rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface-alt)] p-4 text-center"
152
+ >
153
+ <div class="text-2xl font-bold text-[var(--esc-panel-text-secondary)]">
154
+ {{ purgePreview.attachments ?? 0 }}
155
+ </div>
156
+ <div class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">Attachments</div>
157
+ </div>
158
+ <div
159
+ class="rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface-alt)] p-4 text-center"
160
+ >
161
+ <div class="text-2xl font-bold text-[var(--esc-panel-text-secondary)]">
162
+ {{ purgePreview.audit_logs ?? 0 }}
163
+ </div>
164
+ <div class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">Audit Logs</div>
165
+ </div>
166
+ </div>
167
+ </div>
168
+
169
+ <!-- Submit -->
170
+ <div class="flex items-center justify-end gap-3">
171
+ <span v-if="form.recentlySuccessful" class="text-sm text-emerald-400">Saved.</span>
172
+ <button
173
+ type="submit"
174
+ :disabled="form.processing"
175
+ class="rounded-lg bg-gradient-to-r from-[var(--esc-panel-accent)] to-[var(--esc-panel-accent-secondary)] px-5 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)] disabled:opacity-50"
176
+ >
177
+ {{ form.processing ? 'Saving...' : 'Save Retention Settings' }}
178
+ </button>
179
+ </div>
180
+ </form>
181
+ </EscalatedLayout>
182
+ </template>