removed console
This commit is contained in:
parent
fca7cbbcac
commit
dfe9177e8b
@ -209,12 +209,10 @@ const ProductData = ({
|
|||||||
const productsController = new AbortController();
|
const productsController = new AbortController();
|
||||||
const unitsController = new AbortController();
|
const unitsController = new AbortController();
|
||||||
const loadReasons = async () => {
|
const loadReasons = async () => {
|
||||||
console.log('Fetching variation reasons...');
|
|
||||||
setIsLoadingReasons(true);
|
setIsLoadingReasons(true);
|
||||||
setReasonsError('');
|
setReasonsError('');
|
||||||
try {
|
try {
|
||||||
const reasons = await fetchVariationReasons({ signal: variationController.signal });
|
const reasons = await fetchVariationReasons({ signal: variationController.signal });
|
||||||
console.log('Variation reasons fetched:', reasons);
|
|
||||||
setVariationReasons(reasons);
|
setVariationReasons(reasons);
|
||||||
setReasonsError('');
|
setReasonsError('');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -249,7 +247,6 @@ const ProductData = ({
|
|||||||
setProductsError('');
|
setProductsError('');
|
||||||
try {
|
try {
|
||||||
const productsList = await fetchProducts({ signal: productsController.signal });
|
const productsList = await fetchProducts({ signal: productsController.signal });
|
||||||
console.log('Products fetched:', productsList);
|
|
||||||
setProductOptions(productsList);
|
setProductOptions(productsList);
|
||||||
setProductsError('');
|
setProductsError('');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -431,7 +428,6 @@ const ProductData = ({
|
|||||||
productId
|
productId
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('API Response:', response);
|
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.warn('Empty response from getPreviousForecastData');
|
console.warn('Empty response from getPreviousForecastData');
|
||||||
@ -511,7 +507,6 @@ const ProductData = ({
|
|||||||
localStorage.getItem('establishmentId') ||
|
localStorage.getItem('establishmentId') ||
|
||||||
localStorage.getItem('establishment_id');
|
localStorage.getItem('establishment_id');
|
||||||
|
|
||||||
console.log('Retrieved establishment ID:', establishmentId);
|
|
||||||
|
|
||||||
if (establishmentId && quarter && year) {
|
if (establishmentId && quarter && year) {
|
||||||
// Get the actual product ID from the selected product object
|
// Get the actual product ID from the selected product object
|
||||||
@ -605,10 +600,7 @@ const ProductData = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('Fetching forecast data...');
|
const forecastData = await fetchPreviousForecastData(productId, establishmentId);
|
||||||
const forecastData = await fetchPreviousForecastData(productId, establishmentId);
|
|
||||||
console.log('Forecast data received:', forecastData);
|
|
||||||
|
|
||||||
if (!forecastData) {
|
if (!forecastData) {
|
||||||
console.warn('No forecast data received for product:', productId);
|
console.warn('No forecast data received for product:', productId);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -172,11 +172,9 @@ const buildProductRows = (products = [], options = {}) => {
|
|||||||
try {
|
try {
|
||||||
// Find the full product details from productOptions if available
|
// Find the full product details from productOptions if available
|
||||||
const fullProduct = productOptions.find(p => p.id === product.productId || p.value === product.productId);
|
const fullProduct = productOptions.find(p => p.id === product.productId || p.value === product.productId);
|
||||||
console.log("fullProduct",fullProduct)
|
|
||||||
// Extract product details with better fallbacks
|
// Extract product details with better fallbacks
|
||||||
const productId = product.id || `product-${Math.random().toString(36).substr(2, 9)}`;
|
const productId = product.id || `product-${Math.random().toString(36).substr(2, 9)}`;
|
||||||
const productName = fullProduct?.label || fullProduct?.name || product.productName || product.product?.name || product.product;
|
const productName = fullProduct?.label || fullProduct?.name || product.productName || product.product?.name || product.product;
|
||||||
console.log("productName",productName)
|
|
||||||
const productCode = fullProduct?.code || product.productCode || product.code || product.product?.code || product.id || `CODE-${index + 1}`;
|
const productCode = fullProduct?.code || product.productCode || product.code || product.product?.code || product.id || `CODE-${index + 1}`;
|
||||||
console.log("productCode",productCode)
|
console.log("productCode",productCode)
|
||||||
// Use stored unitName if available, otherwise try to find it in unitOptions
|
// Use stored unitName if available, otherwise try to find it in unitOptions
|
||||||
|
|||||||
@ -76,9 +76,7 @@ const AdminUsers = () => {
|
|||||||
const fetchUsers = async () => {
|
const fetchUsers = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
console.log('Fetching admin users...'); // Debug log
|
|
||||||
const response = await getAdminUser();
|
const response = await getAdminUser();
|
||||||
console.log('API Response:', response); // Debug log
|
|
||||||
|
|
||||||
// Check if response is an array directly or if it's in a data property
|
// Check if response is an array directly or if it's in a data property
|
||||||
const usersData = Array.isArray(response) ? response :
|
const usersData = Array.isArray(response) ? response :
|
||||||
@ -104,7 +102,6 @@ const AdminUsers = () => {
|
|||||||
is_active: user.is_active, // Keep the original is_active for reference
|
is_active: user.is_active, // Keep the original is_active for reference
|
||||||
}));
|
}));
|
||||||
|
|
||||||
console.log('Mapped users:', mappedUsers); // Debug log
|
|
||||||
setUsers(mappedUsers);
|
setUsers(mappedUsers);
|
||||||
} else {
|
} else {
|
||||||
const errorMsg = 'Invalid response format: Expected an array of users';
|
const errorMsg = 'Invalid response format: Expected an array of users';
|
||||||
@ -176,9 +173,7 @@ const AdminUsers = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
console.log('Fetching user data for ID:', user.id); // Debug log
|
|
||||||
const userData = await getAdminUserById(user.id);
|
const userData = await getAdminUserById(user.id);
|
||||||
console.log('User data received:', userData); // Debug log
|
|
||||||
|
|
||||||
if (!userData) {
|
if (!userData) {
|
||||||
throw new Error('No user data received');
|
throw new Error('No user data received');
|
||||||
|
|||||||
@ -329,10 +329,8 @@ const EditCompanyProfile = ({ onClose: propOnClose }) => {
|
|||||||
// Fetch establishment details when ID is provided
|
// Fetch establishment details when ID is provided
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
console.log('Establishment ID:', establishmentId);
|
|
||||||
|
|
||||||
if (!establishmentId) {
|
if (!establishmentId) {
|
||||||
console.log('No establishment ID provided');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,6 @@ const SubmissionDeadlines = () => {
|
|||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
// Future: Replace with save logic
|
// Future: Replace with save logic
|
||||||
console.log('Saving submission deadlines', form);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -56,15 +56,10 @@ const UnitMaster = () => {
|
|||||||
const fetchUnits = async () => {
|
const fetchUnits = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const response = await getUnits();
|
const response = await getUnits();
|
||||||
console.log("API Response:", response); // Log the full response
|
|
||||||
|
|
||||||
const unitsData = response.data || [];
|
const unitsData = response.data || [];
|
||||||
console.log("Units Data:", unitsData); // Log the units data
|
|
||||||
|
|
||||||
// Process units to ensure mapped_products_count is included
|
// Process units to ensure mapped_products_count is included
|
||||||
const processedUnits = unitsData.map(unit => {
|
const processedUnits = unitsData.map(unit => {
|
||||||
console.log("Processing unit:", unit); // Log each unit being processed
|
|
||||||
return {
|
return {
|
||||||
...unit,
|
...unit,
|
||||||
mapped_products_count: unit.mapped_products_count !== undefined
|
mapped_products_count: unit.mapped_products_count !== undefined
|
||||||
@ -73,7 +68,6 @@ const fetchUnits = async () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Processed Units:", processedUnits); // Log the processed units
|
|
||||||
|
|
||||||
// Sort by latest created_at date (newest first)
|
// Sort by latest created_at date (newest first)
|
||||||
const sortedUnits = [...processedUnits].sort(
|
const sortedUnits = [...processedUnits].sort(
|
||||||
@ -119,8 +113,6 @@ const fetchUnits = async () => {
|
|||||||
: '-';
|
: '-';
|
||||||
const currentUserName = currentUser?.name || '';
|
const currentUserName = currentUser?.name || '';
|
||||||
|
|
||||||
console.log("Rendering row with item:", item); // Log the item being rendered
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
item.uom || item.unitName, // Unit Name
|
item.uom || item.unitName, // Unit Name
|
||||||
item.uom_short_name || item.description, // Description
|
item.uom_short_name || item.description, // Description
|
||||||
|
|||||||
@ -396,7 +396,6 @@ const Survey = () => {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}, [establishmentData, parseNumber, productsData, stringify]);
|
}, [establishmentData, parseNumber, productsData, stringify]);
|
||||||
console.log("productsData",productsData)
|
|
||||||
|
|
||||||
const handleNext = () => {
|
const handleNext = () => {
|
||||||
if (step < 3) {
|
if (step < 3) {
|
||||||
@ -420,7 +419,6 @@ const Survey = () => {
|
|||||||
|
|
||||||
// Navigate to overview page after successful submission
|
// Navigate to overview page after successful submission
|
||||||
// navigate('/overview');
|
// navigate('/overview');
|
||||||
console.log('Survey submission response:', response);
|
|
||||||
showToast('success', response?.message || 'You have successfully submitted the survey.');
|
showToast('success', response?.message || 'You have successfully submitted the survey.');
|
||||||
setShowSuccessPopup(true);
|
setShowSuccessPopup(true);
|
||||||
setHasSubmitted(true);
|
setHasSubmitted(true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user