diff --git a/src/Pages/Preference/PreferenceList.jsx b/src/Pages/Preference/PreferenceList.jsx index abddc94..130e3ab 100644 --- a/src/Pages/Preference/PreferenceList.jsx +++ b/src/Pages/Preference/PreferenceList.jsx @@ -65,7 +65,7 @@ const PreferenceList = () => { const buildInitialValues = () => ({ dashboard: allSettingsMap['dashboard'] === 'Y', - shortcutkeys:allSettingsMap['shortcutkeys']==="Y", + shortcutkeys: allSettingsMap['shortcutkeys'] === 'Y', autoreceivestock: allSettingsMap['autoreceivestock'] === 'Y', decimal: allSettingsMap['decimal'] === 'Y', enabledModules: [ @@ -287,7 +287,7 @@ const PreferenceList = () => { const key = setting.SettingIdName.toLowerCase(); const boolValues = { dashboard: values.dashboard, - shortcutkeys:values.shortcutkeys, + shortcutkeys: values.shortcutkeys, autoreceivestock: values.autoreceivestock, decimal: values.decimal, searchfocus: values.searchfocus, @@ -564,7 +564,7 @@ const PreferenceList = () => { Sales Page {renderCheckbox('searchfocus', 'Always focus the search bar?')} - {renderCheckbox( + {renderCheckbox( 'shortcutkeys', 'Would you like to enable the shortcut keys?' )} @@ -589,7 +589,7 @@ const PreferenceList = () => { )} - {((allSettingsMap['dinein'] !== undefined && dinePreference) || + {((allSettingsMap['dinein'] !== undefined && dinePreference) || allSettingsMap['estimation'] !== undefined) && ( { 'customisedbillnumber', 'Do you Want Customised Bill Number?' )} - {renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')} + {renderCheckbox('scanlayout', 'Do you Want Scan Layout Page?')} {renderCheckbox('upiqr', 'Do you want to show the UPI QR code?')} {/* {renderCheckbox('editbill', 'Do you want to edit the previously created bill?')} */} @@ -749,7 +749,6 @@ const PreferenceList = () => { 'estimateprintheader', 'Do you want to include a header when printing Estimate bills?' )} -
label { + .ant-form-item-label > label { font-weight: 500; color: #000000; font-size: 16px; @@ -62,7 +62,7 @@ .submitButton { position: unset; - >button { + > button { width: max-content; bottom: 30px; } @@ -83,7 +83,7 @@ .menu-section { padding: 10px 0; - >div { + > div { font-family: "Poppins"; font-weight: 400; font-size: 14px; @@ -99,6 +99,14 @@ &:hover { background-color: #c0cbf8; } + @media (max-width: 500px) { + border: none !important; + text-decoration: none !important; + font-style: unset !important; + } + } + @media (max-width: 500px) { + overflow: auto; } } @@ -118,7 +126,7 @@ font-size: 1rem; } - .ant-form-item-label>label { + .ant-form-item-label > label { font-size: 14px; } @@ -141,7 +149,7 @@ margin: 0; text-decoration: underline; - >div { + > div { font-size: 12px; margin: 0; background-color: unset; @@ -167,4 +175,4 @@ .primary_Button { width: 200px !important; } -} \ No newline at end of file +} diff --git a/src/Pages/Product/ProductForm.jsx b/src/Pages/Product/ProductForm.jsx index 9a3add1..5f08c76 100644 --- a/src/Pages/Product/ProductForm.jsx +++ b/src/Pages/Product/ProductForm.jsx @@ -125,7 +125,7 @@ const ProductForm = ({ formType }) => { UomTypePreference?.some?.( (e) => e?.PreferredSubCatName?.toLowerCase() == - item?.ConfigName?.toLowerCase() && e?.PreferredStatus == 'Y' + item?.ConfigName?.toLowerCase() && e?.PreferredStatus == 'Y' ) ); console.log(UomTypePreference, 'UomTypePreference'); @@ -537,9 +537,12 @@ const ProductForm = ({ formType }) => { useEffect(() => { if ( - AppId !== undefined && AppId !== null && - CompId !== undefined && CompId !== null && - BranchId !== undefined && BranchId !== null + AppId !== undefined && + AppId !== null && + CompId !== undefined && + CompId !== null && + BranchId !== undefined && + BranchId !== null ) { productFetchData(); fetchRackData(); @@ -1125,7 +1128,7 @@ const ProductForm = ({ formType }) => { (item) => parseFloat(item.MRP) === parseFloat(subVariantPriceData?.MRP) && parseFloat(item.SellPrice) === - parseFloat(subVariantPriceData?.SellPrice) && + parseFloat(subVariantPriceData?.SellPrice) && //dhana 18-02-2025 item.ProdVariantName == subVariantPriceData?.ProdVariantName ); @@ -1140,20 +1143,20 @@ const ProductForm = ({ formType }) => { SellPrice: subVariantPriceData?.SellPrice, WhSalePrice: subVariantPriceData?.WhSalePrice == undefined || - subVariantPriceData?.WhSalePrice == null || - subVariantPriceData?.WhSalePrice == '' + subVariantPriceData?.WhSalePrice == null || + subVariantPriceData?.WhSalePrice == '' ? 0 : subVariantPriceData?.WhSalePrice, OfferPrice: subVariantPriceData?.OfferPrice == undefined || - subVariantPriceData?.OfferPrice == null || - subVariantPriceData?.OfferPrice == '' + subVariantPriceData?.OfferPrice == null || + subVariantPriceData?.OfferPrice == '' ? 0 : subVariantPriceData?.OfferPrice, SpecialPrice: subVariantPriceData?.SpecialPrice == undefined || - subVariantPriceData?.SpecialPrice == null || - subVariantPriceData?.SpecialPrice == '' + subVariantPriceData?.SpecialPrice == null || + subVariantPriceData?.SpecialPrice == '' ? 0 : subVariantPriceData?.SpecialPrice, InwardDtlId: null, @@ -1209,20 +1212,20 @@ const ProductForm = ({ formType }) => { SellPrice: subVariantPriceData?.SellPrice, WhSalePrice: subVariantPriceData?.WhSalePrice == undefined || - subVariantPriceData?.WhSalePrice == null || - subVariantPriceData?.WhSalePrice == '' + subVariantPriceData?.WhSalePrice == null || + subVariantPriceData?.WhSalePrice == '' ? 0 : subVariantPriceData?.WhSalePrice, OfferPrice: subVariantPriceData?.OfferPrice == undefined || - subVariantPriceData?.OfferPrice == null || - subVariantPriceData?.OfferPrice == '' + subVariantPriceData?.OfferPrice == null || + subVariantPriceData?.OfferPrice == '' ? 0 : subVariantPriceData?.OfferPrice, SpecialPrice: subVariantPriceData?.SpecialPrice == undefined || - subVariantPriceData?.SpecialPrice == null || - subVariantPriceData?.SpecialPrice == '' + subVariantPriceData?.SpecialPrice == null || + subVariantPriceData?.SpecialPrice == '' ? 0 : subVariantPriceData?.SpecialPrice, InwardDtlId: null, @@ -1288,20 +1291,20 @@ const ProductForm = ({ formType }) => { SellPrice: subVariantPriceData?.SellPrice, WhSalePrice: subVariantPriceData?.WhSalePrice == undefined || - subVariantPriceData?.WhSalePrice == null || - subVariantPriceData?.WhSalePrice == '' + subVariantPriceData?.WhSalePrice == null || + subVariantPriceData?.WhSalePrice == '' ? 0 : subVariantPriceData?.WhSalePrice, OfferPrice: subVariantPriceData?.OfferPrice == undefined || - subVariantPriceData?.OfferPrice == null || - subVariantPriceData?.OfferPrice == '' + subVariantPriceData?.OfferPrice == null || + subVariantPriceData?.OfferPrice == '' ? 0 : subVariantPriceData?.OfferPrice, SpecialPrice: subVariantPriceData?.SpecialPrice == undefined || - subVariantPriceData?.SpecialPrice == null || - subVariantPriceData?.SpecialPrice == '' + subVariantPriceData?.SpecialPrice == null || + subVariantPriceData?.SpecialPrice == '' ? 0 : subVariantPriceData?.SpecialPrice, InwardDtlId: null, @@ -1356,20 +1359,20 @@ const ProductForm = ({ formType }) => { SellPrice: subVariantPriceData?.SellPrice, WhSalePrice: subVariantPriceData?.WhSalePrice == undefined || - subVariantPriceData?.WhSalePrice == null || - subVariantPriceData?.WhSalePrice == '' + subVariantPriceData?.WhSalePrice == null || + subVariantPriceData?.WhSalePrice == '' ? 0 : subVariantPriceData?.WhSalePrice, OfferPrice: subVariantPriceData?.OfferPrice == undefined || - subVariantPriceData?.OfferPrice == null || - subVariantPriceData?.OfferPrice == '' + subVariantPriceData?.OfferPrice == null || + subVariantPriceData?.OfferPrice == '' ? 0 : subVariantPriceData?.OfferPrice, SpecialPrice: subVariantPriceData?.SpecialPrice == undefined || - subVariantPriceData?.SpecialPrice == null || - subVariantPriceData?.SpecialPrice == '' + subVariantPriceData?.SpecialPrice == null || + subVariantPriceData?.SpecialPrice == '' ? 0 : subVariantPriceData?.SpecialPrice, InwardDtlId: null, @@ -1438,17 +1441,17 @@ const ProductForm = ({ formType }) => { (item) => parseFloat(item.MRP) === parseFloat(subVariantPriceData?.MRP) && parseFloat(item.SellPrice) === - parseFloat(subVariantPriceData?.SellPrice) + parseFloat(subVariantPriceData?.SellPrice) ); if ( existsData?.length == 0 || (parseFloat(variantPriceData[variantEditIndex]?.MRP) === parseFloat(subVariantPriceData?.MRP) && parseFloat(variantPriceData[variantEditIndex]?.SellPrice) === - parseFloat(subVariantPriceData?.SellPrice) && + parseFloat(subVariantPriceData?.SellPrice) && //dhana 18-02-2025 variantPriceData[variantEditIndex]?.ProdVariantName == - subVariantPriceData?.ProdVariantName) + subVariantPriceData?.ProdVariantName) ) { let editVariantData = [...variantPriceData]; if ( @@ -1466,20 +1469,20 @@ const ProductForm = ({ formType }) => { SellPrice: subVariantPriceData?.SellPrice, WhSalePrice: subVariantPriceData?.WhSalePrice == undefined || - subVariantPriceData?.WhSalePrice == null || - subVariantPriceData?.WhSalePrice == '' + subVariantPriceData?.WhSalePrice == null || + subVariantPriceData?.WhSalePrice == '' ? 0 : subVariantPriceData?.WhSalePrice, OfferPrice: subVariantPriceData?.OfferPrice == undefined || - subVariantPriceData?.OfferPrice == null || - subVariantPriceData?.OfferPrice == '' + subVariantPriceData?.OfferPrice == null || + subVariantPriceData?.OfferPrice == '' ? 0 : subVariantPriceData?.OfferPrice, SpecialPrice: subVariantPriceData?.SpecialPrice == undefined || - subVariantPriceData?.SpecialPrice == null || - subVariantPriceData?.SpecialPrice == '' + subVariantPriceData?.SpecialPrice == null || + subVariantPriceData?.SpecialPrice == '' ? 0 : subVariantPriceData?.SpecialPrice, InwardDtlId: editVariantData[variantEditIndex]?.InwardDtlId, @@ -1493,20 +1496,20 @@ const ProductForm = ({ formType }) => { SellPrice: subVariantPriceData?.SellPrice, WhSalePrice: subVariantPriceData?.WhSalePrice == undefined || - subVariantPriceData?.WhSalePrice == null || - subVariantPriceData?.WhSalePrice == '' + subVariantPriceData?.WhSalePrice == null || + subVariantPriceData?.WhSalePrice == '' ? 0 : subVariantPriceData?.WhSalePrice, OfferPrice: subVariantPriceData?.OfferPrice == undefined || - subVariantPriceData?.OfferPrice == null || - subVariantPriceData?.OfferPrice == '' + subVariantPriceData?.OfferPrice == null || + subVariantPriceData?.OfferPrice == '' ? 0 : subVariantPriceData?.OfferPrice, SpecialPrice: subVariantPriceData?.SpecialPrice == undefined || - subVariantPriceData?.SpecialPrice == null || - subVariantPriceData?.SpecialPrice == '' + subVariantPriceData?.SpecialPrice == null || + subVariantPriceData?.SpecialPrice == '' ? 0 : subVariantPriceData?.SpecialPrice, InwardDtlId: editVariantData[variantEditIndex]?.InwardDtlId, @@ -1634,20 +1637,20 @@ const ProductForm = ({ formType }) => { SellPrice: row?.SellPrice, WhSalePrice: row?.WhSalePrice == undefined || - row?.WhSalePrice == null || - row?.WhSalePrice == '' + row?.WhSalePrice == null || + row?.WhSalePrice == '' ? 0 : row?.WhSalePrice, OfferPrice: row?.OfferPrice == undefined || - row?.OfferPrice == null || - row?.OfferPrice == '' + row?.OfferPrice == null || + row?.OfferPrice == '' ? 0 : row?.OfferPrice, SpecialPrice: row?.SpecialPrice == undefined || - row?.SpecialPrice == null || - row?.SpecialPrice == '' + row?.SpecialPrice == null || + row?.SpecialPrice == '' ? 0 : row?.SpecialPrice, InwardDtlId: row?.InwardDtlId, @@ -1661,20 +1664,20 @@ const ProductForm = ({ formType }) => { SellPrice: row?.SellPrice, WhSalePrice: row?.WhSalePrice == undefined || - row?.WhSalePrice == null || - row?.WhSalePrice == '' + row?.WhSalePrice == null || + row?.WhSalePrice == '' ? 0 : row?.WhSalePrice, OfferPrice: row?.OfferPrice == undefined || - row?.OfferPrice == null || - row?.OfferPrice == '' + row?.OfferPrice == null || + row?.OfferPrice == '' ? 0 : row?.OfferPrice, SpecialPrice: row?.SpecialPrice == undefined || - row?.SpecialPrice == null || - row?.SpecialPrice == '' + row?.SpecialPrice == null || + row?.SpecialPrice == '' ? 0 : row?.SpecialPrice, InwardDtlId: row?.InwardDtlId, @@ -1811,14 +1814,14 @@ const ProductForm = ({ formType }) => { postData['InwardDate'] = new Date().toJSON(); postData['AutoGenerateQr'] = values?.QRCode === undefined || - values?.QRCode === null || - values?.QRCode === '' + values?.QRCode === null || + values?.QRCode === '' ? QrcodeAuto : 'N'; postData['AutoGenerateSingleQr'] = values?.OnePcQR === undefined || - values?.OnePcQR === null || - values?.OnePcQR === '' + values?.OnePcQR === null || + values?.OnePcQR === '' ? QrcodeAutoSingle : 'N'; postData['CreatedBy'] = UserId; @@ -2136,6 +2139,7 @@ const ProductForm = ({ formType }) => { initialValues={ editstate || { LowStockCount: 0, ExpiryNotificationDays: 0 } } + style={{ marginTop: '0' }} >
@@ -2174,26 +2178,12 @@ const ProductForm = ({ formType }) => { />
- {/* */} - - {/*
*/} - {/*
- -
-
-
*/} + {/* dhana */} -
+
{/*
*/} -
+
{ label={} isOnChange={ editstate?.ProdName || - QrcodeExistsData?.[0]?.ProdName || - voiceData?.product + QrcodeExistsData?.[0]?.ProdName || + voiceData?.product ? true : false } @@ -2259,8 +2249,8 @@ const ProductForm = ({ formType }) => { label={} isOnChange={ editstate?.Size || - QrcodeExistsData?.[0]?.Size || - voiceData?.qty + QrcodeExistsData?.[0]?.Size || + voiceData?.qty ? true : false } @@ -2288,20 +2278,20 @@ const ProductForm = ({ formType }) => { /> } - // inputMode="decimal" - // onInput={(e) => { - // let cleanedValue = e.target.value.replace(/[^0-9.]/g, ""); // Remove invalid characters - // const parts = cleanedValue.split("."); + // inputMode="decimal" + // onInput={(e) => { + // let cleanedValue = e.target.value.replace(/[^0-9.]/g, ""); // Remove invalid characters + // const parts = cleanedValue.split("."); - // if (cleanedValue.startsWith(".")) { - // cleanedValue = "0" + cleanedValue; - // } + // if (cleanedValue.startsWith(".")) { + // cleanedValue = "0" + cleanedValue; + // } - // e.target.value = - // parts.length > 2 - // ? `${parts[0]}.${parts.slice(1).join("")}` - // : cleanedValue; - // }} + // e.target.value = + // parts.length > 2 + // ? `${parts[0]}.${parts.slice(1).join("")}` + // : cleanedValue; + // }} /> { label={} isOnChange={ editstate?.SellPrice || - QrcodeExistsData?.[0]?.SellPrice + QrcodeExistsData?.[0]?.SellPrice ? true : false } @@ -2471,12 +2461,12 @@ const ProductForm = ({ formType }) => { } onChangeFunction={handleProdCatDropDownChange} valueData={SelectedProdCat} - // disabled={ - // editstate?.ProdTypeName == 'Others' || - // formType == 'add' - // ? false - // : true - // } + // disabled={ + // editstate?.ProdTypeName == 'Others' || + // formType == 'add' + // ? false + // : true + // } /> { } onChangeFunction={handleProdSubCatDropDownChange} valueData={SelectedProdSubCat} - // disabled={ - // editstate?.ProdTypeName == 'Others' || - // formType == 'add' - // ? false - // : true - // } + // disabled={ + // editstate?.ProdTypeName == 'Others' || + // formType == 'add' + // ? false + // : true + // } /> {
{imagedata?.map((item, index) => (
setSelectedImage(item)} > @@ -2656,20 +2647,20 @@ const ProductForm = ({ formType }) => { {qrAndTokenDtlsFields?.includes( 'Auto Generate QRCode' ) && ( -
- openQrcodeAuto(e)} - disabled={editstate?.QRCode ? true : false} - /> -
- )} +
+ openQrcodeAuto(e)} + disabled={editstate?.QRCode ? true : false} + /> +
+ )} {(QrcodeAuto == 'N' || editstate?.QRCode) && qrAndTokenDtlsFields?.includes( 'Auto Generate QRCode' @@ -2706,19 +2697,19 @@ const ProductForm = ({ formType }) => { {qrAndTokenDtlsFields?.includes( 'Stock Maintenance' ) && ( -
- openStock(e)} - /> -
- )} +
+ openStock(e)} + /> +
+ )} {StockOpen === 'Y' && qrAndTokenDtlsFields?.includes( 'Stock Maintenance' @@ -2749,35 +2740,35 @@ const ProductForm = ({ formType }) => { {qrAndTokenDtlsFields?.includes( 'Token Maintenance' ) && ( -
- openToken(e)} - /> -
- )} +
+ openToken(e)} + /> +
+ )} {qrAndTokenDtlsFields?.includes( 'Rack Maintenance' ) && ( -
- openRack(e)} - /> -
- )} +
+ openRack(e)} + /> +
+ )} {RackOpen === 'Y' && qrAndTokenDtlsFields?.includes( @@ -2788,15 +2779,15 @@ const ProductForm = ({ formType }) => { options={ formType === 'edit' ? RackData?.map((option) => ({ - value: option.RackId, - label: option.RackName, - })) + value: option.RackId, + label: option.RackName, + })) : RackData?.filter( - (item) => item.ActiveStatus === 'A' - )?.map((option) => ({ - value: option.RackId, - label: option.RackName, - })) + (item) => item.ActiveStatus === 'A' + )?.map((option) => ({ + value: option.RackId, + label: option.RackName, + })) } label={ @@ -2822,21 +2813,21 @@ const ProductForm = ({ formType }) => { {qrAndTokenDtlsFields?.includes( 'Amount Per Piece' ) && ( -
- - openAmountPerPieceAvailable(e) - } - /> -
- )} +
+ + openAmountPerPieceAvailable(e) + } + /> +
+ )} {AmountPerPieceAvailable == 'Y' && qrAndTokenDtlsFields?.includes( @@ -2869,7 +2860,7 @@ const ProductForm = ({ formType }) => { } isOnChange={ editstate?.OnePcsPrice || - editstate?.OnePcsPrice == 0 + editstate?.OnePcsPrice == 0 ? true : false } @@ -2893,38 +2884,38 @@ const ProductForm = ({ formType }) => {
{(QrcodeAutoSingle == 'N' || editstate?.OnePcQR) && ( -
- - { - await validateSafeInput(value); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, +
+ + { + await validateSafeInput(value); // To block HTML tags & SQL keywords + return Promise.resolve(); }, - ]} - > - - -
- )} + }, + ]} + > + +
+
+ )} )} @@ -2973,134 +2964,134 @@ const ProductForm = ({ formType }) => { {(priceDtlsFields?.length > 0 || hsnAndMoreDtlsFields?.length > 0 || dateAndTimeDtlsFields?.length > 0) && ( -
- - -
-
- - ({ +
+ + +
+
+ + ({ value: option.ConfigId, label: option.ConfigName, })) - : ProductTypeData.filter( + : ProductTypeData.filter( (item) => item.ConfigName !== 'Others' )?.map((option) => ({ value: option.ConfigId, label: option.ConfigName, })) - } - label={ - - } + } + label={ + + } + className="field-DropDown" + isOnchanges={ + editstate?.ProdType || SelectedProductType + ? true + : false + } + onChangeFunction={ + handleProductTypeDropDownChange + } + valueData={SelectedProductType} + disabled={ + editstate?.ProdTypeName == 'Others' || + formType == 'add' + ? false + : true + } + /> + + + {priceDtlsFields?.includes('Tax') && ( + + ({ + value: option.TaxId, + label: getOptionLabel( + option, + SelectedTaxId === option.TaxId + ), + }))} + label="Tax" className="field-DropDown" isOnchanges={ - editstate?.ProdType || SelectedProductType + editstate?.TaxId || SelectedTaxId ? true : false } - onChangeFunction={ - handleProductTypeDropDownChange - } - valueData={SelectedProductType} - disabled={ - editstate?.ProdTypeName == 'Others' || - formType == 'add' - ? false - : true - } + onChangeFunction={handleTaxDropDownChange} + valueData={SelectedTaxId} /> + + + + )} - {priceDtlsFields?.includes('Tax') && ( - - ({ - value: option.TaxId, - label: getOptionLabel( - option, - SelectedTaxId === option.TaxId - ), - }))} - label="Tax" - className="field-DropDown" - isOnchanges={ - editstate?.TaxId || SelectedTaxId + {SelectedTaxId && + priceDtlsFields?.includes('Cess') && ( + { + await validateSafeInput(value); + if (!value) { + return Promise.resolve(); // Skip validation if the field is empty + } + + if ( + !/^\d{1,3}(\.\d{1,2})?$/.test(value) + ) { + return Promise.reject( + 'Cess should be a number with up to 2 decimal places' + ); + } + + const cessValue = parseFloat(value); + if (cessValue < 0 || cessValue > 100) { + return Promise.reject( + 'Cess cannot be greater than 100%' + ); + } + + return Promise.resolve(); + }, + }, + ]} + > + - - - )} - - {SelectedTaxId && - priceDtlsFields?.includes('Cess') && ( - { - await validateSafeInput(value); - if (!value) { - return Promise.resolve(); // Skip validation if the field is empty - } - - if ( - !/^\d{1,3}(\.\d{1,2})?$/.test(value) - ) { - return Promise.reject( - 'Cess should be a number with up to 2 decimal places' - ); - } - - const cessValue = parseFloat(value); - if (cessValue < 0 || cessValue > 100) { - return Promise.reject( - 'Cess cannot be greater than 100%' - ); - } - - return Promise.resolve(); - }, - }, - ]} - > - - - )} - {priceDtlsFields?.includes('Discount Type') && ( -
-
+
{ padding: '5px', backgroundColor: '#fff', } - : { opacity: '0.6', boxShadow: 'none' } - } - onClick={() => { - Onchangeoffertype('P'); + : { opacity: '0.6', boxShadow: 'none' } + } + onClick={() => { + Onchangeoffertype('P'); + }} + > + +

- -

- Percentage -

-
-
+
+
{ padding: '5px', backgroundColor: '#fff', } - : { opacity: '0.6', boxShadow: 'none' } - } - onClick={() => { - Onchangeoffertype('F'); + : { opacity: '0.6', boxShadow: 'none' } + } + onClick={() => { + Onchangeoffertype('F'); + }} + > + +

- -

- Fixed -

-
+ Fixed +

+
+
+ )} + + {priceDtlsFields?.includes('Discount Limit') && ( +
+ + Sales Limit} + autocomplete="off" + onChange={Handleoffervalue} + isOnChange={ + DiscountValue || DiscountValue == 0 + ? true + : false + } + inputMode="decimal" + onInput={(e) => { + const cleanedValue = + e.target.value.replace(/[^0-9.]/g, ''); + const parts = cleanedValue.split('.'); + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + value={DiscountValue} + /> + +
+ )} +
+ + {(hsnAndMoreDtlsFields?.length > 0 || + dateAndTimeDtlsFields?.length > 0 || + priceDtlsFields?.includes('Add Variant')) && ( +
+ {(hsnAndMoreDtlsFields?.length > 0 || + dateAndTimeDtlsFields?.length > 0) && ( +
+ {OpenAdd ? : } + + {OpenAdd + ? 'Hide Additional Details' + : 'Show Additional Details'} +
)} - - {priceDtlsFields?.includes('Discount Limit') && ( -
- - Sales Limit} - autocomplete="off" - onChange={Handleoffervalue} - isOnChange={ - DiscountValue || DiscountValue == 0 - ? true - : false - } - inputMode="decimal" - onInput={(e) => { - const cleanedValue = - e.target.value.replace(/[^0-9.]/g, ''); - const parts = cleanedValue.split('.'); - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - value={DiscountValue} - /> - + {priceDtlsFields?.includes('Add Variant') && ( +
+ Add Variant
)}
+ )} - {(hsnAndMoreDtlsFields?.length > 0 || - dateAndTimeDtlsFields?.length > 0 || - priceDtlsFields?.includes('Add Variant')) && ( -
- {(hsnAndMoreDtlsFields?.length > 0 || - dateAndTimeDtlsFields?.length > 0) && ( -
+ + {(hsnAndMoreDtlsFields?.length > 0 || + dateAndTimeDtlsFields?.length > 0) && ( +
+ {OpenAdd && ( +
+ {hsnAndMoreDtlsFields?.length > 0 && ( +
+ - {OpenAdd ? : } - - {OpenAdd - ? 'Hide Additional Details' - : 'Show Additional Details'} - -
- )} - {priceDtlsFields?.includes('Add Variant') && ( -
- Add Variant + +
+ {hsnAndMoreDtlsFields?.includes( + 'HSN' + ) && ( + { + await validateSafeInput( + value + ); + return Promise.resolve(); + }, + }, + ]} + > + + HSN Code + + } + id="HSNCode" + value={selectedHsn} + type="text" + list="hsnList" + maxLength={100} + autoComplete="off" + isOnChange={ + editstate?.HSNCode + ? true + : true + } + onChange={(e) => { + const value = + e?.target?.value || ''; + setSelectedHsn(value); + if (value.length >= 1) { + formRef.current?.setFieldsValue( + { + HSNCode: value, + } + ); + handleHsnData(value); + } + }} + suffix={ + selectedHsn?.length >= 1 ? ( + + setSelectedHsn('') + } + /> + ) : ( +
+ ) + } + /> + {HsnDetails?.length > 0 && ( + + {HsnDetails.filter( + (item) => { + const search = + selectedHsn?.toLowerCase() || + ''; + return ( + item.HSN_CD?.toLowerCase()?.includes( + search + ) || + item.Description?.toLowerCase()?.includes( + search + ) + ); + } + ).map((item, index) => ( + + )} + + )} + {hsnAndMoreDtlsFields?.includes( + 'Part Number' + ) && ( + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + + )} + + {hsnAndMoreDtlsFields?.includes( + 'Batch Number' + ) && ( + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + + )} + {hsnAndMoreDtlsFields?.includes( + 'Model Number' + ) && ( + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + + )} + {hsnAndMoreDtlsFields?.includes( + 'IMEI 1' + ) && ( + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + + )} + {hsnAndMoreDtlsFields?.includes( + 'IMEI 2' + ) && ( + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + + )} + {hsnAndMoreDtlsFields?.includes( + 'Serial Number' + ) && ( + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + + )} + {hsnAndMoreDtlsFields?.includes( + 'MacId' + ) && ( + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + + + )} +
+ +
)} -
- )} +
+ {dateAndTimeDtlsFields?.length > 0 && ( +
+ + +
+ {dateAndTimeDtlsFields?.includes( + 'Manufacture Date' + ) && ( + + +
+
+ +
+ )} + {/* {(dateAndTimeDtlsFields?.includes('Expiry Notification Days') && */} -
- - {(hsnAndMoreDtlsFields?.length > 0 || - dateAndTimeDtlsFields?.length > 0) && ( -
- {OpenAdd && ( -
- {hsnAndMoreDtlsFields?.length > 0 && ( -
- - -
- {hsnAndMoreDtlsFields?.includes( - 'HSN' - ) && ( - { - await validateSafeInput( - value - ); - return Promise.resolve(); - }, - }, - ]} - > - - HSN Code - - } - id="HSNCode" - value={selectedHsn} - type="text" - list="hsnList" - maxLength={100} - autoComplete="off" - isOnChange={ - editstate?.HSNCode - ? true - : true - } - onChange={(e) => { - const value = - e?.target?.value || ''; - setSelectedHsn(value); - if (value.length >= 1) { - formRef.current?.setFieldsValue( - { - HSNCode: value, - } - ); - handleHsnData(value); - } - }} - suffix={ - selectedHsn?.length >= 1 ? ( - - setSelectedHsn('') - } - /> - ) : ( -
- ) - } - /> - {HsnDetails?.length > 0 && ( - - {HsnDetails.filter( - (item) => { - const search = - selectedHsn?.toLowerCase() || - ''; - return ( - item.HSN_CD?.toLowerCase()?.includes( - search - ) || - item.Description?.toLowerCase()?.includes( - search - ) - ); - } - ).map((item, index) => ( - - )} - - )} - {hsnAndMoreDtlsFields?.includes( - 'Part Number' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} - - {hsnAndMoreDtlsFields?.includes( - 'Batch Number' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} - {hsnAndMoreDtlsFields?.includes( - 'Model Number' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} - {hsnAndMoreDtlsFields?.includes( - 'IMEI 1' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} - {hsnAndMoreDtlsFields?.includes( - 'IMEI 2' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} - {hsnAndMoreDtlsFields?.includes( - 'Serial Number' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} - {hsnAndMoreDtlsFields?.includes( - 'MacId' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} -
- - -
- )} -
- {dateAndTimeDtlsFields?.length > 0 && ( -
- - -
- {dateAndTimeDtlsFields?.includes( - 'Manufacture Date' - ) && ( - - -
-
- -
- )} - {/* {(dateAndTimeDtlsFields?.includes('Expiry Notification Days') && */} + { + await validateSafeInput( + value + ); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + Warranty Days + } + isOnChange={true} + /> + + {/* } */} + {dateAndTimeDtlsFields?.includes( + 'Expire Date' + ) && ( + + +
+
+ +
+ )} + {dateAndTimeDtlsFields?.includes( + 'Expiry Notification Days' + ) && + dateAndTimeDtlsFields?.includes( + 'Expire Date' + ) && ( { Warranty Days + } isOnChange={true} /> - {/* } */} - {dateAndTimeDtlsFields?.includes( - 'Expire Date' - ) && ( - - -
-
- -
- )} + )} - {dateAndTimeDtlsFields?.includes( - 'Expiry Notification Days' - ) && - dateAndTimeDtlsFields?.includes( - 'Expire Date' - ) && ( - { - await validateSafeInput( - value - ); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - Expiry Notification Days - - } - isOnChange={true} - /> - - )} - - {dateAndTimeDtlsFields?.includes( - 'Available From' - ) && ( - - -
-
- -
- )} - {dateAndTimeDtlsFields?.includes( - 'Available To' - ) && ( - - -
-
- -
- )} -
-
-
-
- )} -
+ {dateAndTimeDtlsFields?.includes( + 'Available From' + ) && ( + + +
+
+ +
+ )} + {dateAndTimeDtlsFields?.includes( + 'Available To' + ) && ( + + +
+
+ +
+ )} +
+ +
)} +
)} +
+ )} -
- {openVariant && ( - -
-
- - - Variant Name - - } - isOnChange={true} - disabled={ - formType == 'edit' && - variantPriceData[variantEditIndex]?.[ - 'ProdVariantName' - ] && - variantPriceData[variantEditIndex] - ?.InwardDtlId != null && - variantEdit - ? true - : false - } - /> - - { - await validateSafeInput(value); - if (parseFloat(value) === 0) { - return Promise.reject( - 'Please enter valid MRP' - ); - } - - if (value && value?.length > 10) { - return Promise.reject( - 'MRP should not exceed 10 chars' - ); - } - - return Promise.resolve(); - }, - }, - ]} - > - MRP - } - isOnChange={variantEdit ? true : false} - onChange={handleDynamicMRP} - onInput={(e) => { - let cleanedValue = - e.target.value.replace( - /[^0-9.]/g, - '' - ); // Remove invalid characters - const parts = cleanedValue.split('.'); - - if (cleanedValue.startsWith('.')) { - cleanedValue = '0' + cleanedValue; +
+ {openVariant && ( + +
+
+ + + Variant Name + + } + isOnChange={true} + disabled={ + formType == 'edit' && + variantPriceData[variantEditIndex]?.[ + 'ProdVariantName' + ] && + variantPriceData[variantEditIndex] + ?.InwardDtlId != null && + variantEdit + ? true + : false + } + /> + + { + await validateSafeInput(value); + if (parseFloat(value) === 0) { + return Promise.reject( + 'Please enter valid MRP' + ); } - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - /> - + if (value && value?.length > 10) { + return Promise.reject( + 'MRP should not exceed 10 chars' + ); + } + + return Promise.resolve(); + }, + }, + ]} + > + MRP + } + isOnChange={variantEdit ? true : false} + onChange={handleDynamicMRP} + onInput={(e) => { + let cleanedValue = + e.target.value.replace( + /[^0-9.]/g, + '' + ); // Remove invalid characters + const parts = cleanedValue.split('.'); + + if (cleanedValue.startsWith('.')) { + cleanedValue = '0' + cleanedValue; + } + + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + /> + + + + Sales Price + + } + isOnChange={variantEdit ? true : false} + onInput={(e) => { + let cleanedValue = + e.target.value.replace( + /[^0-9.]/g, + '' + ); // Remove invalid characters + const parts = cleanedValue.split('.'); + + if (cleanedValue.startsWith('.')) { + cleanedValue = '0' + cleanedValue; + } + + e.target.value = + parts.length > 2 + ? `${parts[0]}.${parts.slice(1).join('')}` + : cleanedValue; + }} + /> + + { + await validateSafeInput(value); // To block HTML tags & SQL keywords + return Promise.resolve(); + }, + }, + ]} + > + WholeSale} + isOnChange={variantEdit ? true : false} + /> + + { + await validateSafeInput(value); + if (value?.length > 10) { + return Promise.reject( + 'Offer cannot exceed 10 chars' + ); + } + return Promise.resolve(); + }, + }, + ]} + > + Offer} + isOnChange={variantEdit ? true : false} + /> + + { + await validateSafeInput(value); + if (value?.length > 10) { + return Promise.reject( + 'Special Price cannot exceed 10 chars' + ); + } + return Promise.resolve(); + }, + }, + ]} + > + Special Price} + isOnChange={variantEdit ? true : false} + /> + + {AmountPerPieceAvailable == 'Y' && ( - - Sales Price - - } - isOnChange={variantEdit ? true : false} - onInput={(e) => { - let cleanedValue = - e.target.value.replace( - /[^0-9.]/g, - '' - ); // Remove invalid characters - const parts = cleanedValue.split('.'); - - if (cleanedValue.startsWith('.')) { - cleanedValue = '0' + cleanedValue; - } - - e.target.value = - parts.length > 2 - ? `${parts[0]}.${parts.slice(1).join('')}` - : cleanedValue; - }} - /> - - { @@ -3909,131 +3975,56 @@ const ProductForm = ({ formType }) => { > WholeSale} - isOnChange={variantEdit ? true : false} - /> - - { - await validateSafeInput(value); - if (value?.length > 10) { - return Promise.reject( - 'Offer cannot exceed 10 chars' - ); - } - return Promise.resolve(); - }, - }, - ]} - > - Offer} - isOnChange={variantEdit ? true : false} - /> - - { - await validateSafeInput(value); - if (value?.length > 10) { - return Promise.reject( - 'Special Price cannot exceed 10 chars' - ); - } - return Promise.resolve(); - }, - }, - ]} - > - Special Price} - isOnChange={variantEdit ? true : false} - /> - - {AmountPerPieceAvailable == 'Y' && ( - { - await validateSafeInput(value); // To block HTML tags & SQL keywords - return Promise.resolve(); - }, - }, - ]} - > - - - )} - -
{ - try { - await formVariantRef.current?.validateFields(); - if (!variantEdit) { - addVariantPriceData(); - } else { - editVariantPrice(); - } - } catch (err) { - setMessageType('error'); - setMessageData( - 'Please fix the validation errors before submitting.' - ); + label="Amount Per Piece" + isOnChange={ + variantEdit ? true : false } - }} - > - {!variantEdit ? 'Add' : 'Update'} -
+ /> + + )} + +
{ + try { + await formVariantRef.current?.validateFields(); + if (!variantEdit) { + addVariantPriceData(); + } else { + editVariantPrice(); + } + } catch (err) { + setMessageType('error'); + setMessageData( + 'Please fix the validation errors before submitting.' + ); + } + }} + > + {!variantEdit ? 'Add' : 'Update'}
- - )} -
-
- - {variantPriceData?.length > 0 && ( -
- {' '} -
+
+ )}
- - -
- )} +
+ + {variantPriceData?.length > 0 && ( +
+ {' '} +
+ )} +
+
+
+
+ )}
{ buttonText="Submit" children={
-
+
{ handleCancel={handleSubCategory} children={ -
+
{ // rowClassName="editable-row" columns={Columns} dataSource={Tabledata} - // pagination={handlePageChange} - // onChange={handleChange} + // pagination={handlePageChange} + // onChange={handleChange} />
@@ -4235,7 +4226,7 @@ const ProductForm = ({ formType }) => { handleCancel={handleBrand} children={ -
+
{ buttonText="Submit" children={ -
+
({ @@ -4419,7 +4410,7 @@ const ProductForm = ({ formType }) => { onOk={handleExistsData} onCancel={handleExistsDataCancel} > -
+
{ - const [form] = Form.useForm(); - const dispatch = useDispatch() - const [selectedRowKeys, setSelectedRowKeys] = useState([]); - const [loading, setLoading] = useState(false); - const [modalOpen, setModalOpen] = useState(false); - const [modalData, setModalData] = useState([]); - const [checkedRows, setCheckedRows] = useState([]); - const [checkedRowKeys, setCheckedRowKeys] = useState([]); - const [messageType, setMessageType] = useState(null); - const [messageData, setMessageData] = useState(null); - const CompId = getSession('CompId'); - const BranchId = getSession('BranchId'); - const AppId = getSession('AppId'); - const UserId = getSession('UserId'); - const [TableData, setTableData] = useState([]); - const [employeeList, setEmployee] = useState([]); // Add this state for employee dropdown - const checkedTotal = checkedRows.reduce((sum, row) => sum + (Number(row?.IncentiveDetails?.[0]?.IncentiveAmount) || 0), 0); - const Paymentstatus = form.getFieldValue('status'); + const [form] = Form.useForm(); + const dispatch = useDispatch(); + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [loading, setLoading] = useState(false); + const [modalOpen, setModalOpen] = useState(false); + const [modalData, setModalData] = useState([]); + const [checkedRows, setCheckedRows] = useState([]); + const [checkedRowKeys, setCheckedRowKeys] = useState([]); + const [messageType, setMessageType] = useState(null); + const [messageData, setMessageData] = useState(null); + const CompId = getSession('CompId'); + const BranchId = getSession('BranchId'); + const AppId = getSession('AppId'); + const UserId = getSession('UserId'); + const [TableData, setTableData] = useState([]); + const [employeeList, setEmployee] = useState([]); // Add this state for employee dropdown + const checkedTotal = checkedRows.reduce( + (sum, row) => + sum + (Number(row?.IncentiveDetails?.[0]?.IncentiveAmount) || 0), + 0 + ); + const Paymentstatus = form.getFieldValue('status'); - console.log(checkedRowKeys, "checkedRowKeys") - // const employeeOptions = [ - // ...new Set(TableData.map(item => item.Employee)) - // ]; + console.log(checkedRowKeys, 'checkedRowKeys'); + // const employeeOptions = [ + // ...new Set(TableData.map(item => item.Employee)) + // ]; - - const [filteredData, setFilteredData] = useState(TableData); - const items = [ - { - name: 'Home', - link: `${subDirectory}app-page/home`, - }, { + const [filteredData, setFilteredData] = useState(TableData); + const items = [ + { + name: 'Home', + link: `${subDirectory}app-page/home`, + }, + { name: 'Incentive Settlement', link: `${subDirectory}report/EmployeeSettlement`, }, - ]; - const modalColumns = [ - { - title: 'Tip Date', - dataIndex: 'SalesDate', - key: 'SalesDate', - width: 100, - render: (date) => date ? dayjs(date).format('DD/MM/YYYY') : '', - }, - { - title: 'Tip Date', - dataIndex: 'TipsAmount', - key: 'TipsAmount', - width: 100, - render: (item) => ( - {item} - ), - }, + ]; + const modalColumns = [ + { + title: 'Tip Date', + dataIndex: 'SalesDate', + key: 'SalesDate', + width: 100, + render: (date) => (date ? dayjs(date).format('DD/MM/YYYY') : ''), + }, + { + title: 'Tip Date', + dataIndex: 'TipsAmount', + key: 'TipsAmount', + width: 100, + render: (item) => {item}, + }, - // Add more columns as needed based on your TipsDetails structure - ]; + // Add more columns as needed based on your TipsDetails structure + ]; - const handleEyeClick = (record) => { + const handleEyeClick = (record) => { + // Assuming TipsDetails is an array inside WaiterDetails[0] + setModalData(record); + setModalOpen(true); + }; - // Assuming TipsDetails is an array inside WaiterDetails[0] - setModalData(record); - setModalOpen(true); - }; + const columns = [ + { + title: 'Sl No', + dataIndex: 'slNo', + key: 'slNo', + width: 70, + align: 'center', + render: (text, object, index) => ( + {index + 1} + ), + }, - const columns = [ - { - title: 'Sl No', - dataIndex: 'slNo', - key: 'slNo', - width: 70, - align: 'center', - render: (text, object, index) => ( - {index + 1} - ), - }, - - { - title: 'Employee', - dataIndex: 'EmployeeName', - key: 'EmployeeName', - render: (item, record) => ( - {item ? item : record?.MobileNo} - ), - }, - { - title: 'Total Sales Amount', - align: 'right', - dataIndex: 'TotalSalesAmount', - key: 'TotalSalesAmount', - render: (_, record) => { - const statusMap = { toBe: "N", already: "Y" }; - const value = statusMap[form.getFieldValue('status')]; - const group = record?.StatusGroups?.find(e => e?.SettledStatus === value); - return {group?.TotalSalesAmount ?? 0}; - } - } - , - { - title: 'IncentiveAmount', - align: 'right', - dataIndex: 'IncentiveAmount', - key: 'IncentiveAmount', - render: (_, record) => { - const statusMap = { toBe: "N", already: "Y" }; - const value = statusMap[form.getFieldValue('status')]; - const group = record?.StatusGroups?.find(e => e?.SettledStatus === value); - return {group?.IncentiveAmount ?? 0}; - } - }, - ... (Paymentstatus !== "already") ? [{ + { + title: 'Employee', + dataIndex: 'EmployeeName', + key: 'EmployeeName', + render: (item, record) => ( + {item ? item : record?.MobileNo} + ), + }, + { + title: 'Total Sales Amount', + align: 'right', + dataIndex: 'TotalSalesAmount', + key: 'TotalSalesAmount', + render: (_, record) => { + const statusMap = { toBe: 'N', already: 'Y' }; + const value = statusMap[form.getFieldValue('status')]; + const group = record?.StatusGroups?.find( + (e) => e?.SettledStatus === value + ); + return {group?.TotalSalesAmount ?? 0}; + }, + }, + { + title: 'IncentiveAmount', + align: 'right', + dataIndex: 'IncentiveAmount', + key: 'IncentiveAmount', + render: (_, record) => { + const statusMap = { toBe: 'N', already: 'Y' }; + const value = statusMap[form.getFieldValue('status')]; + const group = record?.StatusGroups?.find( + (e) => e?.SettledStatus === value + ); + return {group?.IncentiveAmount ?? 0}; + }, + }, + ...(Paymentstatus !== 'already' + ? [ + { title: 'Settle', key: 'settle', width: 80, align: 'center', render: (_, record) => { - const waiterId = record?.EmployeeId; - const isDisabled = record?.IncentiveAmount === 12; + const waiterId = record?.EmployeeId; + const isDisabled = record?.IncentiveAmount === 12; - return ( - { - if (e.target.checked) { - setCheckedRowKeys(prev => prev.includes(waiterId) ? prev : [...prev, waiterId]); - setCheckedRows(prev => prev.find(row => row?.EmployeeId === waiterId) ? prev : [...prev, record]); - } else { - setCheckedRowKeys(prev => prev.filter(key => key !== waiterId)); - setCheckedRows(prev => prev.filter(row => row?.EmployeeId !== waiterId)); - } - }} - /> - ); + return ( + { + if (e.target.checked) { + setCheckedRowKeys((prev) => + prev.includes(waiterId) ? prev : [...prev, waiterId] + ); + setCheckedRows((prev) => + prev.find((row) => row?.EmployeeId === waiterId) + ? prev + : [...prev, record] + ); + } else { + setCheckedRowKeys((prev) => + prev.filter((key) => key !== waiterId) + ); + setCheckedRows((prev) => + prev.filter((row) => row?.EmployeeId !== waiterId) + ); + } + }} + /> + ); }, - }] : [{}] - ]; + }, + ] + : [{}]), + ]; - // Handle select all checkboxes - const handleSelectAll = e => { - if (e.target.checked) { - const allWaiterIds = groupByEmployeeAndStatus(TableData) - .map(emp => ({ - ...emp, - StatusGroups: emp.StatusGroups.filter(g => g.SettledStatus === "N") - })) - .filter(emp => emp.StatusGroups.length > 0)?.map(row => row?.EmployeeId); - setCheckedRowKeys(allWaiterIds); - setCheckedRows(TableData.slice()); - } else { - setCheckedRowKeys([]); - setCheckedRows([]); - } - }; - - useEffect(() => { - // Set today's date for fromDate and toDate in the form - const today = dayjs(); - form.setFieldsValue({ - fromDate: today, - toDate: today, - }); - dispatch(changeBreadCrumb({ items: items })); - fetchData(); - fetchtipDetails(); - }, []); - - const fetchtipDetails = async () => { - const data = { - CompId, - BranchId, - AppId, - }; - let response = await dispatch(getEmployeeSettlementList(data)).unwrap(); - if (response?.data?.statusCode === 1) { - setTableData(response?.data?.data?.EmployeeDetails) - } - // handle response as needed + // Handle select all checkboxes + const handleSelectAll = (e) => { + if (e.target.checked) { + const allWaiterIds = groupByEmployeeAndStatus(TableData) + .map((emp) => ({ + ...emp, + StatusGroups: emp.StatusGroups.filter((g) => g.SettledStatus === 'N'), + })) + .filter((emp) => emp.StatusGroups.length > 0) + ?.map((row) => row?.EmployeeId); + setCheckedRowKeys(allWaiterIds); + setCheckedRows(TableData.slice()); + } else { + setCheckedRowKeys([]); + setCheckedRows([]); } - const fetchData = async () => { - let data = { - activeStatus: 'A', - compId: CompId, - branchId: BranchId, - type: 'W', - }; - let response = await dispatch(WaiterNames(data))?.unwrap(); - if (response?.data?.statusCode === 1) { - setEmployee(response?.data?.data); - } + }; + + useEffect(() => { + // Set today's date for fromDate and toDate in the form + const today = dayjs(); + form.setFieldsValue({ + fromDate: today, + toDate: today, + }); + dispatch(changeBreadCrumb({ items: items })); + fetchData(); + fetchtipDetails(); + }, []); + + const fetchtipDetails = async () => { + const data = { + CompId, + BranchId, + AppId, + }; + let response = await dispatch(getEmployeeSettlementList(data)).unwrap(); + if (response?.data?.statusCode === 1) { + setTableData(response?.data?.data?.EmployeeDetails); } - - - - - - const handleReset = () => { - form.resetFields(); - setSelectedRowKeys([]); - setFilteredData(TableData); - setTableData([]) - + // handle response as needed + }; + const fetchData = async () => { + let data = { + activeStatus: 'A', + compId: CompId, + branchId: BranchId, + type: 'W', }; - - const onFinish = async (values) => { - const { Employee, fromDate, toDate, ...restValues } = values; - const data = { - CompId, - BranchId, - AppId, - ...restValues, - ...(Employee && Employee !== "all" && Employee !== "undefined" ? { employeeId: Employee } : {}), - }; - let response - Employee !== "all" ? response = await dispatch(getEmployeeSettlementListindIvidually(data)).unwrap() : response = await dispatch(getEmployeeSettlementList(data)).unwrap() - if (response?.data?.statusCode === 1) { - setTableData(response?.data?.data?.EmployeeDetails) - - const StatusValue = form.getFieldValue('status') === 'toBe' ? "N" : "Y"; - - const employees = response?.data?.data?.EmployeeDetails ?? []; - const data = employees.some(e => - e?.IncentiveDetails?.some(a => a?.SettledStatus === StatusValue && a?.IncentiveAmount > 0) - ); - if (data) { - setMessageType('success'); - setMessageData(response?.data?.response); - } - - - - } else { - setMessageType('error'); - setMessageData(response?.data?.response); - setTableData([]) - } - - }; - - const handleCheckedSubmit = async () => { - const today = dayjs(); - const statusMap = { toBe: "N", already: "Y" }; - const value = statusMap[form.getFieldValue('status')]; // "N" or "Y" - - const postData = { - CompId, - BranchId, - AppId, - CreatedBy: UserId, - EmployeeDetails: checkedRows.map((item) => { - const group = item?.StatusGroups?.find(g => g?.SettledStatus === value); - - return { - SettlementAmount: group?.IncentiveAmount ?? 0, - EmployeeId: item?.EmployeeId, - SettledPeriodDate: formatToYYYYMMDD(today), - IncentiveDetails: group?.items ?? [] - }; - }) - }; - - - - console.log(postData) - - let response = await dispatch(postEmployeeSettle(postData))?.unwrap(); - if (response?.data?.statusCode === 1) { - setMessageType('success'); - setMessageData(response?.data?.response); - handleReset() - setCheckedRows([]) - } else { - setMessageType('error'); - setMessageData(response?.data?.response); - handleReset() - } - }; - function formatToYYYYMMDD(dateString) { - const date = new Date(dateString); - - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based - const day = String(date.getDate()).padStart(2, '0'); - - return `${year}/${month}/${day}`; + let response = await dispatch(WaiterNames(data))?.unwrap(); + if (response?.data?.statusCode === 1) { + setEmployee(response?.data?.data); } + }; - const onComplete = useCallback(() => { - setMessageData(null); - setMessageType(null); - }, []); + const handleReset = () => { + form.resetFields(); + setSelectedRowKeys([]); + setFilteredData(TableData); + setTableData([]); + }; - // const getFilteredTableData = useCallback(() => { - // const statusMap = { toBe: "N", already: "Y" }; - // const value = statusMap[form.getFieldValue('status')]; + const onFinish = async (values) => { + const { Employee, fromDate, toDate, ...restValues } = values; + const data = { + CompId, + BranchId, + AppId, + ...restValues, + ...(Employee && Employee !== 'all' && Employee !== 'undefined' + ? { employeeId: Employee } + : {}), + }; + let response; + Employee !== 'all' + ? (response = await dispatch( + getEmployeeSettlementListindIvidually(data) + ).unwrap()) + : (response = await dispatch(getEmployeeSettlementList(data)).unwrap()); + if (response?.data?.statusCode === 1) { + setTableData(response?.data?.data?.EmployeeDetails); - // return value - // ? TableData.flatMap(item => - // item?.IncentiveDetails?.filter(detail => detail?.SettledStatus === value) || [] - // ) - // : TableData.flatMap(item => item?.IncentiveDetails || []); - // }, [form, TableData]); - function groupByEmployeeAndStatus(tableData) { - return tableData - .map(emp => { - const grouped = emp.IncentiveDetails.reduce((acc, curr) => { - if ((curr.IncentiveAmount || 0) === 0) { - return acc; // skip this detail entirely - } + const StatusValue = form.getFieldValue('status') === 'toBe' ? 'N' : 'Y'; - const status = curr.SettledStatus; - if (!acc[status]) { - acc[status] = { - SettledStatus: status, - TotalSalesAmount: 0, - IncentiveAmount: 0, - items: [] - }; - } - acc[status].TotalSalesAmount += curr.TotalSalesAmount || 0; - acc[status].IncentiveAmount += curr.IncentiveAmount || 0; - acc[status].items.push(curr); - return acc; - }, {}); - - return { - EmployeeId: emp?.EmployeeId, - EmployeeName: emp.EmployeeName, - StatusGroups: Object.values(grouped) - }; - }) - .filter(emp => emp.StatusGroups.length > 0); // remove employees with no valid items + const employees = response?.data?.data?.EmployeeDetails ?? []; + const data = employees.some((e) => + e?.IncentiveDetails?.some( + (a) => a?.SettledStatus === StatusValue && a?.IncentiveAmount > 0 + ) + ); + if (data) { + setMessageType('success'); + setMessageData(response?.data?.response); + } + } else { + setMessageType('error'); + setMessageData(response?.data?.response); + setTableData([]); } + }; + const handleCheckedSubmit = async () => { + const today = dayjs(); + const statusMap = { toBe: 'N', already: 'Y' }; + const value = statusMap[form.getFieldValue('status')]; // "N" or "Y" + const postData = { + CompId, + BranchId, + AppId, + CreatedBy: UserId, + EmployeeDetails: checkedRows.map((item) => { + const group = item?.StatusGroups?.find( + (g) => g?.SettledStatus === value + ); - let dataaaa = groupByEmployeeAndStatus(TableData) - console.log(dataaaa, "dataaaa") - useEffect(() => { - setCheckedRowKeys([]); - setCheckedRows([]); - }, [form.getFieldValue('status'), TableData]); - - const handleStatusChange = () => { - setCheckedRowKeys([]); - setCheckedRows([]); - setFilteredData([]); + return { + SettlementAmount: group?.IncentiveAmount ?? 0, + EmployeeId: item?.EmployeeId, + SettledPeriodDate: formatToYYYYMMDD(today), + IncentiveDetails: group?.items ?? [], + }; + }), }; + console.log(postData); + let response = await dispatch(postEmployeeSettle(postData))?.unwrap(); + if (response?.data?.statusCode === 1) { + setMessageType('success'); + setMessageData(response?.data?.response); + handleReset(); + setCheckedRows([]); + } else { + setMessageType('error'); + setMessageData(response?.data?.response); + handleReset(); + } + }; + function formatToYYYYMMDD(dateString) { + const date = new Date(dateString); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based + const day = String(date.getDate()).padStart(2, '0'); + return `${year}/${month}/${day}`; + } - return ( -
-
- -
- - { + setMessageData(null); + setMessageType(null); + }, []); + + // const getFilteredTableData = useCallback(() => { + // const statusMap = { toBe: "N", already: "Y" }; + // const value = statusMap[form.getFieldValue('status')]; + + // return value + // ? TableData.flatMap(item => + // item?.IncentiveDetails?.filter(detail => detail?.SettledStatus === value) || [] + // ) + // : TableData.flatMap(item => item?.IncentiveDetails || []); + // }, [form, TableData]); + function groupByEmployeeAndStatus(tableData) { + return tableData + .map((emp) => { + const grouped = emp.IncentiveDetails.reduce((acc, curr) => { + if ((curr.IncentiveAmount || 0) === 0) { + return acc; // skip this detail entirely + } + + const status = curr.SettledStatus; + if (!acc[status]) { + acc[status] = { + SettledStatus: status, + TotalSalesAmount: 0, + IncentiveAmount: 0, + items: [], + }; + } + acc[status].TotalSalesAmount += curr.TotalSalesAmount || 0; + acc[status].IncentiveAmount += curr.IncentiveAmount || 0; + acc[status].items.push(curr); + return acc; + }, {}); + + return { + EmployeeId: emp?.EmployeeId, + EmployeeName: emp.EmployeeName, + StatusGroups: Object.values(grouped), + }; + }) + .filter((emp) => emp.StatusGroups.length > 0); // remove employees with no valid items + } + + let dataaaa = groupByEmployeeAndStatus(TableData); + console.log(dataaaa, 'dataaaa'); + useEffect(() => { + setCheckedRowKeys([]); + setCheckedRows([]); + }, [form.getFieldValue('status'), TableData]); + + const handleStatusChange = () => { + setCheckedRowKeys([]); + setCheckedRows([]); + setFilteredData([]); + }; + + return ( +
+
+ +
+ + + + + + - + + {employeeList.map((emp) => ( + + ))} + + + - }} - > - - - - - - - - - {/* + {/* { */} - - - - To Be Settled - Already Settled - - - + + + + To Be Settled + Already Settled + + + - - - - - - - - - - - + + + + + + + + + + - {/* Data Table */} - {Paymentstatus !== "already" &&
- 0 && checkedRowKeys?.length < TableData?.length} - checked={TableData?.length > 0 && checkedRowKeys?.length === TableData?.length} - onChange={handleSelectAll} - > - Select All - -
} - ({ - ...emp, - StatusGroups: emp.StatusGroups.filter(g => g.SettledStatus === "N") - })) - .filter(emp => emp.StatusGroups.length > 0) : groupByEmployeeAndStatus(TableData).map(emp => ({ - ...emp, - StatusGroups: emp.StatusGroups.filter(g => g.SettledStatus === "Y") - })) - .filter(emp => emp.StatusGroups.length > 0) - } - loading={loading} - scroll={{ x: 'max-content' }} - size="middle" - style={{ backgroundColor: 'white' }} - /> + {/* Data Table */} + {Paymentstatus !== 'already' && ( +
+ 0 && + checkedRowKeys?.length < TableData?.length + } + checked={ + TableData?.length > 0 && + checkedRowKeys?.length === TableData?.length + } + onChange={handleSelectAll} + > + Select All + +
+ )} +
+
({ + ...emp, + StatusGroups: emp.StatusGroups.filter( + (g) => g.SettledStatus === 'N' + ), + })) + .filter((emp) => emp.StatusGroups.length > 0) + : groupByEmployeeAndStatus(TableData) + .map((emp) => ({ + ...emp, + StatusGroups: emp.StatusGroups.filter( + (g) => g.SettledStatus === 'Y' + ), + })) + .filter((emp) => emp.StatusGroups.length > 0) + } + loading={loading} + scroll={{ x: 'max-content' }} + size="middle" + style={{ backgroundColor: 'white' }} + /> + + {/* Button to submit checked rows */} - {/* Button to submit checked rows */} - -
-
- {/* {checkedRowKeys.length !== 0 && ( +
+
+ {/* {checkedRowKeys.length !== 0 && ( )} */} - -
-
- - setModalOpen(false)} - footer={null} - title="Tip Details" - width={600} - > -
idx} - size="small" - /> - - - {/* Selected Rows Info */} - {selectedRowKeys.length > 0 && ( -
- - Selected {selectedRowKeys.length} items - -
- )} - + - ); + + + setModalOpen(false)} + footer={null} + title="Tip Details" + width={600} + > +
idx} + size="small" + /> + + + {/* Selected Rows Info */} + {selectedRowKeys.length > 0 && ( +
+ + Selected {selectedRowKeys.length} items + +
+ )} + + ); }; -export default EmployeeSettlement; \ No newline at end of file +export default EmployeeSettlement; diff --git a/src/Pages/StockMaster/StockList.jsx b/src/Pages/StockMaster/StockList.jsx index 44db6f7..93fd868 100644 --- a/src/Pages/StockMaster/StockList.jsx +++ b/src/Pages/StockMaster/StockList.jsx @@ -241,7 +241,6 @@ const StockList = () => { if (Response?.data?.statusCode === 1) { return Response?.data?.data; } else { - return []; } }; @@ -295,7 +294,6 @@ const StockList = () => { setpage(1); return Response?.data?.data; } else { - return []; } } @@ -892,25 +890,25 @@ const StockList = () => { PaymentAmount: PaymentAmount.toFixed(2), InvoiceDate: groupInfo.InwardDate ? moment(groupInfo.InwardDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, SuppInvoiceNo: groupInfo.SupplierInvoiceNumber, SuppInvoiceDate: groupInfo.SupplierInvoiceDate ? moment(groupInfo.SupplierInvoiceDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, DeliveryChallanNo: groupInfo.DeliveryChallanNo, DeliveryInvoiceDate: groupInfo.DeliveryInvoiceDate ? moment(groupInfo.DeliveryInvoiceDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, DueDate: groupInfo.DueDate ? moment(groupInfo.DueDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, InvoiceAmount: Totalamount.toFixed(2), TaxAmount: Totaltax.toFixed(2), @@ -928,13 +926,13 @@ const StockList = () => { FreeQty: item.FreeQty, ManufDate: item.ManufactureDate ? moment(item.ManufactureDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, ExpDate: item.ExpireDate ? moment(item.ExpireDate, 'YYYY-MM-DD').format( - 'YYYY-MM-DDTHH:mm:ss' - ) + 'YYYY-MM-DDTHH:mm:ss' + ) : null, BatchNo: item.BatchNo, ModelNo: item.ModelNo, @@ -991,7 +989,6 @@ const StockList = () => { (e) => `${e.ProdName} (${e.Size} ${e.UomName})` ); - const SupplierNames = SupplierData?.map((e) => e.SuppName); const TaxDatas = TaxData.map((e) => e.TaxIdName); @@ -1006,9 +1003,6 @@ const StockList = () => { const InwardDtlIds = Varientdata?.map((e) => e.InwardDtlId); const StockProductId = Varientdata?.map((e) => e.ProdId); - - - const onFinish = async () => { const template = barcodeTemplateDetails?.find( (find) => find.SessionName === dropdownValue @@ -1164,7 +1158,7 @@ const StockList = () => { ? countData?.length : 0 : data?.[0]?.TotalCount; - console.log(debouncedSearchText, countData, data, "kkkk", countOfProduct) + console.log(debouncedSearchText, countData, data, 'kkkk', countOfProduct); return (
@@ -1178,9 +1172,10 @@ const StockList = () => {
+ className="StocklistsearchAddDiv" + style={{ justifyContent: 'flex-start', flexWrap: 'wrap' }} + > +
{ data={filteredData} dataSource={filteredData} onChange={handleChange} - // pagination={handlePageChange} + // pagination={handlePageChange} />{' '} {countOfProduct > 10 && ( { generateQRCodeCopy={(code) => generateQRCodeCopy(QrandbarcodeDatas, code) } - generateCodeImage={(code, codeType = 'Q') => generateCodeImage(code, codeType, QrandbarcodeDatas)} + generateCodeImage={(code, codeType = 'Q') => + generateCodeImage(code, codeType, QrandbarcodeDatas) + } imageTagBarcodeAndQR={imageTagBarcodeAndQR} dropdownValue={dropdownValue} barcodeTemplateDetails={barcodeTemplateDetails} diff --git a/src/Styles/Dining/DiningForm.scss b/src/Styles/Dining/DiningForm.scss index 6a45512..10ca98f 100644 --- a/src/Styles/Dining/DiningForm.scss +++ b/src/Styles/Dining/DiningForm.scss @@ -12,8 +12,7 @@ input::-webkit-inner-spin-button { } .Dinein-Form-Structure { width: 80vw; - background-color: #fff; - padding: 0rem 2rem; + background-color: #fff; border-radius: 15px; } .Dinein-Form { @@ -21,7 +20,8 @@ input::-webkit-inner-spin-button { display: flex; flex-direction: row; padding-top: 2rem; - gap: 1rem; + gap: 0; + column-gap: 1rem; border-radius: 10px; flex-wrap: wrap; } diff --git a/src/Styles/Employee/EmpMaster.scss b/src/Styles/Employee/EmpMaster.scss index 1525651..61ab1c1 100644 --- a/src/Styles/Employee/EmpMaster.scss +++ b/src/Styles/Employee/EmpMaster.scss @@ -3,7 +3,7 @@ } .required:after { - content: ' *'; + content: " *"; color: #ff4d4f; } @@ -18,7 +18,7 @@ border: none; } -.subinputForm .ant-input-affix-wrapper>input.ant-input { +.subinputForm .ant-input-affix-wrapper > input.ant-input { font-size: inherit; border: none; padding: 18px 14px 6px 1px !important; @@ -96,7 +96,6 @@ } } - .image-preview__content { background-color: #f5f5f5; margin: 1rem; @@ -144,12 +143,18 @@ &:active { background-color: #5e5e5e; } - - } .padding-less-modal { .ant-modal-content { padding: 34px !important; } -} \ No newline at end of file +} + +.StocklistsearchAddDiv { + display: flex; + align-items: center; + gap: 1rem; + flex-wrap: wrap; + margin-bottom: 10px; +} diff --git a/src/Styles/Product/Product.scss b/src/Styles/Product/Product.scss index 5384537..8cabe6c 100644 --- a/src/Styles/Product/Product.scss +++ b/src/Styles/Product/Product.scss @@ -28,6 +28,7 @@ .productinputForm { display: flex; flex-wrap: wrap; + gap: 6px; & .field-DropDown { width: 200px !important; @@ -124,6 +125,24 @@ left: 2px; } } +.ProSubRowFlex { + display: flex; + flex-wrap: wrap; + flex-direction: row; + gap: 1.5rem; + width: 100%; + + .ant-form-item, + .float-label { + margin-bottom: 0; + } + + .ant-form-item-explain-error { + position: relative; + top: 16px; + left: 2px; + } +} .scannerdiv { display: flex; @@ -469,10 +488,12 @@ flex-wrap: wrap; justify-content: flex-start; padding-bottom: 0; + flex-direction: row !important; @media (max-width: 768px) { gap: 10px; align-items: flex-start; + justify-content: space-between; } } @@ -488,7 +509,8 @@ } .productFormproductImg { - width: 350px; + width: 250px; + height: 190px; align-items: center; } @@ -510,3 +532,13 @@ bottom: 8px; } } + +.ProductMainRowFlex { + display: flex; + align-items: flex-start; + gap: 1rem; + width: 100%; + @media (max-width: 768px) { + flex-direction: column; + } +}