diff --git a/ipi-survey-platform/public/assets/images/Vector-rejected.svg b/ipi-survey-platform/public/assets/images/Vector-rejected.svg new file mode 100644 index 0000000..79d649d --- /dev/null +++ b/ipi-survey-platform/public/assets/images/Vector-rejected.svg @@ -0,0 +1,3 @@ + + + diff --git a/ipi-survey-platform/src/components/common/Table.jsx b/ipi-survey-platform/src/components/common/Table.jsx index 4ffeb93..891f5fe 100644 --- a/ipi-survey-platform/src/components/common/Table.jsx +++ b/ipi-survey-platform/src/components/common/Table.jsx @@ -77,8 +77,9 @@ const Table = ({ const safeCurrentPage = enablePagination ? Math.min(Math.max(currentPage, 1), totalPages) : 1; const startIndex = enablePagination ? (safeCurrentPage - 1) * pageSize : 0; const endIndex = enablePagination ? startIndex + pageSize : rows.length; + // Calculate range start and end, handling the case when there are no items const rangeStart = totalItems === 0 ? 0 : startIndex + 1; - const rangeEnd = enablePagination ? Math.min(endIndex, totalItems) : rows.length; + const rangeEnd = totalItems === 0 ? 0 : (enablePagination ? Math.min(endIndex, totalItems) : rows.length); const displayedRows = React.useMemo(() => { if (!enablePagination) return rows; diff --git a/ipi-survey-platform/src/components/overview/DetailedOverview.jsx b/ipi-survey-platform/src/components/overview/DetailedOverview.jsx index c7effa9..1940f75 100644 --- a/ipi-survey-platform/src/components/overview/DetailedOverview.jsx +++ b/ipi-survey-platform/src/components/overview/DetailedOverview.jsx @@ -489,6 +489,15 @@ export const DetailedOverview = ({ submission, onBack }) => { pagination={tablePagination} /> + ); }; diff --git a/ipi-survey-platform/src/components/overview/ProductDetails.jsx b/ipi-survey-platform/src/components/overview/ProductDetails.jsx index 6029a2c..198cbec 100644 --- a/ipi-survey-platform/src/components/overview/ProductDetails.jsx +++ b/ipi-survey-platform/src/components/overview/ProductDetails.jsx @@ -37,10 +37,12 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh rejected: { type: 'rejected', bgColor: 'bg-red-50', - textColor: '#D83731', + textColor: 'text-red-600', iconColor: 'text-red-500', message: 'Your survey has been rejected. Please review and resubmit.', - // icon: 'warning-circle-fill-1.svg' + icon: '/assets/images/Vector-rejected.svg', + iconAlt: 'Rejected', + iconClassName: 'mr-2 h-5 w-5 flex-shrink-0' }, submitted: { type: 'submitted', @@ -146,18 +148,11 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh /> ) : toast.type === 'rejected' ? ( - - - + {toast.iconAlt ) : ( -
+
{/* Basic Information */}
@@ -353,7 +348,7 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh {formattedProduct.remarks}
- + {/* Submission Info */} {/*
@@ -380,6 +375,15 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh
*/}
+
); }; diff --git a/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx b/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx index a69ba34..a15ba74 100644 --- a/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx +++ b/ipi-survey-platform/src/components/survey/ProductData/ProductData.jsx @@ -178,12 +178,25 @@ const ProductData = ({ const [unitsError, setUnitsError] = React.useState(''); const [activeTab, setActiveTab] = React.useState('current'); const [isInitialLoad, setIsInitialLoad] = React.useState(true); - const [remarks, setRemarks] = React.useState(''); + const [remarks, setRemarks] = React.useState(() => { + if (typeof window !== 'undefined') { + const savedRemarks = localStorage.getItem('surveyRemarks'); + return savedRemarks || ''; + } + return ''; + }); const [formErrors, setFormErrors] = React.useState({}); const [quarterPeriods, setQuarterPeriods] = useState(null); const [isLoadingPeriods, setIsLoadingPeriods] = useState(false); - // Fetch quarter periods when component mounts or quarter/year changes + const handleRemarksChange = (e) => { + const newRemarks = e.target.value; + setRemarks(newRemarks); + if (typeof window !== 'undefined') { + localStorage.setItem('surveyRemarks', newRemarks); + } + }; + useEffect(() => { const fetchQuarterPeriods = async () => { if (!quarter || !year) return; @@ -1239,7 +1252,7 @@ const ProductData = ({