feat: add transactions locking query.

This commit is contained in:
elforjani13
2021-12-12 19:15:31 +02:00
parent 295fff4746
commit dfc0fbbb71
6 changed files with 125 additions and 18 deletions

View File

@@ -39,7 +39,7 @@ function TransactionsLockingList({
}) {
// Handle switch transactions locking.
const handleSwitchTransactionsLocking = () => {
openDialog('transactions-locking', {});
openDialog('locking-transactions', {});
};
return (
@@ -48,10 +48,11 @@ function TransactionsLockingList({
<TransactionsLockingParagraph>
<TransLockingDesc>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua.
eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem
ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
</TransLockingDesc>
Lock All Transactions At Once. {' '}
Lock All Transactions At Once.{' '}
<Link to={'/'}> {''}Lock All Transactions At Once </Link>
</TransactionsLockingParagraph>

View File

@@ -32,3 +32,4 @@ export * from './cashflowAccounts';
export * from './roles';
export * from './creditNote';
export * from './vendorCredit';
export * from './transactionsLocking';

View File

@@ -0,0 +1,87 @@
import { useQueryClient, useMutation } from 'react-query';
import { useRequestQuery } from '../useQueryRequest';
import { transformPagination } from 'utils';
import useApiRequest from '../useRequest';
import { useRequestPdf } from '../utils';
import t from './types';
// Common invalidate queries.
const commonInvalidateQueries = (queryClient) => {
// Invalidate customers.
queryClient.invalidateQueries(t.TRANSACTIONS_LOCKING);
};
/**
* Create a locking transactions.
*/
export function useCreateLockingTransactoin(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(values) => apiRequest.put('transactions-locking/lock', values),
{
onSuccess: (res, values) => {
// Common invalidate queries.
commonInvalidateQueries(queryClient);
},
...props,
},
);
}
/**
* Create cancle locking transactions
*/
export function useCancelLockingTransaction(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(values) => apiRequest.put('transactions-locking/cancel-lock', values),
{
onSuccess: (res, values) => {
// Common invalidate queries.
commonInvalidateQueries(queryClient);
},
...props,
},
);
}
/**
* Create a unlocking partial transactions.
*/
export function useCreateUnlockingPartialTransactions(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(values) => apiRequest.put('transactions-locking/unlock-partial', values),
{
onSuccess: (res, values) => {
// Common invalidate queries.
commonInvalidateQueries(queryClient);
},
...props,
},
);
}
/**
* Create cancle unlocking partial transactions.
*/
export function useCancelUnlockingPartialTransactions(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(values) =>
apiRequest.put('transactions-locking/cancel-unlock-partial', values),
{
onSuccess: (res, values) => {
// Common invalidate queries.
commonInvalidateQueries(queryClient);
},
...props,
},
);
}

View File

