Added Sales and Estimate Buttons an ddata also split
This commit is contained in:
parent
c4edea3722
commit
97e2724525
|
|
@ -87,6 +87,7 @@ import { v4 as uuidv4 } from 'uuid';
|
||||||
import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js';
|
import { changeOrderOfferDetail } from '../../../../../Features/Offer/Offer.js';
|
||||||
import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, changeLoyaltyConsumedQuantities } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
|
import { ChangeFullFreeProductList, changeFullOfferAppliedProducts, changeLoyaltyConsumedQuantities } from '../../../../../Features/Offer/Offernew/BookingOffernew.js';
|
||||||
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js';
|
import { ChangeTotalAmount } from '../../../../../Features/ExteraCharges/ExtraCharges.js';
|
||||||
|
import { Radio } from 'antd';
|
||||||
|
|
||||||
const RetailApiurl = import.meta.env.ENV_API_URL;
|
const RetailApiurl = import.meta.env.ENV_API_URL;
|
||||||
|
|
||||||
|
|
@ -127,12 +128,17 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
const SettingDataSelector = useSelector(PreferenceData);
|
const SettingDataSelector = useSelector(PreferenceData);
|
||||||
const salesBillEdit = useSelector(GlobalSalesBillEdit);
|
const salesBillEdit = useSelector(GlobalSalesBillEdit);
|
||||||
const custDisable = useSelector(GlobalSelectedCustDisable);
|
const custDisable = useSelector(GlobalSelectedCustDisable);
|
||||||
console.log(SettingDataSelector, 'SettingDataSelector');
|
console.log(SettingDataSelector, 'SettingDataSelectoraa');
|
||||||
const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
|
const MobileA4Print = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
|
||||||
(setting) =>
|
(setting) =>
|
||||||
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
|
setting?.SettingIdName?.toLowerCase() === 'mobilea4' &&
|
||||||
setting?.SettingValue === 'Y'
|
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(
|
const editBill = SettingDataSelector?.[0]?.SettingDtlDetails?.find(
|
||||||
(setting) =>
|
(setting) =>
|
||||||
setting?.SettingIdName?.toLowerCase() === 'editbill' &&
|
setting?.SettingIdName?.toLowerCase() === 'editbill' &&
|
||||||
|
|
@ -160,10 +166,10 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
const AuthToken = sessionStorage.getItem('auth');
|
const AuthToken = sessionStorage.getItem('auth');
|
||||||
const SessionMobileNo = getSession('MobileNo');
|
const SessionMobileNo = getSession('MobileNo');
|
||||||
const [dateStrings, setDateStrings] = useState([]);
|
const [dateStrings, setDateStrings] = useState([]);
|
||||||
|
const [type, setType] = useState("Sales");
|
||||||
// ---- 1. Fetch Function ----
|
// ---- 1. Fetch Function ----
|
||||||
const fetchData = async ({ queryKey }) => {
|
const fetchData = async ({ queryKey }) => {
|
||||||
const [_, dates, page] = queryKey;
|
const [_, dates, page,type] = queryKey;
|
||||||
|
|
||||||
const Response = await dispatch(
|
const Response = await dispatch(
|
||||||
ReprintDetails({
|
ReprintDetails({
|
||||||
CompId,
|
CompId,
|
||||||
|
|
@ -172,6 +178,7 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
OrderFromDate: dates?.[0] ?? '',
|
OrderFromDate: dates?.[0] ?? '',
|
||||||
OrderToDate: dates?.[1] ?? '',
|
OrderToDate: dates?.[1] ?? '',
|
||||||
PageNumber: page,
|
PageNumber: page,
|
||||||
|
Type:type
|
||||||
})
|
})
|
||||||
).unwrap();
|
).unwrap();
|
||||||
if (Response?.data?.statusCode === 1) {
|
if (Response?.data?.statusCode === 1) {
|
||||||
|
|
@ -182,7 +189,7 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data, isLoading, error } = useQuery({
|
const { data, isLoading, error } = useQuery({
|
||||||
queryKey: ['reprint', dateStrings, page],
|
queryKey: ['reprint', dateStrings, page,type],
|
||||||
queryFn: fetchData,
|
queryFn: fetchData,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
staleTime: 1000 * 60 * 5,
|
staleTime: 1000 * 60 * 5,
|
||||||
|
|
@ -242,6 +249,8 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
commonMasterApiCall();
|
commonMasterApiCall();
|
||||||
|
}, []);
|
||||||
|
useEffect(() => {
|
||||||
DefaultReprintReason();
|
DefaultReprintReason();
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -254,7 +263,9 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
dispatch(getPrinterMappingDetails(data)).unwrap();
|
dispatch(getPrinterMappingDetails(data)).unwrap();
|
||||||
const Data1 = { AppId, CompId, BranchId };
|
const Data1 = { AppId, CompId, BranchId };
|
||||||
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
|
dispatch(getPrintSelectionComponentData(Data1)).unwrap();
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleDateChange = (dates, dateStrings) => {
|
const handleDateChange = (dates, dateStrings) => {
|
||||||
// setDateRange(dateStrings);
|
// setDateRange(dateStrings);
|
||||||
if (dateStrings[0] && dateStrings[1]) {
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -1432,20 +1452,16 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
/>
|
/>
|
||||||
<div style={{ width: '100%' }}>
|
<div style={{ width: '100%' }}>
|
||||||
<div className="bsreprintmodaltable-flex">
|
<div className="bsreprintmodaltable-flex">
|
||||||
|
{preferenceEstimate && <div>
|
||||||
|
<Radio.Group
|
||||||
|
options={typeOptions}
|
||||||
|
onChange={typeChange}
|
||||||
|
value={type}
|
||||||
|
optionType="button"
|
||||||
|
buttonStyle="solid" // optional
|
||||||
|
/>
|
||||||
|
</div>}
|
||||||
<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
|
<RangePicker
|
||||||
placeholder={['Start Date', 'End Date']}
|
placeholder={['Start Date', 'End Date']}
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD"
|
||||||
|
|
@ -1473,6 +1489,22 @@ function BSReprint({ setOpenModel = () => { } }) {
|
||||||
Reprintformdata();
|
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>
|
||||||
{/* <div className="Re-Print-table"> */}
|
{/* <div className="Re-Print-table"> */}
|
||||||
<div className="bsreprintmodaltable">
|
<div className="bsreprintmodaltable">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue