@escalated-dev/escalated 0.5.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 (136) hide show
  1. package/README.md +102 -0
  2. package/package.json +37 -6
  3. package/src/components/ActivityTimeline.stories.js +55 -0
  4. package/src/components/ActivityTimeline.vue +83 -66
  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 +37 -23
  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 +57 -41
  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 +75 -33
  33. package/src/components/PresenceIndicator.vue +93 -27
  34. package/src/components/PriorityBadge.stories.js +33 -0
  35. package/src/components/PriorityBadge.vue +46 -39
  36. package/src/components/QuickFilters.vue +65 -49
  37. package/src/components/ReplyComposer.vue +273 -159
  38. package/src/components/ReplyThread.vue +78 -23
  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 +62 -49
  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 +78 -46
  51. package/src/components/TagSelect.vue +84 -53
  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/useI18n.js +80 -0
  63. package/src/composables/usePluginExtensions.js +95 -3
  64. package/src/composables/usePluginHooks.js +65 -0
  65. package/src/defineEscalatedPlugin.js +34 -8
  66. package/src/index.js +72 -35
  67. package/src/locales/de.json +442 -0
  68. package/src/locales/en.json +467 -0
  69. package/src/locales/es.json +442 -0
  70. package/src/locales/fr.json +442 -0
  71. package/src/locales/index.js +6 -0
  72. package/src/pages/Admin/ApiTokens/Index.vue +231 -67
  73. package/src/pages/Admin/AuditLog/Index.vue +154 -0
  74. package/src/pages/Admin/Automations/Form.vue +184 -0
  75. package/src/pages/Admin/Automations/Index.vue +129 -0
  76. package/src/pages/Admin/BusinessHours/Form.vue +172 -0
  77. package/src/pages/Admin/BusinessHours/Index.vue +113 -0
  78. package/src/pages/Admin/CannedResponses/Index.vue +127 -70
  79. package/src/pages/Admin/Capacity/Index.vue +134 -0
  80. package/src/pages/Admin/CustomFields/Form.vue +195 -0
  81. package/src/pages/Admin/CustomFields/Index.vue +134 -0
  82. package/src/pages/Admin/CustomObjects/Form.vue +202 -0
  83. package/src/pages/Admin/CustomObjects/Index.vue +127 -0
  84. package/src/pages/Admin/CustomObjects/Records.vue +228 -0
  85. package/src/pages/Admin/Departments/Form.vue +75 -51
  86. package/src/pages/Admin/Departments/Index.vue +109 -57
  87. package/src/pages/Admin/EscalationRules/Form.vue +157 -96
  88. package/src/pages/Admin/EscalationRules/Index.vue +178 -57
  89. package/src/pages/Admin/Import/Connect.vue +96 -0
  90. package/src/pages/Admin/Import/Index.vue +102 -0
  91. package/src/pages/Admin/Import/Mapping.vue +110 -0
  92. package/src/pages/Admin/Import/Progress.vue +153 -0
  93. package/src/pages/Admin/Import/Review.vue +76 -0
  94. package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -0
  95. package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -0
  96. package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -0
  97. package/src/pages/Admin/Macros/Index.vue +250 -89
  98. package/src/pages/Admin/Plugins/Index.vue +205 -75
  99. package/src/pages/Admin/Reports/AgentMetrics.vue +115 -0
  100. package/src/pages/Admin/Reports/CsatReport.vue +127 -0
  101. package/src/pages/Admin/Reports/Dashboard.vue +211 -0
  102. package/src/pages/Admin/Reports/SlaReport.vue +166 -0
  103. package/src/pages/Admin/Reports.vue +139 -34
  104. package/src/pages/Admin/Roles/Form.vue +71 -0
  105. package/src/pages/Admin/Roles/Index.vue +122 -0
  106. package/src/pages/Admin/Settings/CsatSettings.vue +165 -0
  107. package/src/pages/Admin/Settings/DataRetention.vue +182 -0
  108. package/src/pages/Admin/Settings/EmailSettings.vue +243 -0
  109. package/src/pages/Admin/Settings/Sandbox.vue +135 -0
  110. package/src/pages/Admin/Settings/SsoSettings.vue +218 -0
  111. package/src/pages/Admin/Settings/TwoFactor.vue +110 -0
  112. package/src/pages/Admin/Settings.vue +468 -260
  113. package/src/pages/Admin/Skills/Form.vue +53 -0
  114. package/src/pages/Admin/Skills/Index.vue +94 -0
  115. package/src/pages/Admin/SlaPolicies/Form.vue +118 -75
  116. package/src/pages/Admin/SlaPolicies/Index.vue +120 -59
  117. package/src/pages/Admin/Statuses/Form.vue +114 -0
  118. package/src/pages/Admin/Statuses/Index.vue +153 -0
  119. package/src/pages/Admin/Tags/Index.vue +191 -105
  120. package/src/pages/Admin/Tickets/Index.vue +91 -39
  121. package/src/pages/Admin/Tickets/Show.vue +101 -37
  122. package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -0
  123. package/src/pages/Admin/Webhooks/Form.vue +110 -0
  124. package/src/pages/Admin/Webhooks/Index.vue +136 -0
  125. package/src/pages/Agent/Dashboard.vue +311 -186
  126. package/src/pages/Agent/TicketIndex.vue +88 -38
  127. package/src/pages/Agent/TicketShow.vue +258 -51
  128. package/src/pages/Customer/Create.vue +36 -9
  129. package/src/pages/Customer/Index.vue +31 -24
  130. package/src/pages/Customer/KnowledgeBase/Article.vue +127 -0
  131. package/src/pages/Customer/KnowledgeBase/Index.vue +151 -0
  132. package/src/plugin.js +86 -1
  133. package/src/utils/constants.js +30 -0
  134. package/src/utils/formatting.js +35 -0
  135. package/src/utils/sanitizeHtml.js +64 -0
  136. package/src/pages/Admin/Plugins.vue +0 -129
