mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
feat: style the export dialog form
This commit is contained in:
@@ -121,7 +121,7 @@ function AccountsActionsBar({
|
|||||||
// Handle the export button click.
|
// Handle the export button click.
|
||||||
const handleExportBtnClick = () => {
|
const handleExportBtnClick = () => {
|
||||||
openDialog(DialogsName.Export, { resource: 'account' });
|
openDialog(DialogsName.Export, { resource: 'account' });
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DashboardActionsBar>
|
<DashboardActionsBar>
|
||||||
@@ -186,18 +186,18 @@ function AccountsActionsBar({
|
|||||||
icon={<Icon icon="print-16" iconSize={16} />}
|
icon={<Icon icon="print-16" iconSize={16} />}
|
||||||
text={<T id={'print'} />}
|
text={<T id={'print'} />}
|
||||||
/>
|
/>
|
||||||
<Button
|
|
||||||
className={Classes.MINIMAL}
|
|
||||||
icon={<Icon icon="file-export-16" iconSize={16} />}
|
|
||||||
text={<T id={'export'} />}
|
|
||||||
onClick={handleExportBtnClick}
|
|
||||||
/>
|
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon="file-import-16" iconSize={16} />}
|
icon={<Icon icon="file-import-16" iconSize={16} />}
|
||||||
text={<T id={'import'} />}
|
text={<T id={'import'} />}
|
||||||
onClick={handleImportBtnClick}
|
onClick={handleImportBtnClick}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
className={Classes.MINIMAL}
|
||||||
|
icon={<Icon icon="file-export-16" iconSize={16} />}
|
||||||
|
text={<T id={'export'} />}
|
||||||
|
onClick={handleExportBtnClick}
|
||||||
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
<DashboardRowsHeightButton
|
<DashboardRowsHeightButton
|
||||||
initialValue={accountsTableSize}
|
initialValue={accountsTableSize}
|
||||||
|
|||||||
@@ -92,13 +92,13 @@ function CashFlowAccountsActionsBar({
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon="file-export-16" iconSize={16} />}
|
icon={<Icon icon="file-import-16" iconSize={16} />}
|
||||||
text={<T id={'export'} />}
|
text={<T id={'import'} />}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
icon={<Icon icon="file-import-16" iconSize={16} />}
|
icon={<Icon icon="file-export-16" iconSize={16} />}
|
||||||
text={<T id={'import'} />}
|
text={<T id={'export'} />}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
<Can I={CashflowAction.Edit} a={AbilitySubject.Cashflow}>
|
<Can I={CashflowAction.Edit} a={AbilitySubject.Cashflow}>
|
||||||
@@ -117,7 +117,7 @@ function CashFlowAccountsActionsBar({
|
|||||||
text={'Connect to Bank / Credit Card'}
|
text={'Connect to Bank / Credit Card'}
|
||||||
onClick={handleConnectToBank}
|
onClick={handleConnectToBank}
|
||||||
/>
|
/>
|
||||||
<NavbarDivider />
|
<NavbarDivider />
|
||||||
</FeatureCan>
|
</FeatureCan>
|
||||||
<Button
|
<Button
|
||||||
className={Classes.MINIMAL}
|
className={Classes.MINIMAL}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
.root{
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer{
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.resourceFormGroup{
|
||||||
|
max-width: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paragraph{
|
||||||
|
color: #5F6B7C;
|
||||||
|
margin-bottom: 1.2rem;
|
||||||
|
}
|
||||||
@@ -1,13 +1,16 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { Formik } from 'formik';
|
import { Formik } from 'formik';
|
||||||
|
|
||||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
|
||||||
import { compose, transformToForm } from '@/utils';
|
import { compose, transformToForm } from '@/utils';
|
||||||
|
|
||||||
import { ExportDialogFormSchema } from './ExportDialogForm.schema';
|
import { ExportDialogFormSchema } from './ExportDialogForm.schema';
|
||||||
import { ExportDialogFormContent } from './ExportDialogFormContent';
|
import { ExportDialogFormContent } from './ExportDialogFormContent';
|
||||||
import { useResourceExport } from '@/hooks/query/FinancialReports/use-export';
|
import { useResourceExport } from '@/hooks/query/FinancialReports/use-export';
|
||||||
import { ExportFormInitialValues } from './type';
|
import { ExportFormInitialValues } from './type';
|
||||||
|
import { AppToaster } from '@/components';
|
||||||
|
import { Intent } from '@blueprintjs/core';
|
||||||
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
// Default initial form values.
|
// Default initial form values.
|
||||||
const defaultInitialValues = {
|
const defaultInitialValues = {
|
||||||
@@ -39,9 +42,14 @@ function ExportDialogFormRoot({
|
|||||||
mutateExport({ resource, format })
|
mutateExport({ resource, format })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
closeDialog(DialogsName.Export);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
AppToaster.show({
|
||||||
|
intent: Intent.DANGER,
|
||||||
|
message: 'Something went wrong!',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,63 @@
|
|||||||
import { FFormGroup, FRadioGroup, FSelect } from '@/components';
|
// @ts-nocheck
|
||||||
import { Button, Callout, Intent, Radio } from '@blueprintjs/core';
|
import { FFormGroup, FRadioGroup, FSelect, Group } from '@/components';
|
||||||
import { Form } from 'formik';
|
import { Button, Intent, Radio } from '@blueprintjs/core';
|
||||||
|
import { Form, useFormikContext } from 'formik';
|
||||||
import { ExportResources } from './constants';
|
import { ExportResources } from './constants';
|
||||||
|
import styles from './ExportDialogContent.module.scss';
|
||||||
|
import { compose } from '@/utils';
|
||||||
|
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||||
|
import { DialogsName } from '@/constants/dialogs';
|
||||||
|
|
||||||
|
function ExportDialogFormContentRoot({
|
||||||
|
// #withDialogActions
|
||||||
|
closeDialog,
|
||||||
|
}) {
|
||||||
|
const { isSubmitting } = useFormikContext();
|
||||||
|
const handleCancelBtnClick = () => {
|
||||||
|
closeDialog(DialogsName.Export);
|
||||||
|
};
|
||||||
|
|
||||||
export function ExportDialogFormContent() {
|
|
||||||
return (
|
return (
|
||||||
<Form>
|
<Form>
|
||||||
<Callout>
|
<div className={styles.root}>
|
||||||
You can export data from Bigcapital in CSV or XLSX format
|
<p className={styles.paragraph}>
|
||||||
</Callout>
|
You can export data from Bigcapital in CSV or XLSX format
|
||||||
|
</p>
|
||||||
|
|
||||||
<FFormGroup name={'resource'} label={'Select Resource'}>
|
<FFormGroup
|
||||||
<FSelect name={'resource'} items={ExportResources} />
|
name={'resource'}
|
||||||
</FFormGroup>
|
label={'Select Resource'}
|
||||||
|
className={styles.resourceFormGroup}
|
||||||
|
>
|
||||||
|
<FSelect
|
||||||
|
name={'resource'}
|
||||||
|
items={ExportResources}
|
||||||
|
popoverProps={{ minimal: true }}
|
||||||
|
/>
|
||||||
|
</FFormGroup>
|
||||||
|
|
||||||
<FRadioGroup label={'Export As'} name={'format'}>
|
<FRadioGroup label={'Export As'} name={'format'}>
|
||||||
<Radio value={'xlsx'}>XLSX (Microsoft Excel)</Radio>
|
<Radio value={'xlsx'}>XLSX (Microsoft Excel)</Radio>
|
||||||
<Radio value={'csv'}>CSV (Comma Seperated Value)</Radio>
|
<Radio value={'csv'}>CSV (Comma Seperated Value)</Radio>
|
||||||
</FRadioGroup>
|
</FRadioGroup>
|
||||||
|
|
||||||
<div>
|
<Group position={'right'} spacing={10} className={styles.footer}>
|
||||||
<Button type={'submit'} intent={Intent.PRIMARY}>
|
<Button intent={Intent.NONE} onClick={handleCancelBtnClick}>
|
||||||
Export
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button
|
||||||
|
type={'submit'}
|
||||||
|
intent={Intent.PRIMARY}
|
||||||
|
loading={isSubmitting}
|
||||||
|
>
|
||||||
|
Export
|
||||||
|
</Button>
|
||||||
|
</Group>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const ExportDialogFormContent = compose(withDialogActions)(
|
||||||
|
ExportDialogFormContentRoot,
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user