diff --git a/backend/zato-csm-backend/config/supabase.py b/backend/zato-csm-backend/config/supabase.py index 34afeb60..ec75fb65 100644 --- a/backend/zato-csm-backend/config/supabase.py +++ b/backend/zato-csm-backend/config/supabase.py @@ -3,7 +3,10 @@ from dotenv import load_dotenv from fastapi import HTTPException -load_dotenv() +load_dotenv(dotenv_path=os.path.join(os.path.dirname(__file__), "..", ".env")) +# print("SUPABASE_URL:", os.getenv("SUPABASE_URL")) +# print("SUPABASE_SERVICE_KEY:", os.getenv("SUPABASE_SERVICE_KEY")) + SUPABASE_URL = os.getenv("SUPABASE_URL") SUPABASE_SERVICE_KEY = os.getenv("SUPABASE_SERVICE_KEY") diff --git a/backend/zato-csm-backend/main.py b/backend/zato-csm-backend/main.py index c508257e..9936c5f1 100644 --- a/backend/zato-csm-backend/main.py +++ b/backend/zato-csm-backend/main.py @@ -10,7 +10,6 @@ # --- Swagger Bearer Token Support --- from fastapi.openapi.utils import get_openapi - def custom_openapi(): if app.openapi_schema: return app.openapi_schema diff --git a/backend/zato-csm-backend/requirements.txt b/backend/zato-csm-backend/requirements.txt index c6914a66..078727d5 100644 --- a/backend/zato-csm-backend/requirements.txt +++ b/backend/zato-csm-backend/requirements.txt @@ -51,4 +51,4 @@ supabase_auth==2.12.3 supabase_functions==0.10.1 urllib3==2.5.0 websockets==15.0.1 -cloudinary==1.44.0 \ No newline at end of file +cloudinary==1.44.0 diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index a37635b0..f683043a 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -49,3 +49,4 @@ --sidebar-border: #f1c658; --sidebar-ring: #e28e18; } + diff --git a/frontend/src/app/new-product/page.tsx b/frontend/src/app/new-product/page.tsx index 5f42d937..86ee1c86 100644 --- a/frontend/src/app/new-product/page.tsx +++ b/frontend/src/app/new-product/page.tsx @@ -7,6 +7,9 @@ import ImagesUploader from '@/components/new-product/ImagesUploader'; import NewProductForm from '@/components/new-product/NewProductForm'; import { useAuth } from '@/context/auth-store'; import { productsAPI } from '@/services/api.service'; +import { Formik, Form } from 'formik'; +import * as Yup from 'yup'; +import ProductInfoForm from '@/components/new-product/ProductInfoForm'; const NewProductPage: React.FC = () => { const router = useRouter(); @@ -91,8 +94,37 @@ const NewProductPage: React.FC = () => { } }; + const validationSchema = Yup.object().shape({ + name: Yup.string().required('Name is required'), + unit: Yup.string().required('Unit is required'), + price: Yup.number() + .typeError('Price must be a number') + .positive('Price must be greater than 0') + .required('Price is required'), + inventoryQuantity: Yup.number() + .typeError('Inventory must be a number') + .integer('Inventory must be an integer') + .min(0, 'Inventory must be 0 or more') + .required('Inventory is required'), + category: Yup.string().required('Category is required'), + }); + + const initialValues = { + productType: 'Physical Product', + name: '', + description: '', + location: '', + unit: 'Per item', + weight: '', + price: '', + inventoryQuantity: '', + lowStockAlert: '', + sku: '', + category: '', + }; + return ( -