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