Merge pull request 'Email-Loader' (#291) from Email-Loader into main

Reviewed-on: Pozomind/pozo-retail-app#291
This commit is contained in:
karthikalakshmi 2026-03-20 11:23:27 +05:30
commit aa2a3b3c79
2 changed files with 55 additions and 42 deletions

View File

@ -1158,10 +1158,10 @@ function BSReprint({ setOpenModel = () => { } }) {
}; };
const handleSendEmail = async (value) => { const handleSendEmail = async (value) => {
const toEmail = value.email;
setLoading(true);
try { try {
const toEmail = value.email;
if (selectedRows.length === 0) { if (selectedRows.length === 0) {
setLoading(true);
const result = await MobilePdfPrint({ const result = await MobilePdfPrint({
printerTemplateStyle, printerTemplateStyle,
printDatas, printDatas,
@ -1172,16 +1172,25 @@ function BSReprint({ setOpenModel = () => { } }) {
}); });
if (result?.data?.status === 1) { if (result?.data?.status === 1) {
setEmailModalOpen(false); // Close modal setMessage({ type: 'success', data: result?.data?.response || 'Email sent successfully' });
setEmailId(''); // Reset email input (optional) setEmailModalOpen(false);
setLoading(false); setEmailId('');
form.resetFields(); form.resetFields();
} else {
setMessage({ type: 'error', data: result?.data?.response || 'Email sending failed' });
} }
} else { } else {
mutiplePrint('email',toEmail); await mutiplePrint('email', toEmail);
} }
} catch (err) { } catch (err) {
console.error('❌ Email error:', err); console.error('❌ Email error:', err);
setMessage({ type: 'error', data: err?.message || 'Something went wrong while sending email' });
} finally {
setLoading(false);
if (selectedRows.length === 0) {
// for single row, form already reset on success; for failure, still reset to clear bad input
form.resetFields();
}
} }
}; };
@ -1844,10 +1853,10 @@ function BSReprint({ setOpenModel = () => { } }) {
/> />
</Modal> */} </Modal> */}
{(emailModalOpen || isProcessing) && ( {(emailModalOpen || loading) && (
<EmailModel <EmailModel
open={emailModalOpen} open={emailModalOpen}
emailSending={isProcessing} emailSending={loading}
handleCancel={() => setEmailModalOpen(false)} handleCancel={() => setEmailModalOpen(false)}
form={form} form={form}
handleSendEmailWithEnteredEmail={handleSendEmail} handleSendEmailWithEnteredEmail={handleSendEmail}

View File

@ -90,6 +90,8 @@ const ReprintReasonReportList = () => {
const [message, setMessage] = useState({ type: null, data: null }); const [message, setMessage] = useState({ type: null, data: null });
const [searchedText, setSearchedText] = useState(''); const [searchedText, setSearchedText] = useState('');
const [tableData, setTableData] = useState([]); const [tableData, setTableData] = useState([]);
console.log(tableData, 'tableData23232');
const [fromDate, setFromDate] = useState(); const [fromDate, setFromDate] = useState();
const [toDate, setToDate] = useState(); const [toDate, setToDate] = useState();
const [page, setpage] = useState(1); const [page, setpage] = useState(1);
@ -103,21 +105,21 @@ const ReprintReasonReportList = () => {
index: index + 1 index: index + 1
})); }));
const items = [ const items = [
{ {
name: 'Home', name: 'Home',
link: `${subDirectory}app-page/home`, link: `${subDirectory}app-page/home`,
}, },
{ {
name: 'Reprint Details', name: 'Reprint Details',
link: `${subDirectory}report/reprintreasonreport`, link: `${subDirectory}report/reprintreasonreport`,
}, },
]; ];
useEffect(() => { useEffect(() => {
dispatch(changeBreadCrumb({ items: items })); dispatch(changeBreadCrumb({ items: items }));
}, []); }, []);
const columns = [ const columns = [
{ {
title: 'Sl.No', title: 'Sl.No',
@ -463,11 +465,13 @@ const ReprintReasonReportList = () => {
> >
<BiSolidPrinter <BiSolidPrinter
onClick={Print} onClick={Print}
className={ style={{
tableData?.length > 0 fontSize: '24px',
? 'ItemWiseReport-printerIcon' cursor: tableData?.length > 0 ? 'pointer' : 'not-allowed',
: 'ItemWiseReport-printerIcon-disabled' opacity: tableData?.length > 0 ? 1 : 0.5,
} pointerEvents: tableData?.length > 0 ? 'auto' : 'none'
}}
/> />
{/* <div {/* <div
style={{ style={{
@ -501,20 +505,20 @@ const ReprintReasonReportList = () => {
</Form.Item> </Form.Item>
</div> </div>
</div> */} </div> */}
<div style={{paddingTop:'15px'}}> <div style={{ paddingTop: '15px' }}>
<Form.Item name="DateRange"> <Form.Item name="DateRange">
<DatePicker.RangePicker <DatePicker.RangePicker
format={'DD/MM/YYYY'} format={'DD/MM/YYYY'}
value={ value={
fromDate && toDate fromDate && toDate
? [dayjs(fromDate, 'DD-MM-YYYY HH:mm:ss'), dayjs(toDate, 'DD-MM-YYYY HH:mm:ss')] ? [dayjs(fromDate, 'DD-MM-YYYY HH:mm:ss'), dayjs(toDate, 'DD-MM-YYYY HH:mm:ss')]
: null : null
} }
onChange={onChange_Pending_DateRange} onChange={onChange_Pending_DateRange}
disabledDate={(current) => current && current > dayjs()} disabledDate={(current) => current && current > dayjs()}
/> />
</Form.Item> </Form.Item>
</div> </div>
</Form> </Form>
</div> </div>