mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +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 {
|
try {
|
||||||
const vendor = await this.vendorsApplication.createVendor(
|
const vendor = await this.vendorsApplication.createVendor(
|
||||||
tenantId,
|
tenantId,
|
||||||
contactDTO,
|
contactDTO
|
||||||
user
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
id: vendor.id,
|
id: vendor.id,
|
||||||
message: 'The vendor has been created successfully.',
|
message: 'The vendor has been created successfully.',
|
||||||
|
|||||||
@@ -297,8 +297,7 @@ export default class VendorCreditController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
const vendorCredit = await this.createVendorCreditService.newVendorCredit(
|
const vendorCredit = await this.createVendorCreditService.newVendorCredit(
|
||||||
tenantId,
|
tenantId,
|
||||||
vendorCreditCreateDTO,
|
vendorCreditCreateDTO
|
||||||
user
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
|
|||||||
@@ -338,8 +338,7 @@ export default class PaymentReceivesController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
const creditNote = await this.createCreditNoteService.newCreditNote(
|
const creditNote = await this.createCreditNoteService.newCreditNote(
|
||||||
tenantId,
|
tenantId,
|
||||||
creditNoteDTO,
|
creditNoteDTO
|
||||||
user
|
|
||||||
);
|
);
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
id: creditNote.id,
|
id: creditNote.id,
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ import { InvoiceChangeStatusOnMailSentSubscriber } from '@/services/Sales/Invoic
|
|||||||
import { SaleReceiptMarkClosedOnMailSentSubcriber } from '@/services/Sales/Receipts/subscribers/SaleReceiptMarkClosedOnMailSentSubcriber';
|
import { SaleReceiptMarkClosedOnMailSentSubcriber } from '@/services/Sales/Receipts/subscribers/SaleReceiptMarkClosedOnMailSentSubcriber';
|
||||||
import { SaleEstimateMarkApprovedOnMailSent } from '@/services/Sales/Estimates/subscribers/SaleEstimateMarkApprovedOnMailSent';
|
import { SaleEstimateMarkApprovedOnMailSent } from '@/services/Sales/Estimates/subscribers/SaleEstimateMarkApprovedOnMailSent';
|
||||||
import { DeleteCashflowTransactionOnUncategorize } from '@/services/Cashflow/subscribers/DeleteCashflowTransactionOnUncategorize';
|
import { DeleteCashflowTransactionOnUncategorize } from '@/services/Cashflow/subscribers/DeleteCashflowTransactionOnUncategorize';
|
||||||
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete'; }
|
import { PreventDeleteTransactionOnDelete } from '@/services/Cashflow/subscribers/PreventDeleteTransactionsOnDelete';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return new EventPublisher();
|
return new EventPublisher();
|
||||||
@@ -218,6 +218,6 @@ export const susbcribers = () => {
|
|||||||
|
|
||||||
// Cashflow
|
// Cashflow
|
||||||
DeleteCashflowTransactionOnUncategorize,
|
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
|
* @param {ISystemUser} authorizedUser
|
||||||
* @returns {Promise<ICustomer>}
|
* @returns {Promise<ICustomer>}
|
||||||
*/
|
*/
|
||||||
public createCustomer = (
|
public createCustomer = (tenantId: number, customerDTO: ICustomerNewDTO) => {
|
||||||
tenantId: number,
|
|
||||||
customerDTO: ICustomerNewDTO,
|
|
||||||
) => {
|
|
||||||
return this.createCustomerService.createCustomer(tenantId, customerDTO);
|
return this.createCustomerService.createCustomer(tenantId, customerDTO);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Inject, Service } from 'typedi';
|
import { Inject, Service } from 'typedi';
|
||||||
|
import { Knex } from 'knex';
|
||||||
import {
|
import {
|
||||||
ISystemUser,
|
ISystemUser,
|
||||||
IVendorEditDTO,
|
IVendorEditDTO,
|
||||||
@@ -42,13 +43,9 @@ export class VendorsApplication {
|
|||||||
public createVendor = (
|
public createVendor = (
|
||||||
tenantId: number,
|
tenantId: number,
|
||||||
vendorDTO: IVendorNewDTO,
|
vendorDTO: IVendorNewDTO,
|
||||||
authorizedUser: ISystemUser
|
trx?: Knex.Transaction
|
||||||
) => {
|
) => {
|
||||||
return this.createVendorService.createVendor(
|
return this.createVendorService.createVendor(tenantId, vendorDTO, trx);
|
||||||
tenantId,
|
|
||||||
vendorDTO,
|
|
||||||
authorizedUser
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
ICreditNoteCreatedPayload,
|
ICreditNoteCreatedPayload,
|
||||||
ICreditNoteCreatingPayload,
|
ICreditNoteCreatingPayload,
|
||||||
ICreditNoteNewDTO,
|
ICreditNoteNewDTO,
|
||||||
ISystemUser,
|
|
||||||
} from '@/interfaces';
|
} from '@/interfaces';
|
||||||
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
import HasTenancyService from '@/services/Tenancy/TenancyService';
|
||||||
import ItemsEntriesService from '@/services/Items/ItemsEntriesService';
|
import ItemsEntriesService from '@/services/Items/ItemsEntriesService';
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default class CreateVendorCredit extends BaseVendorCredit {
|
|||||||
* Creates a new vendor credit.
|
* Creates a new vendor credit.
|
||||||
* @param {number} tenantId -
|
* @param {number} tenantId -
|
||||||
* @param {IVendorCreditCreateDTO} vendorCreditCreateDTO -
|
* @param {IVendorCreditCreateDTO} vendorCreditCreateDTO -
|
||||||
|
* @param {Knex.Transaction} trx -
|
||||||
*/
|
*/
|
||||||
public newVendorCredit = async (
|
public newVendorCredit = async (
|
||||||
tenantId: number,
|
tenantId: number,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useQueryClient, useMutation } from 'react-query';
|
|||||||
import { useRequestQuery } from '../useQueryRequest';
|
import { useRequestQuery } from '../useQueryRequest';
|
||||||
import { transformPagination } from '@/utils';
|
import { transformPagination } from '@/utils';
|
||||||
import useApiRequest from '../useRequest';
|
import useApiRequest from '../useRequest';
|
||||||
import { useRequestPdf } from '../utils';
|
import { useRequestPdf } from '../useRequestPdf';
|
||||||
import t from './types';
|
import t from './types';
|
||||||
|
|
||||||
const commonInvalidateQueries = (queryClient) => {
|
const commonInvalidateQueries = (queryClient) => {
|
||||||
@@ -354,7 +354,5 @@ export function useRefundCreditTransaction(id, props, requestProps) {
|
|||||||
* Retrieve the credit note pdf document data,
|
* Retrieve the credit note pdf document data,
|
||||||
*/
|
*/
|
||||||
export function usePdfCreditNote(creditNoteId) {
|
export function usePdfCreditNote(creditNoteId) {
|
||||||
return useRequestPdf({
|
return useRequestPdf({ url: `sales/credit_notes/${creditNoteId}` });
|
||||||
url: `sales/credit_notes/${creditNoteId}`,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
import { useQueryClient, useMutation } from 'react-query';
|
import { useQueryClient, useMutation } from 'react-query';
|
||||||
import { useRequestQuery } from '../useQueryRequest';
|
import { useRequestQuery } from '../useQueryRequest';
|
||||||
import useApiRequest from '../useRequest';
|
import useApiRequest from '../useRequest';
|
||||||
import { useRequestPdf } from '../utils';
|
|
||||||
|
|
||||||
import { transformPagination } from '@/utils';
|
import { transformPagination } from '@/utils';
|
||||||
import t from './types';
|
import t from './types';
|
||||||
|
import { useRequestPdf } from '../useRequestPdf';
|
||||||
|
|
||||||
const commonInvalidateQueries = (queryClient) => {
|
const commonInvalidateQueries = (queryClient) => {
|
||||||
// Invalidate estimates.
|
// Invalidate estimates.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useQueryClient, useMutation } from 'react-query';
|
|||||||
import { useRequestQuery } from '../useQueryRequest';
|
import { useRequestQuery } from '../useQueryRequest';
|
||||||
import { transformPagination } from '@/utils';
|
import { transformPagination } from '@/utils';
|
||||||
import useApiRequest from '../useRequest';
|
import useApiRequest from '../useRequest';
|
||||||
import { useRequestPdf } from '../utils';
|
import { useRequestPdf } from '../useRequestPdf';
|
||||||
import t from './types';
|
import t from './types';
|
||||||
|
|
||||||
// Common invalidate queries.
|
// Common invalidate queries.
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import { useMutation, useQueryClient } from 'react-query';
|
|||||||
import { useRequestQuery } from '../useQueryRequest';
|
import { useRequestQuery } from '../useQueryRequest';
|
||||||
import useApiRequest from '../useRequest';
|
import useApiRequest from '../useRequest';
|
||||||
import { transformPagination, saveInvoke } from '@/utils';
|
import { transformPagination, saveInvoke } from '@/utils';
|
||||||
import { useRequestPdf } from '../utils';
|
|
||||||
|
|
||||||
import t from './types';
|
import t from './types';
|
||||||
|
import { useRequestPdf } from '../useRequestPdf';
|
||||||
|
|
||||||
// Common invalidate queries.
|
// Common invalidate queries.
|
||||||
const commonInvalidateQueries = (client) => {
|
const commonInvalidateQueries = (client) => {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { useQueryClient, useMutation } from 'react-query';
|
import { useQueryClient, useMutation } from 'react-query';
|
||||||
import { useRequestQuery } from '../useQueryRequest';
|
import { useRequestQuery } from '../useQueryRequest';
|
||||||
import { useRequestPdf } from '../utils';
|
|
||||||
import useApiRequest from '../useRequest';
|
import useApiRequest from '../useRequest';
|
||||||
import { transformPagination } from '@/utils';
|
import { transformPagination } from '@/utils';
|
||||||
|
import { useRequestPdf } from '../useRequestPdf';
|
||||||
import t from './types';
|
import t from './types';
|
||||||
|
|
||||||
const commonInvalidateQueries = (queryClient) => {
|
const commonInvalidateQueries = (queryClient) => {
|
||||||
@@ -165,9 +165,7 @@ export function useReceipt(id, props) {
|
|||||||
* @param {number} receiptId -
|
* @param {number} receiptId -
|
||||||
*/
|
*/
|
||||||
export function usePdfReceipt(receiptId: number) {
|
export function usePdfReceipt(receiptId: number) {
|
||||||
return useRequestPdf({
|
return useRequestPdf({ url: `sales/receipts/${receiptId}` });
|
||||||
url: `sales/receipts/${receiptId}`,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useRefreshReceipts() {
|
export function useRefreshReceipts() {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ export * from './usePrevious';
|
|||||||
export * from './useUpdateEffect';
|
export * from './useUpdateEffect';
|
||||||
export * from './useWatch';
|
export * from './useWatch';
|
||||||
export * from './useWhen';
|
export * from './useWhen';
|
||||||
export * from './useRequestPdf';
|
|
||||||
export * from './useIntersectionObserver';
|
export * from './useIntersectionObserver';
|
||||||
export * from './useAbilityContext';
|
export * from './useAbilityContext';
|
||||||
export * from './useCustomCompareEffect';
|
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