@@ -0,0 +1,184 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { useForm } from '@inertiajs/vue3';
4
+
5
+ const props = defineProps({
6
+ automation: { type: Object, default: null },
7
+ });
8
+
9
+ const conditionFields = [
10
+ { value: 'hours_since_created', label: 'Hours since created' },
11
+ { value: 'hours_since_updated', label: 'Hours since updated' },
12
+ { value: 'hours_since_assigned', label: 'Hours since assigned' },
13
+ { value: 'status', label: 'Status' },
14
+ { value: 'priority', label: 'Priority' },
15
+ { value: 'assigned', label: 'Assignment' },
16
+ ];
17
+
18
+ const actionTypes = [
19
+ { value: 'change_status', label: 'Change status' },
20
+ { value: 'assign', label: 'Assign to agent (ID)' },
21
+ { value: 'add_tag', label: 'Add tag (name)' },
22
+ { value: 'change_priority', label: 'Change priority' },
23
+ { value: 'add_note', label: 'Add internal note' },
24
+ ];
25
+
26
+ const form = useForm({
27
+ name: props.automation?.name || '',
28
+ conditions: props.automation?.conditions || [{ field: 'hours_since_updated', operator: '>', value: '' }],
29
+ actions: props.automation?.actions || [{ type: 'change_status', value: '' }],
30
+ active: props.automation?.active ?? true,
31
+ });
32
+
33
+ function addCondition() {
34
+ form.conditions.push({ field: 'hours_since_updated', operator: '>', value: '' });
35
+ }
36
+
37
+ function removeCondition(index) {
38
+ form.conditions.splice(index, 1);
39
+ }
40
+
41
+ function addAction() {
42
+ form.actions.push({ type: 'change_status', value: '' });
43
+ }
44
+
45
+ function removeAction(index) {
46
+ form.actions.splice(index, 1);
47
+ }
48
+
49
+ function submit() {
50
+ if (props.automation) {
51
+ form.put(route('escalated.admin.automations.update', props.automation.id));
52
+ } else {
53
+ form.post(route('escalated.admin.automations.store'));
54
+ }
55
+ }
56
+ </script>
57
+
58
+ <template>
59
+ <EscalatedLayout :title="automation ? 'Edit Automation' : 'Create Automation'">
60
+ <form class="max-w-2xl space-y-6" @submit.prevent="submit">
61
+ <div>
62
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Name</label>
63
+ <input
64
+ v-model="form.name"
65
+ type="text"
66
+ required
67
+ 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)]"
68
+ />
69
+ <p v-if="form.errors.name" class="mt-1 text-xs text-rose-400">{{ form.errors.name }}</p>
70
+ </div>
71
+
72
+ <!-- Conditions -->
73
+ <div>
74
+ <label class="mb-2 block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
75
+ >Conditions (ALL must match)</label
76
+ >
77
+ <div class="space-y-2">
78
+ <div v-for="(condition, i) in form.conditions" :key="i" class="flex items-center gap-2">
79
+ <select
80
+ v-model="condition.field"
81
+ class="rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none"
82
+ >
83
+ <option v-for="f in conditionFields" :key="f.value" :value="f.value">{{ f.label }}</option>
84
+ </select>
85
+ <select
86
+ v-model="condition.operator"
87
+ class="w-16 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none"
88
+ >
89
+ <option value=">">&gt;</option>
90
+ <option value=">=">&gt;=</option>
91
+ <option value="<">&lt;</option>
92
+ <option value="<=">&lt;=</option>
93
+ <option value="=">=</option>
94
+ </select>
95
+ <input
96
+ v-model="condition.value"
97
+ type="text"
98
+ placeholder="Value"
99
+ class="flex-1 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 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
+ <button
102
+ v-if="form.conditions.length > 1"
103
+ type="button"
104
+ class="text-rose-400 hover:text-rose-300"
105
+ @click="removeCondition(i)"
106
+ >
107
+ &times;
108
+ </button>
109
+ </div>
110
+ </div>
111
+ <button
112
+ type="button"
113
+ class="mt-2 text-xs text-[var(--esc-panel-text-tertiary)] hover:text-[var(--esc-panel-text-secondary)]"
114
+ @click="addCondition"
115
+ >
116
+ + Add condition
117
+ </button>
118
+ </div>
119
+
120
+ <!-- Actions -->
121
+ <div>
122
+ <label class="mb-2 block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Actions</label>
123
+ <div class="space-y-2">
124
+ <div v-for="(action, i) in form.actions" :key="i" class="flex items-center gap-2">
125
+ <select
126
+ v-model="action.type"
127
+ class="rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] focus:border-[var(--esc-panel-border-input)] focus:outline-none"
128
+ >
129
+ <option v-for="a in actionTypes" :key="a.value" :value="a.value">{{ a.label }}</option>
130
+ </select>
131
+ <input
132
+ v-model="action.value"
133
+ type="text"
134
+ placeholder="Value"
135
+ class="flex-1 rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-2 py-1.5 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)]"
136
+ />
137
+ <button
138
+ v-if="form.actions.length > 1"
139
+ type="button"
140
+ class="text-rose-400 hover:text-rose-300"
141
+ @click="removeAction(i)"
142
+ >
143
+ &times;
144
+ </button>
145
+ </div>
146
+ </div>
147
+ <button
148
+ type="button"
149
+ class="mt-2 text-xs text-[var(--esc-panel-text-tertiary)] hover:text-[var(--esc-panel-text-secondary)]"
150
+ @click="addAction"
151
+ >
152
+ + Add action
153
+ </button>
154
+ </div>
155
+
156
+ <div>
157
+ <label class="flex items-center gap-2 text-sm text-[var(--esc-panel-text-secondary)]">
158
+ <input
159
+ v-model="form.active"
160
+ type="checkbox"
161
+ class="rounded border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] text-cyan-500 focus:ring-cyan-500/20"
162
+ />
163
+ Active
164
+ </label>
165
+ </div>
166
+
167
+ <div class="flex gap-3">
168
+ <button
169
+ type="submit"
170
+ :disabled="form.processing"
171
+ 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)] disabled:opacity-50"
172
+ >
173
+ {{ automation ? 'Update' : 'Create' }}
174
+ </button>
175
+ <a
176
+ :href="route('escalated.admin.automations.index')"
177
+ class="rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] px-4 py-2 text-sm font-medium text-[var(--esc-panel-text-secondary)] transition-colors hover:bg-[var(--esc-panel-hover)]"
178
+ >
179
+ Cancel
180
+ </a>
181
+ </div>
182
+ </form>
183
+ </EscalatedLayout>
184
+ </template>
@@ -0,0 +1,129 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { Link, router } from '@inertiajs/vue3';
4
+
5
+ defineProps({ automations: Array });
6
+
7
+ function destroy(id) {
8
+ if (confirm('Delete this automation?')) {
9
+ router.delete(route('escalated.admin.automations.destroy', id));
10
+ }
11
+ }
12
+
13
+ function conditionsSummary(automation) {
14
+ return (automation.conditions || []).map((c) => `${c.field} ${c.operator} ${c.value}`).join(', ');
15
+ }
16
+
17
+ function actionsSummary(automation) {
18
+ return (automation.actions || []).map((a) => `${a.type}: ${a.value}`).join(', ');
19
+ }
20
+ </script>
21
+
22
+ <template>
23
+ <EscalatedLayout title="Automations">
24
+ <div class="mb-4 flex justify-end">
25
+ <Link
26
+ :href="route('escalated.admin.automations.create')"
27
+ 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)]"
28
+ >
29
+ Add Automation
30
+ </Link>
31
+ </div>
32
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
33
+ <table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
34
+ <thead>
35
+ <tr class="bg-[var(--esc-panel-hover)]">
36
+ <th
37
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
38
+ >
39
+ Name
40
+ </th>
41
+ <th
42
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
43
+ >
44
+ Conditions
45
+ </th>
46
+ <th
47
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
48
+ >
49
+ Actions
50
+ </th>
51
+ <th
52
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
53
+ >
54
+ Active
55
+ </th>
56
+ <th
57
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
58
+ >
59
+ Last Run
60
+ </th>
61
+ <th
62
+ class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
63
+ >
64
+ Actions
65
+ </th>
66
+ </tr>
67
+ </thead>
68
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
69
+ <tr v-if="!automations?.length">
70
+ <td colspan="6" class="px-4 py-12 text-center">
71
+ <svg
72
+ class="mx-auto mb-3 h-8 w-8 text-[var(--esc-panel-text-muted)]"
73
+ fill="none"
74
+ stroke="currentColor"
75
+ stroke-width="1.5"
76
+ viewBox="0 0 24 24"
77
+ >
78
+ <path
79
+ stroke-linecap="round"
80
+ stroke-linejoin="round"
81
+ d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"
82
+ />
83
+ </svg>
84
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No automations yet</p>
85
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
86
+ Create time-based automations to act on idle tickets
87
+ </p>
88
+ </td>
89
+ </tr>
90
+ <tr
91
+ v-for="automation in automations"
92
+ :key="automation.id"
93
+ class="transition-colors hover:bg-[var(--esc-panel-hover)]"
94
+ >
95
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
96
+ {{ automation.name }}
97
+ </td>
98
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)] max-w-xs truncate">
99
+ {{ conditionsSummary(automation) }}
100
+ </td>
101
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)] max-w-xs truncate">
102
+ {{ actionsSummary(automation) }}
103
+ </td>
104
+ <td class="px-4 py-3 text-sm">
105
+ <span
106
+ :class="automation.active ? 'text-emerald-400' : 'text-[var(--esc-panel-text-muted)]'"
107
+ >{{ automation.active ? 'Yes' : 'No' }}</span
108
+ >
109
+ </td>
110
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
111
+ {{ automation.last_run_at || '---' }}
112
+ </td>
113
+ <td class="px-4 py-3 text-right text-sm">
114
+ <Link
115
+ :href="route('escalated.admin.automations.edit', automation.id)"
116
+ class="text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
117
+ >
118
+ Edit
119
+ </Link>
120
+ <button class="ml-3 text-rose-400 hover:text-rose-300" @click="destroy(automation.id)">
121
+ Delete
122
+ </button>
123
+ </td>
124
+ </tr>
125
+ </tbody>
126
+ </table>
127
+ </div>
128
+ </EscalatedLayout>
129
+ </template>
@@ -0,0 +1,172 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import ScheduleEditor from '../../../components/ScheduleEditor.vue';
4
+ import { useForm } from '@inertiajs/vue3';
5
+ import { ref } from 'vue';
6
+
7
+ const props = defineProps({
8
+ schedule: { type: Object, default: null },
9
+ timezones: { type: Array, default: () => [] },
10
+ });
11
+
12
+ const defaultSchedule = {
13
+ monday: { start: '09:00', end: '17:00' },
14
+ tuesday: { start: '09:00', end: '17:00' },
15
+ wednesday: { start: '09:00', end: '17:00' },
16
+ thursday: { start: '09:00', end: '17:00' },
17
+ friday: { start: '09:00', end: '17:00' },
18
+ saturday: { start: '', end: '' },
19
+ sunday: { start: '', end: '' },
20
+ };
21
+
22
+ const form = useForm({
23
+ name: props.schedule?.name || '',
24
+ timezone: props.schedule?.timezone || 'UTC',
25
+ is_default: props.schedule?.is_default ?? false,
26
+ schedule: props.schedule?.schedule || { ...defaultSchedule },
27
+ holidays:
28
+ props.schedule?.holidays?.map((h) => ({
29
+ name: h.name,
30
+ date: h.date?.split('T')[0] || h.date,
31
+ recurring: h.recurring,
32
+ })) || [],
33
+ });
34
+
35
+ const newHoliday = ref({ name: '', date: '', recurring: false });
36
+
37
+ function addHoliday() {
38
+ if (newHoliday.value.name && newHoliday.value.date) {
39
+ form.holidays.push({ ...newHoliday.value });
40
+ newHoliday.value = { name: '', date: '', recurring: false };
41
+ }
42
+ }
43
+
44
+ function removeHoliday(index) {
45
+ form.holidays.splice(index, 1);
46
+ }
47
+
48
+ function submit() {
49
+ if (props.schedule) {
50
+ form.put(route('escalated.admin.business-hours.update', props.schedule.id));
51
+ } else {
52
+ form.post(route('escalated.admin.business-hours.store'));
53
+ }
54
+ }
55
+ </script>
56
+
57
+ <template>
58
+ <EscalatedLayout :title="schedule ? 'Edit Schedule' : 'New Schedule'">
59
+ <form
60
+ class="mx-auto max-w-2xl space-y-5 rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)] p-6"
61
+ @submit.prevent="submit"
62
+ >
63
+ <div>
64
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Name</label>
65
+ <input
66
+ v-model="form.name"
67
+ type="text"
68
+ required
69
+ 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)]"
70
+ />
71
+ <div v-if="form.errors.name" class="mt-1 text-sm text-rose-400">{{ form.errors.name }}</div>
72
+ </div>
73
+
74
+ <div>
75
+ <label class="block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Timezone</label>
76
+ <select
77
+ v-model="form.timezone"
78
+ required
79
+ 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)]"
80
+ >
81
+ <option v-for="tz in timezones" :key="tz" :value="tz">{{ tz }}</option>
82
+ </select>
83
+ <div v-if="form.errors.timezone" class="mt-1 text-sm text-rose-400">{{ form.errors.timezone }}</div>
84
+ </div>
85
+
86
+ <label class="flex items-center gap-2">
87
+ <input
88
+ v-model="form.is_default"
89
+ type="checkbox"
90
+ class="rounded border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] text-cyan-500 focus:ring-[var(--esc-panel-border-input)]"
91
+ />
92
+ <span class="text-sm text-[var(--esc-panel-text-secondary)]">Default schedule</span>
93
+ </label>
94
+
95
+ <div>
96
+ <label class="mb-2 block text-sm font-medium text-[var(--esc-panel-text-secondary)]"
97
+ >Weekly Hours</label
98
+ >
99
+ <ScheduleEditor v-model="form.schedule" />
100
+ <div v-if="form.errors.schedule" class="mt-1 text-sm text-rose-400">{{ form.errors.schedule }}</div>
101
+ </div>
102
+
103
+ <div>
104
+ <label class="mb-2 block text-sm font-medium text-[var(--esc-panel-text-secondary)]">Holidays</label>
105
+ <div class="space-y-2">
106
+ <div
107
+ v-for="(holiday, idx) in form.holidays"
108
+ :key="idx"
109
+ class="flex items-center gap-2 rounded-lg border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface-alt)] px-3 py-2"
110
+ >
111
+ <span class="flex-1 text-sm text-[var(--esc-panel-text-secondary)]">{{ holiday.name }}</span>
112
+ <span class="text-sm text-[var(--esc-panel-text-tertiary)]">{{ holiday.date }}</span>
113
+ <span
114
+ v-if="holiday.recurring"
115
+ class="inline-flex items-center rounded-full bg-violet-500/10 px-2 py-0.5 text-xs font-medium text-violet-400 ring-1 ring-violet-500/20"
116
+ >Recurring</span
117
+ >
118
+ <button
119
+ type="button"
120
+ class="text-sm text-rose-400 hover:text-rose-300"
121
+ @click="removeHoliday(idx)"
122
+ >
123
+ Remove
124
+ </button>
125
+ </div>
126
+ <div class="flex items-end gap-2">
127
+ <div class="flex-1">
128
+ <input
129
+ v-model="newHoliday.name"
130
+ type="text"
131
+ placeholder="Holiday name"
132
+ class="w-full rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-3 py-1.5 text-sm text-[var(--esc-panel-text-secondary)] placeholder-[var(--esc-panel-text-muted)] focus:border-[var(--esc-panel-border-input)] focus:outline-none focus:ring-1 focus:ring-[var(--esc-panel-border-input)]"
133
+ />
134
+ </div>
135
+ <div>
136
+ <input
137
+ v-model="newHoliday.date"
138
+ type="date"
139
+ class="rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface-alt)] px-3 py-1.5 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)]"
140
+ />
141
+ </div>
142
+ <label class="flex items-center gap-1">
143
+ <input
144
+ v-model="newHoliday.recurring"
145
+ type="checkbox"
146
+ class="rounded border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-surface)] text-cyan-500 focus:ring-[var(--esc-panel-border-input)]"
147
+ />
148
+ <span class="text-xs text-[var(--esc-panel-text-tertiary)]">Recurring</span>
149
+ </label>
150
+ <button
151
+ type="button"
152
+ class="rounded-lg border border-[var(--esc-panel-border-input)] bg-[var(--esc-panel-hover)] px-3 py-1.5 text-sm font-medium text-[var(--esc-panel-text-secondary)] transition-colors hover:bg-[var(--esc-panel-hover)]"
153
+ @click="addHoliday"
154
+ >
155
+ Add
156
+ </button>
157
+ </div>
158
+ </div>
159
+ </div>
160
+
161
+ <div class="flex justify-end">
162
+ <button
163
+ type="submit"
164
+ :disabled="form.processing"
165
+ 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"
166
+ >
167
+ {{ schedule ? 'Update' : 'Create' }}
168
+ </button>
169
+ </div>
170
+ </form>
171
+ </EscalatedLayout>
172
+ </template>
@@ -0,0 +1,113 @@
1
+ <script setup>
2
+ import EscalatedLayout from '../../../components/EscalatedLayout.vue';
3
+ import { Link, router } from '@inertiajs/vue3';
4
+
5
+ defineProps({ schedules: Array });
6
+
7
+ function destroy(id) {
8
+ if (confirm('Delete this schedule?')) {
9
+ router.delete(route('escalated.admin.business-hours.destroy', id));
10
+ }
11
+ }
12
+ </script>
13
+
14
+ <template>
15
+ <EscalatedLayout title="Business Hours">
16
+ <div class="mb-4 flex justify-end">
17
+ <Link
18
+ :href="route('escalated.admin.business-hours.create')"
19
+ 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)]"
20
+ >
21
+ Add Schedule
22
+ </Link>
23
+ </div>
24
+ <div class="overflow-hidden rounded-xl border border-[var(--esc-panel-border)] bg-[var(--esc-panel-surface)]">
25
+ <table class="min-w-full divide-y divide-[var(--esc-panel-border)]">
26
+ <thead>
27
+ <tr class="bg-[var(--esc-panel-hover)]">
28
+ <th
29
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
30
+ >
31
+ Name
32
+ </th>
33
+ <th
34
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
35
+ >
36
+ Timezone
37
+ </th>
38
+ <th
39
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
40
+ >
41
+ Default
42
+ </th>
43
+ <th
44
+ class="px-4 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
45
+ >
46
+ Holidays
47
+ </th>
48
+ <th
49
+ class="px-4 py-3 text-right text-[11px] font-semibold uppercase tracking-wider text-[var(--esc-panel-text-muted)]"
50
+ >
51
+ Actions
52
+ </th>
53
+ </tr>
54
+ </thead>
55
+ <tbody class="divide-y divide-[var(--esc-panel-border)]">
56
+ <tr v-if="!schedules?.length">
57
+ <td colspan="5" class="px-4 py-12 text-center">
58
+ <svg
59
+ class="mx-auto mb-3 h-8 w-8 text-[var(--esc-panel-text-muted)]"
60
+ fill="none"
61
+ stroke="currentColor"
62
+ stroke-width="1.5"
63
+ viewBox="0 0 24 24"
64
+ >
65
+ <path
66
+ stroke-linecap="round"
67
+ stroke-linejoin="round"
68
+ d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z"
69
+ />
70
+ </svg>
71
+ <p class="text-sm text-[var(--esc-panel-text-muted)]">No business schedules yet</p>
72
+ <p class="mt-1 text-xs text-[var(--esc-panel-text-muted)]">
73
+ Create a schedule to define your team's working hours
74
+ </p>
75
+ </td>
76
+ </tr>
77
+ <tr
78
+ v-for="sched in schedules"
79
+ :key="sched.id"
80
+ class="transition-colors hover:bg-[var(--esc-panel-hover)]"
81
+ >
82
+ <td class="px-4 py-3 text-sm font-medium text-[var(--esc-panel-text-secondary)]">
83
+ {{ sched.name }}
84
+ </td>
85
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">{{ sched.timezone }}</td>
86
+ <td class="px-4 py-3 text-sm">
87
+ <span
88
+ v-if="sched.is_default"
89
+ class="inline-flex items-center rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-400 ring-1 ring-emerald-500/20"
90
+ >Default</span
91
+ >
92
+ <span v-else class="text-[var(--esc-panel-text-muted)]">-</span>
93
+ </td>
94
+ <td class="px-4 py-3 text-sm text-[var(--esc-panel-text-tertiary)]">
95
+ {{ sched.holidays?.length || 0 }}
96
+ </td>
97
+ <td class="px-4 py-3 text-right text-sm">
98
+ <Link
99
+ :href="route('escalated.admin.business-hours.edit', sched.id)"
100
+ class="text-[var(--esc-panel-text-secondary)] hover:text-[var(--esc-panel-text)]"
101
+ >
102
+ Edit
103
+ </Link>
104
+ <button class="ml-3 text-rose-400 hover:text-rose-300" @click="destroy(sched.id)">
105
+ Delete
106
+ </button>
107
+ </td>
108
+ </tr>
109
+ </tbody>
110
+ </table>
111
+ </div>
112
+ </EscalatedLayout>
113
+ </template>