This commit is contained in:
Malini 2025-12-12 16:02:02 +05:30
parent 0c3349e136
commit 7cee26ccdb
4 changed files with 4 additions and 92 deletions

View File

@ -226,24 +226,6 @@ const validateCSVFile = (file, existingEstablishments = []) => {
// Parse header
const headers = lines[0].split(',').map(h => h.trim().replace(/"/g, ''));
// Check required headers
// const requiredHeaders = ['Establishment Id', 'Factory Name', 'Email', 'Emirate'];
// const missingHeaders = requiredHeaders.filter(header =>
// !headers.some(h => h.toLowerCase() === header.toLowerCase())
// );
// if (missingHeaders.length > 0) {
// reject({
// type: 'header_validation',
// message: `Missing required headers: ${missingHeaders.join(', ')}`,
// details: missingHeaders.map(header => ({
// header,
// message: `Missing required header: ${header}`
// }))
// });
// return;
// }
const establishmentIdIndex = headers.findIndex(h =>
h.toLowerCase().includes('establishment') && h.toLowerCase().includes('id')

View File

@ -4,8 +4,6 @@ import apiClient from '@/services/api/apiClient';
import { VALIDATION_MESSAGES } from '@/constants/validationMessages';
import { ASSETS } from '@/constants/assets';
// const logoSrc = ASSETS.IMAGES.LOGO;
const ToggleableInput = ({
label,
type = "password",

View File

@ -90,39 +90,6 @@ const History = () => {
loadHscodeOptions();
}, []);
// useEffect(() => {
// const loadAuditHistory = async () => {
// setIsLoadingAudit(true);
// try {
// const establishmentId = resolveEstablishmentId();
// if (!establishmentId) {
// console.error('No establishment ID found');
// setIsLoadingAudit(false);
// return;
// }
// const response = await getSubmissionAuditHistory(establishmentId, {
// year: yearFilter || undefined,
// quarter: quarterFilter || undefined,
// product_id: hscodeFilter || undefined
// });
// setAuditHistory(response?.data || []);
// setPagination(prev => ({
// ...prev,
// totalItems: response?.data?.length,
// currentPage: 1,
// }));
// } catch (error) {
// console.error('Error loading audit history:', error);
// setAuditHistory([]);
// } finally {
// setIsLoadingAudit(false);
// }
// };
// loadAuditHistory();
// }, [yearFilter, quarterFilter, hscodeFilter]);
useEffect(() => {
const loadAuditHistory = async () => {
setIsLoadingAudit(true);
@ -353,13 +320,13 @@ const filteredRows = useMemo(() => {
return Number(num).toLocaleString('en-IN');
};
// 🟨 Added for expand/collapse logic
// Added for expand/collapse logic
const [expandedRow, setExpandedRow] = React.useState(null);
const handleToggleDetails = (rowIndex) => {
setExpandedRow(expandedRow === rowIndex ? null : rowIndex);
};
// 🟩 Updated tableRows with expandable details
// Updated tableRows with expandable details
const handlePageChange = React.useCallback((page) => {
setPagination(prev => ({
...prev,
@ -747,7 +714,7 @@ const tableRows = auditHistory.map((entry, index) => {
{hscodeOptions.map((option) => (
<option
key={option.id}
value={option.product_name} // this is the fix
value={option.product_name} //this is the fix
>
{option.hs_code
? `${option.hs_code} - ${option.product_name || ""}`.trim()
@ -847,19 +814,7 @@ const tableRows = auditHistory.map((entry, index) => {
{filteredRows.length === 0 && !loading ? (
<div className="w-full flex flex-col h-5items-center justify-start pt-1 pb-7 text-center">
<div className="w-full max-w-md mx-auto">
{/* <svg
className="w-16 h-16 text-gray-400 mx-auto mb-2"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
</svg> */}
<h3 className="text-lg font-medium text-[#92722A] pt-4 text-center">No submissions History found</h3>
{/* <p className="mt-1 text-sm text-gray-500">
No submission history is available for the current filters
</p> */}
</div>
</div>
) : (
@ -891,20 +846,6 @@ const tableRows = auditHistory.map((entry, index) => {
if (ci === 5) { // Status column
return <Badge variant={toVariant(filteredRows[ri]?.status)}>{formatStatus(filteredRows[ri]?.status)}</Badge>;
}
// if (ci === 6) {
// const submission = filteredRows[ri];
// const disabled = !submission;
// return (
// <button
// className={`text-[#92722A] hover:underline ${disabled ? 'cursor-not-allowed opacity-50 hover:no-underline' : ''}`}
// type="button"
// disabled={disabled}
// onClick={() => handleViewDetails(submission)}
// >
// {String(value)}
// </button>
// );
// }
return value;
}}
/>

View File

@ -128,7 +128,7 @@ const Overview = () => {
setPagination(prev => ({
...prev,
pageSize: newSize,
currentPage: 1 // Reset to first page when changing page size
currentPage: 1
}));
};
@ -235,15 +235,6 @@ const Overview = () => {
<div className="min-h-screen bg-[#F8FAFC]">
<HeaderBar />
<main className="max-w-[1280px] mx-auto px-4 py-6">
{/* <button
onClick={() => setSelectedSubmission(null)}
className="mb-4 flex items-center text-[#9E792B] hover:text-[#7b5f22] font-medium"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 mr-1" viewBox="0 0 20 20" fill="currentColor">
<path fillRule="evenodd" d="M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z" clipRule="evenodd" />
</svg>
Back to Submissions
</button> */}
<DetailedOverview submission={selectedSubmission} onBack={() => setSelectedSubmission(null)} />
</main>
</div>