mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-12 02:40:31 +00:00
Compare commits
5 Commits
import-fie
...
v0.16.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e87581f4e | ||
|
|
dc52fb1de5 | ||
|
|
21a1777424 | ||
|
|
16b721db91 | ||
|
|
2baa667c5d |
@@ -144,10 +144,8 @@ export default class VendorsController extends ContactsController {
|
||||
try {
|
||||
const vendor = await this.vendorsApplication.createVendor(
|
||||
tenantId,
|
||||
contactDTO,
|
||||
user
|
||||
contactDTO
|
||||
);
|
||||
|
||||
return res.status(200).send({
|
||||
id: vendor.id,
|
||||
message: 'The vendor has been created successfully.',
|
||||
|
||||
@@ -297,8 +297,7 @@ export default class VendorCreditController extends BaseController {
|
||||
try {
|
||||
const vendorCredit = await this.createVendorCreditService.newVendorCredit(
|
||||
tenantId,
|
||||
vendorCreditCreateDTO,
|
||||
user
|
||||
vendorCreditCreateDTO
|
||||
);
|
||||
|
||||
return res.status(200).send({
|
||||
|
||||
@@ -338,8 +338,7 @@ export default class PaymentReceivesController extends BaseController {
|
||||
try {
|
||||
const creditNote = await this.createCreditNoteService.newCreditNote(
|
||||
tenantId,
|
||||
creditNoteDTO,
|
||||
user
|
||||
creditNoteDTO
|
||||
);
|
||||
return res.status(200).send({
|
||||
id: creditNote.id,
|
||||
|
||||
@@ -89,7 +89,7 @@ import { InvoiceChangeStatusOnMailSentSubscriber } from '@/services/Sales/Invoic
|
||||
import { SaleReceiptMarkClosedOnMailSentSubcriber } from '@/services/Sales/Receipts/subscribers/SaleReceiptMarkClosedOnMailSentSubcriber';
|
||||
import { SaleEstimateMarkApprovedOnMailSent } from '@/services/Sales/Estimates/subscribers/SaleEstimateMarkApprovedOnMailSent';
|
||||
import { DeleteCashflowTransactionOnUncategorize } from '@/services/Cashflow/subscribers/DeleteCashflowTransactionOnUncategorize';
|
||||
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete'; }
|
||||
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete';
|
||||
|
||||
export default () => {
|
||||
return new EventPublisher();
|
||||
@@ -218,6 +218,6 @@ export const susbcribers = () => {
|
||||
|
||||
// Cashflow
|
||||
DeleteCashflowTransactionOnUncategorize,
|
||||
PreventDeleteTransactionOnDelete
|
||||
PreventDeleteTransactionOnDelete,
|
||||
];
|
||||
};
|
||||
|
||||
@@ -187,18 +187,4 @@ export default class Contact extends TenantModel {
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
static get fields() {
|
||||
return {
|
||||
contact_service: {
|
||||
column: 'contact_service',
|
||||
},
|
||||
display_name: {
|
||||
column: 'display_name',
|
||||
},
|
||||
created_at: {
|
||||
column: 'created_at',
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,10 +50,7 @@ export class CustomersApplication {
|
||||
* @param {ISystemUser} authorizedUser
|
||||
* @returns {Promise<ICustomer>}
|
||||
*/
|
||||
public createCustomer = (
|
||||
tenantId: number,
|
||||
customerDTO: ICustomerNewDTO,
|
||||
) => {
|
||||
public createCustomer = (tenantId: number, customerDTO: ICustomerNewDTO) => {
|
||||
return this.createCustomerService.createCustomer(tenantId, customerDTO);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { Knex } from 'knex';
|
||||
import {
|
||||
ISystemUser,
|
||||
IVendorEditDTO,
|
||||
@@ -42,13 +43,9 @@ export class VendorsApplication {
|
||||
public createVendor = (
|
||||
tenantId: number,
|
||||
vendorDTO: IVendorNewDTO,
|
||||
authorizedUser: ISystemUser
|
||||
trx?: Knex.Transaction
|
||||
) => {
|
||||
return this.createVendorService.createVendor(
|
||||
tenantId,
|
||||
vendorDTO,
|
||||
authorizedUser
|
||||
);
|
||||
return this.createVendorService.createVendor(tenantId, vendorDTO, trx);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
ICreditNoteCreatedPayload,
|
||||
ICreditNoteCreatingPayload,
|
||||
ICreditNoteNewDTO,
|
||||
ISystemUser,
|
||||
} from '@/interfaces';
|
||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||
import ItemsEntriesService from '@/services/Items/ItemsEntriesService';
|
||||
|
||||
@@ -30,6 +30,7 @@ export default class CreateVendorCredit extends BaseVendorCredit {
|
||||
* Creates a new vendor credit.
|
||||
* @param {number} tenantId -
|
||||
* @param {IVendorCreditCreateDTO} vendorCreditCreateDTO -
|
||||
* @param {Knex.Transaction} trx -
|
||||
*/
|
||||
public newVendorCredit = async (
|
||||
tenantId: number,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useQueryClient, useMutation } from 'react-query';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import { transformPagination } from '@/utils';
|
||||
import useApiRequest from '../useRequest';
|
||||
import { useRequestPdf } from '../utils';
|
||||
import { useRequestPdf } from '../useRequestPdf';
|
||||
import t from './types';
|
||||
|
||||
const commonInvalidateQueries = (queryClient) => {
|
||||
@@ -354,7 +354,5 @@ export function useRefundCreditTransaction(id, props, requestProps) {
|
||||
* Retrieve the credit note pdf document data,
|
||||
*/
|
||||
export function usePdfCreditNote(creditNoteId) {
|
||||
return useRequestPdf({
|
||||
url: `sales/credit_notes/${creditNoteId}`,
|
||||
});
|
||||
return useRequestPdf({ url: `sales/credit_notes/${creditNoteId}` });
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
import { useQueryClient, useMutation } from 'react-query';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import useApiRequest from '../useRequest';
|
||||
import { useRequestPdf } from '../utils';
|
||||
|
||||
import { transformPagination } from '@/utils';
|
||||
import t from './types';
|
||||
import { useRequestPdf } from '../useRequestPdf';
|
||||
|
||||
const commonInvalidateQueries = (queryClient) => {
|
||||
// Invalidate estimates.
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useQueryClient, useMutation } from 'react-query';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import { transformPagination } from '@/utils';
|
||||
import useApiRequest from '../useRequest';
|
||||
import { useRequestPdf } from '../utils';
|
||||
import { useRequestPdf } from '../useRequestPdf';
|
||||
import t from './types';
|
||||
|
||||
// Common invalidate queries.
|
||||
|
||||
@@ -3,9 +3,9 @@ import { useMutation, useQueryClient } from 'react-query';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import useApiRequest from '../useRequest';
|
||||
import { transformPagination, saveInvoke } from '@/utils';
|
||||
import { useRequestPdf } from '../utils';
|
||||
|
||||
import t from './types';
|
||||
import { useRequestPdf } from '../useRequestPdf';
|
||||
|
||||
// Common invalidate queries.
|
||||
const commonInvalidateQueries = (client) => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// @ts-nocheck
|
||||
import { useQueryClient, useMutation } from 'react-query';
|
||||
import { useRequestQuery } from '../useQueryRequest';
|
||||
import { useRequestPdf } from '../utils';
|
||||
import useApiRequest from '../useRequest';
|
||||
import { transformPagination } from '@/utils';
|
||||
import { useRequestPdf } from '../useRequestPdf';
|
||||
import t from './types';
|
||||
|
||||
const commonInvalidateQueries = (queryClient) => {
|
||||
@@ -165,9 +165,7 @@ export function useReceipt(id, props) {
|
||||
* @param {number} receiptId -
|
||||
*/
|
||||
export function usePdfReceipt(receiptId: number) {
|
||||
return useRequestPdf({
|
||||
url: `sales/receipts/${receiptId}`,
|
||||
});
|
||||
return useRequestPdf({ url: `sales/receipts/${receiptId}` });
|
||||
}
|
||||
|
||||
export function useRefreshReceipts() {
|
||||
|
||||
@@ -4,7 +4,6 @@ export * from './usePrevious';
|
||||
export * from './useUpdateEffect';
|
||||
export * from './useWatch';
|
||||
export * from './useWhen';
|
||||
export * from './useRequestPdf';
|
||||
export * from './useIntersectionObserver';
|
||||
export * from './useAbilityContext';
|
||||
export * from './useCustomCompareEffect';
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import useApiRequest from '../useRequest';
|
||||
|
||||
export const useRequestPdf = (url) => {
|
||||
const apiRequest = useApiRequest();
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
const [isLoaded, setIsLoaded] = React.useState(false);
|
||||
const [pdfUrl, setPdfUrl] = React.useState('');
|
||||
const [response, setResponse] = React.useState(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
setIsLoading(true);
|
||||
apiRequest
|
||||
.get(url, {
|
||||
headers: { accept: 'application/pdf' },
|
||||
responseType: 'blob',
|
||||
})
|
||||
.then((response) => {
|
||||
// Create a Blob from the PDF Stream.
|
||||
const file = new Blob([response.data], { type: 'application/pdf' });
|
||||
|
||||
// Build a URL from the file
|
||||
const fileURL = URL.createObjectURL(file);
|
||||
|
||||
setPdfUrl(fileURL);
|
||||
setIsLoading(false);
|
||||
setIsLoaded(true);
|
||||
setResponse(response);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
isLoaded,
|
||||
pdfUrl,
|
||||
response,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user