From 7e2f18ce33866f11b9694e8280ba0d96b128ab82 Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Wed, 28 Jan 2026 18:55:01 +0530 Subject: [PATCH 1/2] i just added Custom Field Feature --- .../BookingScreen/Forms/QuickAdd/QuickAdd.jsx | 264 +++++++++++++----- 1 file changed, 201 insertions(+), 63 deletions(-) diff --git a/src/Pages/BookingScreen/Forms/QuickAdd/QuickAdd.jsx b/src/Pages/BookingScreen/Forms/QuickAdd/QuickAdd.jsx index 9d86099..244dfd7 100644 --- a/src/Pages/BookingScreen/Forms/QuickAdd/QuickAdd.jsx +++ b/src/Pages/BookingScreen/Forms/QuickAdd/QuickAdd.jsx @@ -6,6 +6,7 @@ import { PlusCircleOutlined, InfoCircleOutlined, } from '@ant-design/icons'; +import { IoSettingsOutline } from "react-icons/io5"; import Buttons from '../../../../Components/Forms/Buttons.jsx'; import { InputField } from '../../../../Components/Forms/InputField.jsx'; import { Messages } from '../../../../Components/Notifications/Messages'; @@ -31,7 +32,9 @@ import { supplierSelector, postProductData, postTax, - getHsnData + getHsnData, + getFieldSetupData, + postFieldSetup } from '../../../../Features/ProductPage/ProductPage.js'; import { ChangeNewQrProduct, @@ -78,8 +81,12 @@ const ProductForm = ({ const productFieldPreferences = appPreferences?.find( (preference) => preference?.PreferredCatName?.toLowerCase() === "product form fields" )?.PreferenceCatDetails; - - + // const CustomQuickAddField = appPreferences?.find( + // (preference) => preference?.PreferredCatName?.toLowerCase() === "quick add custom fields" + // )?.PreferenceCatDetails; + const categoryId = appPreferences?.find( + p => p?.PreferredCatName?.toLowerCase() === "quick add custom fields" + )?.PreferredCatId; const UomTypePreference = appPreferences?.find((preference) => preference?.PreferredCatName === 'Product Uom')?.PreferenceCatDetails const UomPreference = UomData?.filter((item) => UomTypePreference?.some?.((e) => e?.PreferredSubCatName?.toLowerCase() == item?.ConfigName?.toLowerCase() && e?.PreferredStatus == "Y")) @@ -87,6 +94,7 @@ const ProductForm = ({ const filteredFields = productFieldPreferences?.filter( (field) => field?.PreferredStatus === 'Y' ); + const cessField = filteredFields?.find((field) => field?.PreferredSubCatName === 'Cess'); const hsnField = filteredFields?.find((field) => field?.PreferredSubCatName === 'HSN'); const taxField = filteredFields?.find((field) => field?.PreferredSubCatName === 'Tax'); @@ -95,15 +103,21 @@ const ProductForm = ({ const [messageType, setMessageType] = useState(null); const [messageData, setMessageData] = useState(null); const [SelectedUom, setSelectedUom] = useState(null); + const [SelectedTaxId, setSelectedTaxId] = useState(null); const [SelectedTaxNameId, setSelectedTaxNameId] = useState(null); const [OpenTaxModel, setOpenTaxModel] = useState(false); - const [OpenAdd, setOpenAdd] = useState(false); + // const [OpenAdd, setOpenAdd] = useState(false); const [imageBrandUrl, setBrandImageUrl] = useState(''); const [selectedHsn, setSelectedHsn] = useState(""); const [HsnDetails, setHsnDetails] = useState([]); - - + const [selectedAdditionalColumn, setSelectedAdditionalColumn] = useState([]); + const [showColumnModal, setShowColumnModal] = useState(false); + const [tempSelectedColumns, setTempSelectedColumns] = useState([]); + const [tableFieldPreferences, setTableFieldPreferences] = useState([]); + const [selectedFields, setSelectedFields] = useState([]); + console.log(selectedAdditionalColumn, "selectedAdditionalColumn") + console.log(tempSelectedColumns, "tempSelectedColumns") const CompId = getSession('CompId'); const BranchId = getSession('BranchId'); const AppId = getSession('AppId'); @@ -149,19 +163,39 @@ const ProductForm = ({ setSelectedTaxId(TaxId); } }, [TaxData]); + useEffect(() => { + getFieldSetup(); + }, [categoryId]) + const getFieldSetup = async () => { + try { + const response = await dispatch(getFieldSetupData({ AppId, CompId, BranchId, categoryId, Type: "QA" })).unwrap(); + if (response?.data?.statusCode === 1) { + console.log(response?.data?.data?.[0]?.ConfigDtl, "Field Setup Data"); + setSelectedFields(response?.data?.data?.[0]?.ConfigDtl?.filter(c => c.ConfigId && c.Access === 'Y')?.map(c => c.ConfigId) || []); + setSelectedAdditionalColumn(response?.data?.data?.[0]?.ConfigDtl?.filter(c => c.ConfigId && c.Access === 'Y')?.map(c => c.ConfigName) || []) + setTableFieldPreferences(response?.data?.data?.[0]?.ConfigDtl?.map(c => ({ + value: c.ConfigId, + label: c.ConfigName, + access: c.Access + })) || []); + } + } catch (error) { + console.error('Error fetching field setup:', error); + } + }; const onComplete = useCallback(() => { setMessageData(null); setMessageType(null); }, []); - const openAdditionalDetails = () => { - if (OpenAdd) { - setOpenAdd(false); - } else { - setOpenAdd(true); - } - }; + // const openAdditionalDetails = () => { + // if (OpenAdd) { + // setOpenAdd(false); + // } else { + // setOpenAdd(true); + // } + // }; const getApplicationPreference = async () => { @@ -367,7 +401,7 @@ const ProductForm = ({ setSelectedUom(null); setSelectedTaxId(null); handleCancelData(); - setOpenAdd(false); + // setOpenAdd(false); if (ProductSearchType != 'C') { let data = { CompId: CompId, @@ -444,6 +478,36 @@ const ProductForm = ({ } } + const handleFieldSetupSubmit = async () => { + + const postData = { + "AppId": AppId, + "CompId": CompId, + "BranchId": BranchId, + "Type": "QA", + "FormType": "Quick Add", + "TypeId": categoryId, + "ConfigDtl": selectedFields?.map((field) => ({ + "ConfigId": field, + "Access": 'Y', + })), + "CreatedBy": UserId + } + + const response = await dispatch(postFieldSetup(postData))?.unwrap(); + + if (response?.data?.statusCode === 1) { + setSelectedAdditionalColumn([...tempSelectedColumns]); + setShowColumnModal(false); + setTempSelectedColumns([]) + setMessageType("success"); + setMessageData(response?.data?.response); + await getFieldSetup(); + } else { + setMessageType("error"); + setMessageData("Failed to set up fields"); + } + } return (
+ +
{ + setTempSelectedColumns([...selectedAdditionalColumn]); + setShowColumnModal(true); + }}> + + {/* Additional Fields */} + { + setTempSelectedColumns([...selectedAdditionalColumn]); + setShowColumnModal(true); + }} + style={{ cursor: 'pointer', fontSize: '20px' }} + /> + +
+
@@ -667,30 +752,35 @@ const ProductForm = ({
)} - {OpenAdd && ( + {true && ( <> - {taxField && - ({ - value: option.TaxId, - label: getOptionLabel( - option, - SelectedTaxId === option.TaxId - ), - // label: option.TaxIdName + ' - ' + option.TaxPercentage + ' % ', - }))} - label="Tax" - className="field-DropDown" - isOnchanges={SelectedTaxId ? true : false} - onChangeFunction={handleTaxDropDownChange} - valueData={SelectedTaxId} - /> - - - - } + {(taxField && selectedAdditionalColumn?.includes('Tax')) && + + ({ + value: option.TaxId, + label: getOptionLabel( + option, + SelectedTaxId === option.TaxId + ), + // label: option.TaxIdName + ' - ' + option.TaxPercentage + ' % ', + }))} + label="Tax" + className="field-DropDown" + isOnchanges={SelectedTaxId ? true : false} + onChangeFunction={handleTaxDropDownChange} + valueData={SelectedTaxId} + /> + + } + {(taxField && selectedAdditionalColumn?.includes('Tax')) && + + + + + } - {cessField && } - {hsnField && - @@ -779,32 +869,34 @@ const ProductForm = ({ } - { - await validateSafeInput(value); // To block HTML tags & SQL keywords - return Promise.resolve(); + {selectedAdditionalColumn?.includes('WholeSale') && + - WholeSale} - /> - + { + validator: async (_, value) => { + await validateSafeInput(value); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + WholeSale} + /> + + } )}
-
+ {/*
Additional Details -
+
*/}
@@ -823,6 +915,7 @@ const ProductForm = ({ open={OpenTaxModel} footer={true} buttonText="Submit" + destroyOnClose={true} children={
@@ -901,6 +994,51 @@ const ProductForm = ({ handleSubmit={submitTax} handleCancel={handleTax} > + + { + setShowColumnModal(false); + setSelectedFields([...selectedAdditionalColumn.map(col => + tableFieldPreferences?.find(pref => pref.label === col)?.value + ).filter(Boolean)]); + setTempSelectedColumns([...selectedAdditionalColumn]); + }} + > +
+ {tableFieldPreferences?.map((option) => ( +
+ +
+ ))} +
+
+
); From b76e28f7ea89161bfc1e8066655f68bf31e8150b Mon Sep 17 00:00:00 2001 From: Tamilselvan Date: Wed, 28 Jan 2026 18:56:12 +0530 Subject: [PATCH 2/2] I have Just Added Style for Custmoized Quick Add --- src/Styles/Product/Product.scss | 44 ++++++++++++++------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/Styles/Product/Product.scss b/src/Styles/Product/Product.scss index 2d4e839..7363dd2 100644 --- a/src/Styles/Product/Product.scss +++ b/src/Styles/Product/Product.scss @@ -1,24 +1,9 @@ .cropUploadFieldSmall { - :where( - .css-dev-only-do-not-override-1v5z42l - ).ant-upload-wrapper.ant-upload-picture-card-wrapper - .ant-upload-list.ant-upload-list-picture-card - .ant-upload-list-item-container, - :where( - .css-dev-only-do-not-override-1v5z42l - ).ant-upload-wrapper.ant-upload-picture-circle-wrapper - .ant-upload-list.ant-upload-list-picture-card - .ant-upload-list-item-container, - :where( - .css-dev-only-do-not-override-1v5z42l - ).ant-upload-wrapper.ant-upload-picture-card-wrapper - .ant-upload-list.ant-upload-list-picture-circle - .ant-upload-list-item-container, - :where( - .css-dev-only-do-not-override-1v5z42l - ).ant-upload-wrapper.ant-upload-picture-circle-wrapper - .ant-upload-list.ant-upload-list-picture-circle - .ant-upload-list-item-container { + + :where(.css-dev-only-do-not-override-1v5z42l).ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container, + :where(.css-dev-only-do-not-override-1v5z42l).ant-upload-wrapper.ant-upload-picture-circle-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container, + :where(.css-dev-only-do-not-override-1v5z42l).ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-circle .ant-upload-list-item-container, + :where(.css-dev-only-do-not-override-1v5z42l).ant-upload-wrapper.ant-upload-picture-circle-wrapper .ant-upload-list.ant-upload-list-picture-circle .ant-upload-list-item-container { width: 65px; height: 65px; } @@ -125,6 +110,7 @@ .float-label { margin-bottom: 0; } + .ant-form-item-explain-error { position: relative; top: 16px; @@ -333,14 +319,14 @@ } .viewerExcelupload .ant-table-wrapper, -.viewerExcelupload .ant-table-tbody > tr.ant-table-row > td { +.viewerExcelupload .ant-table-tbody>tr.ant-table-row>td { padding: 4px; font-size: 14px; font-weight: 600; } .viewerExcelupload .ant-table-wrapper, -.viewerExcelupload .ant-table-thead > tr > th { +.viewerExcelupload .ant-table-thead>tr>th { padding: 1px 8px !important; } @@ -395,7 +381,7 @@ } .productinputForm { - .ant-input-affix-wrapper > input.ant-input { + .ant-input-affix-wrapper>input.ant-input { padding-top: 1.5rem; } } @@ -449,7 +435,7 @@ } .product-Add-HSN { - .ant-input-affix-wrapper > input.ant-input { + .ant-input-affix-wrapper>input.ant-input { padding: 12px 0 0 0 !important; } } @@ -490,7 +476,15 @@ } -.productFormproductImg{ +.productFormproductImg { width: 350px; align-items: center; +} + +.Customized_QuickAdd { + margin-bottom: 10px; + font-family: 'Poppins', sans-serif; + font-size: 16px; + font-weight: 400; + font-style: normal; } \ No newline at end of file