This commit is contained in:
NotII
2025-02-16 16:30:57 +00:00
parent 236fb223e4
commit 62e2602d28
5 changed files with 116 additions and 57 deletions

View File

@@ -87,10 +87,10 @@ export const ProductModal: React.FC<ProductModalProps> = ({
const handleAddTier = () => {
setProductData((prev) => ({
...prev,
pricing: [...prev.pricing, { minQuantity: 0, pricePerUnit: 0 }],
pricing: [...prev.pricing, { minQuantity: 0, pricePerUnit: 0 }],
}));
};
const handleSave = async () => {
if (!productData.category) {
toast.error("Please select or add a category");
@@ -114,7 +114,7 @@ export const ProductModal: React.FC<ProductModalProps> = ({
...prev,
pricing: prev.pricing.map((tier, i) =>
i === index
? { ...tier, [name]: value === "" ? 0 : Number(value) }
? { ...tier, [name]: value === "" ? 0 : Number(value) }
: tier
),
}));
@@ -122,7 +122,7 @@ export const ProductModal: React.FC<ProductModalProps> = ({
return (
<Dialog open={open} onOpenChange={onClose}>
<DialogContent className="max-w-6xl">
<DialogContent className="max-w-[95vw] lg:max-w-6xl w-full overflow-y-auto max-h-[90vh] z-[80]">
<DialogHeader>
<DialogTitle className="text-base">
{editing ? "Edit Product" : "Add Product"}
@@ -221,9 +221,9 @@ const CategorySelect: React.FC<CategorySelectProps> = ({
// Get root categories (those without parentId)
const rootCategories = categories.filter(cat => !cat.parentId);
// Get subcategories for a given parent
const getSubcategories = (parentId: string) =>
const getSubcategories = (parentId: string) =>
categories.filter(cat => cat.parentId === parentId);
return (