bug fixed
This commit is contained in:
parent
07e1c56da8
commit
28a56efa5a
@ -69,14 +69,11 @@ export const DetailedOverview = ({ submission, onBack }) => {
|
||||
setError(null);
|
||||
const response = await fetchSubmissionDetail(submission.id);
|
||||
if (response && response.data) {
|
||||
console.log('Setting submission data:', response.data);
|
||||
setSubmissionData(response.data);
|
||||
setQuarterPeriods(response.quarter_periods);
|
||||
|
||||
// Log the products array to verify it's being set correctly
|
||||
if (response.data.products) {
|
||||
console.log('Products in response:', response.data.products);
|
||||
console.log('Number of products:', response.data.products.length);
|
||||
}
|
||||
} else {
|
||||
console.warn('No data received in response');
|
||||
@ -99,11 +96,7 @@ export const DetailedOverview = ({ submission, onBack }) => {
|
||||
}, [submission]);
|
||||
|
||||
const filteredProducts = useMemo(() => {
|
||||
console.log('Filtering products...');
|
||||
console.log('Raw products data:', submissionData?.products);
|
||||
|
||||
if (!submissionData?.products || !Array.isArray(submissionData.products)) {
|
||||
console.log('No products array found in submissionData');
|
||||
return [];
|
||||
}
|
||||
|
||||
@ -141,8 +134,6 @@ export const DetailedOverview = ({ submission, onBack }) => {
|
||||
totalItems: filtered.length,
|
||||
currentPage: 1 // Reset to first page when filters change
|
||||
}));
|
||||
|
||||
console.log('Filtered products:', filtered);
|
||||
return filtered;
|
||||
}, [searchTerm, selectedStatus, submissionData]);
|
||||
|
||||
@ -229,12 +220,8 @@ export const DetailedOverview = ({ submission, onBack }) => {
|
||||
|
||||
const rows = useMemo(() => {
|
||||
if (!filteredProducts || !Array.isArray(filteredProducts)) {
|
||||
console.log('No filtered products available');
|
||||
return [];
|
||||
}
|
||||
|
||||
console.log('Generating rows for filtered products:', paginatedProducts);
|
||||
|
||||
return paginatedProducts.map((product, index) => {
|
||||
// Add null checks for product and product properties
|
||||
const productData = product.product || {};
|
||||
|
||||
@ -26,7 +26,6 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh
|
||||
|
||||
if (submissionStatus) {
|
||||
const status = String(submissionStatus).toLowerCase();
|
||||
console.log("statuschecking", status);
|
||||
const toastConfig = {
|
||||
approved: {
|
||||
type: 'approved',
|
||||
@ -76,8 +75,6 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh
|
||||
|
||||
// Debug log to check product status and is_active
|
||||
useEffect(() => {
|
||||
console.log('Product Status:', product?.status);
|
||||
console.log('Product is_active:', product?.is_active);
|
||||
}, [product?.status, product?.is_active]);
|
||||
|
||||
const navigate = useNavigate();
|
||||
@ -180,7 +177,6 @@ const ProductDetails = ({ product, onBack, showToast: shouldShowToast, onToastSh
|
||||
<button
|
||||
onClick={() => {
|
||||
// Add your resubmit logic here
|
||||
console.log('Resubmit button clicked');
|
||||
// You can navigate to the edit page or trigger a resubmit function
|
||||
}}
|
||||
className="ml-auto px-3 py-1 bg-[#FEF2F2] text-[#7C2320] text-sm font-medium rounded hover:bg-[#FEF2F2] transition-colors"
|
||||
|
||||
@ -88,8 +88,6 @@ const EstablishmentInfo = ({
|
||||
};
|
||||
// Debug log to see what data is being received
|
||||
React.useEffect(() => {
|
||||
console.log('EstablishmentInfo data:', data);
|
||||
console.log('Establishment contact email from data:', data?.establishment_contact_email);
|
||||
}, [data]);
|
||||
|
||||
const info = React.useMemo(
|
||||
|
||||
@ -1095,14 +1095,14 @@ const ProductData = ({
|
||||
<p className="mt-1 text-xs text-red-600">{reasonsError}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
{/* <div className="mt-4">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">Remarks</label>
|
||||
<Textarea
|
||||
placeholder="Enter any additional remarks"
|
||||
value={p.remarks || ''}
|
||||
onChange={(e) => updateProductField(p.id, 'remarks', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</SectionBox>
|
||||
|
||||
|
||||
@ -748,14 +748,16 @@ const ReviewSubmit = ({
|
||||
|
||||
<div className="bg-white rounded-md">
|
||||
<label className="flex items-start gap-3 text-sm text-[#4B5563]">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="mt-1 h-4 w-4 text-[#92722A] border-gray-300 rounded"
|
||||
checked={confirm}
|
||||
disabled={hasSubmitted}
|
||||
onChange={(e) => setConfirm(e.target.checked)}
|
||||
/>
|
||||
<span>I hereby confirm that all data entered is accurate and complete to the best of my knowledge.</span>
|
||||
<div className="flex-shrink-0 mt-0.5">
|
||||
<input
|
||||
type="checkbox"
|
||||
className="h-4 w-4 text-[#92722A] border-gray-300 rounded focus:ring-[#92722A]"
|
||||
checked={confirm}
|
||||
disabled={hasSubmitted}
|
||||
onChange={(e) => setConfirm(e.target.checked)}
|
||||
/>
|
||||
</div>
|
||||
<span className="leading-relaxed">I hereby confirm that all data entered is accurate and complete to the best of my knowledge.</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
@ -379,7 +379,7 @@ const QuarterlyWindows = () => {
|
||||
type="button"
|
||||
className="h-8 w-8 grid place-items-center rounded hover:bg-gray-50 cursor-pointer"
|
||||
title="Edit"
|
||||
aria-label="Edit quarter"
|
||||
aria-label="Edit Quarterly Survey"
|
||||
onClick={() => openEditModal(rowIndex)}
|
||||
onMouseEnter={() => setHoveredEdit(rowIndex)}
|
||||
onMouseLeave={() => setHoveredEdit(null)}
|
||||
|
||||
@ -59,10 +59,8 @@ export const productService = {
|
||||
// Delete product
|
||||
deleteProduct: async (id) => {
|
||||
try {
|
||||
console.log(`Initiating delete for product ID: ${id}`);
|
||||
// Use relative path since baseURL is already configured in apiClient
|
||||
const response = await deleteRequest(`/products/${id}`);
|
||||
console.log('Delete response:', response);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error(`Error in productService.deleteProduct for ID ${id}:`, {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user