Added Dowload feture

This commit is contained in:
Srinath 2026-02-16 14:34:29 +05:30
parent aade736b5c
commit 19af706317
1 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import { PublicQrCodepost } from '../../../../Features/ConfigMasterPage/ConfigMa
import { renderToStaticMarkup } from 'react-dom/server'; import { renderToStaticMarkup } from 'react-dom/server';
const MainHomeUrl = import.meta.env.ENV_MAIN_BASE_URL; 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 // Create a secure blob URL creator that works in all environments
const createSecureBlobUrl = (blob) => { const createSecureBlobUrl = (blob) => {
@ -60,10 +61,10 @@ export const MobileMultiPdfPrint = async ({
dispatch, dispatch,
UserId = '', UserId = '',
onProgress = () => {}, onProgress = () => {},
returnBlob = false,
}) => { }) => {
try { try {
const style = await PrintStyleFunction(printerTemplateStyle, 'Sales'); const style = await PrintStyleFunction(printerTemplateStyle, 'Sales');
const stylesMap = { const stylesMap = {
'Style 1': 'PrintStyle1', 'Style 1': 'PrintStyle1',
'Style 2': 'PrintStyle2', 'Style 2': 'PrintStyle2',
@ -171,6 +172,15 @@ export const MobileMultiPdfPrint = async ({
}, 100); }, 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") { // if (PrintComing === "whatsapp") {
// const orderIds = PrintOrderDetails.map((row) => row?.OrderId).filter(Boolean); // const orderIds = PrintOrderDetails.map((row) => row?.OrderId).filter(Boolean);
// const documentUrl = `${MainHomeUrl}viewbill?code=${orderIds}`; // const documentUrl = `${MainHomeUrl}viewbill?code=${orderIds}`;