Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d5e243e06 | |||
| 9210621d67 | |||
| cefaf3a850 | |||
| 120ff12fef |
@@ -189,7 +189,15 @@ export const getDoctorsByDepartmentId = async (req, res) => {
|
|||||||
doctor: {isActive: true},
|
doctor: {isActive: true},
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
doctor: true,
|
doctor: {
|
||||||
|
include: {
|
||||||
|
seo: {
|
||||||
|
select: {
|
||||||
|
slug: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
orderBy: {sortOrder: "asc"},
|
orderBy: {sortOrder: "asc"},
|
||||||
});
|
});
|
||||||
@@ -200,6 +208,7 @@ export const getDoctorsByDepartmentId = async (req, res) => {
|
|||||||
image: d.doctor.image ?? "",
|
image: d.doctor.image ?? "",
|
||||||
designation: d.doctor.designation,
|
designation: d.doctor.designation,
|
||||||
hierarchyOrder: d.sortOrder,
|
hierarchyOrder: d.sortOrder,
|
||||||
|
slug: d.doctor.seo?.slug ?? "",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export interface HealthPackage {
|
|||||||
name: string;
|
name: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
price: number;
|
price?: number;
|
||||||
image?: string;
|
image?: string;
|
||||||
discountedPrice?: number;
|
discountedPrice?: number;
|
||||||
inclusions: Record<string, string[]>;
|
inclusions: Record<string, string[]>;
|
||||||
|
|||||||
@@ -270,10 +270,6 @@ export default function HealthPackagePage() {
|
|||||||
if (!pkgForm.slug?.trim()) return toast.error("URL Slug is required.");
|
if (!pkgForm.slug?.trim()) return toast.error("URL Slug is required.");
|
||||||
if (!pkgForm.categoryId)
|
if (!pkgForm.categoryId)
|
||||||
return toast.error("Please select a valid category.");
|
return toast.error("Please select a valid category.");
|
||||||
if (pkgForm.price === undefined || pkgForm.price <= 0)
|
|
||||||
return toast.error(
|
|
||||||
"Regular Price must be a valid amount greater than 0.",
|
|
||||||
);
|
|
||||||
if (!pkgForm.description?.trim())
|
if (!pkgForm.description?.trim())
|
||||||
return toast.error("Description is required.");
|
return toast.error("Description is required.");
|
||||||
|
|
||||||
@@ -299,8 +295,18 @@ export default function HealthPackagePage() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const finalData = { ...pkgForm, inclusions: parsedInclusions };
|
const finalData: Partial<HealthPackage> = {
|
||||||
|
...pkgForm,
|
||||||
|
inclusions: parsedInclusions,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!finalData.price) {
|
||||||
|
delete finalData.price;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!finalData.discountedPrice) {
|
||||||
|
delete finalData.discountedPrice;
|
||||||
|
}
|
||||||
if (editingPackage?.id) {
|
if (editingPackage?.id) {
|
||||||
const changedFields: Record<string, any> = {};
|
const changedFields: Record<string, any> = {};
|
||||||
Object.keys(finalData).forEach((key) => {
|
Object.keys(finalData).forEach((key) => {
|
||||||
@@ -836,7 +842,9 @@ export default function HealthPackagePage() {
|
|||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setPkgForm({
|
setPkgForm({
|
||||||
...pkgForm,
|
...pkgForm,
|
||||||
price: Number(e.target.value),
|
price: e.target.value
|
||||||
|
? Number(e.target.value)
|
||||||
|
: undefined,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
className="text-base"
|
className="text-base"
|
||||||
@@ -852,7 +860,9 @@ export default function HealthPackagePage() {
|
|||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setPkgForm({
|
setPkgForm({
|
||||||
...pkgForm,
|
...pkgForm,
|
||||||
discountedPrice: Number(e.target.value),
|
discountedPrice: e.target.value
|
||||||
|
? Number(e.target.value)
|
||||||
|
: undefined,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
className="text-base"
|
className="text-base"
|
||||||
|
|||||||
Reference in New Issue
Block a user