bug fixed in establishemnet
This commit is contained in:
parent
0e65ba4d13
commit
b5f8cb4014
@ -1,8 +1,8 @@
|
|||||||
import React, { useEffect, useState, useMemo,useCallback } from 'react';
|
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import Table from '@/components/common/Table';
|
import Table from '@/components/common/Table';
|
||||||
import HeaderBar from '@/components/layout/HeaderBar';
|
import HeaderBar from '@/components/layout/HeaderBar';
|
||||||
// import { fetchSubmissionHistory } from '@/services/submissions/submissionService.js';
|
import { resolveEstablishmentId } from '@/services/utils/establishment';
|
||||||
import { fetchProducts } from '@/services/masters/masterService';
|
import { fetchProducts } from '@/services/masters/masterService';
|
||||||
import { fetchSubmissionHistory, getSubmissionAuditHistory } from '@/services/submissions/submissionService';
|
import { fetchSubmissionHistory, getSubmissionAuditHistory } from '@/services/submissions/submissionService';
|
||||||
|
|
||||||
@ -71,7 +71,12 @@ const History = () => {
|
|||||||
// const loadAuditHistory = async () => {
|
// const loadAuditHistory = async () => {
|
||||||
// setIsLoadingAudit(true);
|
// setIsLoadingAudit(true);
|
||||||
// try {
|
// try {
|
||||||
// const establishmentId = 41; // Replace with dynamic ID if available
|
// const establishmentId = resolveEstablishmentId();
|
||||||
|
// if (!establishmentId) {
|
||||||
|
// console.error('No establishment ID found');
|
||||||
|
// setIsLoadingAudit(false);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
// const response = await getSubmissionAuditHistory(establishmentId, {
|
// const response = await getSubmissionAuditHistory(establishmentId, {
|
||||||
// year: yearFilter || undefined,
|
// year: yearFilter || undefined,
|
||||||
// quarter: quarterFilter || undefined,
|
// quarter: quarterFilter || undefined,
|
||||||
@ -97,7 +102,13 @@ useEffect(() => {
|
|||||||
const loadAuditHistory = async () => {
|
const loadAuditHistory = async () => {
|
||||||
setIsLoadingAudit(true);
|
setIsLoadingAudit(true);
|
||||||
try {
|
try {
|
||||||
const establishmentId = 41; // Replace with dynamic ID if available
|
const establishmentId = resolveEstablishmentId();
|
||||||
|
if (!establishmentId) {
|
||||||
|
console.error('No establishment ID found');
|
||||||
|
setIsLoadingAudit(false);
|
||||||
|
showToast('error', 'No establishment ID found. Please log in again.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Extract product_name from selected value ("HS - Product" → "Product")
|
// Extract product_name from selected value ("HS - Product" → "Product")
|
||||||
const productName = hscodeFilter.includes(" - ")
|
const productName = hscodeFilter.includes(" - ")
|
||||||
@ -108,6 +119,7 @@ useEffect(() => {
|
|||||||
yearFilter,
|
yearFilter,
|
||||||
quarterFilter,
|
quarterFilter,
|
||||||
productName,
|
productName,
|
||||||
|
establishmentId
|
||||||
});
|
});
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user