diff --git a/ipi-survey-platform/src/components/overview/ProductDetails.jsx b/ipi-survey-platform/src/components/overview/ProductDetails.jsx
index a36a229..1b6894a 100644
--- a/ipi-survey-platform/src/components/overview/ProductDetails.jsx
+++ b/ipi-survey-platform/src/components/overview/ProductDetails.jsx
@@ -127,6 +127,29 @@ const ProductDetails = ({
// Use provided quarterPeriods or fall back to defaults
const periods = quarterPeriods || product?.quarterPeriods || defaultQuarterPeriods;
+ // Determine if we should hide PREVIOUS QUARTER section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHidePreviousQuarter = React.useMemo(() => {
+ const effectiveYear = (periods?.current_year || new Date().getFullYear()).toString();
+ const rawQuarter = periods?.current_quarter || 'Q1';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return (effectiveYear === '2022' && normalizedQuarter === 'Q1') ||
+ (effectiveYear === '2025' && normalizedQuarter === 'Q1');
+ }, [periods]);
+
+ // Determine if we should hide FORECAST section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHideForecast = React.useMemo(() => {
+ const effectiveYear = (periods?.current_year || new Date().getFullYear()).toString();
+ const rawQuarter = periods?.current_quarter || 'Q1';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return effectiveYear === '2022' && normalizedQuarter === 'Q4';
+ }, [periods]);
+
const navigate = useNavigate();
// Function to save resubmission data to localStorage
@@ -460,28 +483,36 @@ const ProductDetails = ({
Metric
|
-
- {periods.previous_quarter}-{periods.previous_year} (Previous Quarter)
- |
+ {!shouldHidePreviousQuarter && (
+
+ {periods.previous_quarter}-{periods.previous_year} (Previous Quarter)
+ |
+ )}
{periods.current_quarter}-{periods.current_year} (Current Quarter)
|
-
- {periods.forecast_quarter}-{periods.forecast_year} (Next Quarter)
- |
+ {!shouldHideForecast && (
+
+ {periods.forecast_quarter}-{periods.forecast_year} (Next Quarter)
+ |
+ )}
{/* Second header row */}
- |
- {periods.previous_month.previous_period_one}
- |
-
- {periods.previous_month.previous_period_two}
- |
-
- {periods.previous_month.previous_period_three}
- |
+ {!shouldHidePreviousQuarter && (
+ <>
+
+ {periods.previous_month.previous_period_one}
+ |
+
+ {periods.previous_month.previous_period_two}
+ |
+
+ {periods.previous_month.previous_period_three}
+ |
+ >
+ )}
{periods.current_month.current_period_one}
|
@@ -491,15 +522,19 @@ const ProductDetails = ({
{periods.current_month.current_period_three}
|
-
- {periods.forecast_month.forecast_period_one}
- |
-
- {periods.forecast_month.forecast_period_two}
- |
-
- {periods.forecast_month.forecast_period_three}
- |
+ {!shouldHideForecast && (
+ <>
+
+ {periods.forecast_month.forecast_period_one}
+ |
+
+ {periods.forecast_month.forecast_period_two}
+ |
+
+ {periods.forecast_month.forecast_period_three}
+ |
+ >
+ )}
@@ -509,15 +544,23 @@ const ProductDetails = ({
Quantity ({formattedProduct.unit})
|
- {formattedProduct.q4_oct_quantity} |
- {formattedProduct.q4_nov_quantity} |
- {formattedProduct.q4_dec_quantity} |
+ {!shouldHidePreviousQuarter && (
+ <>
+ {formattedProduct.q4_oct_quantity} |
+ {formattedProduct.q4_nov_quantity} |
+ {formattedProduct.q4_dec_quantity} |
+ >
+ )}
{formattedProduct.q1_jan_quantity} |
{formattedProduct.q1_feb_quantity} |
{formattedProduct.q1_mar_quantity} |
- {formattedProduct.q2_apr_quantity} |
- {formattedProduct.q2_may_quantity} |
- {formattedProduct.q2_jun_quantity} |
+ {!shouldHideForecast && (
+ <>
+ {formattedProduct.q2_apr_quantity} |
+ {formattedProduct.q2_may_quantity} |
+ {formattedProduct.q2_jun_quantity} |
+ >
+ )}
{/* Cost Row */}
@@ -525,15 +568,23 @@ const ProductDetails = ({
Value (AED)
|
- {formattedProduct.q4_oct_cost} |
- {formattedProduct.q4_nov_cost} |
- {formattedProduct.q4_dec_cost} |
+ {!shouldHidePreviousQuarter && (
+ <>
+ {formattedProduct.q4_oct_cost} |
+ {formattedProduct.q4_nov_cost} |
+ {formattedProduct.q4_dec_cost} |
+ >
+ )}
{formattedProduct.q1_jan_cost} |
{formattedProduct.q1_feb_cost} |
{formattedProduct.q1_mar_cost} |
- {formattedProduct.q2_apr_cost} |
- {formattedProduct.q2_may_cost} |
- {formattedProduct.q2_jun_cost} |
+ {!shouldHideForecast && (
+ <>
+ {formattedProduct.q2_apr_cost} |
+ {formattedProduct.q2_may_cost} |
+ {formattedProduct.q2_jun_cost} |
+ >
+ )}
{/* Reason Current */}
@@ -541,15 +592,19 @@ const ProductDetails = ({
Reason (Current)
|
-
- -- --
- |
+ {!shouldHidePreviousQuarter && (
+
+ -- --
+ |
+ )}
{formattedProduct.variationReason}
|
-
- -- --
- |
+ {!shouldHideForecast && (
+
+ -- --
+ |
+ )}
{/* Reason Forecast */}
@@ -557,12 +612,19 @@ const ProductDetails = ({
Reason (Forecast)
|
-
+ {!shouldHidePreviousQuarter && (
+ |
+ -- --
+ |
+ )}
+
-- --
|
-
- {formattedProduct.zeroTargetReason}
- |
+ {!shouldHideForecast && (
+
+ {formattedProduct.zeroTargetReason}
+ |
+ )}
diff --git a/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx b/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx
index 2a0b86d..5cca6aa 100644
--- a/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx
+++ b/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx
@@ -501,6 +501,29 @@ const ProductData = ({
const [isInitialLoad, setIsInitialLoad] = React.useState(true);
const [quarterPeriods, setQuarterPeriods] = React.useState(null);
const [isLoadingPeriods, setIsLoadingPeriods] = React.useState(false);
+
+ // Determine if we should hide PREVIOUS QUARTER section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHidePreviousQuarter = React.useMemo(() => {
+ const effectiveYear = (quarterPeriods?.current_year || year || '').toString();
+ const rawQuarter = quarterPeriods?.current_quarter || quarter || '';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return (effectiveYear === '2022' && normalizedQuarter === 'Q1') ||
+ (effectiveYear === '2025' && normalizedQuarter === 'Q1');
+ }, [quarterPeriods, year, quarter]);
+
+ // Determine if we should hide FORECAST section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHideForecast = React.useMemo(() => {
+ const effectiveYear = (quarterPeriods?.current_year || year || '').toString();
+ const rawQuarter = quarterPeriods?.current_quarter || quarter || '';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return effectiveYear === '2022' && normalizedQuarter === 'Q4';
+ }, [quarterPeriods, year, quarter]);
const [showOtherVariationReason, setShowOtherVariationReason] = React.useState({});
const [showOtherZeroTargetReason, setShowOtherZeroTargetReason] = React.useState({});
const [formErrors, setFormErrors] = React.useState({});
@@ -2648,7 +2671,7 @@ useEffect(() => {
Data definitions
Product (HS Code – Name): Standard trade classification. Start typing to search by code or name.
Quantity (Qty): Physical output produced in the month, measured in the selected unit.
- Value (AED
): The net monthly sales value of a single product excluding VAT and any applicable duties. Do not include sales margins.
Formula: Sales Value − (VAT, Duties, etc)
+ Value (AED
): The net monthly gross sales value of a single product excluding VAT and any applicable duties. Do not include sales margins.
Formula: Gross Sales Value − (VAT, Duties, etc)
Annual Installed Capacity: Maximum achievable annual output under normal operating conditions with existing equipment; do not include extraordinary overtime.
)}
@@ -2908,7 +2931,12 @@ useEffect(() => {
-
+
+ {!shouldHidePreviousQuarter && (
{
+ )}
{
+ {!shouldHideForecast && (
{
+ )}
diff --git a/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx b/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx
index 6e615b4..f4a3a0b 100644
--- a/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx
+++ b/ipi-survey-platform/src/components/survey/ReviewSubmit/ReviewSubmit.jsx
@@ -375,6 +375,29 @@ const ReviewSubmit = ({
return '';
});
+ // Determine if we should hide PREVIOUS QUARTER section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHidePreviousQuarter = React.useMemo(() => {
+ const effectiveYear = (quarterPeriods?.current_year || year || '').toString();
+ const rawQuarter = quarterPeriods?.current_quarter || quarter || '';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return (effectiveYear === '2022' && normalizedQuarter === 'Q1') ||
+ (effectiveYear === '2025' && normalizedQuarter === 'Q1');
+ }, [quarterPeriods, year, quarter]);
+
+ // Determine if we should hide FORECAST section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHideForecast = React.useMemo(() => {
+ const effectiveYear = (quarterPeriods?.current_year || year || '').toString();
+ const rawQuarter = quarterPeriods?.current_quarter || quarter || '';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return effectiveYear === '2022' && normalizedQuarter === 'Q4';
+ }, [quarterPeriods, year, quarter]);
+
useEffect(() => {
const fetchEmiratesData = async () => {
try {
@@ -1021,24 +1044,28 @@ if (!establishment) {
Metric
{isLoading ? (
-
+ |
Loading quarters...
|
) : error ? (
-
+ |
{error}
|
) : (
<>
-
- {quarterPeriods?.previous_quarter}-{quarterPeriods?.previous_year} (Previous Quarter)
- |
+ {!shouldHidePreviousQuarter && (
+
+ {quarterPeriods?.previous_quarter}-{quarterPeriods?.previous_year} (Previous Quarter)
+ |
+ )}
{quarterPeriods?.current_quarter}-{quarterPeriods?.current_year} (Current Quarter)
|
-
- {quarterPeriods?.forecast_quarter}-{quarterPeriods?.forecast_year} (Next Quarter)
- |
+ {!shouldHideForecast && (
+
+ {quarterPeriods?.forecast_quarter}-{quarterPeriods?.forecast_year} (Next Quarter)
+ |
+ )}
>
)}
@@ -1046,21 +1073,25 @@ if (!establishment) {
{/* Second header row */}
{isLoading ? (
- | Loading months... |
+ Loading months... |
) : error ? (
- {error} |
+ {error} |
) : (
<>
{/* Previous Quarter Months */}
-
- {quarterPeriods?.previous_month?.previous_period_one}
- |
-
- {quarterPeriods?.previous_month?.previous_period_two}
- |
-
- {quarterPeriods?.previous_month?.previous_period_three}
- |
+ {!shouldHidePreviousQuarter && (
+ <>
+
+ {quarterPeriods?.previous_month?.previous_period_one}
+ |
+
+ {quarterPeriods?.previous_month?.previous_period_two}
+ |
+
+ {quarterPeriods?.previous_month?.previous_period_three}
+ |
+ >
+ )}
{/* Current Quarter Months */}
@@ -1074,15 +1105,19 @@ if (!establishment) {
|
{/* Next Quarter Months */}
-
- {quarterPeriods?.forecast_month?.forecast_period_one}
- |
-
- {quarterPeriods?.forecast_month?.forecast_period_two}
- |
-
- {quarterPeriods?.forecast_month?.forecast_period_three}
- |
+ {!shouldHideForecast && (
+ <>
+
+ {quarterPeriods?.forecast_month?.forecast_period_one}
+ |
+
+ {quarterPeriods?.forecast_month?.forecast_period_two}
+ |
+
+ {quarterPeriods?.forecast_month?.forecast_period_three}
+ |
+ >
+ )}
>
)}
@@ -1094,15 +1129,23 @@ if (!establishment) {
Quantity ({product.unit || 'units'})
|
- {product.q4_oct_quantity || '—'} |
- {product.q4_nov_quantity || '—'} |
- {product.q4_dec_quantity || '—'} |
+ {!shouldHidePreviousQuarter && (
+ <>
+ {product.q4_oct_quantity || '—'} |
+ {product.q4_nov_quantity || '—'} |
+ {product.q4_dec_quantity || '—'} |
+ >
+ )}
{product.q1_jan_quantity || '—'} |
{product.q1_feb_quantity || '—'} |
{product.q1_mar_quantity || '—'} |
- {product.q2_apr_quantity || '—'} |
- {product.q2_may_quantity || '—'} |
- {product.q2_jun_quantity || '—'} |
+ {!shouldHideForecast && (
+ <>
+ {product.q2_apr_quantity || '—'} |
+ {product.q2_may_quantity || '—'} |
+ {product.q2_jun_quantity || '—'} |
+ >
+ )}
{/* Cost Row */}
@@ -1110,15 +1153,23 @@ if (!establishment) {
Value (AED)
|
- {product.q4_oct_cost || '—'} |
- {product.q4_nov_cost || '—'} |
- {product.q4_dec_cost || '—'} |
+ {!shouldHidePreviousQuarter && (
+ <>
+ {product.q4_oct_cost || '—'} |
+ {product.q4_nov_cost || '—'} |
+ {product.q4_dec_cost || '—'} |
+ >
+ )}
{product.q1_jan_cost || '—'} |
{product.q1_feb_cost || '—'} |
{product.q1_mar_cost || '—'} |
- {product.q2_apr_cost || '—'} |
- {product.q2_may_cost || '—'} |
- {product.q2_jun_cost || '—'} |
+ {!shouldHideForecast && (
+ <>
+ {product.q2_apr_cost || '—'} |
+ {product.q2_may_cost || '—'} |
+ {product.q2_jun_cost || '—'} |
+ >
+ )}
{/* Reason Current */}
@@ -1126,9 +1177,11 @@ if (!establishment) {
Reason (Current)
|
-
- -- --
- |
+ {!shouldHidePreviousQuarter && (
+
+ -- --
+ |
+ )}
{product.otherVariationReason ? (
@@ -1138,9 +1191,11 @@ if (!establishment) {
)}
|
-
- -- --
- |
+ {!shouldHideForecast && (
+
+ -- --
+ |
+ )}
{/* Reason Forecast */}
@@ -1148,18 +1203,25 @@ if (!establishment) {
Reason (Forecast)
|
-
+ {!shouldHidePreviousQuarter && (
+ |
+ -- --
+ |
+ )}
+
-- --
|
-
-
- {product.otherZeroTargetReason ? (
- {product.otherZeroTargetReason}
- ) : (
- {product.zeroTargetReasonName?.replace('Others: ', '') || product.zeroTargetReason?.replace('Others: ', '') || '—'}
- )}
-
- |
+ {!shouldHideForecast && (
+
+
+ {product.otherZeroTargetReason ? (
+ {product.otherZeroTargetReason}
+ ) : (
+ {product.zeroTargetReasonName?.replace('Others: ', '') || product.zeroTargetReason?.replace('Others: ', '') || '—'}
+ )}
+
+ |
+ )}
diff --git a/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx b/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx
index 6951c72..aab6906 100644
--- a/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx
+++ b/ipi-survey-platform/src/pages/Admin/ValidationReview.jsx
@@ -393,6 +393,29 @@ const ValidationReview = () => {
const [additionalForecastMonths, setAdditionalForecastMonths] = React.useState(['', '', '']);
const [emirates, setEmirates] = useState([]);
+ // Determine if we should hide PREVIOUS QUARTER section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHidePreviousQuarter = React.useMemo(() => {
+ const effectiveYear = (quarterPeriods?.current_year || new Date().getFullYear()).toString();
+ const rawQuarter = quarterPeriods?.current_quarter || 'Q1';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return (effectiveYear === '2022' && normalizedQuarter === 'Q1') ||
+ (effectiveYear === '2025' && normalizedQuarter === 'Q1');
+ }, [quarterPeriods]);
+
+ // Determine if we should hide FORECAST section for specific year/quarter combinations
+ // Uses quarterPeriods (API response) as primary source since that's what drives the UI
+ const shouldHideForecast = React.useMemo(() => {
+ const effectiveYear = (quarterPeriods?.current_year || new Date().getFullYear()).toString();
+ const rawQuarter = quarterPeriods?.current_quarter || 'Q1';
+ const normalizedQuarter = rawQuarter.toString().toUpperCase().startsWith('Q')
+ ? rawQuarter.toString().toUpperCase()
+ : `Q${rawQuarter}`;
+ return effectiveYear === '2022' && normalizedQuarter === 'Q4';
+ }, [quarterPeriods]);
+
React.useEffect(() => {
const fetchSubmission = async () => {
if (!id) {
@@ -1160,31 +1183,39 @@ setAdditionalForecastMonths([
{showPreviousNext ? (
<>
{/* 12 columns when showPreviousNext is true */}
-
- {previousLabel || 'Q1 2024'} (PREVIOUS QUARTER)
- |
+ {!shouldHidePreviousQuarter && (
+
+ {previousLabel || 'Q1 2024'} (PREVIOUS QUARTER)
+ |
+ )}
{currentLabel || 'Q2 2024'} (CURRENT QUARTER)
|
{additionalForecastLabel || ''} (PREVIOUS FORECAST)
|
-
- {forecastLabel || 'Q3 2024'} (NEXT YEAR FORECAST)
- |
+ {!shouldHideForecast && (
+
+ {forecastLabel || 'Q3 2024'} (NEXT YEAR FORECAST)
+ |
+ )}
>
) : (
<>
{/* 9 columns when showPreviousNext is false */}
-
- {previousLabel || 'Q1 2024'} (PREVIOUS QUARTER)
- |
+ {!shouldHidePreviousQuarter && (
+
+ {previousLabel || 'Q1 2024'} (PREVIOUS QUARTER)
+ |
+ )}
{currentLabel || 'Q2 2024'} (CURRENT QUARTER)
|
-
- {forecastLabel || 'Q3 2024'} (NEXT YEAR FORECAST)
- |
+ {!shouldHideForecast && (
+
+ {forecastLabel || 'Q3 2024'} (NEXT YEAR FORECAST)
+ |
+ )}
>
)}
@@ -1193,15 +1224,19 @@ setAdditionalForecastMonths([
{showPreviousNext ? (
<>
{/* Previous Quarter Months */}
-
- {previousMonths?.previous_period_one || 'Jan'}
- |
-
- {previousMonths?.previous_period_two || 'Feb'}
- |
-
- {previousMonths?.previous_period_three || 'Mar'}
- |
+ {!shouldHidePreviousQuarter && (
+ <>
+
+ {previousMonths?.previous_period_one || 'Jan'}
+ |
+
+ {previousMonths?.previous_period_two || 'Feb'}
+ |
+
+ {previousMonths?.previous_period_three || 'Mar'}
+ |
+ >
+ )}
{/* Current Quarter Months */}
@@ -1226,28 +1261,36 @@ setAdditionalForecastMonths([
|
{/* Next Year Forecast Months */}
-
- {forecastMonths?.forecast_period_one || 'Oct'}
- |
-
- {forecastMonths?.forecast_period_two || 'Nov'}
- |
-
- {forecastMonths?.forecast_period_three || 'Dec'}
- |
+ {!shouldHideForecast && (
+ <>
+
+ {forecastMonths?.forecast_period_one || 'Oct'}
+ |
+
+ {forecastMonths?.forecast_period_two || 'Nov'}
+ |
+
+ {forecastMonths?.forecast_period_three || 'Dec'}
+ |
+ >
+ )}
>
) : (
<>
{/* Previous Quarter Months */}
-
- {previousMonths?.previous_period_one || 'Jan'}
- |
-
- {previousMonths?.previous_period_two || 'Feb'}
- |
-
- {previousMonths?.previous_period_three || 'Mar'}
- |
+ {!shouldHidePreviousQuarter && (
+ <>
+
+ {previousMonths?.previous_period_one || 'Jan'}
+ |
+
+ {previousMonths?.previous_period_two || 'Feb'}
+ |
+
+ {previousMonths?.previous_period_three || 'Mar'}
+ |
+ >
+ )}
{/* Current Quarter Months */}
@@ -1261,15 +1304,19 @@ setAdditionalForecastMonths([
|
{/* Next Year Forecast Months */}
-
- {forecastMonths?.forecast_period_one || 'Jul'}
- |
-
- {forecastMonths?.forecast_period_two || 'Aug'}
- |
-
- {forecastMonths?.forecast_period_three || 'Sep'}
- |
+ {!shouldHideForecast && (
+ <>
+
+ {forecastMonths?.forecast_period_one || 'Jul'}
+ |
+
+ {forecastMonths?.forecast_period_two || 'Aug'}
+ |
+
+ {forecastMonths?.forecast_period_three || 'Sep'}
+ |
+ >
+ )}
>
)}
@@ -1284,50 +1331,54 @@ setAdditionalForecastMonths([
{showPreviousNext ? (
<>
{/* Previous Quarter – Month 1 (BASE) - NO VARIANCE */}
-
-
-
- {product.previous_quantity_period_one || "0"}
-
-
- |
+ {!shouldHidePreviousQuarter && (
+ <>
+
+
+
+ {product.previous_quantity_period_one || "0"}
+
+
+ |
- {/* Previous Quarter – Month 2 */}
-
-
-
- {product.previous_quantity_period_two || "0"}
-
- {/* If previous quarter has values, show variance from 2nd column */}
- {!isPreviousQuarterAllZeros && getVarianceDisplay(
- product.previous_quantity_period_one,
- product.previous_quantity_period_two
- )}
-
- |
+ {/* Previous Quarter – Month 2 */}
+
+
+
+ {product.previous_quantity_period_two || "0"}
+
+ {/* If previous quarter has values, show variance from 2nd column */}
+ {!isPreviousQuarterAllZeros && getVarianceDisplay(
+ product.previous_quantity_period_one,
+ product.previous_quantity_period_two
+ )}
+
+ |
- {/* Previous Quarter – Month 3 */}
-
-
-
- {product.previous_quantity_period_three || "0"}
-
- {/* If previous quarter has values, show variance */}
- {!isPreviousQuarterAllZeros && getVarianceDisplay(
- product.previous_quantity_period_two,
- product.previous_quantity_period_three
- )}
-
- |
+ {/* Previous Quarter – Month 3 */}
+
+
+
+ {product.previous_quantity_period_three || "0"}
+
+ {/* If previous quarter has values, show variance */}
+ {!isPreviousQuarterAllZeros && getVarianceDisplay(
+ product.previous_quantity_period_two,
+ product.previous_quantity_period_three
+ )}
+
+ |
+ >
+ )}
{/* Current Quarter – Month 1 */}
-
+ |
{product.current_quantity_period_one || "0"}
{/* If previous quarter is all zeros, treat this as FIRST month */}
- {!isPreviousQuarterAllZeros && getVarianceDisplay(
+ {!shouldHidePreviousQuarter && !isPreviousQuarterAllZeros && getVarianceDisplay(
product.previous_quantity_period_three,
product.current_quantity_period_one
)}
@@ -1390,61 +1441,71 @@ setAdditionalForecastMonths([
})()}
{/* NEXT YEAR FORECAST Data (original from submission) */}
-
-
- {product.forecast_quantity_period_one || '0'}
- {getVarianceDisplay(product.current_quantity_period_three, product.forecast_quantity_period_one)}
-
- |
-
-
- {product.forecast_quantity_period_two || '0'}
- {getVarianceDisplay(product.forecast_quantity_period_one, product.forecast_quantity_period_two)}
-
- |
-
-
- {product.forecast_quantity_period_three || '0'}
- {getVarianceDisplay(product.forecast_quantity_period_two, product.forecast_quantity_period_three)}
-
- |
+ {!shouldHideForecast && (
+ <>
+
+
+ {product.forecast_quantity_period_one || '0'}
+ {getVarianceDisplay(product.current_quantity_period_three, product.forecast_quantity_period_one)}
+
+ |
+
+
+ {product.forecast_quantity_period_two || '0'}
+ {getVarianceDisplay(product.forecast_quantity_period_one, product.forecast_quantity_period_two)}
+
+ |
+
+
+ {product.forecast_quantity_period_three || '0'}
+ {getVarianceDisplay(product.forecast_quantity_period_two, product.forecast_quantity_period_three)}
+
+ |
+ >
+ )}
>
) : (
<>
{/* Previous Quarter – Month 1 */}
-
-
- {product.previous_quantity_period_one || '0'}
-
- |
+ {!shouldHidePreviousQuarter && (
+
+
+ {product.previous_quantity_period_one || '0'}
+
+ |
+ )}
{/* Previous Quarter – Month 2 */}
-
-
- {product.previous_quantity_period_two || '0'}
- {!isPreviousQuarterAllZeros && getVarianceDisplay(
- product.previous_quantity_period_one,
- product.previous_quantity_period_two
- )}
-
- |
+ {!shouldHidePreviousQuarter && (
+
+
+ {product.previous_quantity_period_two || '0'}
+ {!isPreviousQuarterAllZeros && getVarianceDisplay(
+ product.previous_quantity_period_one,
+ product.previous_quantity_period_two
+ )}
+
+ |
+ )}
{/* Previous Quarter – Month 3 */}
-
-
- {product.previous_quantity_period_three || '0'}
- {!isPreviousQuarterAllZeros && getVarianceDisplay(
- product.previous_quantity_period_two,
- product.previous_quantity_period_three
- )}
-
- |
+ {!shouldHidePreviousQuarter && (
+
+
+ {product.previous_quantity_period_three || '0'}
+ {!isPreviousQuarterAllZeros && getVarianceDisplay(
+ product.previous_quantity_period_two,
+ product.previous_quantity_period_three
+ )}
+
+ |
+ )}
{/* Current Quarter – Month 1 */}
-
+ |
{product.current_quantity_period_one || '0'}
- {!isPreviousQuarterAllZeros && getVarianceDisplay(
+ {!shouldHidePreviousQuarter && !isPreviousQuarterAllZeros && getVarianceDisplay(
product.previous_quantity_period_three,
product.current_quantity_period_one
)}
@@ -1517,45 +1578,49 @@ setAdditionalForecastMonths([
{showPreviousNext ? (
<>
{/* Previous Cost – Month 1 (BASE) - NO VARIANCE */}
-
-
-
- {product.previous_cost_period_one || "0"}
-
-
- |
+ {!shouldHidePreviousQuarter && (
+ <>
+
+
+
+ {product.previous_cost_period_one || "0"}
+
+
+ |
- {/* Previous Cost – Month 2 */}
-
-
-
- {product.previous_cost_period_two || "0"}
-
- {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
- product.previous_cost_period_one,
- product.previous_cost_period_two
- )}
-
- |
+ {/* Previous Cost – Month 2 */}
+
+
+
+ {product.previous_cost_period_two || "0"}
+
+ {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
+ product.previous_cost_period_one,
+ product.previous_cost_period_two
+ )}
+
+ |
- {/* Previous Cost – Month 3 */}
-
-
-
- {product.previous_cost_period_three || "0"}
-
- {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
- product.previous_cost_period_two,
- product.previous_cost_period_three
- )}
-
- |
+ {/* Previous Cost – Month 3 */}
+
+
+
+ {product.previous_cost_period_three || "0"}
+
+ {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
+ product.previous_cost_period_two,
+ product.previous_cost_period_three
+ )}
+
+ |
+ >
+ )}
{/* Current Quarter Cost – Month 1 */}
-
+ |
{product.current_cost_period_one || '0'}
- {!isPreviousQuarterCostAllZeros && getVarianceDisplay(product.previous_cost_period_three, product.current_cost_period_one)}
+ {!shouldHidePreviousQuarter && !isPreviousQuarterCostAllZeros && getVarianceDisplay(product.previous_cost_period_three, product.current_cost_period_one)}
|
@@ -1599,61 +1664,71 @@ setAdditionalForecastMonths([
})()}
{/* NEXT YEAR FORECAST Cost (original from submission) */}
- |
-
- {product.forecast_cost_period_one || '0'}
- {getVarianceDisplay(product.current_cost_period_three, product.forecast_cost_period_one)}
-
- |
-
-
- {product.forecast_cost_period_two || '0'}
- {getVarianceDisplay(product.forecast_cost_period_one, product.forecast_cost_period_two)}
-
- |
-
-
- {product.forecast_cost_period_three || '0'}
- {getVarianceDisplay(product.forecast_cost_period_two, product.forecast_cost_period_three)}
-
- |
+ {!shouldHideForecast && (
+ <>
+
+
+ {product.forecast_cost_period_one || '0'}
+ {getVarianceDisplay(product.current_cost_period_three, product.forecast_cost_period_one)}
+
+ |
+
+
+ {product.forecast_cost_period_two || '0'}
+ {getVarianceDisplay(product.forecast_cost_period_one, product.forecast_cost_period_two)}
+
+ |
+
+
+ {product.forecast_cost_period_three || '0'}
+ {getVarianceDisplay(product.forecast_cost_period_two, product.forecast_cost_period_three)}
+
+ |
+ >
+ )}
>
) : (
<>
{/* Previous Cost – Month 1 */}
-
-
- {product.previous_cost_period_one || '0'}
-
- |
+ {!shouldHidePreviousQuarter && (
+
+
+ {product.previous_cost_period_one || '0'}
+
+ |
+ )}
{/* Previous Cost – Month 2 */}
-
-
- {product.previous_cost_period_two || '0'}
- {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
- product.previous_cost_period_one,
- product.previous_cost_period_two
- )}
-
- |
+ {!shouldHidePreviousQuarter && (
+
+
+ {product.previous_cost_period_two || '0'}
+ {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
+ product.previous_cost_period_one,
+ product.previous_cost_period_two
+ )}
+
+ |
+ )}
{/* Previous Cost – Month 3 */}
-
-
- {product.previous_cost_period_three || '0'}
- {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
- product.previous_cost_period_two,
- product.previous_cost_period_three
- )}
-
- |
+ {!shouldHidePreviousQuarter && (
+
+
+ {product.previous_cost_period_three || '0'}
+ {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
+ product.previous_cost_period_two,
+ product.previous_cost_period_three
+ )}
+
+ |
+ )}
{/* Current Cost – Month 1 */}
-
+ |
{product.current_cost_period_one || '0'}
- {!isPreviousQuarterCostAllZeros && getVarianceDisplay(
+ {!shouldHidePreviousQuarter && !isPreviousQuarterCostAllZeros && getVarianceDisplay(
product.previous_cost_period_three,
product.current_cost_period_one
)}
@@ -1683,37 +1758,43 @@ setAdditionalForecastMonths([
|
{/* Forecast Cost – Month 1 */}
-
-
- {product.forecast_cost_period_one || '0'}
- {getVarianceDisplay(
- product.current_cost_period_three,
- product.forecast_cost_period_one
- )}
-
- |
+ {!shouldHideForecast && (
+
+
+ {product.forecast_cost_period_one || '0'}
+ {getVarianceDisplay(
+ product.current_cost_period_three,
+ product.forecast_cost_period_one
+ )}
+
+ |
+ )}
{/* Forecast Cost – Month 2 */}
-
-
- {product.forecast_cost_period_two || '0'}
- {getVarianceDisplay(
- product.forecast_cost_period_one,
- product.forecast_cost_period_two
- )}
-
- |
+ {!shouldHideForecast && (
+
+
+ {product.forecast_cost_period_two || '0'}
+ {getVarianceDisplay(
+ product.forecast_cost_period_one,
+ product.forecast_cost_period_two
+ )}
+
+ |
+ )}
{/* Forecast Cost – Month 3 */}
-
-
- {product.forecast_cost_period_three || '0'}
- {getVarianceDisplay(
- product.forecast_cost_period_two,
- product.forecast_cost_period_three
- )}
-
- |
+ {!shouldHideForecast && (
+
+
+ {product.forecast_cost_period_three || '0'}
+ {getVarianceDisplay(
+ product.forecast_cost_period_two,
+ product.forecast_cost_period_three
+ )}
+
+ |
+ )}
>
)}
@@ -1724,9 +1805,11 @@ setAdditionalForecastMonths([
|
{showPreviousNext ? (
<>
-
- –
- |
+ {!shouldHidePreviousQuarter && (
+
+ –
+ |
+ )}
{product.other_variation_reason ||
(product?.variation_reason?.reason ?
@@ -1738,18 +1821,19 @@ setAdditionalForecastMonths([
|
–
|
- {/* Next Year Forecast (colSpan 3) */}
-
- –
- |
+ {!shouldHideForecast && (
+
+ –
+ |
+ )}
>
) : (
<>
- {/* Previous Quarter (colSpan 3) */}
-
- –
- |
- {/* Current Quarter (colSpan 3) */}
+ {!shouldHidePreviousQuarter && (
+
+ –
+ |
+ )}
{product.other_variation_reason ||
(product?.variation_reason?.reason ?
@@ -1757,10 +1841,11 @@ setAdditionalForecastMonths([
: 'No reason provided')
}
|
- {/* Next Year Forecast (colSpan 3) */}
-
- –
- |
+ {!shouldHideForecast && (
+
+ –
+ |
+ )}
>
)}
@@ -1771,38 +1856,46 @@ setAdditionalForecastMonths([
|
{showPreviousNext ? (
<>
+ {!shouldHidePreviousQuarter && (
+
+ –
+ |
+ )}
–
|
–
|
-
- –
- |
-
- {product.other_zero_target_reason ||
- (product?.zero_target_reason?.reason ?
- (product.zero_target_reason.reason.startsWith('Other (specify)') ? '' : product.zero_target_reason.reason)
- : 'No reason provided')
- }
- |
+ {!shouldHideForecast && (
+
+ {product.other_zero_target_reason ||
+ (product?.zero_target_reason?.reason ?
+ (product.zero_target_reason.reason.startsWith('Other (specify)') ? '' : product.zero_target_reason.reason)
+ : 'No reason provided')
+ }
+ |
+ )}
>
) : (
<>
+ {!shouldHidePreviousQuarter && (
+
+ –
+ |
+ )}
–
|
-
- –
- |
-
- {product.other_zero_target_reason ||
- (product?.zero_target_reason?.reason ?
- (product.zero_target_reason.reason.startsWith('Other (specify)') ? '' : product.zero_target_reason.reason)
- : 'No reason provided')
- }
- |
+ {!shouldHideForecast && (
+
+ {product.other_zero_target_reason ||
+ (product?.zero_target_reason?.reason ?
+ (product.zero_target_reason.reason.startsWith('Other (specify)') ? '' : product.zero_target_reason.reason)
+ : 'No reason provided')
+ }
+ |
+ )}
>
)}
diff --git a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
index dc1c335..69d58ca 100644
--- a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
+++ b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx
@@ -2567,6 +2567,16 @@ const handleView = async (id) => {
}
}
+ // ISIC code validation for industryCodeBusiness field
+ if (field === 'industryCodeBusiness' && value) {
+ if (!/^\d+$/.test(value)) {
+ return 'ISIC code must contain only digits';
+ }
+ if (value.length < 10 || value.length > 32) {
+ return 'Industry Code must be between 10 and 32 digits';
+ }
+ }
+
const numericFields = [
'employmentEmiratiMale',
'employmentEmiratiFemale',