Added Sales and Estimate Buttons an ddata also split

This commit is contained in:
Srinath 2026-02-11 15:46:40 +05:30
parent c4edea3722
commit 97e2724525
1 changed files with 49 additions and 17 deletions

View File

@ -87,6 +87,7 @@ import { v4 as uuidv4 } from 'uuid';
import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js';
import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, changeLoyaltyConsumedQuantities } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js';
import { Radio } from 'antd';
const RetailApiurl = import.meta.env.ENV_API_URL;
@ -127,12 +128,17 @@ function BSReprint({ setOpenModel = () => { } }) {
const SettingDataSelector = useSelector(PreferenceData);
const salesBillEdit = useSelector(GlobalSalesBillEdit);
const custDisable = useSelector(GlobalSelectedCustDisable);
console.log(SettingDataSelector, 'SettingDataSelector');
console.log(SettingDataSelector, 'SettingDataSelectoraa');
const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
setting?.SettingValue === 'Y'
);
const preferenceEstimate =
SettingDataSelector?.[0]?.['SettingDtlDetails']?.find(
(item) => item.SettingIdName === 'Estimation'
)?.SettingValue === 'Y';
console.log(preferenceEstimate, 'preferenceEstimate');
const editBill = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
(setting) =>
setting?.SettingIdName?.toLowerCase() === 'editbill' &&
@ -160,10 +166,10 @@ function BSReprint({ setOpenModel = () => { } }) {
const AuthToken = sessionStorage.getItem('auth');
const SessionMobileNo = getSession('MobileNo');
const [dateStrings, setDateStrings] = useState([]);
const [type, setType] = useState("Sales");
// ---- 1. Fetch Function ----
const fetchData = async ({ queryKey }) => {
const [_, dates, page] = queryKey;
const [_, dates, page,type] = queryKey;
const Response = await dispatch(
ReprintDetails({
CompId,
@ -172,6 +178,7 @@ function BSReprint({ setOpenModel = () => { } }) {
OrderFromDate: dates?.[0] ?? '',
OrderToDate: dates?.[1] ?? '',
PageNumber: page,
Type:type
})
).unwrap();
if (Response?.data?.statusCode === 1) {
@ -182,7 +189,7 @@ function BSReprint({ setOpenModel = () => { } }) {
};
const { data, isLoading, error } = useQuery({
queryKey: ['reprint', dateStrings, page],
queryKey: ['reprint', dateStrings, page,type],
queryFn: fetchData,
enabled: true,
staleTime: 1000 * 60 * 5,
@ -242,6 +249,8 @@ function BSReprint({ setOpenModel = () => { } }) {
}
};
commonMasterApiCall();
}, []);
useEffect(() => {
DefaultReprintReason();
}, []);
useEffect(() => {
@ -254,7 +263,9 @@ function BSReprint({ setOpenModel = () => { } }) {
dispatch(getPrinterMappingDetails(data)).unwrap();
const Data1 = { AppId, CompId, BranchId };
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
}, []);
const handleDateChange = (dates, dateStrings) => {
// setDateRange(dateStrings);
if (dateStrings[0] && dateStrings[1]) {
@ -1394,6 +1405,15 @@ function BSReprint({ setOpenModel = () => { } }) {
}
}
const typeOptions = [
{ label: "Sales", value: "Sales" },
{ label: "Estimate", value: "Est" },
];
const typeChange = (e) => {
setType(e.target.value);
};
return (
<>
<div>
@ -1432,20 +1452,16 @@ function BSReprint({ setOpenModel = () => { } }) {
/>
<div style={{ width: '100%' }}>
<div className="bsreprintmodaltable-flex">
{preferenceEstimate && <div>
<Radio.Group
options={typeOptions}
onChange={typeChange}
value={type}
optionType="button"
buttonStyle="solid" // optional
/>
</div>}
<div>
{selectedRows.length > 0 && (
<div className="action-icons-reprint">
<FaDownload
onClick={() => mutiplePrint('download')}
className="icon-download"
/>
<MdEmail onClick={() => handleEmail()} className="icon-email" />
<FaWhatsapp
onClick={() => mutiplePrint('whatsapp')}
className="icon-whatsapp"
/>
</div>
)}
<RangePicker
placeholder={['Start Date', 'End Date']}
format="YYYY-MM-DD"
@ -1473,6 +1489,22 @@ function BSReprint({ setOpenModel = () => { } }) {
Reprintformdata();
}}
/>
<div>
{selectedRows.length > 0 && (
<div className="action-icons-reprint">
<FaDownload
onClick={() => mutiplePrint('download')}
className="icon-download"
/>
<MdEmail onClick={() => handleEmail()} className="icon-email" />
<FaWhatsapp
onClick={() => mutiplePrint('whatsapp')}
className="icon-whatsapp"
/>
</div>
)}
</div>
</div>
{/* <div className="Re-Print-table"> */}
<div className="bsreprintmodaltable">