@@ -119,7 +119,7 @@ const CREDIT_NOTES = {
const VENDOR_CREDIT_NOTES = {
VENDOR_CREDITS: 'VENDOR_CREDITS',
VENDOR_CREDIT: 'VENDOR_CREDIT',
REFUND_VENDOR_CREDIT: 'REFUND_VENDOR_CREDIT',
REFUND_VENDOR_CREDIT: 'REFUND_VENDOR_CREDIT',
RECONCILE_VENDOR_CREDIT: 'RECONCILE_VENDOR_CREDIT',
RECONCILE_VENDOR_CREDITS: 'RECONCILE_VENDOR_CREDITS',
};
@@ -178,6 +178,10 @@ const CASH_FLOW_ACCOUNTS = {
'CASHFLOW_ACCOUNT_TRANSACTIONS_INFINITY',
};
const TARNSACTIONS_LOCKING = {
TRANSACTIONS_LOCKING: 'TRANSACTIONS_LOCKING',
};
export default {
...ACCOUNTS,
...BILLS,
@@ -204,4 +208,5 @@ export default {
...ROLES,
...CREDIT_NOTES,
...VENDOR_CREDIT_NOTES,
...TARNSACTIONS_LOCKING,
};

View File

@@ -1477,8 +1477,6 @@
"roles.label.role_name_": "Role name",
"roles.error.role_is_predefined": "Role is predefined, you cannot delete predefined roles.",
"roles.error.you_cannot_change_your_own_role": "You cannot change your own role.",
"sidebar.transactions_locaking": "Transactions Locaking",
"transactions_locking.dialog.label": "Transactions locking",
"roles.permission_schema.success_message": "The role has been created successfully.",
"roles.permission_schema.upload_message": "The given role has been updated successfully.",
"roles.permission_schema.delete.alert_message": "The given role has been deleted successfully.",
@@ -1503,7 +1501,6 @@
"credit_note.label_credit_note_date": "Credit Note date",
"credit_note.label_credit_note": "Credit Note #",
"credit_note.label_amount_to_credit": "Amount to credit",
"credit_note.label_credit_note_details": "Credit Note details",
"credit_note.label_customer_note": "Customer notes",
"credit_note.once_delete_this_credit_note": "Once you delete this credit note, you won't be able to restore it later. Are you sure you want to delete this credit note?",
@@ -1550,8 +1547,8 @@
"vendor_credit.drawer.label_created_at": "Created at",
"vendor_credit.drawer.label_total": "TOTAL",
"vendor_credit.drawer.label_subtotal": "Subtotal",
"vendor_credit.drawer.label_refund_transactions":"Refund Transactions",
"vendor_credit.drawer.label_bills_reconciled":"Bills Reconciled",
"vendor_credit.drawer.label_refund_transactions": "Refund Transactions",
"vendor_credit.drawer.label_bills_reconciled": "Bills Reconciled",
"landed_cost.dialog.label_select_transaction": "Select transaction",
"landed_cost.dialog.label_select_transaction_entry": "Select transaction entry",
"refund_credit_note.dialog.label": "Refund Credit Note",
@@ -1605,5 +1602,21 @@
"vendor_credit.error.you_couldn_t_delete_vendor_credit_that_has_associated_refund": "You couldn't delete vendor credit that has associated refund transactions.",
"bills.error.you_couldn_t_delete_bill_has_reconciled_with_vendor_credit": "You couldn't delete bill has reconciled with vendor credit transaction.",
"reconcile_vendor_credit.alert.success_message": "The applied vendor credit to bill has been deleted successfully",
"reconcile_vendor_credit.alert.once_you_delete_this_reconcile_vendor_credit": "Once you delete this reconcile vendor credit note, you won't be able to restore it later. Are you sure you want to delete this reconcile vendor credit note?"
"reconcile_vendor_credit.alert.once_you_delete_this_reconcile_vendor_credit": "Once you delete this reconcile vendor credit note, you won't be able to restore it later. Are you sure you want to delete this reconcile vendor credit note?",
"sidebar.transactions_locaking": "Transactions Locaking",
"locking_transactions.dialog.label": "Locking transactions",
"locking_transactions.dialog.locking_date": "Locking date",
"locking_transactions.dialog.reason": "Locking reason",
"locking_transactions.dialog.success_message": "All transactions locking has been submit successfully.",
"unlocking_transactions.dialog.label": "transactions locking",
"unlocking_transactions.dialog.reason": "Unlocking reason",
"unlocking_transactions.dialog.success_message": "Transactions locking has been canceled successfully.",
"unlocking_partial_transactions.dialog.label": "Partial unlocking transactions",
"unlocking_partial_transactions.dialog.from_date": "Unlocking from date",
"unlocking_partial_transactions.dialog.to_date": "To date",
"unlocking_partial_transactions.dialog.reason": "Unlocking reason",
"unlocking_partial_transactions.dialog.success_message": "Transactions locking haas been unlocked partially successfully.",
"unlocking_full_transactions.dialog.label": "Full unlocking transactions",
"unlocking_full_transactions.dialog.reason": "Unlocking reason",
"unlocking_full_transactions.dialog.success_message": "Partial transaction unlocking has been canceled successfully."
}

View File

@@ -872,13 +872,13 @@ export const getDashboardRoutes = () => [
subscriptionActive: [SUBSCRIPTION_TYPE.MAIN],
defaultSearchResource: RESOURCES_TYPES.ACCOUNT,
},
// {
// path: `/transactions-locking`,
// component: lazy(() =>
// import('../containers/TransactionsLocking/TransactionsLockingList'),
// ),
// pageTitle: intl.get('sidebar.transactions_locaking'),
// },
{
path: `/transactions-locking`,
component: lazy(() =>
import('../containers/TransactionsLocking/TransactionsLockingList'),
),
pageTitle: intl.get('sidebar.transactions_locaking'),
},
// Homepage
{
path: `/`,