mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
feat: more resources support importing
This commit is contained in:
25
packages/webapp/src/containers/Expenses/ExpensesImport.tsx
Normal file
25
packages/webapp/src/containers/Expenses/ExpensesImport.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
// @ts-nocheck
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { DashboardInsider } from '@/components';
|
||||
import { ImportView } from '../Import/ImportView';
|
||||
|
||||
export default function ExpensesImport() {
|
||||
const history = useHistory();
|
||||
|
||||
const handleCancelBtnClick = () => {
|
||||
history.push('/expenses');
|
||||
};
|
||||
const handleImportSuccess = () => {
|
||||
history.push('/expenses');
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider name={'import-expenses'}>
|
||||
<ImportView
|
||||
resource={'expenses'}
|
||||
onCancelClick={handleCancelBtnClick}
|
||||
onImportSuccess={handleImportSuccess}
|
||||
/>
|
||||
</DashboardInsider>
|
||||
);
|
||||
}
|
||||
@@ -79,6 +79,11 @@ function ExpensesActionsBar({
|
||||
refresh();
|
||||
};
|
||||
|
||||
// Handle the import button click.
|
||||
const handleImportBtnClick = () => {
|
||||
history.push('/expenses/import');
|
||||
}
|
||||
|
||||
// Handle table row size change.
|
||||
const handleTableRowSizeChange = (size) => {
|
||||
addSetting('expenses', 'tableSize', size);
|
||||
@@ -135,6 +140,7 @@ function ExpensesActionsBar({
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon="file-import-16" iconSize={16} />}
|
||||
text={<T id={'import'} />}
|
||||
onClick={handleImportBtnClick}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// @ts-nocheck
|
||||
import { useMemo } from 'react';
|
||||
import { chain, isEmpty, lowerCase, head, last, set } from 'lodash';
|
||||
import { chain, isEmpty, lowerCase, head, last, set, get } from 'lodash';
|
||||
import { useImportFileContext } from './ImportFileProvider';
|
||||
import { useImportFileMapBootContext } from './ImportFileMappingBoot';
|
||||
import { deepdash, transformToForm } from '@/utils';
|
||||
@@ -21,7 +22,7 @@ export const transformValueToReq = (
|
||||
): { mapping: ImportFileMappingRes[] } => {
|
||||
const mapping = chain(value)
|
||||
.thru(deepdash.index)
|
||||
.pickBy((_value, key) => !isEmpty(_.get(value, key)))
|
||||
.pickBy((_value, key) => !isEmpty(get(value, key)))
|
||||
.map((from, key) => ({
|
||||
from,
|
||||
to: key.includes('.') ? last(key.split('.')) : key,
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// @ts-nocheck
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { DashboardInsider } from '@/components';
|
||||
import { ImportView } from '@/containers/Import';
|
||||
|
||||
export default function PaymentMadesImport() {
|
||||
const history = useHistory();
|
||||
|
||||
const handleCancelBtnClick = () => {
|
||||
history.push('/payment-mades');
|
||||
};
|
||||
const handleImportSuccess = () => {
|
||||
history.push('/payment-mades');
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider name={'import-payment-mades'}>
|
||||
<ImportView
|
||||
resource={'bill_payment'}
|
||||
onCancelClick={handleCancelBtnClick}
|
||||
onImportSuccess={handleImportSuccess}
|
||||
/>
|
||||
</DashboardInsider>
|
||||
);
|
||||
}
|
||||
@@ -78,6 +78,11 @@ function PaymentMadeActionsBar({
|
||||
addSetting('billPayments', 'tableSize', size);
|
||||
};
|
||||
|
||||
// Handle the import button click.
|
||||
const handleImportBtnClick = () => {
|
||||
history.push('/payment-mades/import');
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -128,6 +133,7 @@ function PaymentMadeActionsBar({
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'file-import-16'} />}
|
||||
text={<T id={'import'} />}
|
||||
onClick={handleImportBtnClick}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// @ts-nocheck
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { DashboardInsider } from '@/components';
|
||||
import { ImportView } from '@/containers/Import';
|
||||
|
||||
export default function EstimatesImport() {
|
||||
const history = useHistory();
|
||||
|
||||
const handleCancelBtnClick = () => {
|
||||
history.push('/estimates');
|
||||
};
|
||||
const handleImportSuccess = () => {
|
||||
history.push('/estimates');
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider name={'import-accounts'}>
|
||||
<ImportView
|
||||
resource={'sale_estimate'}
|
||||
onCancelClick={handleCancelBtnClick}
|
||||
onImportSuccess={handleImportSuccess}
|
||||
/>
|
||||
</DashboardInsider>
|
||||
);
|
||||
}
|
||||
@@ -77,6 +77,11 @@ function EstimateActionsBar({
|
||||
addSetting('salesEstimates', 'tableSize', size);
|
||||
};
|
||||
|
||||
// Handle the import button click.
|
||||
const handleImportBtnClick = () => {
|
||||
history.push('/estimates/import');
|
||||
}
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -130,6 +135,7 @@ function EstimateActionsBar({
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'file-import-16'} />}
|
||||
text={<T id={'import'} />}
|
||||
onClick={handleImportBtnClick}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// @ts-nocheck
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { DashboardInsider } from '@/components';
|
||||
import { ImportView } from '@/containers/Import';
|
||||
|
||||
export default function InvoicesImport() {
|
||||
const history = useHistory();
|
||||
|
||||
const handleCancelBtnClick = () => {
|
||||
history.push('/invoices');
|
||||
};
|
||||
const handleImportSuccess = () => {
|
||||
history.push('/invoices');
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardInsider name={'import-invoices'}>
|
||||
<ImportView
|
||||
resource={'sale_invoice'}
|
||||
onCancelClick={handleCancelBtnClick}
|
||||
onImportSuccess={handleImportSuccess}
|
||||
/>
|
||||
</DashboardInsider>
|
||||
);
|
||||
}
|
||||
@@ -74,6 +74,11 @@ function InvoiceActionsBar({
|
||||
addSetting('salesInvoices', 'tableSize', size);
|
||||
};
|
||||
|
||||
// Handle the import button click.
|
||||
const handleImportBtnClick = () => {
|
||||
history.push('/invoices/import');
|
||||
};
|
||||
|
||||
return (
|
||||
<DashboardActionsBar>
|
||||
<NavbarGroup>
|
||||
@@ -124,6 +129,7 @@ function InvoiceActionsBar({
|
||||
className={Classes.MINIMAL}
|
||||
icon={<Icon icon={'file-import-16'} />}
|
||||
text={<T id={'import'} />}
|
||||
onClick={handleImportBtnClick}
|
||||
/>
|
||||
<Button
|
||||
className={Classes.MINIMAL}
|
||||
|
||||
Reference in New Issue
Block a user