diff --git a/ipi-survey-platform/src/components/admin/SubmissionTable.jsx b/ipi-survey-platform/src/components/admin/SubmissionTable.jsx index 5229c97..86c4bbe 100644 --- a/ipi-survey-platform/src/components/admin/SubmissionTable.jsx +++ b/ipi-survey-platform/src/components/admin/SubmissionTable.jsx @@ -84,10 +84,16 @@ const SubmissionTable = ({ selectedQuarter, selectedYear }) => { Rejected ); - } else if (normalized === 'pending') { + } else if (normalized === 'submitted') { return ( - Pending + Submitted + + ); + } else if (normalized === 'resubmitted') { + return ( + + Resubmitted ); } else { @@ -133,12 +139,14 @@ const SubmissionTable = ({ selectedQuarter, selectedYear }) => { return (
| - Q4-2024 (Previous Quarter) + {quarterPeriods?.previous_quarter}-{quarterPeriods?.previous_year} (Previous Quarter) | - Q1-2025 (Current Quarter) + {quarterPeriods?.current_quarter}-{quarterPeriods?.current_year} (Current Quarter) | - Q2-2025 (Next Quarter) + {quarterPeriods?.forecast_quarter}-{quarterPeriods?.forecast_year} (Next Quarter) | |||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Oct | -Nov | -Dec | +{quarterPeriods?.current_month?.current_period_one} | +{quarterPeriods?.current_month?.current_period_two} | +{quarterPeriods?.current_month?.current_period_three} | -Jan | -Feb | -Mar | +{quarterPeriods?.forecast_month?.forecast_period_one} | +{quarterPeriods?.forecast_month?.forecast_period_two} | +{quarterPeriods?.forecast_month?.forecast_period_three} | -Apr | -May | -Jun | +{quarterPeriods?.previous_month?.previous_period_one} | +{quarterPeriods?.previous_month?.previous_period_two} | +{quarterPeriods?.previous_month?.previous_period_three} | ||||||||||||||||||||||||||||||||
| - Quantity (liters) - | -1200 | -1180 ▼ | -1250 ▲ | + {submissionData?.products?.map((product, idx) => ( +||||||||||||||||||||||||||||||||||||||||||||||
| + Quantity ({product.unit?.uom || 'units'}) + | + {/* Previous Quarter Quantities */} ++ {product.previous_quantity_period_one || '0'} + | ++ {product.previous_quantity_period_two || '0'} + | ++ {product.previous_quantity_period_three || '0'} + | + + {/* Current Quarter Quantities */} ++ {product.current_quantity_period_one || '0'} + | ++ {product.current_quantity_period_two || '0'} + | ++ {product.current_quantity_period_three || '0'} + | + + {/* Forecast Quarter Quantities */} ++ {product.forecast_quantity_period_one || '0'} + | ++ {product.forecast_quantity_period_two || '0'} + | ++ {product.forecast_quantity_period_three || '0'} + | +1280 | -1340 | -1375 | + {/* Cost Row */} +|||||||||||||||||||||||||||||||||||||
| + Cost (AED) + | + {/* Previous Quarter Costs */} ++ {product.previous_cost_period_one || '0'} + | ++ {product.previous_cost_period_two || '0'} + | ++ {product.previous_cost_period_three || '0'} + | + + {/* Current Quarter Costs */} ++ {product.current_cost_period_one || '0'} + | ++ {product.current_cost_period_two || '0'} + | ++ {product.current_cost_period_three || '0'} + | + + {/* Forecast Quarter Costs */} ++ {product.forecast_cost_period_one || '0'} + | ++ {product.forecast_cost_period_two || '0'} + | ++ {product.forecast_cost_period_three || '0'} + | +||||||||||||||||||||||||||||||||||||||||
| + Remarks + | ++ {product.remarks} + | +||||||||||||||||||||||||||||||||||||||||||||||||
| + Reason (Current) + | +-- | +
+ {product.variation_reason?.reason || 'No reason provided'}
+ {product.other_variation_reason && (
+ Note: {product.other_variation_reason}
+ )}
+ |
+ -- | +1400 | -1450 | -1500 | -|||||||||||||||||||||||||||||||||||||||||||
| - Cost (AED) - | -39,000 | -37,500 ▼ | -41,000 ▲ | - -40,000 | -42,000 | -43,500 | - -44,000 | -45,000 | -46,000 | -||||||||||||||||||||||||||||||||||||||||
| - Reason (Current) - | --- | -- Seasonal Increase - | --- | -||||||||||||||||||||||||||||||||||||||||||||||
| - Reason (Forecast) - | --- | --- | -- Projected demand - | -||||||||||||||||||||||||||||||||||||||||||||||
| + Reason (Forecast) + | +-- | +-- | +
+ {product.zero_target_reason?.reason || 'No reason provided'}
+ {product.other_zero_target_reason && (
+ Note: {product.other_zero_target_reason}
+ )}
+ |
+ ||||||||||||||||||||||||||||||||||||||||||||||
- Green ▲ indicates upward trend;{' '} - Red ▼ indicates downward trend compared to previous month or quarter -
-- Remarks: NA -
-+ Green ▲ indicates upward trend;{' '} + Red ▼ indicates downward trend compared to previous month or quarter +
*/} ++ Remarks: NA +
No products found for this submission.
diff --git a/ipi-survey-platform/src/pages/Admin/Validations.jsx b/ipi-survey-platform/src/pages/Admin/Validations.jsx index e0d101d..3547d31 100644 --- a/ipi-survey-platform/src/pages/Admin/Validations.jsx +++ b/ipi-survey-platform/src/pages/Admin/Validations.jsx @@ -13,6 +13,8 @@ const STATUS_VARIANTS = { Approved: { background: '#F3FAF4', text: '#2F663C', border: '#F3FAF4' }, Pending: { background: '#E7F5FF', text: '#286CFF', border: '#E7F5FF' }, Rejected: { background: '#FEF2F2', text: '#B52520', border: '#FEF2F2' }, + Resubmitted: { background: '#F9F7ED', text: '#7C5E24', border: '#FEF2F2' }, + Submitted: { background: '#E7F5FF', text: '#003CFF', border: '#FEF2F2' }, }; const SUMMARY_VARIANTS = { @@ -20,8 +22,12 @@ const SUMMARY_VARIANTS = { approved: { background: '#F3FAF4', label: '#2F663C', value: '#232528' }, pending: { background: '#E7F5FF', label: '#003CFF', value: '#232528' }, rejected: { background: '#FEF2F2', label: '#B52520', value: '#232528' }, + resubmitted: { background: '#F9F7ED', text: '#7C5E24', border: '#FEF2F2' }, + submitted: { background: '#E7F5FF', text: '#003CFF', border: '#FEF2F2' }, + }; + const formatDateTime = (value) => { if (!value) return '—'; const date = new Date(value); diff --git a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx index c4ee233..49f77eb 100644 --- a/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx +++ b/ipi-survey-platform/src/pages/Admin/configuration/CompanyProfile.jsx @@ -1947,6 +1947,7 @@ const requiredFields = [ factory_name: form.establishmentName || form.contactName || '', permanent_factory_code: form.permanentFactoryCode || '', industry_code: form.industryCodeBusiness || form.industryCodeCurrent || '', + industry_code_production: form.industryCodeBusiness || form.industryCodeCurrent || '', license_number: form.uniqueLicenseNumber || '', isic_code: form.isicCode || form.industryCodeBusiness || '', description: form.industryDescription || '', @@ -2025,6 +2026,7 @@ const requiredFields = [ factory_name: form.establishmentName || form.contactName || '', permanent_factory_code: form.permanentFactoryCode || '', industry_code: form.industryCodeBusiness || form.industryCodeCurrent || '', + industry_code_production: form.industryCodeBusiness || form.industryCodeCurrent || '', license_number: form.uniqueLicenseNumber || '', isic_code: form.isicCode || form.industryCodeBusiness || '', description: form.industryDescription || '', diff --git a/ipi-survey-platform/src/pages/History/History.jsx b/ipi-survey-platform/src/pages/History/History.jsx index a220858..3f20cfc 100644 --- a/ipi-survey-platform/src/pages/History/History.jsx +++ b/ipi-survey-platform/src/pages/History/History.jsx @@ -11,15 +11,40 @@ const BreadcrumbVector = '/assets/images/Breadcrumb-vector.svg'; const caretDownSrc = '/assets/images/CaretDown.svg'; const Badge = ({ variant = 'default', children }) => { + // Define all possible status variants and their styles const styles = { - approved: 'bg-[#F3FAF4] text-[#2F663C]', - submitted: 'bg-[#E7F5FF] text-[#003CFF]', - pending: 'bg-[#F9F7ED] text-[#7C5E24]', - rejected: 'bg-[#FEF2F2] text-[#B52520]', - default: 'bg-gray-50 text-gray-700', + // Approved status + approved: 'text-green-700 bg-green-50', + + // Submitted status + submitted: 'text-green-700 bg-green-50', + + // Under Review status (includes pending and in-progress) + 'under review': 'text-blue-600 bg-blue-50', + pending: 'text-blue-600 bg-blue-50', + 'in-progress': 'text-blue-600 bg-blue-50', + + // Rejected status (includes returned) + rejected: 'text-red-600 bg-red-50', + returned: 'text-red-600 bg-red-50', + + // Resubmitted status + resubmitted: 'text-[#7C5E24] bg-[#F9F7ED]', + + // Default fallback + default: 'text-gray-600 bg-gray-50', }; + + // Normalize the variant key + const normalizedVariant = String(variant || '').toLowerCase().trim(); + + // Get the appropriate style, fallback to default if not found + const style = styles[normalizedVariant] || styles.default; + return ( - + {children} ); @@ -180,8 +205,9 @@ const formatExportDateTime = (value) => { const text = String(status || '').toLowerCase(); if (text === 'approved') return 'approved'; if (text === 'submitted') return 'submitted'; - if (text === 'rejected') return 'rejected'; - if (text === 'pending' || text === 'in-progress' || text === 'under review') return 'pending'; + if (text === 'resubmitted') return 'resubmitted'; + if (text === 'rejected' || text === 'returned') return 'rejected'; + if (text === 'pending' || text === 'in-progress' || text === 'under review') return 'under review'; return 'default'; }, []); @@ -375,7 +401,7 @@ const filteredRows = useMemo(() => { 'Quarter', 'HS Code', 'Product', - 'Status', + { name: 'Status', className: 'text-center' }, 'Actors', 'Details' ]; @@ -850,14 +876,24 @@ const tableRows = auditHistory.map((entry, index) => { loading={loading} error={error} className="mt-4" - pagination={{ - currentPage: pagination.currentPage, - onPageChange: handlePageChange, - pageSize: pagination.pageSize, - totalItems: pagination.totalItems, - pageSizeOptions: [10, 25, 50, 100], - onPageSizeChange: handlePageSizeChange, - }} + columnWidths={[ + { width: 180, style: { whiteSpace: 'normal', wordWrap: 'break-word' } }, // Submission Date + { width: 80, style: { whiteSpace: 'normal', wordWrap: 'break-word' } }, // Year + { width: 80, style: { whiteSpace: 'normal', wordWrap: 'break-word' } }, // Quarter + { width: 120, style: { whiteSpace: 'normal', wordWrap: 'break-word' } }, // HS Code + { width: 200, style: { whiteSpace: 'normal', wordWrap: 'break-word' } }, // Product + { width: 130, align: 'center', style: { whiteSpace: 'normal', wordWrap: 'break-word' } }, // Status + { width: 140, style: { whiteSpace: 'normal', wordWrap: 'break-word' } }, // Actors + { width: 270, style: { whiteSpace: 'normal', wordWrap: 'break-word' } } // Details + ]} + pagination={{ + currentPage: pagination.currentPage, + onPageChange: handlePageChange, + pageSize: pagination.pageSize, + totalItems: pagination.totalItems, + pageSizeOptions: [10, 25, 50, 100], + onPageSizeChange: handlePageSizeChange, + }} renderCell={(value, ri, ci) => { if (ci === 5) { // Status column return- Thank you. Your IP Quarterly Survey for {establishmentData?.quarter} {establishmentData?.year} has been submitted. + Thank you. Your IP Quarterly Survey for {establishmentData?.quarter} {establishmentData?.year} has been {isResubmit ? 'resubmitted' : 'submitted'}.
{/* Button */}