diff --git a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
index 6473eb0..995d8d8 100644
--- a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
+++ b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
@@ -76,6 +76,7 @@ const PASSWORD_POLICY = {
};
const MAX_PASSWORD_HISTORY = 5;
+const MAX_PRODUCTS = 15;
const validatePasswordComplexity = (password) => {
if (!password) return '';
@@ -1356,7 +1357,12 @@ const CompanyProfile = () => {
@@ -1386,13 +1392,24 @@ const CompanyProfile = () => {
Selected Products
{selectedProducts.length > 0 && (
-
- {selectedProducts.length} selected
+ = MAX_PRODUCTS
+ ? 'bg-red-100 text-red-800'
+ : 'bg-[#FEF3C7] text-[#92400E]'
+ }`}>
+ {selectedProducts.length}/{MAX_PRODUCTS} selected
)}
+ {selectedProducts.length >= MAX_PRODUCTS && (
+
+
+ Maximum limit of {MAX_PRODUCTS} products reached. Remove a product to add another.
+
+
+ )}
{selectedProducts.length > 0 ? (
@@ -1551,12 +1568,19 @@ const CompanyProfile = () => {
setProductError('');
setSaveError('');
+ // Check if adding this product would exceed the maximum limit
+ if (selectedProducts.length >= MAX_PRODUCTS) {
+ setProductError(`You can only select up to ${MAX_PRODUCTS} products. Please remove a product before adding another.`);
+ showToast('error', `Maximum ${MAX_PRODUCTS} products allowed`);
+ return;
+ }
+
// Enhanced product formatting to ensure all required fields
const enhancedProduct = {
id: product.id || product.product_id || 0,
product_id: product.product_id || product.id || 0,
hs_code: product.hs_code || product.hsCode || '',
- hsCode: product.hsCode || product.hs_code || '',
+ hsCode: product.productName || product.hs_code || '',
product_name: product.product_name || product.productName || product.label || '',
productName: product.productName || product.product_name || product.label || '',
label: product.label || `${product.product_name || product.productName || 'Unnamed Product'}${(product.hs_code || product.hsCode) ? ` (${product.hs_code || product.hsCode})` : ''}`,