Cleanup
This commit is contained in:
64
lib/types.ts
64
lib/types.ts
@@ -1,3 +1,19 @@
|
||||
import { ChangeEvent, Dispatch, SetStateAction } from "react";
|
||||
|
||||
export interface ProductModalProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onSave: (productData: ProductData) => void;
|
||||
productData: ProductData;
|
||||
categories: Category[];
|
||||
editing: boolean;
|
||||
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
||||
handleTieredPricingChange: (e: React.ChangeEvent<HTMLInputElement>, index: number) => void;
|
||||
handleAddTier: () => void; // ✅ ADDED
|
||||
handleRemoveTier: (index: number) => void; // ✅ ADDED
|
||||
setProductData: React.Dispatch<React.SetStateAction<ProductData>>;
|
||||
}
|
||||
|
||||
// lib/types.ts
|
||||
export interface ShippingMethod {
|
||||
_id?: string; // Optional before saving, required after fetching
|
||||
@@ -11,19 +27,43 @@ export interface ShippingData {
|
||||
price: number;
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
_id?: string;
|
||||
name: string;
|
||||
price: number;
|
||||
description?: string;
|
||||
sku?: string;
|
||||
stock: number;
|
||||
createdAt?: Date;
|
||||
updatedAt?: Date;
|
||||
}
|
||||
|
||||
export type ApiResponse<T> = {
|
||||
data?: T;
|
||||
error?: string;
|
||||
total?: number;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
export interface Product {
|
||||
_id?: string;
|
||||
name: string;
|
||||
description: string;
|
||||
stock?: number;
|
||||
unitType: string;
|
||||
category: string;
|
||||
pricing: PricingTier[];
|
||||
image?: string | File | null;
|
||||
}
|
||||
|
||||
export interface ProductData {
|
||||
_id?: string;
|
||||
name: string;
|
||||
description: string;
|
||||
stock?: number;
|
||||
unitType: string;
|
||||
category: string;
|
||||
pricing: PricingTier[];
|
||||
image?: string | File | null;
|
||||
}
|
||||
|
||||
export interface PricingTier {
|
||||
minQuantity: number;
|
||||
pricePerUnit: number;
|
||||
_id?: string;
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
_id: string;
|
||||
name: string;
|
||||
}
|
||||
Reference in New Issue
Block a user