feat: wip send mail preview

This commit is contained in:
Ahmed Bouhuolia
2024-11-23 10:19:26 +02:00
parent b6f3c0145f
commit d5b0546301
6 changed files with 20 additions and 8 deletions

View File

@@ -30,7 +30,6 @@ import {
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers'; import { DRAWERS } from '@/constants/drawers';
import { DialogsName } from '@/constants/dialogs';
/** /**
* Estimate read-only details actions bar of the drawer. * Estimate read-only details actions bar of the drawer.
@@ -44,6 +43,7 @@ function EstimateDetailActionsBar({
// #withDrawerActions // #withDrawerActions
closeDrawer, closeDrawer,
openDrawer
}) { }) {
// Estimate details drawer context. // Estimate details drawer context.
const { estimateId, estimate } = useEstimateDetailDrawerContext(); const { estimateId, estimate } = useEstimateDetailDrawerContext();
@@ -80,7 +80,7 @@ function EstimateDetailActionsBar({
}; };
// Handles the estimate mail dialog. // Handles the estimate mail dialog.
const handleMailEstimate = () => { const handleMailEstimate = () => {
openDialog(DialogsName.EstimateMail, { estimateId }); openDrawer(DRAWERS.ESTIMATE_SEND_MAIL, { estimateId });
}; };
return ( return (

View File

@@ -28,7 +28,6 @@ import {
import { compose } from '@/utils'; import { compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers'; import { DRAWERS } from '@/constants/drawers';
import { DialogsName } from '@/constants/dialogs';
/** /**
* Payment receive actions bar. * Payment receive actions bar.
@@ -39,6 +38,7 @@ function PaymentsReceivedActionsBar({
// #withDrawerActions // #withDrawerActions
closeDrawer, closeDrawer,
openDrawer,
// #withDialogActions // #withDialogActions
openDialog, openDialog,
@@ -69,8 +69,11 @@ function PaymentsReceivedActionsBar({
openDialog('payment-pdf-preview', { paymentReceiveId }); openDialog('payment-pdf-preview', { paymentReceiveId });
}; };
// Handle mail action.
const handleMailPaymentReceive = () => { const handleMailPaymentReceive = () => {
openDialog(DialogsName.PaymentMail, { paymentReceiveId }); openDrawer(DRAWERS.PAYMENT_RECEIVED_SEND_MAIL, {
paymentReceivedId: paymentReceiveId,
});
}; };
return ( return (

View File

@@ -24,7 +24,6 @@ import { useReceiptDetailDrawerContext } from './ReceiptDetailDrawerProvider';
import { SaleReceiptAction, AbilitySubject } from '@/constants/abilityOption'; import { SaleReceiptAction, AbilitySubject } from '@/constants/abilityOption';
import { safeCallback, compose } from '@/utils'; import { safeCallback, compose } from '@/utils';
import { DRAWERS } from '@/constants/drawers'; import { DRAWERS } from '@/constants/drawers';
import { DialogsName } from '@/constants/dialogs';
/** /**
* Receipt details actions bar. * Receipt details actions bar.
@@ -39,6 +38,7 @@ function ReceiptDetailActionBar({
// #withDrawerActions // #withDrawerActions
closeDrawer, closeDrawer,
openDrawer
}) { }) {
const history = useHistory(); const history = useHistory();
const { receiptId } = useReceiptDetailDrawerContext(); const { receiptId } = useReceiptDetailDrawerContext();
@@ -61,8 +61,9 @@ function ReceiptDetailActionBar({
const handleNotifyViaSMS = () => { const handleNotifyViaSMS = () => {
openDialog('notify-receipt-via-sms', { receiptId }); openDialog('notify-receipt-via-sms', { receiptId });
}; };
// Handle receipt mail action.
const handleReceiptMail = () => { const handleReceiptMail = () => {
openDialog(DialogsName.ReceiptMail, { receiptId }); openDrawer(DRAWERS.RECEIPT_SEND_MAIL, { receiptId });
}; };
return ( return (

View File

@@ -1,3 +1,11 @@
import * as Yup from 'yup'; import * as Yup from 'yup';
export const EstimateSendMailSchema = Yup.object().shape({}); export const EstimateSendMailSchema = Yup.object().shape({
subject: Yup.string().required('Subject is required'),
message: Yup.string().required('Message is required'),
to: Yup.array()
.of(Yup.string().email('Invalid email address'))
.required('To address is required'),
cc: Yup.array().of(Yup.string().email('Invalid email address')),
bcc: Yup.array().of(Yup.string().email('Invalid email address')),
});

View File

@@ -13,7 +13,7 @@ export function InvoiceSendMailFields() {
const argsOptions = useSendInvoiceFormatArgsOptions(); const argsOptions = useSendInvoiceFormatArgsOptions();
return ( return (
<Stack> <Stack flex={1}>
<Stack spacing={0} overflow="auto" flex="1" p={'30px'}> <Stack spacing={0} overflow="auto" flex="1" p={'30px'}>
<SendMailViewToAddressField <SendMailViewToAddressField
toMultiSelectProps={{ items }} toMultiSelectProps={{ items }}