diff --git a/ipi-survey-platform/src/components/common/Table.jsx b/ipi-survey-platform/src/components/common/Table.jsx
index 4ffeb93..a668498 100644
--- a/ipi-survey-platform/src/components/common/Table.jsx
+++ b/ipi-survey-platform/src/components/common/Table.jsx
@@ -135,16 +135,16 @@ const Table = ({
'h-9 px-2 text-sm text-[#232528] disabled:text-[#C3C6CB] disabled:cursor-not-allowed transition-colors flex items-center gap-2 hover:text-[#92722A]';
return (
-
+
{beforeHeader}
-
diff --git a/ipi-survey-platform/src/pages/History/History.jsx b/ipi-survey-platform/src/pages/History/History.jsx
index 60c3a86..8239e7a 100644
--- a/ipi-survey-platform/src/pages/History/History.jsx
+++ b/ipi-survey-platform/src/pages/History/History.jsx
@@ -1,8 +1,9 @@
-import React from 'react';
+import React, { useEffect, useState, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import Table from '@/components/common/Table';
import HeaderBar from '@/components/layout/HeaderBar';
import { fetchSubmissionHistory } from '@/services/submissions/submissionService.js';
+import { fetchProducts } from '@/services/masters/masterService';
const searchIconSrc = '/assets/images/material-symbols_search-rounded.svg';
const BreadcrumbVector = '/assets/images/Breadcrumb-vector.svg';
@@ -31,6 +32,9 @@ const History = () => {
const [statusFilter, setStatusFilter] = React.useState('all');
const [yearFilter, setYearFilter] = React.useState('');
const [quarterFilter, setQuarterFilter] = React.useState('');
+ const [hscodeFilter, setHscodeFilter] = React.useState('');
+ const [hscodeOptions, setHscodeOptions] = React.useState([]);
+ const [isLoadingHscodes, setIsLoadingHscodes] = React.useState(false);
const [pagination, setPagination] = React.useState({
currentPage: 1,
pageSize: 10,
@@ -38,6 +42,23 @@ const History = () => {
});
const navigate = useNavigate();
+ // Fetch HS Code options on component mount
+ React.useEffect(() => {
+ const loadHscodeOptions = async () => {
+ setIsLoadingHscodes(true);
+ try {
+ const products = await fetchProducts();
+ setHscodeOptions(products);
+ } catch (error) {
+ console.error('Failed to load HS Codes:', error);
+ } finally {
+ setIsLoadingHscodes(false);
+ }
+ };
+
+ loadHscodeOptions();
+ }, []);
+
const toVariant = React.useCallback((status) => {
const text = String(status || '').toLowerCase();
if (text === 'approved') return 'approved';
@@ -108,14 +129,14 @@ const History = () => {
}, []);
const headers = [
- { name: 'Submission Date & Time', className: 'text-left whitespace-nowrap w-[140px]' },
+ { name: 'Submission Date & Time', className: 'text-left whitespace-nowrap w-[200px]' },
{ name: 'Year', className: 'text-left w-[60px]' },
{ name: 'Quarter', className: 'text-left w-[70px]' },
- { name: 'HS Code', className: 'text-left w-[80px]' },
+ { name: 'HS Code', className: 'text-left w-[110px]' },
{ name: 'Product', className: 'text-left w-[120px]' },
{ name: 'Status', className: 'text-center w-[100px]' },
{ name: 'Actors', className: 'text-left w-[150px]' },
- { name: 'Details', className: 'text-left flex-1 min-w-[200px]' }
+ { name: 'Details', className: 'text-left flex-1 min-w-[260px]' }
];
const statusOptions = React.useMemo(
@@ -134,11 +155,17 @@ const History = () => {
navigate('/survey', { state: { submission, initialStep: 3 } });
}, [navigate]);
- // Get unique years from the data
+ // Years from 2015 to 2030 in descending order
const yearOptions = React.useMemo(() => {
- const years = [...new Set(rows.map(entry => entry.year).filter(Boolean))].sort((a, b) => b - a);
+ const currentYear = new Date().getFullYear();
+ const startYear = 2015;
+ const endYear = 2030;
+ const years = [];
+ for (let year = endYear; year >= startYear; year--) {
+ years.push(year);
+ }
return years;
- }, [rows]);
+ }, []);
const quarterOptions = [
{ label: 'Quarter', value: '' },
@@ -399,7 +426,7 @@ const History = () => {
onChange={(e) => setYearFilter(e.target.value)}
className="h-10 w-32 rounded-md border border-[#E2E8F0] bg-white pl-3 pr-8 text-sm text-[#232528] focus:outline-none cursor-pointer appearance-none"
>
-
+
{yearOptions.map(year => (
))}
@@ -426,33 +453,32 @@ const History = () => {
-
+ {isLoadingHscodes ? (
+
+ ) : (
+
+ )}
-
-
-
-