Merge pull request 'combo-table8-Hold-qty-edit-issue' (#151) from combo-table8-Hold-qty-edit-issue into main
Reviewed-on: Pozomind/pozo-retail-app#151
This commit is contained in:
commit
5aff627aa7
|
|
@ -36,8 +36,10 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
const formRef = useRef(null);
|
const formRef = useRef(null);
|
||||||
const quantityInputRef = useRef(null);
|
const quantityInputRef = useRef(null);
|
||||||
const priceChangeInputRef = useRef(null);
|
const priceChangeInputRef = useRef(null);
|
||||||
|
const modalRef = useRef(null);
|
||||||
const { setIndex = () => {}, setEditQtyCombo = () => {}, setEditRateCombo = () => {} } = props;
|
const { setIndex = () => {}, setEditQtyCombo = () => {}, setEditRateCombo = () => {} } = props;
|
||||||
|
|
||||||
|
|
||||||
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
const [disableSubmitButton, setDisableSubmitButton] = useState(false);
|
||||||
const SessionData = useSelector(StoredSessionData);
|
const SessionData = useSelector(StoredSessionData);
|
||||||
// const AppId = SessionData?.AppId;
|
// const AppId = SessionData?.AppId;
|
||||||
|
|
@ -140,11 +142,18 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
if (preferenceshortcutkey && event.shiftKey && event.key === 'E') {
|
const navigationKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||||
|
if (event.key === 'Escape' || navigationKeys.includes(event.key)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (PriceChangeaccess && props.Productdata?.Offer <= 0) {
|
if (props.BSBillingEditQuantity) {
|
||||||
onRadioBtnChange('Price');
|
props.handleEditQuantityCancel?.();
|
||||||
|
setEditQtyCombo(false);
|
||||||
}
|
}
|
||||||
|
if (props.BSBillingEditRate) {
|
||||||
|
props.handleEditRateComboCancel?.();
|
||||||
|
setEditRateCombo(false);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -160,8 +169,12 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
preferenceshortcutkey,
|
preferenceshortcutkey,
|
||||||
PriceChangeaccess,
|
PriceChangeaccess,
|
||||||
props.Productdata?.Offer,
|
props.Productdata?.Offer,
|
||||||
|
props.BSBillingEditQuantity,
|
||||||
|
props.BSBillingEditRate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const BillOrder = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
|
const BillOrder = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
|
||||||
(item) => item.SettingIdName === 'BillItemsOrder'
|
(item) => item.SettingIdName === 'BillItemsOrder'
|
||||||
|
|
@ -3203,6 +3216,7 @@ const ComboEditQtyAndRate = (props) => {
|
||||||
ref={quantityInputRef}
|
ref={quantityInputRef}
|
||||||
type="number"
|
type="number"
|
||||||
value={Quantity}
|
value={Quantity}
|
||||||
|
min="0"
|
||||||
onChange={(e) => setQuantity(e.target.value)}
|
onChange={(e) => setQuantity(e.target.value)}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
if (Quantity && Quantity.trim() !== '') {
|
if (Quantity && Quantity.trim() !== '') {
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,6 @@ const ComboSalesBillTable = () => {
|
||||||
const [PreviousdataLength, setPreviousdataLength] = useState();
|
const [PreviousdataLength, setPreviousdataLength] = useState();
|
||||||
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
|
const BookingTypeBoth = useSelector(GlobalBookingTypeBoth);
|
||||||
const OrderType = useSelector(GlobalOrderType);
|
const OrderType = useSelector(GlobalOrderType);
|
||||||
console.log(PreviousOrderLength, 'PreviousOrderLength');
|
|
||||||
const GlobEstBooking = useSelector(GlobalEstimateBooking);
|
const GlobEstBooking = useSelector(GlobalEstimateBooking);
|
||||||
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
|
const GlobalExtraCharge = useSelector(globalExtraTotalAmount);
|
||||||
const OfferFreeProduct = useSelector(GlobalFreeProdList, shallowEqual);
|
const OfferFreeProduct = useSelector(GlobalFreeProdList, shallowEqual);
|
||||||
|
|
@ -236,6 +235,48 @@ const ComboSalesBillTable = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [tableOptions]);
|
}, [tableOptions]);
|
||||||
|
|
||||||
|
// Merge same items in hold order
|
||||||
|
useEffect(() => {
|
||||||
|
if (OrderType === 'Hold' && tableData?.length > 0) {
|
||||||
|
const mergedData = [];
|
||||||
|
const processedIds = new Set();
|
||||||
|
|
||||||
|
tableData.forEach((item) => {
|
||||||
|
const key = `${item.InwardDtlId}-${item.BookingTypeName}-${item.OrderRate}`;
|
||||||
|
|
||||||
|
if (processedIds.has(key)) return;
|
||||||
|
|
||||||
|
// Find all items with same InwardDtlId, BookingTypeName, and OrderRate
|
||||||
|
const sameItems = tableData.filter(
|
||||||
|
(i) =>
|
||||||
|
i.InwardDtlId === item.InwardDtlId &&
|
||||||
|
i.BookingTypeName === item.BookingTypeName &&
|
||||||
|
i.OrderRate === item.OrderRate
|
||||||
|
);
|
||||||
|
|
||||||
|
if (sameItems.length > 1) {
|
||||||
|
// Merge quantities
|
||||||
|
const totalQty = sameItems.reduce((sum, i) => sum + i.OrderQty, 0);
|
||||||
|
const mergedItem = {
|
||||||
|
...sameItems[0],
|
||||||
|
OrderQty: totalQty,
|
||||||
|
TotalAmt: totalQty * item.OrderRate,
|
||||||
|
TaxAmt: ((totalQty * item.OrderRate * item.TaxPercentage) / (100 + item.TaxPercentage)),
|
||||||
|
};
|
||||||
|
mergedData.push(mergedItem);
|
||||||
|
} else {
|
||||||
|
mergedData.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
processedIds.add(key);
|
||||||
|
});
|
||||||
|
if (mergedData.length !== tableData.length) {
|
||||||
|
dispatch(changeOrderCardDetails(mergedData));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [tableData?.length, OrderType]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (SelectedFont) {
|
if (SelectedFont) {
|
||||||
WebFont.load({
|
WebFont.load({
|
||||||
|
|
@ -347,7 +388,7 @@ const ComboSalesBillTable = () => {
|
||||||
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
||||||
setEditQuantity(false);
|
setEditQuantity(false);
|
||||||
} else {
|
} else {
|
||||||
if (value?.SalesId) {
|
if (value?.SalesId && OrderType !== 'Hold') {
|
||||||
setEditQuantity(false);
|
setEditQuantity(false);
|
||||||
} else {
|
} else {
|
||||||
setEditQuantity(true);
|
setEditQuantity(true);
|
||||||
|
|
@ -360,7 +401,7 @@ const ComboSalesBillTable = () => {
|
||||||
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
||||||
setEditQtyCombo(false);
|
setEditQtyCombo(false);
|
||||||
} else {
|
} else {
|
||||||
if (value?.SalesId) {
|
if (value?.SalesId && OrderType !== 'Hold') {
|
||||||
setEditQtyCombo(false);
|
setEditQtyCombo(false);
|
||||||
} else {
|
} else {
|
||||||
setEditQtyCombo(true);
|
setEditQtyCombo(true);
|
||||||
|
|
@ -374,7 +415,7 @@ const ComboSalesBillTable = () => {
|
||||||
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
if (OtherServicesglobal && value.Type == 'OS' && value.ServiceType == 'I') {
|
||||||
setEditRateCombo(false);
|
setEditRateCombo(false);
|
||||||
} else {
|
} else {
|
||||||
if (value?.SalesId) {
|
if (value?.SalesId && OrderType !== 'Hold') {
|
||||||
setEditRateCombo(false);
|
setEditRateCombo(false);
|
||||||
} else {
|
} else {
|
||||||
setEditRateCombo(true);
|
setEditRateCombo(true);
|
||||||
|
|
@ -2196,7 +2237,6 @@ const ComboSalesBillTable = () => {
|
||||||
tableOptions,
|
tableOptions,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
console.log(combinedTableData, 'combinedTableData', tableData);
|
|
||||||
const displayTableData =
|
const displayTableData =
|
||||||
BillOrderPre === 'N' ? [...combinedTableData].reverse() : combinedTableData;
|
BillOrderPre === 'N' ? [...combinedTableData].reverse() : combinedTableData;
|
||||||
|
|
||||||
|
|
@ -2410,7 +2450,7 @@ const ComboSalesBillTable = () => {
|
||||||
? 'wheat'
|
? 'wheat'
|
||||||
: 'inherit'
|
: 'inherit'
|
||||||
: 'none',
|
: 'none',
|
||||||
background: row?.SalesId
|
background: row?.SalesId && OrderType !== 'Hold'
|
||||||
? 'rgb(243, 248, 213)'
|
? 'rgb(243, 248, 213)'
|
||||||
: GlobEstBooking === 'ParEst' &&
|
: GlobEstBooking === 'ParEst' &&
|
||||||
GlobProdwisedata?.includes(
|
GlobProdwisedata?.includes(
|
||||||
|
|
|
||||||
|
|
@ -1204,6 +1204,7 @@ export default function BSC1Search(props) {
|
||||||
let ProdNamedata = ProductList?.find((item) => item.ProdName === data);
|
let ProdNamedata = ProductList?.find((item) => item.ProdName === data);
|
||||||
const removedDefault = removeDefaultVariantStock(ProdNamedata);
|
const removedDefault = removeDefaultVariantStock(ProdNamedata);
|
||||||
setSelectedProduct(removedDefault);
|
setSelectedProduct(removedDefault);
|
||||||
|
formRef.current.resetFields(['ItemName']);
|
||||||
};
|
};
|
||||||
const ProductSelected = (item) => {
|
const ProductSelected = (item) => {
|
||||||
if (item.OverAllExpStatus == 'Y') {
|
if (item.OverAllExpStatus == 'Y') {
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ const PublicQrCodeShare = (qrCodeUrl) => {
|
||||||
toEmail: toEmail,
|
toEmail: toEmail,
|
||||||
type: 'M',
|
type: 'M',
|
||||||
fileUrl: qrCodeUrl.qrCodeUrl,
|
fileUrl: qrCodeUrl.qrCodeUrl,
|
||||||
|
HeaderType:"SelfBooking"
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue