added flag for products
This commit is contained in:
parent
236743053e
commit
318d35235d
10
ipi-survey-platform/package-lock.json
generated
10
ipi-survey-platform/package-lock.json
generated
@ -13,6 +13,7 @@
|
|||||||
"react": "^19.1.1",
|
"react": "^19.1.1",
|
||||||
"react-dom": "^19.1.1",
|
"react-dom": "^19.1.1",
|
||||||
"react-google-recaptcha": "^3.1.0",
|
"react-google-recaptcha": "^3.1.0",
|
||||||
|
"react-icons": "^5.5.0",
|
||||||
"react-router-dom": "^7.9.4",
|
"react-router-dom": "^7.9.4",
|
||||||
"react-toastify": "^11.0.5"
|
"react-toastify": "^11.0.5"
|
||||||
},
|
},
|
||||||
@ -3568,6 +3569,15 @@
|
|||||||
"react": ">=16.4.1"
|
"react": ">=16.4.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-icons": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-is": {
|
"node_modules/react-is": {
|
||||||
"version": "16.13.1",
|
"version": "16.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
"react": "^19.1.1",
|
"react": "^19.1.1",
|
||||||
"react-dom": "^19.1.1",
|
"react-dom": "^19.1.1",
|
||||||
"react-google-recaptcha": "^3.1.0",
|
"react-google-recaptcha": "^3.1.0",
|
||||||
|
"react-icons": "^5.5.0",
|
||||||
"react-router-dom": "^7.9.4",
|
"react-router-dom": "^7.9.4",
|
||||||
"react-toastify": "^11.0.5"
|
"react-toastify": "^11.0.5"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1389,7 +1389,7 @@ const location = useLocation();
|
|||||||
}}
|
}}
|
||||||
loading={isLoadingUnits}
|
loading={isLoadingUnits}
|
||||||
error={!!formErrors[`unit_${idx}`]}
|
error={!!formErrors[`unit_${idx}`]}
|
||||||
disabled={!!p.unitName} // Disable if unit is auto-filled from product
|
// disabled={!!p.unitName} // Disable if unit is auto-filled from product
|
||||||
/>
|
/>
|
||||||
<div className="h-5">
|
<div className="h-5">
|
||||||
{formErrors[`unit_${idx}`] && (
|
{formErrors[`unit_${idx}`] && (
|
||||||
|
|||||||
@ -159,6 +159,7 @@ const createEmptyProfile = () => ({
|
|||||||
industryCodeBusiness: '',
|
industryCodeBusiness: '',
|
||||||
industryCodeProduction: '',
|
industryCodeProduction: '',
|
||||||
industryCodeCurrent: '',
|
industryCodeCurrent: '',
|
||||||
|
industryCodeMismatchRemarks: '',
|
||||||
industryDescription: '',
|
industryDescription: '',
|
||||||
// Establishment contact details
|
// Establishment contact details
|
||||||
contactName: '',
|
contactName: '',
|
||||||
@ -816,6 +817,10 @@ const CompanyProfile = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderStepContent = () => {
|
const renderStepContent = () => {
|
||||||
|
const fieldProps = (fieldName) => ({
|
||||||
|
disabled: modalMode === 'view',
|
||||||
|
error: fieldErrors[fieldName]
|
||||||
|
});
|
||||||
switch (activeStep) {
|
switch (activeStep) {
|
||||||
case 0:
|
case 0:
|
||||||
return (
|
return (
|
||||||
@ -831,6 +836,8 @@ const CompanyProfile = () => {
|
|||||||
width="100%"
|
width="100%"
|
||||||
required
|
required
|
||||||
error={fieldErrors.userProfileName}
|
error={fieldErrors.userProfileName}
|
||||||
|
{...fieldProps('userProfileName')}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
label="Email"
|
label="Email"
|
||||||
@ -958,12 +965,24 @@ const CompanyProfile = () => {
|
|||||||
<div className="mt-4">
|
<div className="mt-4">
|
||||||
<TextField
|
<TextField
|
||||||
label="Remarks"
|
label="Remarks"
|
||||||
value={form.remarks}
|
value={form.industryCodeMismatchRemarks}
|
||||||
onChange={handleFormChange('remarks')}
|
onChange={handleFormChange('industryCodeMismatchRemarks')}
|
||||||
placeholder="Add Remarks"
|
placeholder="Enter remarks for industry code mismatch"
|
||||||
width="100%"
|
width="100%"
|
||||||
style={{ height: '72px' }}
|
multiline
|
||||||
|
rows={3}
|
||||||
/>
|
/>
|
||||||
|
{/* <div className="mt-2">
|
||||||
|
<TextField
|
||||||
|
label="Industry Description"
|
||||||
|
value={form.industryDescription}
|
||||||
|
onChange={handleFormChange('industryDescription')}
|
||||||
|
placeholder="Enter industry description"
|
||||||
|
width="100%"
|
||||||
|
multiline
|
||||||
|
rows={2}
|
||||||
|
/>
|
||||||
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -1449,7 +1468,7 @@ const CompanyProfile = () => {
|
|||||||
showToast('success', `Establishment ${newStatus ? 'activated' : 'deactivated'} successfully`);
|
showToast('success', `Establishment ${newStatus ? 'activated' : 'deactivated'} successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error updating status:', error);
|
console.error('Error updating status:', error);
|
||||||
const message = error?.response?.data?.message || 'Failed to update status. Please try again.';
|
const message = error?.response?.data?.message || error?.message || 'Failed to update status. Please try again.';
|
||||||
showToast('error', message);
|
showToast('error', message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1805,6 +1824,7 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
industryCodeBusiness: item?.industry_code,
|
industryCodeBusiness: item?.industry_code,
|
||||||
industryCodeProduction: item?.industry_code_production,
|
industryCodeProduction: item?.industry_code_production,
|
||||||
industryCodeCurrent: item?.industryCodeCurrent,
|
industryCodeCurrent: item?.industryCodeCurrent,
|
||||||
|
industryCodeMismatchRemarks: item?.industry_code_mismatch_remarks ?? '',
|
||||||
industryDescription: item?.description ?? base.industryDescription,
|
industryDescription: item?.description ?? base.industryDescription,
|
||||||
establishmentId: item?.establishment_code ?? '',
|
establishmentId: item?.establishment_code ?? '',
|
||||||
contactAddress: item?.establishment_address ?? base.contactAddress,
|
contactAddress: item?.establishment_address ?? base.contactAddress,
|
||||||
@ -2116,13 +2136,47 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleView = async (id) => {
|
// const handleView = async (id) => {
|
||||||
|
// try {
|
||||||
|
// setIsLoading(true);
|
||||||
|
// const response = await fetchEstablishmentDetail(id);
|
||||||
|
// const establishment = mapApiEstablishmentToProfile(response.data);
|
||||||
|
// setForm(establishment);
|
||||||
|
// setSelectedProducts(establishment.products || []);
|
||||||
|
// setModalMode('view');
|
||||||
|
// setIsViewMode(true);
|
||||||
|
// setEditingRow(id);
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('Error fetching establishment details:', error);
|
||||||
|
// showToast('error', 'Failed to load establishment details');
|
||||||
|
// } finally {
|
||||||
|
// setIsLoading(false);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
const handleView = async (id) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const response = await fetchEstablishmentDetail(id);
|
const response = await fetchEstablishmentDetail(id);
|
||||||
const establishment = mapApiEstablishmentToProfile(response.data);
|
const establishment = mapApiEstablishmentToProfile(response.data);
|
||||||
setForm(establishment);
|
setForm(establishment);
|
||||||
setSelectedProducts(establishment.products || []);
|
|
||||||
|
// Format products data before setting to state
|
||||||
|
const formattedProducts = (response.data.establishment_products || []).map(item => {
|
||||||
|
const product = item.product || {};
|
||||||
|
const productName = product.product_name || 'Unnamed Product';
|
||||||
|
const hsCode = product.hs_code || '';
|
||||||
|
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
...product,
|
||||||
|
product_name: productName,
|
||||||
|
hs_code: hsCode,
|
||||||
|
label: `${productName}${hsCode ? ` (${hsCode})` : ''}`,
|
||||||
|
value: item.product_id ? String(item.product_id) : '',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
setSelectedProducts(formattedProducts);
|
||||||
setModalMode('view');
|
setModalMode('view');
|
||||||
setIsViewMode(true);
|
setIsViewMode(true);
|
||||||
setEditingRow(id);
|
setEditingRow(id);
|
||||||
@ -2133,7 +2187,6 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = (establishmentId) => {
|
const handleDelete = (establishmentId) => {
|
||||||
if (!establishmentId) return;
|
if (!establishmentId) return;
|
||||||
const originalIndex = profiles.findIndex((item) => {
|
const originalIndex = profiles.findIndex((item) => {
|
||||||
@ -2507,6 +2560,7 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
permanent_factory_code: form.permanentFactoryCode || '',
|
permanent_factory_code: form.permanentFactoryCode || '',
|
||||||
industry_code: form.industryCodeBusiness || '',
|
industry_code: form.industryCodeBusiness || '',
|
||||||
industry_code_production: form.industryCodeProduction || form.industryCodeCurrent || '',
|
industry_code_production: form.industryCodeProduction || form.industryCodeCurrent || '',
|
||||||
|
industry_code_mismatch_remarks: form.industryCodeMismatchRemarks || '',
|
||||||
license_number: form.uniqueLicenseNumber || '',
|
license_number: form.uniqueLicenseNumber || '',
|
||||||
isic_code: form.industryCodeProduction || '',
|
isic_code: form.industryCodeProduction || '',
|
||||||
description: form.industryDescription || '',
|
description: form.industryDescription || '',
|
||||||
@ -2548,7 +2602,8 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
password: form.userProfilePassword || ''
|
password: form.userProfilePassword || ''
|
||||||
},
|
},
|
||||||
establishment_products: Array.isArray(selectedProducts) && selectedProducts.length > 0
|
establishment_products: Array.isArray(selectedProducts) && selectedProducts.length > 0
|
||||||
? selectedProducts.map(p => ({ product_id: p.id || p.product_id || 0 }))
|
? selectedProducts.map(p => ({ product_id: p.id || p.product_id || 0
|
||||||
|
}))
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2612,6 +2667,7 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
permanent_factory_code: form.permanentFactoryCode || '',
|
permanent_factory_code: form.permanentFactoryCode || '',
|
||||||
industry_code: form.industryCodeBusiness || '',
|
industry_code: form.industryCodeBusiness || '',
|
||||||
industry_code_production: form.industryCodeProduction || form.industryCodeCurrent || '',
|
industry_code_production: form.industryCodeProduction || form.industryCodeCurrent || '',
|
||||||
|
industry_code_mismatch_remarks: form.industryCodeMismatchRemarks || '',
|
||||||
license_number: form.uniqueLicenseNumber || '',
|
license_number: form.uniqueLicenseNumber || '',
|
||||||
isic_code: form.industryCodeProduction || '',
|
isic_code: form.industryCodeProduction || '',
|
||||||
description: form.industryDescription || '',
|
description: form.industryDescription || '',
|
||||||
@ -2650,7 +2706,10 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
// Enhanced product handling for updates - only send product IDs that exist
|
// Enhanced product handling for updates - only send product IDs that exist
|
||||||
establishment_products: Array.isArray(selectedProducts) && selectedProducts.length > 0
|
establishment_products: Array.isArray(selectedProducts) && selectedProducts.length > 0
|
||||||
? selectedProducts.map(p => ({
|
? selectedProducts.map(p => ({
|
||||||
product_id: p.product_id || p.id || 0
|
product_id: p.product_id || p.id || 0,
|
||||||
|
action_done_by: "admin_user" ,
|
||||||
|
created_by: currentUserId?.id
|
||||||
|
|
||||||
}))
|
}))
|
||||||
: []
|
: []
|
||||||
};
|
};
|
||||||
@ -2784,7 +2843,7 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!modalMode) return undefined;
|
if (!modalMode || isViewMode) return undefined;
|
||||||
const handleBeforeUnload = (event) => {
|
const handleBeforeUnload = (event) => {
|
||||||
if (isDirty) {
|
if (isDirty) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -2795,7 +2854,7 @@ const displayedRows = filteredProfiles.map((item) => {
|
|||||||
return () => {
|
return () => {
|
||||||
window.removeEventListener('beforeunload', handleBeforeUnload);
|
window.removeEventListener('beforeunload', handleBeforeUnload);
|
||||||
};
|
};
|
||||||
}, [isDirty, modalMode]);
|
}, [isDirty, modalMode, isViewMode]);
|
||||||
|
|
||||||
const deletingProfile = React.useMemo(() => {
|
const deletingProfile = React.useMemo(() => {
|
||||||
if (deletingRow === null || deletingRow < 0 || deletingRow >= profiles.length) return null;
|
if (deletingRow === null || deletingRow < 0 || deletingRow >= profiles.length) return null;
|
||||||
@ -3070,7 +3129,8 @@ const handleImport = async () => {
|
|||||||
>
|
>
|
||||||
<div className="flex items-center justify-between px-6 py-4 border-b border-[#F1F2F4]">
|
<div className="flex items-center justify-between px-6 py-4 border-b border-[#F1F2F4]">
|
||||||
<h3 className="text-[18px] font-medium text-[#232528]">
|
<h3 className="text-[18px] font-medium text-[#232528]">
|
||||||
{modalMode === 'edit' ? 'Edit Company Profile' : 'Add Profile'}
|
{/* {modalMode === 'edit' ? 'Edit Company Profile' : 'Add Profile'} */}
|
||||||
|
{isViewMode ? 'View Profile' : modalMode === 'edit' ? 'Edit Profile' : 'Add Profile'}
|
||||||
</h3>
|
</h3>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@ -3156,6 +3216,17 @@ const handleImport = async () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{activeStep === formSteps.length - 1 ? (
|
{activeStep === formSteps.length - 1 ? (
|
||||||
|
isViewMode ? (
|
||||||
|
<div className="flex justify-end">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="h-10 px-6 rounded-md bg-[#92722A] text-sm font-medium text-white hover:bg-[#92722A] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-[#6B7280]"
|
||||||
|
onClick={closeModal}
|
||||||
|
>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@ -3174,6 +3245,7 @@ const handleImport = async () => {
|
|||||||
{isUpdating ? 'Updating…' : isSaving ? 'Saving…' : modalMode === 'edit' ? 'Update' : 'Add'}
|
{isUpdating ? 'Updating…' : isSaving ? 'Saving…' : modalMode === 'edit' ? 'Update' : 'Add'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
{activeStep > 0 && (
|
{activeStep > 0 && (
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import React, { useState, useMemo, useCallback, useEffect, useRef } from "react";
|
import React, { useState, useMemo, useCallback, useEffect, useRef } from "react";
|
||||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||||
|
import { FaBuilding } from 'react-icons/fa6';
|
||||||
|
import { MdAdminPanelSettings } from "react-icons/md";
|
||||||
import { TextField, SelectField, PhoneField } from "@/components/common/FormControls";
|
import { TextField, SelectField, PhoneField } from "@/components/common/FormControls";
|
||||||
import Loader from "@/components/common/Loader";
|
import Loader from "@/components/common/Loader";
|
||||||
import { fetchEstablishmentDetail, updateEstablishment } from '@/services/establishments/establishmentService';
|
import { fetchEstablishmentDetail, updateEstablishment } from '@/services/establishments/establishmentService';
|
||||||
@ -14,6 +16,7 @@ const createEmptyProfile = () => ({
|
|||||||
uniqueLicenseNumber: '',
|
uniqueLicenseNumber: '',
|
||||||
industryCodeBusiness: '',
|
industryCodeBusiness: '',
|
||||||
industryCodeCurrent: '',
|
industryCodeCurrent: '',
|
||||||
|
industryCodeMismatchRemarks: '',
|
||||||
contactName: '',
|
contactName: '',
|
||||||
contactAddress: '',
|
contactAddress: '',
|
||||||
contactCityTown: '',
|
contactCityTown: '',
|
||||||
@ -39,8 +42,9 @@ const mapApiEstablishmentToProfile = (apiData) => {
|
|||||||
userProfileEmail: data.users?.[0]?.email || '',
|
userProfileEmail: data.users?.[0]?.email || '',
|
||||||
permanentFactoryCode: data.permanent_factory_code || '',
|
permanentFactoryCode: data.permanent_factory_code || '',
|
||||||
uniqueLicenseNumber: data.license_number || '',
|
uniqueLicenseNumber: data.license_number || '',
|
||||||
industryCodeBusiness: data.isic_code || '',
|
industryCodeBusiness: data.industry_code_production || '',
|
||||||
industryCodeCurrent: data.isic_code || '',
|
industryCodeCurrent: data.industry_code || '',
|
||||||
|
industryCodeMismatchRemarks: data.industry_code_mismatch_remarks || '',
|
||||||
contactName: data.factory_name || '',
|
contactName: data.factory_name || '',
|
||||||
contactAddress: data.establishment_address || '',
|
contactAddress: data.establishment_address || '',
|
||||||
contactCityTown: data.establishment_city?.name || '',
|
contactCityTown: data.establishment_city?.name || '',
|
||||||
@ -77,8 +81,6 @@ const computeEmploymentTotals = (data) => {
|
|||||||
const EditCompanyProfile = () => {
|
const EditCompanyProfile = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { id: establishmentId } = useParams();
|
const { id: establishmentId } = useParams();
|
||||||
console.log('EditCompanyProfile mounted, establishmentId from params:', establishmentId);
|
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [form, setForm] = useState(createEmptyProfile());
|
const [form, setForm] = useState(createEmptyProfile());
|
||||||
const [activeStep, setActiveStep] = useState(0);
|
const [activeStep, setActiveStep] = useState(0);
|
||||||
@ -412,12 +414,15 @@ const EditCompanyProfile = () => {
|
|||||||
// Find the product in the loaded products to get the proper format
|
// Find the product in the loaded products to get the proper format
|
||||||
const foundProduct = allProducts.find(p => p.value === String(productId));
|
const foundProduct = allProducts.find(p => p.value === String(productId));
|
||||||
|
|
||||||
return foundProduct || {
|
return {
|
||||||
|
...(foundProduct || {
|
||||||
value: String(productId),
|
value: String(productId),
|
||||||
label: productData.product_name || productData.name || 'Unnamed Product',
|
label: productData.product_name || productData.name || 'Unnamed Product',
|
||||||
hs_code: productData.hs_code || '',
|
hs_code: productData.hs_code || '',
|
||||||
product_name: productData.product_name || productData.name || 'Unnamed Product',
|
product_name: productData.product_name || productData.name || 'Unnamed Product',
|
||||||
isExisting: true // Mark as existing product
|
isExisting: true // Mark as existing product
|
||||||
|
}),
|
||||||
|
action_done_by: ep.action_done_by // Add the action_done_by field from the API response
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -503,7 +508,7 @@ const EditCompanyProfile = () => {
|
|||||||
permanent_factory_code: form.permanentFactoryCode || "",
|
permanent_factory_code: form.permanentFactoryCode || "",
|
||||||
industry_code: form.industryCodeBusiness || "",
|
industry_code: form.industryCodeBusiness || "",
|
||||||
license_number: form.uniqueLicenseNumber || "",
|
license_number: form.uniqueLicenseNumber || "",
|
||||||
isic_code: form.industryCodeCurrent || "",
|
industry_code_production: form.industryCodeCurrent || "",
|
||||||
description: form.industryDescription || "",
|
description: form.industryDescription || "",
|
||||||
establishment_address: form.contactAddress || "",
|
establishment_address: form.contactAddress || "",
|
||||||
establishment_city_town_id: selectedCity ? Number(selectedCity.value) : null,
|
establishment_city_town_id: selectedCity ? Number(selectedCity.value) : null,
|
||||||
@ -531,7 +536,10 @@ const EditCompanyProfile = () => {
|
|||||||
updated_by: 1,
|
updated_by: 1,
|
||||||
establishment_products: Array.isArray(selectedProducts) && selectedProducts.length > 0
|
establishment_products: Array.isArray(selectedProducts) && selectedProducts.length > 0
|
||||||
? selectedProducts.map(p => ({
|
? selectedProducts.map(p => ({
|
||||||
product_id: Number(p.value) || 0
|
product_id: Number(p.value) || 0,
|
||||||
|
action_done_by: p.action_done_by || "establishment_users",
|
||||||
|
created_by: p.created_by || establishmentId
|
||||||
|
|
||||||
}))
|
}))
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
@ -655,6 +663,21 @@ const EditCompanyProfile = () => {
|
|||||||
rows={3}
|
rows={3}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{form.industryCodeCurrent && form.industryCodeBusiness !== form.industryCodeCurrent && (
|
||||||
|
<div className="col-span-full">
|
||||||
|
<TextField
|
||||||
|
label="Remarks"
|
||||||
|
value={form.industryCodeMismatchRemarks || ''}
|
||||||
|
onChange={(e) => handleFormChange('industryCodeMismatchRemarks', e.target.value)}
|
||||||
|
placeholder="Enter remarks for industry code mismatch"
|
||||||
|
width="100%"
|
||||||
|
multiline
|
||||||
|
rows={3}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -785,8 +808,24 @@ const EditCompanyProfile = () => {
|
|||||||
case 3:
|
case 3:
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div className="flex items-center justify-between">
|
||||||
|
{/* Left side: Products Header */}
|
||||||
<h4 className="text-[16px] font-semibold text-[#232528]">Products</h4>
|
<h4 className="text-[16px] font-semibold text-[#232528]">Products</h4>
|
||||||
|
|
||||||
|
{/* Right side: Icons */}
|
||||||
|
<div className="flex items-center gap-4 text-sm text-medium-600">
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<MdAdminPanelSettings className="text-[#92722A] text-lg" />
|
||||||
|
<span>Admin User</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<FaBuilding className="text-[#92722A]" />
|
||||||
|
<span>Establishment User</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* </div> */}
|
||||||
|
|
||||||
{productError && (
|
{productError && (
|
||||||
<p className="text-xs text-[#B91C1C] mt-1">{productError}</p>
|
<p className="text-xs text-[#B91C1C] mt-1">{productError}</p>
|
||||||
)}
|
)}
|
||||||
@ -865,6 +904,12 @@ const EditCompanyProfile = () => {
|
|||||||
const isNewlyAdded = newlyAddedProductIds.has(product.value);
|
const isNewlyAdded = newlyAddedProductIds.has(product.value);
|
||||||
return (
|
return (
|
||||||
<li key={product.value} className="p-3 hover:bg-[#F9FAFB] flex justify-between items-center">
|
<li key={product.value} className="p-3 hover:bg-[#F9FAFB] flex justify-between items-center">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
{product.action_done_by === "admin_user" ? (
|
||||||
|
<MdAdminPanelSettings className="text-[#92722A] text-lg" title="Added by Admin" />
|
||||||
|
) : (
|
||||||
|
<FaBuilding className="text-[#92722A]" title="Added by Establishment" />
|
||||||
|
)}
|
||||||
<div>
|
<div>
|
||||||
<div className="text-sm font-medium text-[#111827]">
|
<div className="text-sm font-medium text-[#111827]">
|
||||||
{product.label}
|
{product.label}
|
||||||
@ -875,6 +920,7 @@ const EditCompanyProfile = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{isNewlyAdded && (
|
{isNewlyAdded && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user