mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
feat: add notify by sms .
This commit is contained in:
@@ -14,32 +14,36 @@ function NotifyEstimateViaSMSForm({
|
|||||||
// #withDialogActions
|
// #withDialogActions
|
||||||
closeDialog,
|
closeDialog,
|
||||||
}) {
|
}) {
|
||||||
const { dialogName, estimateId } = useEstimateViaSMSContext();
|
const {
|
||||||
|
estimateId,
|
||||||
|
dialogName,
|
||||||
|
estimateSMSDetail,
|
||||||
|
createNotifyEstimateBySMSMutate,
|
||||||
|
} = useEstimateViaSMSContext();
|
||||||
|
|
||||||
// Handles the form submit.
|
// Handles the form submit.
|
||||||
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
||||||
// Handle request response success.
|
// Handle request response success.
|
||||||
const onSuccess = (response) => {
|
const onSuccess = (response) => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: intl.get('notify_via_sms.dialog.success_message'),
|
message: intl.get('notify_estimate_via_sms.dialog.success_message'),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
closeDialog(dialogName);
|
closeDialog(dialogName);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle request response errors.
|
// Handle request response errors.
|
||||||
const onError = ({
|
const onError = () => {
|
||||||
response: {
|
|
||||||
data: { errors },
|
|
||||||
},
|
|
||||||
}) => {
|
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
};
|
};
|
||||||
|
createNotifyEstimateBySMSMutate([estimateId, values])
|
||||||
|
.then(onSuccess)
|
||||||
|
.then(onError);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NotifyViaSMSForm
|
<NotifyViaSMSForm
|
||||||
NotificationDetail={{}}
|
NotificationDetail={estimateSMSDetail}
|
||||||
NotificationName={dialogName}
|
NotificationName={dialogName}
|
||||||
onSubmit={handleFormSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DialogContent } from 'components';
|
import { DialogContent } from 'components';
|
||||||
// import { } from 'hooks/query';
|
import {
|
||||||
|
useEstimateSMSDetail,
|
||||||
|
useCreateNotifyEstimateBySMS,
|
||||||
|
} from 'hooks/query';
|
||||||
|
|
||||||
const NotifyEstimateViaSMSContext = React.createContext();
|
const NotifyEstimateViaSMSContext = React.createContext();
|
||||||
|
|
||||||
@@ -9,16 +12,25 @@ function NotifyEstimateViaSMSFormProvider({
|
|||||||
dialogName,
|
dialogName,
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
|
const { data: estimateSMSDetail, isLoading: isEstimateSMSDetailLoading } =
|
||||||
|
useEstimateSMSDetail(estimateId, {
|
||||||
|
enabled: !!estimateId,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create notfiy estimate by sms mutations.
|
||||||
|
const { mutateAsync: createNotifyEstimateBySMSMutate } =
|
||||||
|
useCreateNotifyEstimateBySMS();
|
||||||
|
|
||||||
// State provider.
|
// State provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
estimateId,
|
estimateId,
|
||||||
dialogName,
|
dialogName,
|
||||||
|
estimateSMSDetail,
|
||||||
|
createNotifyEstimateBySMSMutate,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogContent
|
<DialogContent isLoading={isEstimateSMSDetailLoading}>
|
||||||
// isLoading={}
|
|
||||||
>
|
|
||||||
<NotifyEstimateViaSMSContext.Provider value={provider} {...props} />
|
<NotifyEstimateViaSMSContext.Provider value={provider} {...props} />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DialogContent } from 'components';
|
import { DialogContent } from 'components';
|
||||||
import { useCreateNotifyInvoiceBySMS, useInvocieSMSDetails } from 'hooks/query';
|
import { useCreateNotifyInvoiceBySMS, useInvoiceSMSDetail } from 'hooks/query';
|
||||||
|
|
||||||
const NotifyInvoiceViaSMSContext = React.createContext();
|
const NotifyInvoiceViaSMSContext = React.createContext();
|
||||||
|
|
||||||
function NotifyInvoiceViaSMSFormProvider({ invoiceId, dialogName, ...props }) {
|
function NotifyInvoiceViaSMSFormProvider({ invoiceId, dialogName, ...props }) {
|
||||||
const { data: invoiceSMSDetail, isLoading: isInvoiceSMSDetailLoading } =
|
const { data: invoiceSMSDetail, isLoading: isInvoiceSMSDetailLoading } =
|
||||||
useInvocieSMSDetails(invoiceId, {
|
useInvoiceSMSDetail(invoiceId, {
|
||||||
enabled: !!invoiceId,
|
enabled: !!invoiceId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DialogContent } from 'components';
|
import { DialogContent } from 'components';
|
||||||
// import { useCreateNotifyInvoiceBySMS, useInvocieSMSDetails } from 'hooks/query';
|
import {
|
||||||
|
useCreateNotifyPaymentReceiveBySMS,
|
||||||
|
usePaymentReceiveSMSDetail,
|
||||||
|
} from 'hooks/query';
|
||||||
|
|
||||||
const NotifyPaymentReceiveViaSMSContext = React.createContext();
|
const NotifyPaymentReceiveViaSMSContext = React.createContext();
|
||||||
|
|
||||||
@@ -9,16 +12,27 @@ function NotifyPaymentReceiveViaFormProvider({
|
|||||||
dialogName,
|
dialogName,
|
||||||
...props
|
...props
|
||||||
}) {
|
}) {
|
||||||
|
// Create notfiy receipt via sms mutations.
|
||||||
|
const { mutateAsync: createNotifyPaymentReceivetBySMSMutate } =
|
||||||
|
useCreateNotifyPaymentReceiveBySMS();
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: paymentReceiveMSDetail,
|
||||||
|
isLoading: isPaymentReceiveSMSDetailLoading,
|
||||||
|
} = usePaymentReceiveSMSDetail(paymentReceiveId, {
|
||||||
|
enabled: !!paymentReceiveId,
|
||||||
|
});
|
||||||
|
|
||||||
// State provider.
|
// State provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
paymentReceiveId,
|
paymentReceiveId,
|
||||||
dialogName,
|
dialogName,
|
||||||
|
paymentReceiveMSDetail,
|
||||||
|
createNotifyPaymentReceivetBySMSMutate,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogContent
|
<DialogContent isLoading={isPaymentReceiveSMSDetailLoading}>
|
||||||
// isLoading={}
|
|
||||||
>
|
|
||||||
<NotifyPaymentReceiveViaSMSContext.Provider value={provider} {...props} />
|
<NotifyPaymentReceiveViaSMSContext.Provider value={provider} {...props} />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,33 +17,38 @@ function NotifyPaymentReceiveViaSMSForm({
|
|||||||
// #withDialogActions
|
// #withDialogActions
|
||||||
closeDialog,
|
closeDialog,
|
||||||
}) {
|
}) {
|
||||||
const { dialogName, paymentReceiveId } =
|
const {
|
||||||
useNotifyPaymentReceiveViaSMSContext();
|
dialogName,
|
||||||
|
paymentReceiveId,
|
||||||
|
paymentReceiveMSDetail,
|
||||||
|
createNotifyPaymentReceivetBySMSMutate,
|
||||||
|
} = useNotifyPaymentReceiveViaSMSContext();
|
||||||
|
|
||||||
// Handles the form submit.
|
// Handles the form submit.
|
||||||
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
||||||
// Handle request response success.
|
// Handle request response success.
|
||||||
const onSuccess = (response) => {
|
const onSuccess = (response) => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: intl.get('notify_via_sms.dialog.success_message'),
|
message: intl.get(
|
||||||
|
'notify_payment_receive_via_sms.dialog.success_message',
|
||||||
|
),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
closeDialog(dialogName);
|
closeDialog(dialogName);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle request response errors.
|
// Handle request response errors.
|
||||||
const onError = ({
|
const onError = ({}) => {
|
||||||
response: {
|
|
||||||
data: { errors },
|
|
||||||
},
|
|
||||||
}) => {
|
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
};
|
};
|
||||||
|
createNotifyPaymentReceivetBySMSMutate([paymentReceiveId, values])
|
||||||
|
.then(onSuccess)
|
||||||
|
.catch(onError);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NotifyViaSMSForm
|
<NotifyViaSMSForm
|
||||||
NotificationDetail={{}}
|
NotificationDetail={paymentReceiveMSDetail}
|
||||||
NotificationName={dialogName}
|
NotificationName={dialogName}
|
||||||
onSubmit={handleFormSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function NotifyPaymentReciveViaSMSDialog({
|
|||||||
<DialogSuspense>
|
<DialogSuspense>
|
||||||
<NotifyPaymentReceiveViaSMSDialogContent
|
<NotifyPaymentReceiveViaSMSDialogContent
|
||||||
dialogName={dialogName}
|
dialogName={dialogName}
|
||||||
paymnetReceive={paymentReceiveId}
|
paymentReceive={paymentReceiveId}
|
||||||
/>
|
/>
|
||||||
</DialogSuspense>
|
</DialogSuspense>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
@@ -17,32 +17,36 @@ function NotifyReceiptViaSMSForm({
|
|||||||
// #withDialogActions
|
// #withDialogActions
|
||||||
closeDialog,
|
closeDialog,
|
||||||
}) {
|
}) {
|
||||||
const { dialogName, receiptId } = useNotifyReceiptViaSMSContext();
|
const {
|
||||||
|
dialogName,
|
||||||
|
receiptId,
|
||||||
|
receiptSMSDetail,
|
||||||
|
createNotifyReceiptBySMSMutate,
|
||||||
|
} = useNotifyReceiptViaSMSContext();
|
||||||
|
|
||||||
// Handles the form submit.
|
// Handles the form submit.
|
||||||
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {
|
||||||
// Handle request response success.
|
// Handle request response success.
|
||||||
const onSuccess = (response) => {
|
const onSuccess = (response) => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: intl.get('notify_via_sms.dialog.success_message'),
|
message: intl.get('notify_receipt_via_sms.dialog.success_message'),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
closeDialog(dialogName);
|
closeDialog(dialogName);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle request response errors.
|
// Handle request response errors.
|
||||||
const onError = ({
|
const onError = ({}) => {
|
||||||
response: {
|
|
||||||
data: { errors },
|
|
||||||
},
|
|
||||||
}) => {
|
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
};
|
};
|
||||||
|
createNotifyReceiptBySMSMutate([receiptId, values])
|
||||||
|
.then(onSuccess)
|
||||||
|
.catch(onError);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NotifyViaSMSForm
|
<NotifyViaSMSForm
|
||||||
NotificationDetail={{}}
|
NotificationDetail={receiptSMSDetail}
|
||||||
NotificationName={dialogName}
|
NotificationName={dialogName}
|
||||||
onSubmit={handleFormSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,22 +1,29 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DialogContent } from 'components';
|
import { DialogContent } from 'components';
|
||||||
// import { useCreateNotifyInvoiceBySMS, useInvocieSMSDetails } from 'hooks/query';
|
import { useCreateNotifyReceiptBySMS, useReceiptSMSDetail } from 'hooks/query';
|
||||||
|
|
||||||
const NotifyReceiptViaSMSContext = React.createContext();
|
const NotifyReceiptViaSMSContext = React.createContext();
|
||||||
|
|
||||||
function NotifyReceiptViaSMSFormProvider({ receiptId, dialogName, ...props }) {
|
function NotifyReceiptViaSMSFormProvider({ receiptId, dialogName, ...props }) {
|
||||||
// Create notfiy receipt via sms mutations.
|
// Create notfiy receipt via sms mutations.
|
||||||
|
const { mutateAsync: createNotifyReceiptBySMSMutate } =
|
||||||
|
useCreateNotifyReceiptBySMS();
|
||||||
|
|
||||||
|
const { data: receiptSMSDetail, isLoading: isReceiptSMSDetailLoading } =
|
||||||
|
useReceiptSMSDetail(receiptId, {
|
||||||
|
enabled: !!receiptId,
|
||||||
|
});
|
||||||
|
|
||||||
// State provider.
|
// State provider.
|
||||||
const provider = {
|
const provider = {
|
||||||
receiptId,
|
receiptId,
|
||||||
dialogName,
|
dialogName,
|
||||||
|
receiptSMSDetail,
|
||||||
|
createNotifyReceiptBySMSMutate,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogContent
|
<DialogContent isLoading={isReceiptSMSDetailLoading}>
|
||||||
// isLoading={}
|
|
||||||
>
|
|
||||||
<NotifyReceiptViaSMSContext.Provider value={provider} {...props} />
|
<NotifyReceiptViaSMSContext.Provider value={provider} {...props} />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { transformToForm, saveInvoke } from 'utils';
|
|||||||
|
|
||||||
const defaultInitialValues = {
|
const defaultInitialValues = {
|
||||||
customer_name: '',
|
customer_name: '',
|
||||||
customer_personal_phone: '',
|
customer_phone_number: '',
|
||||||
sms_message: '',
|
sms_message: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { DATATYPES_LENGTH } from 'common/dataTypes';
|
|||||||
|
|
||||||
const Schema = Yup.object().shape({
|
const Schema = Yup.object().shape({
|
||||||
customer_name: Yup.string().required(),
|
customer_name: Yup.string().required(),
|
||||||
customer_personal_phone: Yup.number().required(),
|
customer_phone_number: Yup.number().required(),
|
||||||
sms_message: Yup.string().required().trim().max(DATATYPES_LENGTH.TEXT),
|
sms_message: Yup.string().required().trim().max(DATATYPES_LENGTH.TEXT),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,15 @@ function NotifyViaSMSFormFields() {
|
|||||||
</FastField>
|
</FastField>
|
||||||
|
|
||||||
{/* ----------- Phone number ----------- */}
|
{/* ----------- Phone number ----------- */}
|
||||||
<FastField name={'customer_personal_phone'}>
|
<FastField name={'customer_phone_number'}>
|
||||||
{({ form, field, meta: { error, touched } }) => (
|
{({ form, field, meta: { error, touched } }) => (
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={<T id={'phone_number'} />}
|
label={<T id={'phone_number'} />}
|
||||||
labelInfo={<FieldRequiredHint />}
|
labelInfo={<FieldRequiredHint />}
|
||||||
intent={inputIntent({ error, touched })}
|
intent={inputIntent({ error, touched })}
|
||||||
helperText={<ErrorMessage name="customer_personal_phone" />}
|
helperText={<ErrorMessage name="customer_phone_number" />}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'form-group--customer_personal_phone',
|
'form-group--customer_phone_number',
|
||||||
CLASSES.FILL,
|
CLASSES.FILL,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -195,30 +195,31 @@ export function useCreateNotifyEstimateBySMS(props) {
|
|||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation(
|
return useMutation(
|
||||||
(id) => apiRequest.post(`sales/estimates/${id}/notify-by-sms`),
|
([id, values]) =>
|
||||||
|
apiRequest.post(`sales/estimates/${id}/notify-by-sms`, values),
|
||||||
{
|
{
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, [id, values]) => {
|
||||||
|
// Invalidate
|
||||||
|
queryClient.invalidateQueries([t.NOTIFY_SALE_ESTIMATE_BY_SMS, id]);
|
||||||
|
|
||||||
// Common invalidate queries.
|
// Common invalidate queries.
|
||||||
commonInvalidateQueries(queryClient);
|
commonInvalidateQueries(queryClient);
|
||||||
|
|
||||||
// Invalidate sale estimate.
|
|
||||||
queryClient.invalidateQueries([t.NOTIFY_SALE_ESTIMATE_BY_SMS, id]);
|
|
||||||
},
|
},
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useEstimateSMS(estimateId, props, requestProps) {
|
export function useEstimateSMSDetail(estimateId, props, requestProps) {
|
||||||
return useRequestQuery(
|
return useRequestQuery(
|
||||||
[t.SALE_ESTIMATE_SMS, estimateId],
|
[t.SALE_ESTIMATE_SMS_DETAIL, estimateId],
|
||||||
{
|
{
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `sales/estimates/${estimateId}/sms-details`,
|
url: `sales/estimates/${estimateId}/sms-details`,
|
||||||
...requestProps,
|
...requestProps,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
select: (res) => res.data,
|
select: (res) => res.data.data,
|
||||||
defaultData: {},
|
defaultData: {},
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -239,9 +239,10 @@ export function useCreateNotifyInvoiceBySMS(props) {
|
|||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation(
|
return useMutation(
|
||||||
(id) => apiRequest.post(`sales/invoices/${id}/notify-by-sms`),
|
([id, values]) =>
|
||||||
|
apiRequest.post(`sales/invoices/${id}/notify-by-sms`, values),
|
||||||
{
|
{
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, [id, values]) => {
|
||||||
// Invalidate
|
// Invalidate
|
||||||
queryClient.invalidateQueries([t.NOTIFY_SALE_INVOICE_BY_SMS, id]);
|
queryClient.invalidateQueries([t.NOTIFY_SALE_INVOICE_BY_SMS, id]);
|
||||||
|
|
||||||
@@ -253,9 +254,9 @@ export function useCreateNotifyInvoiceBySMS(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useInvocieSMSDetails(invoiceId, props, requestProps) {
|
export function useInvoiceSMSDetail(invoiceId, props, requestProps) {
|
||||||
return useRequestQuery(
|
return useRequestQuery(
|
||||||
[t.SALE_INVOICE_SMS, invoiceId],
|
[t.SALE_INVOICE_SMS_DETAIL, invoiceId],
|
||||||
{
|
{
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: `sales/invoices/${invoiceId}/sms-details`,
|
url: `sales/invoices/${invoiceId}/sms-details`,
|
||||||
|
|||||||
@@ -180,9 +180,10 @@ export function useCreateNotifyPaymentReceiveBySMS(props) {
|
|||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
|
|
||||||
return useMutation(
|
return useMutation(
|
||||||
(id) => apiRequest.post(`sales/payment_receives/${id}/notify-by-sms`),
|
([id, values]) =>
|
||||||
|
apiRequest.post(`sales/payment_receives/${id}/notify-by-sms`, values),
|
||||||
{
|
{
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, [id, values]) => {
|
||||||
// Invalidate
|
// Invalidate
|
||||||
queryClient.invalidateQueries([t.NOTIFY_PAYMENT_RECEIVE_BY_SMS, id]);
|
queryClient.invalidateQueries([t.NOTIFY_PAYMENT_RECEIVE_BY_SMS, id]);
|
||||||
|
|
||||||
@@ -194,12 +195,20 @@ export function useCreateNotifyPaymentReceiveBySMS(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function usePaymentReceiveSMS(id, props, requestProps) {
|
export function usePaymentReceiveSMSDetail(
|
||||||
|
paymentReceiveId,
|
||||||
|
props,
|
||||||
|
requestProps,
|
||||||
|
) {
|
||||||
return useRequestQuery(
|
return useRequestQuery(
|
||||||
[t.PAYMENT_RECEIVE_SMS, id],
|
[t.PAYMENT_RECEIVE_SMS_DETAIL, paymentReceiveId],
|
||||||
{ method: 'get', url: `sales/payment_receives/${id}/sms-details`, ...requestProps },
|
|
||||||
{
|
{
|
||||||
select: (res) => res.data,
|
method: 'get',
|
||||||
|
url: `sales/payment_receives/${paymentReceiveId}/sms-details`,
|
||||||
|
...requestProps,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
select: (res) => res.data.data,
|
||||||
defaultData: {},
|
defaultData: {},
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -168,9 +168,10 @@ export function useCreateNotifyReceiptBySMS(props) {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const apiRequest = useApiRequest();
|
const apiRequest = useApiRequest();
|
||||||
return useMutation(
|
return useMutation(
|
||||||
(id) => apiRequest.post(`sales/receipts/${id}/notify-by-sms`),
|
([id, values]) =>
|
||||||
|
apiRequest.post(`sales/receipts/${id}/notify-by-sms`, values),
|
||||||
{
|
{
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, [id, values]) => {
|
||||||
queryClient.invalidateQueries([t.NOTIFY_SALE_RECEIPT_BY_SMS, id]);
|
queryClient.invalidateQueries([t.NOTIFY_SALE_RECEIPT_BY_SMS, id]);
|
||||||
|
|
||||||
// Invalidate queries.
|
// Invalidate queries.
|
||||||
@@ -181,12 +182,16 @@ export function useCreateNotifyReceiptBySMS(props) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useReceiptSMS(receiptId, props, requestProps) {
|
export function useReceiptSMSDetail(receiptId, props, requestProps) {
|
||||||
return useRequestQuery(
|
return useRequestQuery(
|
||||||
[t.SALE_RECEIPT_SMS, receiptId],
|
[t.SALE_RECEIPT_SMS_DETAIL, receiptId],
|
||||||
{ method: 'get', url: `sales/receipts/${receiptId}/sms-details`, ...requestProps },
|
|
||||||
{
|
{
|
||||||
select: (res) => res.data,
|
method: 'get',
|
||||||
|
url: `sales/receipts/${receiptId}/sms-details`,
|
||||||
|
...requestProps,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
select: (res) => res.data.data,
|
||||||
defaultData: {},
|
defaultData: {},
|
||||||
...props,
|
...props,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ const ITEMS = {
|
|||||||
const SALE_ESTIMATES = {
|
const SALE_ESTIMATES = {
|
||||||
SALE_ESTIMATES: 'SALE_ESTIMATES',
|
SALE_ESTIMATES: 'SALE_ESTIMATES',
|
||||||
SALE_ESTIMATE: 'SALE_ESTIMATE',
|
SALE_ESTIMATE: 'SALE_ESTIMATE',
|
||||||
SALE_ESTIMATE_SMS: 'SALE_ESTIMATE_SMS',
|
SALE_ESTIMATE_SMS_DETAIL: 'SALE_ESTIMATE_SMS_DETAIL',
|
||||||
NOTIFY_SALE_ESTIMATE_BY_SMS: 'NOTIFY_SALE_ESTIMATE_BY_SMS',
|
NOTIFY_SALE_ESTIMATE_BY_SMS: 'NOTIFY_SALE_ESTIMATE_BY_SMS',
|
||||||
};
|
};
|
||||||
|
|
||||||
const SALE_RECEIPTS = {
|
const SALE_RECEIPTS = {
|
||||||
SALE_RECEIPTS: 'SALE_RECEIPTS',
|
SALE_RECEIPTS: 'SALE_RECEIPTS',
|
||||||
SALE_RECEIPT: 'SALE_RECEIPT',
|
SALE_RECEIPT: 'SALE_RECEIPT',
|
||||||
SALE_RECEIPT_SMS: 'SALE_RECEIPT_SMS',
|
SALE_RECEIPT_SMS_DETAIL: 'SALE_RECEIPT_SMS_DETAIL',
|
||||||
NOTIFY_SALE_RECEIPT_BY_SMS: 'NOTIFY_SALE_RECEIPT_BY_SMS',
|
NOTIFY_SALE_RECEIPT_BY_SMS: 'NOTIFY_SALE_RECEIPT_BY_SMS',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ const PAYMENT_RECEIVES = {
|
|||||||
PAYMENT_RECEIVE: 'PAYMENT_RECEIVE',
|
PAYMENT_RECEIVE: 'PAYMENT_RECEIVE',
|
||||||
PAYMENT_RECEIVE_NEW_ENTRIES: 'PAYMENT_RECEIVE_NEW_ENTRIES',
|
PAYMENT_RECEIVE_NEW_ENTRIES: 'PAYMENT_RECEIVE_NEW_ENTRIES',
|
||||||
PAYMENT_RECEIVE_EDIT_PAGE: 'PAYMENT_RECEIVE_EDIT_PAGE',
|
PAYMENT_RECEIVE_EDIT_PAGE: 'PAYMENT_RECEIVE_EDIT_PAGE',
|
||||||
PAYMENT_RECEIVE_SMS: 'PAYMENT_RECEIVE_SMS',
|
PAYMENT_RECEIVE_SMS_DETAIL: 'PAYMENT_RECEIVE_SMS_DETAIL',
|
||||||
NOTIFY_PAYMENT_RECEIVE_BY_SMS: 'NOTIFY_PAYMENT_RECEIVE_BY_SMS',
|
NOTIFY_PAYMENT_RECEIVE_BY_SMS: 'NOTIFY_PAYMENT_RECEIVE_BY_SMS',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ const SALE_INVOICES = {
|
|||||||
SALE_INVOICES: 'SALE_INVOICES',
|
SALE_INVOICES: 'SALE_INVOICES',
|
||||||
SALE_INVOICE: 'SALE_INVOICE',
|
SALE_INVOICE: 'SALE_INVOICE',
|
||||||
SALE_INVOICES_DUE: 'SALE_INVOICES_DUE',
|
SALE_INVOICES_DUE: 'SALE_INVOICES_DUE',
|
||||||
SALE_INVOICE_SMS: 'SALE_INVOICE_SMS',
|
SALE_INVOICE_SMS_DETAIL: 'SALE_INVOICE_SMS_DETAIL',
|
||||||
NOTIFY_SALE_INVOICE_BY_SMS: 'NOTIFY_SALE_INVOICE_BY_SMS',
|
NOTIFY_SALE_INVOICE_BY_SMS: 'NOTIFY_SALE_INVOICE_BY_SMS',
|
||||||
BAD_DEBT: 'BAD_DEBT',
|
BAD_DEBT: 'BAD_DEBT',
|
||||||
CANCEL_BAD_DEBT: 'CANCEL_BAD_DEBT',
|
CANCEL_BAD_DEBT: 'CANCEL_BAD_DEBT',
|
||||||
|
|||||||
@@ -1430,7 +1430,10 @@
|
|||||||
"notify_via_sms.dialog.send_notification_to":"Send notification to",
|
"notify_via_sms.dialog.send_notification_to":"Send notification to",
|
||||||
"notify_via_sms.dialog.message_text":"Message Text",
|
"notify_via_sms.dialog.message_text":"Message Text",
|
||||||
"notify_via_sms.dialog.notify_via_sms":"Notify vis SMS",
|
"notify_via_sms.dialog.notify_via_sms":"Notify vis SMS",
|
||||||
"notify_via_sms.dialog.success_message":"To notify have been successfully",
|
"notify_invoice_via_sms.dialog.success_message":"The sale invoice sms notification has been sent successfully",
|
||||||
|
"notify_estimate_via_sms.dialog.success_message":"The sale estimate sms notification has been sent successfully",
|
||||||
|
"notify_receipt_via_sms.dialog.success_message":"The sale receipt sms notification has been sent successfully",
|
||||||
|
"notify_payment_receive_via_sms.dialog.success_message":"The payment notification has been sent successfully.",
|
||||||
"send": "Send",
|
"send": "Send",
|
||||||
"sms_integration.label":"SMS Integration",
|
"sms_integration.label":"SMS Integration",
|
||||||
"sms_integration.label.overview":"Overview",
|
"sms_integration.label.overview":"Overview",
|
||||||
@@ -1441,4 +1444,5 @@
|
|||||||
"sms_message.label_auto":"Auto",
|
"sms_message.label_auto":"Auto",
|
||||||
"sms_message":"SMS message",
|
"sms_message":"SMS message",
|
||||||
"sms_message.dialog.success_message":"Sms notification settings has been updated successfully."
|
"sms_message.dialog.success_message":"Sms notification settings has been updated successfully."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user