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