mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2baa667c5d | ||
|
|
00e6c141ee | ||
|
|
0aea339c1c |
@@ -136,6 +136,11 @@ export default {
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
inventory: {
|
||||
cost_compute_running: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
accounts: {
|
||||
account_code_required: {
|
||||
type: 'boolean',
|
||||
|
||||
@@ -5,12 +5,16 @@ import { useHistory } from 'react-router-dom';
|
||||
import { getDashboardRoutes } from '@/routes/dashboard';
|
||||
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import withUniversalSearchActions from '@/containers/UniversalSearch/withUniversalSearchActions';
|
||||
|
||||
import { compose } from '@/utils';
|
||||
|
||||
function GlobalHotkeys({
|
||||
// #withDashboardActions
|
||||
toggleSidebarExpend,
|
||||
toggleSidebarExpand,
|
||||
|
||||
// withUniversalSearchActions
|
||||
openGlobalSearch,
|
||||
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
@@ -24,7 +28,7 @@ function GlobalHotkeys({
|
||||
.toString();
|
||||
|
||||
const handleSidebarToggleBtn = () => {
|
||||
toggleSidebarExpend();
|
||||
toggleSidebarExpand();
|
||||
};
|
||||
useHotkeys(
|
||||
globalHotkeys,
|
||||
@@ -37,10 +41,26 @@ function GlobalHotkeys({
|
||||
},
|
||||
[history],
|
||||
);
|
||||
useHotkeys('ctrl+/', (event, handle) => handleSidebarToggleBtn());
|
||||
useHotkeys('shift+d', (event, handle) => openDialog('money-in', {}));
|
||||
useHotkeys('shift+q', (event, handle) => openDialog('money-out', {}));
|
||||
useHotkeys('ctrl+/', () => {
|
||||
handleSidebarToggleBtn();
|
||||
});
|
||||
useHotkeys('shift+d', () => {
|
||||
openDialog('money-in', {});
|
||||
});
|
||||
useHotkeys('shift+q', () => {
|
||||
openDialog('money-out', {});
|
||||
});
|
||||
useHotkeys('/', () => {
|
||||
setTimeout(() => {
|
||||
openGlobalSearch();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
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}
|
||||
/>
|
||||
}
|
||||
autoFocus={true}
|
||||
/>
|
||||
{listProps.itemList}
|
||||
</div>
|
||||
|
||||
@@ -11,11 +11,10 @@ import { compose } from '@/utils';
|
||||
import withUniversalSearchActions from './withUniversalSearchActions';
|
||||
import withUniversalSearch from './withUniversalSearch';
|
||||
|
||||
import { useGetUniversalSearchTypeOptions } from './utils';
|
||||
import DashboardUniversalSearchItemActions from './DashboardUniversalSearchItemActions';
|
||||
import { DashboardUniversalSearchItem } from './components';
|
||||
|
||||
import DashboardUniversalSearchHotkeys from './DashboardUniversalSearchHotkeys';
|
||||
import { useGetUniversalSearchTypeOptions } from './utils';
|
||||
|
||||
/**
|
||||
* Dashboard universal search.
|
||||
|
||||
@@ -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