mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: add notify by sms .
This commit is contained in:
@@ -195,30 +195,31 @@ export function useCreateNotifyEstimateBySMS(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
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.
|
||||
commonInvalidateQueries(queryClient);
|
||||
|
||||
// Invalidate sale estimate.
|
||||
queryClient.invalidateQueries([t.NOTIFY_SALE_ESTIMATE_BY_SMS, id]);
|
||||
},
|
||||
...props,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function useEstimateSMS(estimateId, props, requestProps) {
|
||||
export function useEstimateSMSDetail(estimateId, props, requestProps) {
|
||||
return useRequestQuery(
|
||||
[t.SALE_ESTIMATE_SMS, estimateId],
|
||||
[t.SALE_ESTIMATE_SMS_DETAIL, estimateId],
|
||||
{
|
||||
method: 'get',
|
||||
url: `sales/estimates/${estimateId}/sms-details`,
|
||||
...requestProps,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data,
|
||||
select: (res) => res.data.data,
|
||||
defaultData: {},
|
||||
...props,
|
||||
},
|
||||
|
||||
@@ -239,9 +239,10 @@ export function useCreateNotifyInvoiceBySMS(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
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
|
||||
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(
|
||||
[t.SALE_INVOICE_SMS, invoiceId],
|
||||
[t.SALE_INVOICE_SMS_DETAIL, invoiceId],
|
||||
{
|
||||
method: 'get',
|
||||
url: `sales/invoices/${invoiceId}/sms-details`,
|
||||
|
||||
@@ -180,9 +180,10 @@ export function useCreateNotifyPaymentReceiveBySMS(props) {
|
||||
const apiRequest = useApiRequest();
|
||||
|
||||
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
|
||||
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(
|
||||
[t.PAYMENT_RECEIVE_SMS, id],
|
||||
{ method: 'get', url: `sales/payment_receives/${id}/sms-details`, ...requestProps },
|
||||
[t.PAYMENT_RECEIVE_SMS_DETAIL, paymentReceiveId],
|
||||
{
|
||||
select: (res) => res.data,
|
||||
method: 'get',
|
||||
url: `sales/payment_receives/${paymentReceiveId}/sms-details`,
|
||||
...requestProps,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data.data,
|
||||
defaultData: {},
|
||||
...props,
|
||||
},
|
||||
|
||||
@@ -168,9 +168,10 @@ export function useCreateNotifyReceiptBySMS(props) {
|
||||
const queryClient = useQueryClient();
|
||||
const apiRequest = useApiRequest();
|
||||
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]);
|
||||
|
||||
// Invalidate queries.
|
||||
@@ -181,12 +182,16 @@ export function useCreateNotifyReceiptBySMS(props) {
|
||||
);
|
||||
}
|
||||
|
||||
export function useReceiptSMS(receiptId, props, requestProps) {
|
||||
export function useReceiptSMSDetail(receiptId, props, requestProps) {
|
||||
return useRequestQuery(
|
||||
[t.SALE_RECEIPT_SMS, receiptId],
|
||||
{ method: 'get', url: `sales/receipts/${receiptId}/sms-details`, ...requestProps },
|
||||
[t.SALE_RECEIPT_SMS_DETAIL, receiptId],
|
||||
{
|
||||
select: (res) => res.data,
|
||||
method: 'get',
|
||||
url: `sales/receipts/${receiptId}/sms-details`,
|
||||
...requestProps,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data.data,
|
||||
defaultData: {},
|
||||
...props,
|
||||
},
|
||||
|
||||
@@ -51,14 +51,14 @@ const ITEMS = {
|
||||
const SALE_ESTIMATES = {
|
||||
SALE_ESTIMATES: 'SALE_ESTIMATES',
|
||||
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',
|
||||
};
|
||||
|
||||
const SALE_RECEIPTS = {
|
||||
SALE_RECEIPTS: 'SALE_RECEIPTS',
|
||||
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',
|
||||
};
|
||||
|
||||
@@ -83,7 +83,7 @@ const PAYMENT_RECEIVES = {
|
||||
PAYMENT_RECEIVE: 'PAYMENT_RECEIVE',
|
||||
PAYMENT_RECEIVE_NEW_ENTRIES: 'PAYMENT_RECEIVE_NEW_ENTRIES',
|
||||
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',
|
||||
};
|
||||
|
||||
@@ -91,7 +91,7 @@ const SALE_INVOICES = {
|
||||
SALE_INVOICES: 'SALE_INVOICES',
|
||||
SALE_INVOICE: 'SALE_INVOICE',
|
||||
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',
|
||||
BAD_DEBT: 'BAD_DEBT',
|
||||
CANCEL_BAD_DEBT: 'CANCEL_BAD_DEBT',
|
||||
|
||||
Reference in New Issue
Block a user