diff --git a/src/Features/BookingScreen/Customer/addCustomer.js b/src/Features/BookingScreen/Customer/addCustomer.js index ff16a92..de7c3fd 100644 --- a/src/Features/BookingScreen/Customer/addCustomer.js +++ b/src/Features/BookingScreen/Customer/addCustomer.js @@ -79,17 +79,23 @@ export const getRePrintReason = createAsyncThunk( export const ReprintDetails = createAsyncThunk( "addCustomer/ReprintDetails", async (data) => { - const { AppId, CompId, BranchId, OrderFromDate, OrderToDate, OrderId } = data || {}; + const { AppId, CompId, BranchId, OrderFromDate, OrderToDate, OrderId,PageNumber } = data || {}; if (OrderId && !OrderFromDate && !OrderToDate) { return await axiosRetailInstanceData.get( `/reprint?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}&OrderId=${OrderId}&pageNumber=${data.PageNumber}&Type=${data.Type}` ); } - if (OrderFromDate && OrderToDate) { + if (OrderFromDate && OrderToDate && PageNumber) { return await axiosRetailInstanceData.get( `/reprint?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}&orderFromDate=${OrderFromDate}&orderToDate=${OrderToDate} &pageNumber=${data.PageNumber}&Type=${data.Type}` ); - } else { + } + else if(OrderFromDate && OrderToDate ) { + return await axiosRetailInstanceData.get( + `/reprint?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}&orderFromDate=${OrderFromDate}&orderToDate=${OrderToDate}&Type=${data.Type}` + ); + } + else { return await axiosRetailInstanceData.get( `/reprint?CompId=${CompId}&BranchId=${BranchId}&AppId=${AppId}&pageNumber=${data.PageNumber}&Type=${data.Type}` ); diff --git a/src/Features/ConfigMasterPage/ConfigMasterPage.js b/src/Features/ConfigMasterPage/ConfigMasterPage.js index f2797b2..cf6e03b 100644 --- a/src/Features/ConfigMasterPage/ConfigMasterPage.js +++ b/src/Features/ConfigMasterPage/ConfigMasterPage.js @@ -105,11 +105,12 @@ export const postBulkConfiguration = createAsyncThunk( export const SelfBookingEmailSendLink = createAsyncThunk( 'email/sendEmailLink', async (EmailData) => { - const { toEmail, type, fileUrl} = EmailData; + const { toEmail, type, fileUrl,HeaderType} = EmailData; const data = { toEmail:toEmail, Type: type, fileUrl:fileUrl, + HeaderType:HeaderType }; return await axiosEmail_SMSData.post('/SendUrlEmail', data); } diff --git a/src/Pages/BookingScreen/Components/BookingFunctionality/MobileMultiPdfPrint.jsx b/src/Pages/BookingScreen/Components/BookingFunctionality/MobileMultiPdfPrint.jsx index 61dc7ad..465b2a9 100644 --- a/src/Pages/BookingScreen/Components/BookingFunctionality/MobileMultiPdfPrint.jsx +++ b/src/Pages/BookingScreen/Components/BookingFunctionality/MobileMultiPdfPrint.jsx @@ -11,6 +11,7 @@ import { PublicQrCodepost } from '../../../../Features/ConfigMasterPage/ConfigMa import { renderToStaticMarkup } from 'react-dom/server'; const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; +const uploadApiUrl = import.meta.env.ENV_IMAGE_UPLOAD_API_URL; // Create a secure blob URL creator that works in all environments const createSecureBlobUrl = (blob) => { @@ -60,10 +61,10 @@ export const MobileMultiPdfPrint = async ({ dispatch, UserId = '', onProgress = () => {}, + returnBlob = false, }) => { try { const style = await PrintStyleFunction(printerTemplateStyle, 'Sales'); - const stylesMap = { 'Style 1': 'PrintStyle1', 'Style 2': 'PrintStyle2', @@ -170,6 +171,15 @@ export const MobileMultiPdfPrint = async ({ revokeSecureBlobUrl(blobUrl); }, 100); } + + // Return blob if requested (after download completes) + if (returnBlob && PrintComing === 'download') { + setPrintOrderDetails([]); + if (container) { + document.body.removeChild(container); + } + return { success: true, pdfBlob: combinedPdfBlob }; + } // if (PrintComing === "whatsapp") { // const orderIds = PrintOrderDetails.map((row) => row?.OrderId).filter(Boolean); diff --git a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx index 9526717..65d399f 100644 --- a/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx +++ b/src/Pages/BookingScreen/Components/OtherConponents/Reprint/BSReprint.jsx @@ -88,6 +88,8 @@ 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'; +import ReprintPDFDataShare from './ReprintPDFDataShare.jsx'; +import { ImShare } from 'react-icons/im'; const RetailApiurl = import.meta.env.ENV_API_URL; @@ -116,7 +118,6 @@ function BSReprint({ setOpenModel = () => { } }) { const [bulkMode, setBulkMode] = useState(false); const [loading, setLoading] = useState(false); const [reprintData, setReprintData] = useState([]); - console.log(reprintData, 'reprintData'); const [reprintReasonList, setReprintReasonList] = useState([]); const [isDuplicate, setIsDuplicate] = useState('Original'); const [BillSearch, setBillSearch] = useState(''); @@ -138,7 +139,7 @@ function BSReprint({ setOpenModel = () => { } }) { SettingDataSelector?.[0]?.['SettingDtlDetails']?.find( (item) => item.SettingIdName === 'Estimation' )?.SettingValue === 'Y'; - console.log(preferenceEstimate, 'preferenceEstimate'); + console.log(preferenceEstimate, 'preferenceEstimate'); const editBill = SettingDataSelector?.[0]?.SettingDtlDetails?.find( (setting) => setting?.SettingIdName?.toLowerCase() === 'editbill' && @@ -167,9 +168,10 @@ function BSReprint({ setOpenModel = () => { } }) { const SessionMobileNo = getSession('MobileNo'); const [dateStrings, setDateStrings] = useState([]); const [type, setType] = useState("Sales"); + const [showShareModal, setShowShareModal] = useState(false); // ---- 1. Fetch Function ---- const fetchData = async ({ queryKey }) => { - const [_, dates, page,type] = queryKey; + const [_, dates, page, type] = queryKey; const Response = await dispatch( ReprintDetails({ CompId, @@ -178,7 +180,7 @@ function BSReprint({ setOpenModel = () => { } }) { OrderFromDate: dates?.[0] ?? '', OrderToDate: dates?.[1] ?? '', PageNumber: page, - Type:type + Type: type }) ).unwrap(); if (Response?.data?.statusCode === 1) { @@ -189,7 +191,7 @@ function BSReprint({ setOpenModel = () => { } }) { }; const { data, isLoading, error } = useQuery({ - queryKey: ['reprint', dateStrings, page,type], + queryKey: ['reprint', dateStrings, page, type], queryFn: fetchData, enabled: true, staleTime: 1000 * 60 * 5, @@ -250,7 +252,7 @@ function BSReprint({ setOpenModel = () => { } }) { }; commonMasterApiCall(); }, []); - useEffect(() => { + useEffect(() => { DefaultReprintReason(); }, []); useEffect(() => { @@ -263,7 +265,7 @@ function BSReprint({ setOpenModel = () => { } }) { dispatch(getPrinterMappingDetails(data)).unwrap(); const Data1 = { AppId, CompId, BranchId }; dispatch(getPrintSelectionComponentData(Data1)).unwrap(); - + }, []); const handleDateChange = (dates, dateStrings) => { @@ -1193,7 +1195,6 @@ function BSReprint({ setOpenModel = () => { } }) { const mutiplePrint = async (printType) => { setIsProcessing(true); setProcessingProgress(0); - const result = await MobileMultiPdfPrint({ printerTemplateStyle, printDatas, @@ -1280,7 +1281,7 @@ function BSReprint({ setOpenModel = () => { } }) { OverallDisc, OrderPaymentDtl, } = orderDtls; - + const updated = productDetails?.map((item) => ({ ...item, Offer: item?.OfferAmt, @@ -1406,7 +1407,7 @@ function BSReprint({ setOpenModel = () => { } }) { } } - const typeOptions = [ + const typeOptions = [ { label: "Sales", value: "Sales" }, { label: "Estimate", value: "Est" }, ]; @@ -1490,7 +1491,9 @@ function BSReprint({ setOpenModel = () => { } }) { Reprintformdata(); }} /> - +