mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
Compare commits
7 Commits
big-144-fi
...
release/v0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2baa667c5d | ||
|
|
00e6c141ee | ||
|
|
0aea339c1c | ||
|
|
2cf75e0136 | ||
|
|
5a8c394ad7 | ||
|
|
71742c3480 | ||
|
|
b340776278 |
@@ -21,4 +21,5 @@ block content
|
|||||||
each row in table.rows
|
each row in table.rows
|
||||||
tr(class=row.classNames)
|
tr(class=row.classNames)
|
||||||
each cell in row.cells
|
each cell in row.cells
|
||||||
td(class='cell--' + cell.key)!= cell.value
|
td(class='cell--' + cell.key)
|
||||||
|
span!= cell.value
|
||||||
@@ -136,6 +136,11 @@ export default {
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
inventory: {
|
||||||
|
cost_compute_running: {
|
||||||
|
type: 'boolean',
|
||||||
|
},
|
||||||
|
},
|
||||||
accounts: {
|
accounts: {
|
||||||
account_code_required: {
|
account_code_required: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export default abstract class AgingSummaryTable extends R.compose(
|
|||||||
node: IAgingSummaryContact | IAgingSummaryTotal
|
node: IAgingSummaryContact | IAgingSummaryTotal
|
||||||
): ITableColumnAccessor[] => {
|
): ITableColumnAccessor[] => {
|
||||||
return node.aging.map((aging, index) => ({
|
return node.aging.map((aging, index) => ({
|
||||||
key: 'aging',
|
key: 'aging_period',
|
||||||
accessor: `aging[${index}].total.formattedAmount`,
|
accessor: `aging[${index}].total.formattedAmount`,
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,8 +5,17 @@ export enum AgingSummaryRowType {
|
|||||||
|
|
||||||
export const HtmlTableCss = `
|
export const HtmlTableCss = `
|
||||||
table tr.row-type--total td{
|
table tr.row-type--total td{
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
border-top: 1px solid #bbb;
|
border-top: 1px solid #bbb;
|
||||||
border-bottom: 3px double #333;
|
border-bottom: 3px double #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table .column--current,
|
||||||
|
table .column--aging_period,
|
||||||
|
table .column--total,
|
||||||
|
table .cell--current,
|
||||||
|
table .cell--aging_period,
|
||||||
|
table .cell--total {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -25,19 +25,18 @@ export class CustomerBalanceSummaryTableInjectable {
|
|||||||
tenantId: number,
|
tenantId: number,
|
||||||
filter: ICustomerBalanceSummaryQuery
|
filter: ICustomerBalanceSummaryQuery
|
||||||
): Promise<ICustomerBalanceSummaryTable> {
|
): Promise<ICustomerBalanceSummaryTable> {
|
||||||
|
|
||||||
const i18n = this.tenancy.i18n(tenantId);
|
const i18n = this.tenancy.i18n(tenantId);
|
||||||
const { data, query, meta } =
|
const { data, query, meta } =
|
||||||
await this.customerBalanceSummaryService.customerBalanceSummary(
|
await this.customerBalanceSummaryService.customerBalanceSummary(
|
||||||
tenantId,
|
tenantId,
|
||||||
filter
|
filter
|
||||||
);
|
);
|
||||||
const tableRows = new CustomerBalanceSummaryTable(data, filter, i18n);
|
const table = new CustomerBalanceSummaryTable(data, filter, i18n);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
table: {
|
table: {
|
||||||
columns: tableRows.tableColumns(),
|
columns: table.tableColumns(),
|
||||||
rows: tableRows.tableRows(),
|
rows: table.tableRows(),
|
||||||
},
|
},
|
||||||
query,
|
query,
|
||||||
meta,
|
meta,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export class CustomerBalanceSummaryTable {
|
|||||||
*/
|
*/
|
||||||
private getCustomerColumnsAccessor = (): IColumnMapperMeta[] => {
|
private getCustomerColumnsAccessor = (): IColumnMapperMeta[] => {
|
||||||
const columns = [
|
const columns = [
|
||||||
{ key: 'customerName', accessor: 'customerName' },
|
{ key: 'name', accessor: 'customerName' },
|
||||||
{ key: 'total', accessor: 'total.formattedAmount' },
|
{ key: 'total', accessor: 'total.formattedAmount' },
|
||||||
];
|
];
|
||||||
return R.compose(
|
return R.compose(
|
||||||
@@ -85,7 +85,7 @@ export class CustomerBalanceSummaryTable {
|
|||||||
*/
|
*/
|
||||||
private getTotalColumnsAccessor = (): IColumnMapperMeta[] => {
|
private getTotalColumnsAccessor = (): IColumnMapperMeta[] => {
|
||||||
const columns = [
|
const columns = [
|
||||||
{ key: 'total', value: this.i18n.__('Total') },
|
{ key: 'name', value: this.i18n.__('Total') },
|
||||||
{ key: 'total', accessor: 'total.formattedAmount' },
|
{ key: 'total', accessor: 'total.formattedAmount' },
|
||||||
];
|
];
|
||||||
return R.compose(
|
return R.compose(
|
||||||
|
|||||||
@@ -3,4 +3,12 @@ table tr.row-type--total td {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
border-top: 1px solid #bbb;
|
border-top: 1px solid #bbb;
|
||||||
border-bottom: 3px double #333;
|
border-bottom: 3px double #333;
|
||||||
}`;
|
}
|
||||||
|
table .column--name {
|
||||||
|
width: 65%;
|
||||||
|
}
|
||||||
|
table .column--total,
|
||||||
|
table .cell--total {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -10,4 +10,20 @@ table tr.row-type--closing-balance td{
|
|||||||
table tr.row-type--closing-balance td {
|
table tr.row-type--closing-balance td {
|
||||||
border-bottom: 1px solid #ececec;
|
border-bottom: 1px solid #ececec;
|
||||||
}
|
}
|
||||||
`;
|
|
||||||
|
table .column--debit,
|
||||||
|
table .column--credit,
|
||||||
|
table .column--amount,
|
||||||
|
table .column--running_balance,
|
||||||
|
table .cell--debit,
|
||||||
|
table .cell--credit,
|
||||||
|
table .cell--amount,
|
||||||
|
table .cell--running_balance{
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
table tr.row-type--account .cell--date span,
|
||||||
|
table tr.row-type--opening-balance .cell--account_name span,
|
||||||
|
table tr.row-type--closing-balance .cell--account_name span{
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
`;
|
||||||
@@ -75,6 +75,6 @@ export class SalesTaxLiabilitySummaryApplication {
|
|||||||
tenantId: number,
|
tenantId: number,
|
||||||
query: SalesTaxLiabilitySummaryQuery
|
query: SalesTaxLiabilitySummaryQuery
|
||||||
): Promise<Buffer> {
|
): Promise<Buffer> {
|
||||||
return this.salesTaxLiabiltiyPdf.pdf(tenantId, query):
|
return this.salesTaxLiabiltiyPdf.pdf(tenantId, query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export enum IROW_TYPE {
|
|||||||
export const HtmlTableCustomCss = `
|
export const HtmlTableCustomCss = `
|
||||||
table tr.row-type--total td{
|
table tr.row-type--total td{
|
||||||
border-top: 1px solid #bbb;
|
border-top: 1px solid #bbb;
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
border-bottom: 3px double #000;
|
border-bottom: 3px double #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class VendorBalanceSummaryTable {
|
|||||||
*/
|
*/
|
||||||
private getVendorColumnsAccessor = (): IColumnMapperMeta[] => {
|
private getVendorColumnsAccessor = (): IColumnMapperMeta[] => {
|
||||||
const columns = [
|
const columns = [
|
||||||
{ key: 'vendorName', accessor: 'vendorName' },
|
{ key: 'name', accessor: 'vendorName' },
|
||||||
{ key: 'total', accessor: 'total.formattedAmount' },
|
{ key: 'total', accessor: 'total.formattedAmount' },
|
||||||
];
|
];
|
||||||
return R.compose(
|
return R.compose(
|
||||||
@@ -87,7 +87,7 @@ export class VendorBalanceSummaryTable {
|
|||||||
*/
|
*/
|
||||||
private getTotalColumnsAccessor = (): IColumnMapperMeta[] => {
|
private getTotalColumnsAccessor = (): IColumnMapperMeta[] => {
|
||||||
const columns = [
|
const columns = [
|
||||||
{ key: 'total', value: this.i18n.__('Total') },
|
{ key: 'name', value: this.i18n.__('Total') },
|
||||||
{ key: 'total', accessor: 'total.formattedAmount' },
|
{ key: 'total', accessor: 'total.formattedAmount' },
|
||||||
];
|
];
|
||||||
return R.compose(
|
return R.compose(
|
||||||
|
|||||||
@@ -3,4 +3,12 @@ table tr.row-type--total td {
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
border-top: 1px solid #bbb;
|
border-top: 1px solid #bbb;
|
||||||
border-bottom: 3px double #333;
|
border-bottom: 3px double #333;
|
||||||
}`;
|
}
|
||||||
|
table .column--name {
|
||||||
|
width: 65%;
|
||||||
|
}
|
||||||
|
table .column--total,
|
||||||
|
table .cell--total {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -5,12 +5,16 @@ import { useHistory } from 'react-router-dom';
|
|||||||
import { getDashboardRoutes } from '@/routes/dashboard';
|
import { getDashboardRoutes } from '@/routes/dashboard';
|
||||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
import withUniversalSearchActions from '@/containers/UniversalSearch/withUniversalSearchActions';
|
||||||
|
|
||||||
import { compose } from '@/utils';
|
import { compose } from '@/utils';
|
||||||
|
|
||||||
function GlobalHotkeys({
|
function GlobalHotkeys({
|
||||||
// #withDashboardActions
|
// #withDashboardActions
|
||||||
toggleSidebarExpend,
|
toggleSidebarExpand,
|
||||||
|
|
||||||
|
// withUniversalSearchActions
|
||||||
|
openGlobalSearch,
|
||||||
|
|
||||||
// #withDialogActions
|
// #withDialogActions
|
||||||
openDialog,
|
openDialog,
|
||||||
@@ -24,7 +28,7 @@ function GlobalHotkeys({
|
|||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
const handleSidebarToggleBtn = () => {
|
const handleSidebarToggleBtn = () => {
|
||||||
toggleSidebarExpend();
|
toggleSidebarExpand();
|
||||||
};
|
};
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
globalHotkeys,
|
globalHotkeys,
|
||||||
@@ -37,10 +41,26 @@ function GlobalHotkeys({
|
|||||||
},
|
},
|
||||||
[history],
|
[history],
|
||||||
);
|
);
|
||||||
useHotkeys('ctrl+/', (event, handle) => handleSidebarToggleBtn());
|
useHotkeys('ctrl+/', () => {
|
||||||
useHotkeys('shift+d', (event, handle) => openDialog('money-in', {}));
|
handleSidebarToggleBtn();
|
||||||
useHotkeys('shift+q', (event, handle) => openDialog('money-out', {}));
|
});
|
||||||
|
useHotkeys('shift+d', () => {
|
||||||
|
openDialog('money-in', {});
|
||||||
|
});
|
||||||
|
useHotkeys('shift+q', () => {
|
||||||
|
openDialog('money-out', {});
|
||||||
|
});
|
||||||
|
useHotkeys('/', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
openGlobalSearch();
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
return <div></div>;
|
return <div></div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(withDashboardActions, withDialogActions)(GlobalHotkeys);
|
export default compose(
|
||||||
|
withDashboardActions,
|
||||||
|
withDialogActions,
|
||||||
|
withUniversalSearchActions,
|
||||||
|
)(GlobalHotkeys);
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ function UniversalSearchBar({ isOpen, onSearchTypeChange, ...listProps }) {
|
|||||||
onSearchTypeChange={onSearchTypeChange}
|
onSearchTypeChange={onSearchTypeChange}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
autoFocus={true}
|
||||||
/>
|
/>
|
||||||
{listProps.itemList}
|
{listProps.itemList}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,11 +11,10 @@ import { compose } from '@/utils';
|
|||||||
import withUniversalSearchActions from './withUniversalSearchActions';
|
import withUniversalSearchActions from './withUniversalSearchActions';
|
||||||
import withUniversalSearch from './withUniversalSearch';
|
import withUniversalSearch from './withUniversalSearch';
|
||||||
|
|
||||||
|
import { useGetUniversalSearchTypeOptions } from './utils';
|
||||||
import DashboardUniversalSearchItemActions from './DashboardUniversalSearchItemActions';
|
import DashboardUniversalSearchItemActions from './DashboardUniversalSearchItemActions';
|
||||||
import { DashboardUniversalSearchItem } from './components';
|
import { DashboardUniversalSearchItem } from './components';
|
||||||
|
|
||||||
import DashboardUniversalSearchHotkeys from './DashboardUniversalSearchHotkeys';
|
import DashboardUniversalSearchHotkeys from './DashboardUniversalSearchHotkeys';
|
||||||
import { useGetUniversalSearchTypeOptions } from './utils';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dashboard universal search.
|
* Dashboard universal search.
|
||||||
|
|||||||
@@ -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