mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
refactor(nestjs): landed cost
This commit is contained in:
@@ -27,6 +27,8 @@ function BillDrawerProvider({ billId, ...props }) {
|
||||
enabled: !!billId,
|
||||
});
|
||||
|
||||
console.log(transactions, 'ahmed');
|
||||
|
||||
//provider.
|
||||
const provider = {
|
||||
billId,
|
||||
|
||||
@@ -34,6 +34,8 @@ function LocatedLandedCostTable({
|
||||
// Bill drawer context.
|
||||
const { transactions, billId } = useBillDrawerContext();
|
||||
|
||||
console.log(transactions, 'ahmed');
|
||||
|
||||
// Handle the transaction delete action.
|
||||
const handleDeleteTransaction = ({ id }) => {
|
||||
openAlert('bill-located-cost-delete', { BillId: id });
|
||||
|
||||
@@ -163,7 +163,7 @@ export function useBill(id, props) {
|
||||
[t.BILL, id],
|
||||
{ method: 'get', url: `/bills/${id}` },
|
||||
{
|
||||
select: (res) => res.data.bill,
|
||||
select: (res) => res.data,
|
||||
defaultData: {},
|
||||
...props,
|
||||
},
|
||||
@@ -208,7 +208,7 @@ export function useBillPaymentTransactions(id, props) {
|
||||
url: `bills/${id}/payment-transactions`,
|
||||
},
|
||||
{
|
||||
select: (res) => res.data.data,
|
||||
select: (res) => res.data,
|
||||
defaultData: [],
|
||||
...props,
|
||||
},
|
||||
|
||||
@@ -23,7 +23,7 @@ export function useCreateLandedCost(props) {
|
||||
|
||||
return useMutation(
|
||||
([id, values]) =>
|
||||
apiRequest.post(`purchases/landed-cost/bills/${id}/allocate`, values),
|
||||
apiRequest.post(`landed-cost/bills/${id}/allocate`, values),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
// Common invalidate queries.
|
||||
@@ -43,7 +43,7 @@ export function useDeleteLandedCost(props) {
|
||||
|
||||
return useMutation(
|
||||
(landedCostId) =>
|
||||
apiRequest.delete(`purchases/landed-cost/${landedCostId}`),
|
||||
apiRequest.delete(`landed-cost/${landedCostId}`),
|
||||
{
|
||||
onSuccess: (res, id) => {
|
||||
// Common invalidate queries.
|
||||
@@ -62,7 +62,7 @@ export function useLandedCostTransaction(query, props) {
|
||||
[t.LANDED_COST, query],
|
||||
{
|
||||
method: 'get',
|
||||
url: 'purchases/landed-cost/transactions',
|
||||
url: 'landed-cost/transactions',
|
||||
params: { transaction_type: query },
|
||||
},
|
||||
{
|
||||
@@ -81,10 +81,10 @@ export function useLandedCostTransaction(query, props) {
|
||||
export function useBillLocatedLandedCost(id, props) {
|
||||
return useRequestQuery(
|
||||
[t.LANDED_COST_TRANSACTION, id],
|
||||
{ method: 'get', url: `purchases/landed-cost/bills/${id}/transactions` },
|
||||
{ method: 'get', url: `landed-cost/bills/${id}/transactions` },
|
||||
{
|
||||
select: (res) => res.data.transactions,
|
||||
defaultData: {},
|
||||
select: (res) => res.data?.data,
|
||||
defaultData: [],
|
||||
...props,
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user