This commit is contained in:
Malini 2026-01-27 18:39:43 +05:30
parent 8c708f9bd7
commit 0b480b0aae
3 changed files with 16 additions and 10 deletions

View File

@ -146,6 +146,8 @@ const EstablishmentInfo = ({
endDate: data.end_date || ''
};
localStorage.setItem('currentSurveyPeriod', JSON.stringify(surveyPeriod));
localStorage.setItem('currentQuarter', data.quarter); // Store quarter separately
localStorage.setItem('currentYear', data.year);
return surveyPeriod;
}
@ -154,6 +156,8 @@ const EstablishmentInfo = ({
const { quarter, year, endDate } = location.state.survey;
const surveyPeriod = { quarter, year, endDate };
localStorage.setItem('currentSurveyPeriod', JSON.stringify(surveyPeriod));
localStorage.setItem('currentQuarter', quarter); // Store quarter separately
localStorage.setItem('currentYear', year); // Store year separately
return surveyPeriod;
}
@ -394,7 +398,7 @@ const EstablishmentInfo = ({
day: 'numeric'
})
) : (
<span className="text-amber-600">To be announced</span>
<span className="text-amber-600">-</span>
)}
</span>
</div>

View File

@ -1211,7 +1211,7 @@ const location = useLocation();
day: 'numeric'
})
) : (
<span className="text-amber-600">To be announced</span>
<span className="text-amber-600">-</span>
);
})()}
</div>

View File

@ -351,15 +351,17 @@ const ReviewSubmit = ({
const fetchQuarterPeriods = async () => {
try {
setIsLoading(true);
const savedSurveyPeriod = localStorage.getItem('currentSurveyPeriod');
if (!savedSurveyPeriod) {
throw new Error('No survey period found in localStorage');
}
// const savedSurveyPeriod = localStorage.getItem('currentSurveyPeriod');
// if (!savedSurveyPeriod) {
// throw new Error('No survey period found in localStorage');
// }
const { quarter, year } = JSON.parse(savedSurveyPeriod);
if (!quarter || !year) {
throw new Error('Incomplete survey period data');
}
// const { quarter, year } = JSON.parse(savedSurveyPeriod);
// if (!quarter || !year) {
// throw new Error('Incomplete survey period data');
// }
const quarter = localStorage.getItem('currentQuarter');
const year = localStorage.getItem('currentYear');
const response = await getQuarterPeriods(year, quarter);
if (response.status === 'success') {