edit admin
This commit is contained in:
@@ -11,7 +11,7 @@ export type BusinessService = {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string | null;
|
||||
defaultDurationMinutes: number;
|
||||
defaultDurationMinutes: number | null;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+1
-2
@@ -82,7 +82,7 @@ export type ServiceTemplate = {
|
||||
title: string;
|
||||
slug: string;
|
||||
description: string | null;
|
||||
defaultDurationMinutes: number;
|
||||
defaultDurationMinutes: number | null;
|
||||
isActive: boolean;
|
||||
categoryId: string;
|
||||
category?: BusinessCategory;
|
||||
@@ -95,7 +95,6 @@ export type CreateServiceTemplatePayload = {
|
||||
slug?: string;
|
||||
categoryId: string;
|
||||
description?: string;
|
||||
defaultDurationMinutes?: number;
|
||||
isActive?: boolean;
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
<p class="font-semibold text-text">{{ tpl.title }}</p>
|
||||
<p class="mt-0.5 text-xs text-muted" dir="ltr">{{ tpl.slug }}</p>
|
||||
<p v-if="tpl.description" class="mt-1 text-sm text-muted">{{ tpl.description }}</p>
|
||||
<p class="mt-1 text-xs text-muted">مدت پیشفرض: {{ tpl.defaultDurationMinutes }} دقیقه</p>
|
||||
<AppBadge class="mt-2" :tone="tpl.isActive ? 'success' : 'warning'">
|
||||
{{ activeLabel(tpl.isActive) }}
|
||||
</AppBadge>
|
||||
@@ -83,14 +82,6 @@
|
||||
placeholder="اختیاری — از عنوان ساخته میشود"
|
||||
/>
|
||||
<AppTextarea id="tplDesc" v-model="form.description" label="توضیحات" rows="2" />
|
||||
<AppInput
|
||||
id="tplDuration"
|
||||
v-model="form.defaultDurationMinutes"
|
||||
label="مدت پیشفرض (دقیقه)"
|
||||
type="number"
|
||||
inputmode="numeric"
|
||||
ltr
|
||||
/>
|
||||
<label class="flex items-center gap-2 text-sm text-text">
|
||||
<input v-model="form.isActive" type="checkbox" class="rounded border-border" />
|
||||
فعال
|
||||
@@ -141,7 +132,6 @@ const form = ref({
|
||||
title: '',
|
||||
slug: '',
|
||||
description: '',
|
||||
defaultDurationMinutes: '30',
|
||||
isActive: true,
|
||||
});
|
||||
|
||||
@@ -190,7 +180,6 @@ function openCreate() {
|
||||
title: '',
|
||||
slug: '',
|
||||
description: '',
|
||||
defaultDurationMinutes: '30',
|
||||
isActive: true,
|
||||
};
|
||||
modalOpen.value = true;
|
||||
@@ -203,7 +192,6 @@ function openEdit(tpl: ServiceTemplate) {
|
||||
title: tpl.title,
|
||||
slug: tpl.slug,
|
||||
description: tpl.description ?? '',
|
||||
defaultDurationMinutes: String(tpl.defaultDurationMinutes),
|
||||
isActive: tpl.isActive,
|
||||
};
|
||||
modalOpen.value = true;
|
||||
@@ -226,11 +214,6 @@ async function onSave() {
|
||||
error.value = 'اسلاگ فقط حروف کوچک انگلیسی و خط تیره باشد.';
|
||||
return;
|
||||
}
|
||||
const duration = Number.parseInt(form.value.defaultDurationMinutes, 10);
|
||||
if (!Number.isFinite(duration) || duration < 1) {
|
||||
error.value = 'مدت پیشفرض معتبر نیست.';
|
||||
return;
|
||||
}
|
||||
saving.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
@@ -238,7 +221,6 @@ async function onSave() {
|
||||
title: form.value.title.trim(),
|
||||
...(slug ? { slug } : {}),
|
||||
description: form.value.description.trim() || undefined,
|
||||
defaultDurationMinutes: duration,
|
||||
isActive: form.value.isActive,
|
||||
};
|
||||
if (editingId.value) {
|
||||
|
||||
Reference in New Issue
Block a user