removed console
This commit is contained in:
parent
913fd33642
commit
0c3349e136
@ -352,7 +352,6 @@ const ProductData = ({
|
|||||||
|
|
||||||
// Debug: Log products data when it changes
|
// Debug: Log products data when it changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('Products data updated:', products);
|
|
||||||
}, [products]);
|
}, [products]);
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = React.useState('current');
|
const [activeTab, setActiveTab] = React.useState('current');
|
||||||
@ -732,12 +731,6 @@ const location = useLocation();
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchPreviousForecastData = async (productId, establishmentId) => {
|
const fetchPreviousForecastData = async (productId, establishmentId) => {
|
||||||
console.log('fetchPreviousForecastData called with:', {
|
|
||||||
productId,
|
|
||||||
establishmentId,
|
|
||||||
quarter,
|
|
||||||
year
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!productId || !establishmentId || !quarter || !year) {
|
if (!productId || !establishmentId || !quarter || !year) {
|
||||||
console.warn('Missing required parameters for fetchPreviousForecastData:', {
|
console.warn('Missing required parameters for fetchPreviousForecastData:', {
|
||||||
@ -918,14 +911,6 @@ const location = useLocation();
|
|||||||
// Use the product_id directly as the value
|
// Use the product_id directly as the value
|
||||||
const productId = selectedProduct.value;
|
const productId = selectedProduct.value;
|
||||||
|
|
||||||
console.log('Fetching forecast data for:', {
|
|
||||||
productId,
|
|
||||||
establishmentId,
|
|
||||||
quarter,
|
|
||||||
year,
|
|
||||||
storageSource: localStorage.getItem('establishment_id') ? 'sessionStorage' : 'localStorage'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Call handleProductSelect with the product ID
|
// Call handleProductSelect with the product ID
|
||||||
handleProductSelect(productId, establishmentId, id);
|
handleProductSelect(productId, establishmentId, id);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -77,11 +77,9 @@ const ImportModal = ({ isOpen, onClose, onImport, showToast: showToastProp }) =>
|
|||||||
const fileInputRef = React.useRef(null);
|
const fileInputRef = React.useRef(null);
|
||||||
|
|
||||||
const showToast = (message, type = 'success', position = 'modal') => {
|
const showToast = (message, type = 'success', position = 'modal') => {
|
||||||
console.log('showToast called with:', { message, type, position });
|
|
||||||
|
|
||||||
// Always use local toast state for the modal
|
// Always use local toast state for the modal
|
||||||
setToast(prev => {
|
setToast(prev => {
|
||||||
console.log('Updating toast state');
|
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
show: true,
|
show: true,
|
||||||
@ -93,13 +91,11 @@ const ImportModal = ({ isOpen, onClose, onImport, showToast: showToastProp }) =>
|
|||||||
|
|
||||||
// Auto-hide after delay
|
// Auto-hide after delay
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
console.log('Hiding toast after timeout');
|
|
||||||
setToast(prev => ({ ...prev, show: false }));
|
setToast(prev => ({ ...prev, show: false }));
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
return () => {
|
return () => {
|
||||||
console.log('Cleaning up toast timeout');
|
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -152,7 +148,6 @@ const ImportModal = ({ isOpen, onClose, onImport, showToast: showToastProp }) =>
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleImport = async () => {
|
const handleImport = async () => {
|
||||||
console.log('handleImport called');
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
setError('Please select a file to import');
|
setError('Please select a file to import');
|
||||||
return;
|
return;
|
||||||
@ -162,13 +157,9 @@ const ImportModal = ({ isOpen, onClose, onImport, showToast: showToastProp }) =>
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
setError('');
|
setError('');
|
||||||
|
|
||||||
console.log('Calling productService.uploadCSV');
|
|
||||||
const response = await productService.uploadCSV(file);
|
const response = await productService.uploadCSV(file);
|
||||||
console.log('Upload response:', response);
|
|
||||||
|
|
||||||
// Check the response status
|
// Check the response status
|
||||||
if (response.status === 'failed') {
|
if (response.status === 'failed') {
|
||||||
console.log('Import failed with response:', response);
|
|
||||||
let errorMsg = response.message || 'Import failed';
|
let errorMsg = response.message || 'Import failed';
|
||||||
|
|
||||||
if (response.summary?.errors?.length > 0) {
|
if (response.summary?.errors?.length > 0) {
|
||||||
@ -187,7 +178,6 @@ const ImportModal = ({ isOpen, onClose, onImport, showToast: showToastProp }) =>
|
|||||||
onClose();
|
onClose();
|
||||||
|
|
||||||
// Then call onImport which will trigger the parent's success handling
|
// Then call onImport which will trigger the parent's success handling
|
||||||
console.log('Calling onImport');
|
|
||||||
await onImport(response);
|
await onImport(response);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error uploading CSV:', err);
|
console.error('Error uploading CSV:', err);
|
||||||
@ -275,7 +265,6 @@ const ImportModal = ({ isOpen, onClose, onImport, showToast: showToastProp }) =>
|
|||||||
type={toast.type}
|
type={toast.type}
|
||||||
position="modal"
|
position="modal"
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
console.log('Toast onClose called');
|
|
||||||
setToast(prev => ({ ...prev, show: false }));
|
setToast(prev => ({ ...prev, show: false }));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -722,7 +722,7 @@ const downloadSampleCSV = async () => {
|
|||||||
const response = await downloadSampleFile();
|
const response = await downloadSampleFile();
|
||||||
|
|
||||||
// Create a blob from the response
|
// Create a blob from the response
|
||||||
const blob = new Blob([response.data], { type: 'text/csv' });
|
const blob = new Blob([response.data], { type: 'text/csv;charset=utf-8;' });
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.href = url;
|
link.href = url;
|
||||||
|
|||||||
@ -140,12 +140,6 @@ useEffect(() => {
|
|||||||
? hscodeFilter.split(" - ")[1].trim()
|
? hscodeFilter.split(" - ")[1].trim()
|
||||||
: hscodeFilter.trim();
|
: hscodeFilter.trim();
|
||||||
|
|
||||||
console.log("Loading audit history with:", {
|
|
||||||
yearFilter,
|
|
||||||
quarterFilter,
|
|
||||||
productName,
|
|
||||||
establishmentId
|
|
||||||
});
|
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
year: yearFilter || undefined,
|
year: yearFilter || undefined,
|
||||||
|
|||||||
@ -168,12 +168,10 @@ const submit = async (e) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await login({ email, password });
|
const response = await login({ email, password });
|
||||||
console.log("Login response:", response);
|
|
||||||
|
|
||||||
// Check if login was successful
|
// Check if login was successful
|
||||||
if (response?.status === 'success' && response?.data) {
|
if (response?.status === 'success' && response?.data) {
|
||||||
const userData = response.data;
|
const userData = response.data;
|
||||||
console.log("User data:", userData);
|
|
||||||
|
|
||||||
// Clear any existing failed attempts
|
// Clear any existing failed attempts
|
||||||
const storedAttempts = JSON.parse(localStorage.getItem("login_attempts") || "{}");
|
const storedAttempts = JSON.parse(localStorage.getItem("login_attempts") || "{}");
|
||||||
|
|||||||
@ -389,16 +389,6 @@ const Survey = () => {
|
|||||||
const unitName = ensureString(product?.unit?.uom) ||
|
const unitName = ensureString(product?.unit?.uom) ||
|
||||||
ensureString(product?.unit?.name) ||
|
ensureString(product?.unit?.name) ||
|
||||||
ensureString(unitId) || '';
|
ensureString(unitId) || '';
|
||||||
|
|
||||||
console.log('Product mapping:', {
|
|
||||||
id: productId,
|
|
||||||
productName,
|
|
||||||
hsCode,
|
|
||||||
displayName,
|
|
||||||
unitId,
|
|
||||||
unitName,
|
|
||||||
originalProduct: product
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: product?.id ?? index + 1,
|
id: product?.id ?? index + 1,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user