@escalated-dev/escalated 0.7.0 → 0.7.1
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 +31 -0
- package/package.json +12 -6
- package/src/components/ActiveChatsPanel.vue +246 -0
- package/src/components/ActivityTimeline.stories.js +55 -55
- package/src/components/ActivityTimeline.vue +83 -83
- package/src/components/AdminDashboard.stories.js +1423 -1095
- package/src/components/AgentLoadIndicator.stories.js +37 -37
- package/src/components/AgentLoadIndicator.vue +49 -49
- package/src/components/AgentPerformanceCard.vue +44 -44
- package/src/components/ArticleEditor.vue +82 -82
- package/src/components/AssigneeSelect.vue +37 -37
- package/src/components/AttachmentList.vue +13 -1
- package/src/components/AuditLogEntry.vue +95 -95
- package/src/components/BulkActionBar.vue +166 -166
- package/src/components/CategoryTree.vue +89 -89
- package/src/components/ChartWidget.vue +46 -46
- package/src/components/ChatActionBar.vue +226 -0
- package/src/components/ChatBubble.vue +162 -0
- package/src/components/ChatComposer.vue +308 -0
- package/src/components/ChatQueue.vue +222 -0
- package/src/components/ChatThread.vue +197 -0
- package/src/components/CollisionWarning.stories.js +30 -30
- package/src/components/CollisionWarning.vue +68 -68
- package/src/components/ConditionalFieldRules.vue +135 -135
- package/src/components/ContextPanel.vue +66 -66
- package/src/components/ContextPanelSection.vue +65 -65
- package/src/components/CustomFieldRenderer.vue +159 -159
- package/src/components/EscalatedLayout.vue +29 -6
- package/src/components/FileDropzone.vue +57 -57
- package/src/components/FollowButton.stories.js +30 -30
- package/src/components/FollowButton.vue +88 -88
- package/src/components/KeyboardShortcutHelp.vue +213 -213
- package/src/components/KnowledgePanel.vue +122 -122
- package/src/components/KpiCard.stories.js +32 -32
- package/src/components/KpiCard.vue +88 -88
- package/src/components/MacroDropdown.vue +150 -150
- package/src/components/MentionDropdown.vue +154 -0
- package/src/components/MetricComparison.vue +89 -0
- package/src/components/PercentileChart.vue +67 -0
- package/src/components/PeriodSelector.vue +98 -0
- package/src/components/PermissionMatrix.vue +107 -107
- package/src/components/PinnedNotes.vue +129 -129
- package/src/components/PluginSlot.vue +68 -62
- package/src/components/PresenceIndicator.vue +46 -2
- package/src/components/PriorityBadge.stories.js +33 -33
- package/src/components/PriorityBadge.vue +46 -46
- package/src/components/ReplyComposer.vue +81 -18
- package/src/components/ReplyThread.vue +40 -2
- package/src/components/ReportChart.vue +395 -0
- package/src/components/ReportExportButton.vue +108 -0
- package/src/components/SatisfactionRating.vue +180 -180
- package/src/components/SaveViewDialog.vue +172 -0
- package/src/components/SavedViewSidebar.vue +208 -0
- package/src/components/ScheduleEditor.vue +104 -104
- package/src/components/SideConversation.vue +165 -165
- package/src/components/SideConversationList.vue +147 -147
- package/src/components/SkillTagManager.vue +79 -79
- package/src/components/SlaComplianceChart.vue +46 -53
- package/src/components/SlaTimer.stories.js +35 -35
- package/src/components/SlaTimer.vue +62 -62
- package/src/components/SnoozeButton.vue +247 -0
- package/src/components/StatsCard.stories.js +24 -24
- package/src/components/StatsCard.vue +58 -58
- package/src/components/StatusBadge.stories.js +53 -53
- package/src/components/StatusBadge.vue +78 -78
- package/src/components/TagSelect.vue +84 -84
- package/src/components/TicketFilters.vue +270 -225
- package/src/components/TicketLinkPanel.vue +193 -193
- package/src/components/TicketList.vue +655 -594
- package/src/components/TicketMergeDialog.vue +157 -157
- package/src/components/TicketSplitDialog.vue +98 -0
- package/src/components/TotpInput.stories.js +9 -9
- package/src/components/TotpInput.vue +81 -81
- package/src/components/TwoFactorSetup.vue +113 -113
- package/src/components/VariableTokenInput.vue +111 -0
- package/src/components/WorkflowActionConfig.vue +287 -0
- package/src/components/WorkflowActionList.vue +350 -0
- package/src/components/WorkflowConditionBuilder.vue +265 -0
- package/src/components/WorkflowTriggerSelector.vue +125 -0
- package/src/composables/useChat.js +187 -0
- package/src/composables/useI18n.js +80 -80
- package/src/composables/useKeyboardShortcuts.js +46 -46
- package/src/composables/useMentions.js +134 -0
- package/src/composables/usePluginExtensions.js +159 -159
- package/src/composables/usePluginHooks.js +65 -65
- package/src/composables/useRealtime.js +182 -0
- package/src/defineEscalatedPlugin.js +76 -76
- package/src/index.js +84 -72
- package/src/locales/ar.json +727 -0
- package/src/locales/de.json +678 -430
- package/src/locales/en.json +717 -455
- package/src/locales/es.json +679 -430
- package/src/locales/fr.json +680 -431
- package/src/locales/index.js +12 -2
- package/src/locales/it.json +727 -0
- package/src/locales/ja.json +727 -0
- package/src/locales/ko.json +727 -0
- package/src/locales/nl.json +727 -0
- package/src/locales/pl.json +727 -0
- package/src/locales/pt-BR.json +727 -0
- package/src/locales/ru.json +727 -0
- package/src/locales/tr.json +727 -0
- package/src/locales/zh-CN.json +727 -0
- package/src/pages/Admin/ApiTokens/Index.vue +381 -381
- package/src/pages/Admin/AuditLog/Index.vue +154 -154
- package/src/pages/Admin/BusinessHours/Form.vue +172 -172
- package/src/pages/Admin/BusinessHours/Index.vue +113 -113
- package/src/pages/Admin/CannedResponses/Index.vue +127 -127
- package/src/pages/Admin/Capacity/Index.vue +134 -134
- package/src/pages/Admin/CustomFields/Form.vue +195 -195
- package/src/pages/Admin/CustomFields/Index.vue +134 -134
- package/src/pages/Admin/CustomObjects/Form.vue +202 -202
- package/src/pages/Admin/CustomObjects/Index.vue +127 -127
- package/src/pages/Admin/CustomObjects/Records.vue +228 -228
- package/src/pages/Admin/Departments/Form.vue +75 -75
- package/src/pages/Admin/Departments/Index.vue +110 -109
- package/src/pages/Admin/EscalationRules/Form.vue +157 -157
- package/src/pages/Admin/EscalationRules/Index.vue +178 -178
- package/src/pages/Admin/Import/Connect.vue +0 -1
- package/src/pages/Admin/Import/Index.vue +1 -1
- package/src/pages/Admin/Import/Progress.vue +1 -1
- package/src/pages/Admin/KnowledgeBase/Articles/Form.vue +142 -142
- package/src/pages/Admin/KnowledgeBase/Articles/Index.vue +195 -195
- package/src/pages/Admin/KnowledgeBase/Categories/Index.vue +193 -193
- package/src/pages/Admin/Macros/Index.vue +448 -448
- package/src/pages/Admin/Plugins/Index.vue +327 -327
- package/src/pages/Admin/Reports/AgentDetail.vue +132 -0
- package/src/pages/Admin/Reports/AgentMetrics.vue +115 -115
- package/src/pages/Admin/Reports/AgentRanking.vue +246 -0
- package/src/pages/Admin/Reports/Cohorts.vue +180 -0
- package/src/pages/Admin/Reports/Comparison.vue +141 -0
- package/src/pages/Admin/Reports/CsatReport.vue +127 -127
- package/src/pages/Admin/Reports/Dashboard.vue +36 -21
- package/src/pages/Admin/Reports/ResolutionTimes.vue +164 -0
- package/src/pages/Admin/Reports/ResponseTimes.vue +164 -0
- package/src/pages/Admin/Reports/SlaReport.vue +162 -166
- package/src/pages/Admin/Reports/SlaTrends.vue +183 -0
- package/src/pages/Admin/Reports.vue +206 -206
- package/src/pages/Admin/Roles/Form.vue +71 -71
- package/src/pages/Admin/Roles/Index.vue +122 -122
- package/src/pages/Admin/Settings/CsatSettings.vue +165 -165
- package/src/pages/Admin/Settings/DataRetention.vue +182 -182
- package/src/pages/Admin/Settings/EmailSettings.vue +243 -243
- package/src/pages/Admin/Settings/Sandbox.vue +135 -135
- package/src/pages/Admin/Settings/SsoSettings.vue +218 -218
- package/src/pages/Admin/Settings/TwoFactor.vue +110 -110
- package/src/pages/Admin/Settings.vue +1008 -468
- package/src/pages/Admin/Skills/Form.vue +53 -53
- package/src/pages/Admin/Skills/Index.vue +94 -94
- package/src/pages/Admin/SlaPolicies/Form.vue +118 -118
- package/src/pages/Admin/SlaPolicies/Index.vue +121 -120
- package/src/pages/Admin/Statuses/Form.vue +114 -114
- package/src/pages/Admin/Statuses/Index.vue +153 -153
- package/src/pages/Admin/Tags/Index.vue +191 -191
- package/src/pages/Admin/Tickets/Index.vue +126 -91
- package/src/pages/Admin/Tickets/Show.vue +29 -0
- package/src/pages/Admin/Webhooks/DeliveryLog.vue +120 -120
- package/src/pages/Admin/Webhooks/Form.vue +110 -110
- package/src/pages/Admin/Webhooks/Index.vue +136 -136
- package/src/pages/Admin/Workflows/Builder.vue +207 -0
- package/src/pages/Admin/Workflows/Index.vue +235 -0
- package/src/pages/Admin/Workflows/Logs.vue +286 -0
- package/src/pages/Agent/TicketIndex.vue +112 -88
- package/src/pages/Agent/TicketShow.vue +192 -60
- package/src/pages/Customer/Create.vue +1 -1
- package/src/pages/Customer/Index.vue +31 -31
- package/src/pages/Customer/KnowledgeBase/Article.vue +4 -2
- package/src/pages/Customer/KnowledgeBase/Index.vue +151 -151
- package/src/pages/Customer/Show.vue +69 -63
- package/src/pages/Guest/Create.vue +40 -15
- package/src/pages/Guest/Show.vue +124 -93
- package/src/plugin.js +25 -0
- package/src/utils/mentionHighlight.js +24 -0
- package/src/utils/sanitizeHtml.js +78 -64
- package/src/widget/EscalatedWidget.vue +804 -0
- package/src/widget/index.js +254 -0
- package/src/pages/Admin/Automations/Form.vue +0 -184
- package/src/pages/Admin/Automations/Index.vue +0 -129
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, inject, nextTick } from 'vue';
|
|
3
|
+
import { router } from '@inertiajs/vue3';
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
savedViews: { type: Array, default: () => [] },
|
|
7
|
+
currentFilters: { type: Object, default: () => ({}) },
|
|
8
|
+
route: { type: String, required: true },
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const emit = defineEmits(['apply-view']);
|
|
12
|
+
const escDark = inject(
|
|
13
|
+
'esc-dark',
|
|
14
|
+
computed(() => false),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const activeViewId = ref(null);
|
|
18
|
+
const menuOpenId = ref(null);
|
|
19
|
+
const editingView = ref(null);
|
|
20
|
+
const editName = ref('');
|
|
21
|
+
|
|
22
|
+
function applyView(view) {
|
|
23
|
+
if (view === null) {
|
|
24
|
+
activeViewId.value = null;
|
|
25
|
+
emit('apply-view', {});
|
|
26
|
+
router.get(props.route, {}, { preserveState: true, preserveScroll: true });
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
activeViewId.value = view.id;
|
|
30
|
+
emit('apply-view', view.filters);
|
|
31
|
+
router.get(props.route, view.filters || {}, { preserveState: true, preserveScroll: true });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function toggleMenu(viewId) {
|
|
35
|
+
menuOpenId.value = menuOpenId.value === viewId ? null : viewId;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function startEdit(view) {
|
|
39
|
+
editingView.value = view.id;
|
|
40
|
+
editName.value = view.name;
|
|
41
|
+
menuOpenId.value = null;
|
|
42
|
+
nextTick(() => {
|
|
43
|
+
const input = document.querySelector(`[data-edit-view="${view.id}"]`);
|
|
44
|
+
if (input) input.focus();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function saveEdit(view) {
|
|
49
|
+
if (!editName.value.trim()) {
|
|
50
|
+
editingView.value = null;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
fetch(route('escalated.admin.saved-views.update', view.id), {
|
|
54
|
+
method: 'PUT',
|
|
55
|
+
headers: {
|
|
56
|
+
'Content-Type': 'application/json',
|
|
57
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
58
|
+
Accept: 'application/json',
|
|
59
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
60
|
+
},
|
|
61
|
+
body: JSON.stringify({ name: editName.value, filters: view.filters }),
|
|
62
|
+
}).then(() => {
|
|
63
|
+
view.name = editName.value;
|
|
64
|
+
editingView.value = null;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function updateViewFilters(view) {
|
|
69
|
+
menuOpenId.value = null;
|
|
70
|
+
const nonEmptyFilters = {};
|
|
71
|
+
for (const [key, value] of Object.entries(props.currentFilters)) {
|
|
72
|
+
if (value !== '' && value !== null && value !== undefined) {
|
|
73
|
+
nonEmptyFilters[key] = value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
fetch(route('escalated.admin.saved-views.update', view.id), {
|
|
77
|
+
method: 'PUT',
|
|
78
|
+
headers: {
|
|
79
|
+
'Content-Type': 'application/json',
|
|
80
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
81
|
+
Accept: 'application/json',
|
|
82
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
83
|
+
},
|
|
84
|
+
body: JSON.stringify({ name: view.name, filters: nonEmptyFilters }),
|
|
85
|
+
}).then(() => {
|
|
86
|
+
view.filters = nonEmptyFilters;
|
|
87
|
+
router.reload({ only: ['savedViews'] });
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function deleteView(view) {
|
|
92
|
+
menuOpenId.value = null;
|
|
93
|
+
if (!confirm(`Delete view "${view.name}"?`)) return;
|
|
94
|
+
fetch(route('escalated.admin.saved-views.destroy', view.id), {
|
|
95
|
+
method: 'DELETE',
|
|
96
|
+
headers: {
|
|
97
|
+
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || '',
|
|
98
|
+
Accept: 'application/json',
|
|
99
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
100
|
+
},
|
|
101
|
+
}).then(() => {
|
|
102
|
+
if (activeViewId.value === view.id) {
|
|
103
|
+
activeViewId.value = null;
|
|
104
|
+
}
|
|
105
|
+
router.reload({ only: ['savedViews'] });
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const itemClass = computed(
|
|
110
|
+
() => (isActive) =>
|
|
111
|
+
[
|
|
112
|
+
'flex items-center justify-between gap-2 rounded-md px-3 py-1.5 text-sm cursor-pointer transition-colors group',
|
|
113
|
+
isActive
|
|
114
|
+
? escDark.value
|
|
115
|
+
? 'bg-cyan-500/10 text-cyan-400'
|
|
116
|
+
: 'bg-blue-50 text-blue-700 font-medium'
|
|
117
|
+
: escDark.value
|
|
118
|
+
? 'text-neutral-400 hover:bg-white/[0.04] hover:text-neutral-200'
|
|
119
|
+
: 'text-gray-600 hover:bg-gray-50 hover:text-gray-900',
|
|
120
|
+
].flat(),
|
|
121
|
+
);
|
|
122
|
+
</script>
|
|
123
|
+
|
|
124
|
+
<template>
|
|
125
|
+
<div class="space-y-1">
|
|
126
|
+
<div :class="itemClass(activeViewId === null)" @click="applyView(null)">
|
|
127
|
+
<span class="truncate">All Tickets</span>
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div v-for="view in savedViews" :key="view.id" class="relative">
|
|
131
|
+
<div v-if="editingView === view.id" class="flex items-center gap-1 px-1">
|
|
132
|
+
<input
|
|
133
|
+
v-model="editName"
|
|
134
|
+
:data-edit-view="view.id"
|
|
135
|
+
type="text"
|
|
136
|
+
class="flex-1 rounded border px-2 py-1 text-sm"
|
|
137
|
+
:class="
|
|
138
|
+
escDark
|
|
139
|
+
? 'border-white/10 bg-white/5 text-neutral-200'
|
|
140
|
+
: 'border-gray-300 bg-white text-gray-900'
|
|
141
|
+
"
|
|
142
|
+
@keydown.enter="saveEdit(view)"
|
|
143
|
+
@keydown.escape="editingView = null"
|
|
144
|
+
@blur="saveEdit(view)"
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
<div v-else :class="itemClass(activeViewId === view.id)" @click="applyView(view)">
|
|
148
|
+
<span class="flex items-center gap-2 truncate">
|
|
149
|
+
<span
|
|
150
|
+
v-if="view.color"
|
|
151
|
+
class="inline-block h-2 w-2 shrink-0 rounded-full"
|
|
152
|
+
:style="{ backgroundColor: view.color }"
|
|
153
|
+
></span>
|
|
154
|
+
<span class="truncate">{{ view.name }}</span>
|
|
155
|
+
<span
|
|
156
|
+
v-if="view.is_shared"
|
|
157
|
+
:class="[
|
|
158
|
+
'shrink-0 rounded px-1 py-0.5 text-[10px] leading-none font-medium',
|
|
159
|
+
escDark ? 'bg-white/[0.06] text-neutral-500' : 'bg-gray-100 text-gray-400',
|
|
160
|
+
]"
|
|
161
|
+
>shared</span
|
|
162
|
+
>
|
|
163
|
+
</span>
|
|
164
|
+
<button
|
|
165
|
+
aria-label="View options"
|
|
166
|
+
class="shrink-0 rounded p-0.5 opacity-0 transition-opacity group-hover:opacity-100"
|
|
167
|
+
:class="escDark ? 'hover:bg-white/10' : 'hover:bg-gray-200'"
|
|
168
|
+
@click.stop="toggleMenu(view.id)"
|
|
169
|
+
>
|
|
170
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="currentColor" viewBox="0 0 20 20">
|
|
171
|
+
<path
|
|
172
|
+
d="M10 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4zm0 6a2 2 0 110-4 2 2 0 010 4z"
|
|
173
|
+
/>
|
|
174
|
+
</svg>
|
|
175
|
+
</button>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<!-- Kebab menu -->
|
|
179
|
+
<div
|
|
180
|
+
v-if="menuOpenId === view.id"
|
|
181
|
+
class="absolute right-0 z-20 mt-1 w-44 rounded-md border py-1 shadow-lg"
|
|
182
|
+
:class="escDark ? 'border-white/10 bg-[var(--esc-panel-surface)]' : 'border-gray-200 bg-white'"
|
|
183
|
+
>
|
|
184
|
+
<button
|
|
185
|
+
class="block w-full px-3 py-1.5 text-left text-sm"
|
|
186
|
+
:class="escDark ? 'text-neutral-300 hover:bg-white/5' : 'text-gray-700 hover:bg-gray-50'"
|
|
187
|
+
@click="startEdit(view)"
|
|
188
|
+
>
|
|
189
|
+
Rename
|
|
190
|
+
</button>
|
|
191
|
+
<button
|
|
192
|
+
class="block w-full px-3 py-1.5 text-left text-sm"
|
|
193
|
+
:class="escDark ? 'text-neutral-300 hover:bg-white/5' : 'text-gray-700 hover:bg-gray-50'"
|
|
194
|
+
@click="updateViewFilters(view)"
|
|
195
|
+
>
|
|
196
|
+
Save current filters
|
|
197
|
+
</button>
|
|
198
|
+
<button
|
|
199
|
+
class="block w-full px-3 py-1.5 text-left text-sm"
|
|
200
|
+
:class="escDark ? 'text-red-400 hover:bg-white/5' : 'text-red-600 hover:bg-red-50'"
|
|
201
|
+
@click="deleteView(view)"
|
|
202
|
+
>
|
|
203
|
+
Delete
|
|
204
|
+
</button>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</template>
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
|
|
4
|
-
const props = defineProps({
|
|
5
|
-
modelValue: {
|
|
6
|
-
type: Object,
|
|
7
|
-
default: () => ({
|
|
8
|
-
monday: { start: '09:00', end: '17:00' },
|
|
9
|
-
tuesday: { start: '09:00', end: '17:00' },
|
|
10
|
-
wednesday: { start: '09:00', end: '17:00' },
|
|
11
|
-
thursday: { start: '09:00', end: '17:00' },
|
|
12
|
-
friday: { start: '09:00', end: '17:00' },
|
|
13
|
-
saturday: { start: '', end: '' },
|
|
14
|
-
sunday: { start: '', end: '' },
|
|
15
|
-
}),
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const emit = defineEmits(['update:modelValue']);
|
|
20
|
-
|
|
21
|
-
const days = [
|
|
22
|
-
{ key: 'monday', label: 'Monday' },
|
|
23
|
-
{ key: 'tuesday', label: 'Tuesday' },
|
|
24
|
-
{ key: 'wednesday', label: 'Wednesday' },
|
|
25
|
-
{ key: 'thursday', label: 'Thursday' },
|
|
26
|
-
{ key: 'friday', label: 'Friday' },
|
|
27
|
-
{ key: 'saturday', label: 'Saturday' },
|
|
28
|
-
{ key: 'sunday', label: 'Sunday' },
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const timeOptions = computed(() => {
|
|
32
|
-
const options = [];
|
|
33
|
-
for (let h = 0; h < 24; h++) {
|
|
34
|
-
for (let m = 0; m < 60; m += 30) {
|
|
35
|
-
const hh = String(h).padStart(2, '0');
|
|
36
|
-
const mm = String(m).padStart(2, '0');
|
|
37
|
-
options.push(`${hh}:${mm}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
options.push('24:00');
|
|
41
|
-
return options;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
function updateDay(dayKey, field, value) {
|
|
45
|
-
const updated = { ...props.modelValue };
|
|
46
|
-
updated[dayKey] = { ...(updated[dayKey] || { start: '', end: '' }), [field]: value };
|
|
47
|
-
emit('update:modelValue', updated);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function toggleDay(dayKey) {
|
|
51
|
-
const updated = { ...props.modelValue };
|
|
52
|
-
const current = updated[dayKey];
|
|
53
|
-
if (current && current.start) {
|
|
54
|
-
updated[dayKey] = { start: '', end: '' };
|
|
55
|
-
} else {
|
|
56
|
-
updated[dayKey] = { start: '09:00', end: '17:00' };
|
|
57
|
-
}
|
|
58
|
-
emit('update:modelValue', updated);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function isDayEnabled(dayKey) {
|
|
62
|
-
const day = props.modelValue[dayKey];
|
|
63
|
-
return day && day.start;
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<template>
|
|
68
|
-
<div class="space-y-2">
|
|
69
|
-
<div
|
|
70
|
-
v-for="day in days"
|
|
71
|
-
:key="day.key"
|
|
72
|
-
class="flex items-center gap-3 rounded-lg border border-white/[0.06] bg-neutral-950/50 px-3 py-2"
|
|
73
|
-
>
|
|
74
|
-
<label class="flex w-28 items-center gap-2">
|
|
75
|
-
<input
|
|
76
|
-
type="checkbox"
|
|
77
|
-
:checked="isDayEnabled(day.key)"
|
|
78
|
-
class="rounded border-white/20 bg-neutral-900 text-cyan-500 focus:ring-white/10"
|
|
79
|
-
@change="toggleDay(day.key)"
|
|
80
|
-
/>
|
|
81
|
-
<span class="text-sm font-medium text-neutral-300">{{ day.label }}</span>
|
|
82
|
-
</label>
|
|
83
|
-
|
|
84
|
-
<template v-if="isDayEnabled(day.key)">
|
|
85
|
-
<select
|
|
86
|
-
:value="modelValue[day.key]?.start || '09:00'"
|
|
87
|
-
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
88
|
-
@change="updateDay(day.key, 'start', $event.target.value)"
|
|
89
|
-
>
|
|
90
|
-
<option v-for="t in timeOptions" :key="'s-' + t" :value="t">{{ t }}</option>
|
|
91
|
-
</select>
|
|
92
|
-
<span class="text-xs text-neutral-500">to</span>
|
|
93
|
-
<select
|
|
94
|
-
:value="modelValue[day.key]?.end || '17:00'"
|
|
95
|
-
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
96
|
-
@change="updateDay(day.key, 'end', $event.target.value)"
|
|
97
|
-
>
|
|
98
|
-
<option v-for="t in timeOptions" :key="'e-' + t" :value="t">{{ t }}</option>
|
|
99
|
-
</select>
|
|
100
|
-
</template>
|
|
101
|
-
<span v-else class="text-xs text-neutral-500">Closed</span>
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
104
|
-
</template>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: Object,
|
|
7
|
+
default: () => ({
|
|
8
|
+
monday: { start: '09:00', end: '17:00' },
|
|
9
|
+
tuesday: { start: '09:00', end: '17:00' },
|
|
10
|
+
wednesday: { start: '09:00', end: '17:00' },
|
|
11
|
+
thursday: { start: '09:00', end: '17:00' },
|
|
12
|
+
friday: { start: '09:00', end: '17:00' },
|
|
13
|
+
saturday: { start: '', end: '' },
|
|
14
|
+
sunday: { start: '', end: '' },
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits(['update:modelValue']);
|
|
20
|
+
|
|
21
|
+
const days = [
|
|
22
|
+
{ key: 'monday', label: 'Monday' },
|
|
23
|
+
{ key: 'tuesday', label: 'Tuesday' },
|
|
24
|
+
{ key: 'wednesday', label: 'Wednesday' },
|
|
25
|
+
{ key: 'thursday', label: 'Thursday' },
|
|
26
|
+
{ key: 'friday', label: 'Friday' },
|
|
27
|
+
{ key: 'saturday', label: 'Saturday' },
|
|
28
|
+
{ key: 'sunday', label: 'Sunday' },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const timeOptions = computed(() => {
|
|
32
|
+
const options = [];
|
|
33
|
+
for (let h = 0; h < 24; h++) {
|
|
34
|
+
for (let m = 0; m < 60; m += 30) {
|
|
35
|
+
const hh = String(h).padStart(2, '0');
|
|
36
|
+
const mm = String(m).padStart(2, '0');
|
|
37
|
+
options.push(`${hh}:${mm}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
options.push('24:00');
|
|
41
|
+
return options;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
function updateDay(dayKey, field, value) {
|
|
45
|
+
const updated = { ...props.modelValue };
|
|
46
|
+
updated[dayKey] = { ...(updated[dayKey] || { start: '', end: '' }), [field]: value };
|
|
47
|
+
emit('update:modelValue', updated);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function toggleDay(dayKey) {
|
|
51
|
+
const updated = { ...props.modelValue };
|
|
52
|
+
const current = updated[dayKey];
|
|
53
|
+
if (current && current.start) {
|
|
54
|
+
updated[dayKey] = { start: '', end: '' };
|
|
55
|
+
} else {
|
|
56
|
+
updated[dayKey] = { start: '09:00', end: '17:00' };
|
|
57
|
+
}
|
|
58
|
+
emit('update:modelValue', updated);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function isDayEnabled(dayKey) {
|
|
62
|
+
const day = props.modelValue[dayKey];
|
|
63
|
+
return day && day.start;
|
|
64
|
+
}
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<div class="space-y-2">
|
|
69
|
+
<div
|
|
70
|
+
v-for="day in days"
|
|
71
|
+
:key="day.key"
|
|
72
|
+
class="flex items-center gap-3 rounded-lg border border-white/[0.06] bg-neutral-950/50 px-3 py-2"
|
|
73
|
+
>
|
|
74
|
+
<label class="flex w-28 items-center gap-2">
|
|
75
|
+
<input
|
|
76
|
+
type="checkbox"
|
|
77
|
+
:checked="isDayEnabled(day.key)"
|
|
78
|
+
class="rounded border-white/20 bg-neutral-900 text-cyan-500 focus:ring-white/10"
|
|
79
|
+
@change="toggleDay(day.key)"
|
|
80
|
+
/>
|
|
81
|
+
<span class="text-sm font-medium text-neutral-300">{{ day.label }}</span>
|
|
82
|
+
</label>
|
|
83
|
+
|
|
84
|
+
<template v-if="isDayEnabled(day.key)">
|
|
85
|
+
<select
|
|
86
|
+
:value="modelValue[day.key]?.start || '09:00'"
|
|
87
|
+
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
88
|
+
@change="updateDay(day.key, 'start', $event.target.value)"
|
|
89
|
+
>
|
|
90
|
+
<option v-for="t in timeOptions" :key="'s-' + t" :value="t">{{ t }}</option>
|
|
91
|
+
</select>
|
|
92
|
+
<span class="text-xs text-neutral-500">to</span>
|
|
93
|
+
<select
|
|
94
|
+
:value="modelValue[day.key]?.end || '17:00'"
|
|
95
|
+
class="rounded-lg border border-white/10 bg-neutral-950 px-2 py-1 text-sm text-neutral-200 focus:border-white/20 focus:outline-none focus:ring-1 focus:ring-white/10"
|
|
96
|
+
@change="updateDay(day.key, 'end', $event.target.value)"
|
|
97
|
+
>
|
|
98
|
+
<option v-for="t in timeOptions" :key="'e-' + t" :value="t">{{ t }}</option>
|
|
99
|
+
</select>
|
|
100
|
+
</template>
|
|
101
|
+
<span v-else class="text-xs text-neutral-500">Closed</span>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|