mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat(branches): add branches.
This commit is contained in:
@@ -70,6 +70,7 @@ const CLASSES = {
|
||||
PREFERENCES_PAGE_INSIDE_CONTENT_ACCOUNTANT: 'preferences-page__inside-content--accountant',
|
||||
PREFERENCES_PAGE_INSIDE_CONTENT_SMS_INTEGRATION: 'preferences-page__inside-content--sms-integration',
|
||||
PREFERENCES_PAGE_INSIDE_CONTENT_ROLES_FORM: 'preferences-page__inside-content--roles-form',
|
||||
PREFERENCES_PAGE_INSIDE_CONTENT_BRANCHES: 'preferences-page__inside-content--branches',
|
||||
|
||||
FINANCIAL_REPORT_INSIDER: 'dashboard__insider--financial-report',
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import UnlockingTransactionsDialog from '../containers/Dialogs/UnlockingTransact
|
||||
import UnlockingPartialTransactionsDialog from '../containers/Dialogs/UnlockingPartialTransactionsDialog';
|
||||
import CreditNotePdfPreviewDialog from '../containers/Dialogs/CreditNotePdfPreviewDialog';
|
||||
import PaymentReceivePdfPreviewDialog from '../containers/Dialogs/PaymentReceivePdfPreviewDialog';
|
||||
import BranchFormDialog from '../containers/Dialogs/BranchFormDialog';
|
||||
|
||||
/**
|
||||
* Dialogs container.
|
||||
@@ -78,6 +79,7 @@ export default function DialogsContainer() {
|
||||
/>
|
||||
<CreditNotePdfPreviewDialog dialogName={'credit-note-pdf-preview'} />
|
||||
<PaymentReceivePdfPreviewDialog dialogName={'payment-pdf-preview'} />
|
||||
<BranchFormDialog dialogName={'branch-form'} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { CLASSES } from 'common/classes';
|
||||
import DashboardTopbarUser from 'components/Dashboard/TopbarUser';
|
||||
import UsersActions from 'containers/Preferences/Users/UsersActions';
|
||||
import CurrenciesActions from 'containers/Preferences/Currencies/CurrenciesActions';
|
||||
import BranchesActions from '../../containers/Preferences/Branches/BranchesActions';
|
||||
import withDashboard from 'containers/Dashboard/withDashboard';
|
||||
|
||||
import { compose } from 'utils';
|
||||
@@ -35,6 +36,11 @@ function PreferencesTopbar({ preferencesPageTitle }) {
|
||||
path={'/preferences/currencies'}
|
||||
component={CurrenciesActions}
|
||||
/>
|
||||
<Route
|
||||
exact
|
||||
path={'/preferences/branches'}
|
||||
component={BranchesActions}
|
||||
/>
|
||||
</Switch>
|
||||
</Route>
|
||||
</div>
|
||||
|
||||
@@ -13,9 +13,12 @@ export default [
|
||||
},
|
||||
{
|
||||
text: <T id={'currencies'} />,
|
||||
|
||||
href: '/preferences/currencies',
|
||||
},
|
||||
{
|
||||
text: <T id={'branches.label'} />,
|
||||
href: '/preferences/branches',
|
||||
},
|
||||
{
|
||||
text: <T id={'accountant'} />,
|
||||
disabled: false,
|
||||
|
||||
45
src/containers/Dialogs/BranchFormDialog/BranchForm.js
Normal file
45
src/containers/Dialogs/BranchFormDialog/BranchForm.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import React from 'react';
|
||||
import { Formik } from 'formik';
|
||||
|
||||
import { AppToaster } from 'components';
|
||||
import { CreateBranchFormSchema } from './BranchForm.schema';
|
||||
|
||||
import BranchFormContent from './BranchFormContent';
|
||||
import { useBranchFormContext } from './BranchFormProvider';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
|
||||
const defaultInitialValues = {
|
||||
branch_name: '',
|
||||
branch_address_1: '',
|
||||
branch_address_2: '',
|
||||
phone_number: '',
|
||||
email: '',
|
||||
website: '',
|
||||
branch_address_city: '',
|
||||
branch_address_country: '',
|
||||
};
|
||||
|
||||
function BranchForm({
|
||||
// #withDialogActions
|
||||
closeDialog,
|
||||
}) {
|
||||
// Initial form values.
|
||||
const initialValues = {
|
||||
...defaultInitialValues,
|
||||
};
|
||||
|
||||
// Handles the form submit.
|
||||
const handleFormSubmit = (values, { setSubmitting, setErrors }) => {};
|
||||
|
||||
return (
|
||||
<Formik
|
||||
validationSchema={CreateBranchFormSchema}
|
||||
initialValues={initialValues}
|
||||
onSubmit={handleFormSubmit}
|
||||
component={BranchFormContent}
|
||||
/>
|
||||
);
|
||||
}
|
||||
export default compose(withDialogActions)(BranchForm);
|
||||
15
src/containers/Dialogs/BranchFormDialog/BranchForm.schema.js
Normal file
15
src/containers/Dialogs/BranchFormDialog/BranchForm.schema.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import * as Yup from 'yup';
|
||||
import intl from 'react-intl-universal';
|
||||
|
||||
const Schema = Yup.object().shape({
|
||||
branch_name: Yup.string().required().label(intl.get('branch_name')),
|
||||
branch_address_1: Yup.string().trim(),
|
||||
branch_address_2: Yup.string().trim(),
|
||||
branch_address_city: Yup.string().trim(),
|
||||
branch_address_country: Yup.string().trim(),
|
||||
website: Yup.string().url().nullable(),
|
||||
phone_number: Yup.number(),
|
||||
email: Yup.string().email().nullable(),
|
||||
});
|
||||
|
||||
export const CreateBranchFormSchema = Schema;
|
||||
17
src/containers/Dialogs/BranchFormDialog/BranchFormContent.js
Normal file
17
src/containers/Dialogs/BranchFormDialog/BranchFormContent.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import { Form } from 'formik';
|
||||
|
||||
import BranchFormFields from './BranchFormFields';
|
||||
import BranchFormFloatingActions from './BranchFormFloatingActions';
|
||||
|
||||
/**
|
||||
* Branch form content.
|
||||
*/
|
||||
export default function BranchFormContent() {
|
||||
return (
|
||||
<Form>
|
||||
<BranchFormFields />
|
||||
<BranchFormFloatingActions />
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import React from 'react';
|
||||
|
||||
import '../../../style/pages/Branches/BranchFormDialog.scss';
|
||||
|
||||
import { BranchFormProvider } from './BranchFormProvider';
|
||||
import BranchForm from './BranchForm';
|
||||
|
||||
/**
|
||||
* Branch form dialog content.
|
||||
*/
|
||||
export default function BranchFormDialogContent({
|
||||
// #ownProps
|
||||
dialogName,
|
||||
}) {
|
||||
return (
|
||||
<BranchFormProvider dialogName={dialogName}>
|
||||
<BranchForm />
|
||||
</BranchFormProvider>
|
||||
);
|
||||
}
|
||||
157
src/containers/Dialogs/BranchFormDialog/BranchFormFields.js
Normal file
157
src/containers/Dialogs/BranchFormDialog/BranchFormFields.js
Normal file
@@ -0,0 +1,157 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import { FastField, ErrorMessage, Field } from 'formik';
|
||||
import styled from 'styled-components';
|
||||
import {
|
||||
Classes,
|
||||
FormGroup,
|
||||
InputGroup,
|
||||
ControlGroup,
|
||||
Position,
|
||||
} from '@blueprintjs/core';
|
||||
import { inputIntent } from 'utils';
|
||||
import { FieldRequiredHint, Col, Row, FormattedMessage as T } from 'components';
|
||||
import { useBranchFormContext } from './BranchFormProvider';
|
||||
|
||||
/**
|
||||
* Branch form dialog fields.
|
||||
*/
|
||||
function BranchFormFields() {
|
||||
return (
|
||||
<div className={Classes.DIALOG_BODY}>
|
||||
{/*------------ Branch Name -----------*/}
|
||||
<FastField name={'branch_name'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'branch.dialog.label.branch_name'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
helperText={<ErrorMessage name="branch_name" />}
|
||||
className={'form-group--branch_name'}
|
||||
>
|
||||
<InputGroup intent={inputIntent({ error, touched })} {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
{/*------------ Branch Address 1 -----------*/}
|
||||
<FastField name={'branch_address_1'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={intl.get('branch.dialog.label.branch_address')}
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
helperText={<ErrorMessage name="branch_address_1" />}
|
||||
className={'form-group--branch_address_1'}
|
||||
>
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={intl.get('branch.dialog.label.address_1')}
|
||||
{...field}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
<BranchAddressWrap>
|
||||
{/*------------ Branch Address 2 -----------*/}
|
||||
<FastField name={'branch_address_2'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
helperText={<ErrorMessage name="branch_address_2" />}
|
||||
className={'form-group--branch_address_2'}
|
||||
>
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={intl.get('branch.dialog.label.address_2')}
|
||||
{...field}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
{/*------------ Branch Address City & Country-----------*/}
|
||||
<FormGroup
|
||||
inline={true}
|
||||
className={'form-group--branch_address_city'}
|
||||
helperText={<ErrorMessage name="branch_address_2" />}
|
||||
>
|
||||
<ControlGroup>
|
||||
<FastField name={'branch_address_city'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={intl.get('branch.dialog.label.city')}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
<FastField name={'branch_address_country'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<InputGroup
|
||||
intent={inputIntent({ error, touched })}
|
||||
placeholder={intl.get('branch.dialog.label.country')}
|
||||
{...field}
|
||||
/>
|
||||
)}
|
||||
</FastField>
|
||||
</ControlGroup>
|
||||
</FormGroup>
|
||||
</BranchAddressWrap>
|
||||
|
||||
{/*------------ Phone Number -----------*/}
|
||||
<FastField name={'phone_number'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={intl.get('branch.dialog.label.phone_number')}
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
helperText={<ErrorMessage name="phone_number" />}
|
||||
className={'form-group--phone_number'}
|
||||
>
|
||||
<InputGroup intent={inputIntent({ error, touched })} {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
{/*------------ Email -----------*/}
|
||||
<FastField name={'email'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={intl.get('branch.dialog.label.email')}
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
helperText={<ErrorMessage name="email" />}
|
||||
className={'form-group--email'}
|
||||
>
|
||||
<InputGroup intent={inputIntent({ error, touched })} {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
{/*------------ Website -----------*/}
|
||||
<FastField name={'website'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={intl.get('branch.dialog.label.website')}
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
helperText={<ErrorMessage name="email" />}
|
||||
className={'form-group--website'}
|
||||
>
|
||||
<InputGroup intent={inputIntent({ error, touched })} {...field} />
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default BranchFormFields;
|
||||
|
||||
const BranchAddressWrap = styled.div`
|
||||
margin-left: 160px;
|
||||
`;
|
||||
@@ -0,0 +1,46 @@
|
||||
import React from 'react';
|
||||
|
||||
import { Intent, Button, Classes } from '@blueprintjs/core';
|
||||
import { useFormikContext } from 'formik';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
|
||||
import { useBranchFormContext } from './BranchFormProvider';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
* Branch form floating actions.
|
||||
*/
|
||||
function BranchFormFloatingActions({
|
||||
// #withDialogActions
|
||||
closeDialog,
|
||||
}) {
|
||||
// Formik context.
|
||||
const { isSubmitting } = useFormikContext();
|
||||
|
||||
const { dialogName } = useBranchFormContext();
|
||||
|
||||
// Handle close button click.
|
||||
const handleCancelBtnClick = () => {
|
||||
closeDialog(dialogName);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={Classes.DIALOG_FOOTER}>
|
||||
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
||||
<Button onClick={handleCancelBtnClick} style={{ minWidth: '85px' }}>
|
||||
<T id={'cancel'} />
|
||||
</Button>
|
||||
<Button
|
||||
intent={Intent.PRIMARY}
|
||||
loading={isSubmitting}
|
||||
style={{ minWidth: '95px' }}
|
||||
type="submit"
|
||||
>
|
||||
{<T id={'save'} />}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default compose(withDialogActions)(BranchFormFloatingActions);
|
||||
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { DialogContent } from 'components';
|
||||
// import {} from 'hooks/query';
|
||||
|
||||
const BranchFormContext = React.createContext();
|
||||
|
||||
/**
|
||||
* Branch form dialog provider.
|
||||
*/
|
||||
function BranchFormProvider({ dialogName, ...props }) {
|
||||
// State provider.
|
||||
const provider = {
|
||||
dialogName,
|
||||
};
|
||||
return (
|
||||
<DialogContent
|
||||
// isLoading={}
|
||||
>
|
||||
<BranchFormContext.Provider value={provider} {...props} />
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
const useBranchFormContext = () => React.useContext(BranchFormContext);
|
||||
|
||||
export { BranchFormProvider, useBranchFormContext };
|
||||
31
src/containers/Dialogs/BranchFormDialog/index.js
Normal file
31
src/containers/Dialogs/BranchFormDialog/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import React from 'react';
|
||||
import { FormattedMessage as T } from 'components';
|
||||
import { Dialog, DialogSuspense } from 'components';
|
||||
import withDialogRedux from 'components/DialogReduxConnect';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
const BranchFormDialogContent = React.lazy(() =>
|
||||
import('./BranchFormDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Branch form form dialog.
|
||||
*/
|
||||
function BranchFormDialog({ dialogName, payload = {}, isOpen }) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
title={<T id={'branch.dialog.label'} />}
|
||||
isOpen={isOpen}
|
||||
canEscapeJeyClose={true}
|
||||
autoFocus={true}
|
||||
className={'dialog--branch-form'}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<BranchFormDialogContent dialogName={dialogName} />
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
export default compose(withDialogRedux())(BranchFormDialog);
|
||||
21
src/containers/Preferences/Branches/Branches.js
Normal file
21
src/containers/Preferences/Branches/Branches.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import classNames from 'classnames';
|
||||
import { CLASSES } from 'common/classes';
|
||||
|
||||
import BranchesDataTable from './BranchesDataTable';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
|
||||
import { compose } from 'utils';
|
||||
|
||||
function Branches({
|
||||
// #withDashboardActions
|
||||
changePreferencesPageTitle,
|
||||
}) {
|
||||
React.useEffect(() => {
|
||||
changePreferencesPageTitle(intl.get('branches.label'));
|
||||
}, [changePreferencesPageTitle]);
|
||||
|
||||
return <BranchesDataTable />;
|
||||
}
|
||||
export default compose(withDashboardActions)(Branches);
|
||||
29
src/containers/Preferences/Branches/BranchesActions.js
Normal file
29
src/containers/Preferences/Branches/BranchesActions.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import { Button, Intent } from '@blueprintjs/core';
|
||||
|
||||
import { FormattedMessage as T, Icon } from 'components';
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
|
||||
function BranchesActions({
|
||||
//#ownProps
|
||||
openDialog,
|
||||
}) {
|
||||
const handleClickNewBranche = () => {
|
||||
openDialog('branch-form');
|
||||
};
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Button
|
||||
icon={<Icon icon="plus" iconSize={12} />}
|
||||
onClick={handleClickNewBranche}
|
||||
intent={Intent.PRIMARY}
|
||||
>
|
||||
<T id={'branches.label.new_branche'} />
|
||||
</Button>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogActions)(BranchesActions);
|
||||
36
src/containers/Preferences/Branches/BranchesDataTable.js
Normal file
36
src/containers/Preferences/Branches/BranchesDataTable.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { DataTable } from 'components';
|
||||
import TableSkeletonRows from 'components/Datatable/TableSkeletonRows';
|
||||
import { useBranchesTableColumns, ActionsMenu } from './components';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
|
||||
/**
|
||||
* Branches data table.
|
||||
*/
|
||||
function BranchesDataTable({
|
||||
// #withDialogAction
|
||||
openDialog,
|
||||
}) {
|
||||
// Table columns.
|
||||
const columns = useBranchesTableColumns();
|
||||
|
||||
return (
|
||||
<BranchesTable
|
||||
columns={columns}
|
||||
data={[]}
|
||||
// loading={}
|
||||
// progressBarLoading={}
|
||||
TableLoadingRenderer={TableSkeletonRows}
|
||||
ContextMenu={ActionsMenu}
|
||||
payload={{}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogActions)(BranchesDataTable);
|
||||
|
||||
const BranchesTable = styled(DataTable)``;
|
||||
35
src/containers/Preferences/Branches/BranchesProvider.js
Normal file
35
src/containers/Preferences/Branches/BranchesProvider.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import classNames from 'classnames';
|
||||
import { CLASSES } from 'common/classes';
|
||||
import { Card } from 'components';
|
||||
|
||||
const BranchesContext = React.createContext();
|
||||
|
||||
/**
|
||||
* Branches data provider.
|
||||
*/
|
||||
function BranchesProvider({ ...props }) {
|
||||
// Provider state.
|
||||
const provider = {};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT,
|
||||
CLASSES.PREFERENCES_PAGE_INSIDE_CONTENT_BRANCHES,
|
||||
)}
|
||||
>
|
||||
<BrachesPreferencesCard>
|
||||
<BranchesContext.Provider value={provider} {...props} />
|
||||
</BrachesPreferencesCard>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const useBranchesContext = () => React.useContext(BranchesContext);
|
||||
export { BranchesProvider, useBranchesContext };
|
||||
|
||||
const BrachesPreferencesCard = styled(Card)`
|
||||
padding: 0;
|
||||
`;
|
||||
76
src/containers/Preferences/Branches/components.js
Normal file
76
src/containers/Preferences/Branches/components.js
Normal file
@@ -0,0 +1,76 @@
|
||||
import React from 'react';
|
||||
import intl from 'react-intl-universal';
|
||||
import {
|
||||
Intent,
|
||||
Button,
|
||||
Popover,
|
||||
Menu,
|
||||
MenuDivider,
|
||||
Tag,
|
||||
MenuItem,
|
||||
Position,
|
||||
} from '@blueprintjs/core';
|
||||
|
||||
import { safeCallback } from 'utils';
|
||||
import { Icon } from 'components';
|
||||
|
||||
/**
|
||||
* Context menu of Branches.
|
||||
*/
|
||||
export function ActionsMenu({
|
||||
payload: { onEdit, onDelete },
|
||||
row: { original },
|
||||
}) {
|
||||
return (
|
||||
<Menu>
|
||||
<MenuItem
|
||||
icon={<Icon icon="pen-18" />}
|
||||
text={intl.get('branches.action.edit_branch')}
|
||||
onClick={safeCallback(onEdit, original)}
|
||||
/>
|
||||
<MenuDivider />
|
||||
<MenuItem
|
||||
icon={<Icon icon="trash-16" iconSize={16} />}
|
||||
text={intl.get('branches.action.delete_branch')}
|
||||
onClick={safeCallback(onDelete, original)}
|
||||
intent={Intent.DANGER}
|
||||
/>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve branches table columns
|
||||
* @returns
|
||||
*/
|
||||
export function useBranchesTableColumns() {
|
||||
return React.useMemo(
|
||||
() => [
|
||||
{
|
||||
id: 'branch_name',
|
||||
Header: intl.get('branches.column.branch_name'),
|
||||
accessor: 'branch_name',
|
||||
className: 'branch_name',
|
||||
width: '120',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('branches.column.address'),
|
||||
accessor: 'address',
|
||||
className: 'address',
|
||||
width: '180',
|
||||
disableSortBy: true,
|
||||
textOverview: true,
|
||||
},
|
||||
{
|
||||
Header: intl.get('branches.column.phone_number'),
|
||||
accessor: 'phone_number',
|
||||
className: 'phone_number',
|
||||
width: '120',
|
||||
disableSortBy: true,
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
}
|
||||
15
src/containers/Preferences/Branches/index.js
Normal file
15
src/containers/Preferences/Branches/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
|
||||
import { BranchesProvider } from './BranchesProvider';
|
||||
import Branches from './Branches';
|
||||
|
||||
/**
|
||||
* Branches .
|
||||
*/
|
||||
export default function BranchesPreferences() {
|
||||
return (
|
||||
<BranchesProvider>
|
||||
<Branches />
|
||||
</BranchesProvider>
|
||||
);
|
||||
}
|
||||
@@ -1738,19 +1738,32 @@
|
||||
"global_error.you_dont_have_permissions": "You do not have permissions to access this page.",
|
||||
"global_error.transactions_locked": "Transactions before {lockedToDate} has been locked. Hence action cannot be performed.",
|
||||
"global_error.authorized_user_inactive": "The authorized user is inactive.",
|
||||
|
||||
"the_vendor_has_been_inactivated_successfully": "The contact has been inactivated successfully.",
|
||||
|
||||
"vendor.alert.activated_message": "The vendor has been activated successfully.",
|
||||
"vendor.alert.are_you_sure_want_to_inactivate_this_vendor":"Are you sure want to inactivate this vendor? You will to able to activate it later.",
|
||||
"vendor.alert.are_you_sure_want_to_inactivate_this_vendor": "Are you sure want to inactivate this vendor? You will to able to activate it later.",
|
||||
"vendor.alert.inactivated_message": "The vendor has been inactivated successfully.",
|
||||
"vendor.alert.are_you_sure_want_to_activate_this_vendor": "Are you sure want to activate this vendor? You will to able to inactivate it later.",
|
||||
|
||||
"customer.alert.activated_message":"The customer has been activated successfully.",
|
||||
"customer.alert.activated_message": "The customer has been activated successfully.",
|
||||
"customer.alert.are_you_sure_want_to_activate_this_customer": "Are you sure want to activate this customer? You will to able to inactivate it later.",
|
||||
"customer.alert.inactivated_message": "The customer has been inactivated successfully.",
|
||||
"customer.alert.are_you_sure_want_to_inactivate_this_customer":"Are you sure want to inactivate this customer? You will to able to activate it later.",
|
||||
|
||||
"credit_note_preview.dialog.title":"Credit Note PDF Preview",
|
||||
"payment_receive_preview.dialog.title":"Payment Receive PDF Preview"
|
||||
"customer.alert.are_you_sure_want_to_inactivate_this_customer": "Are you sure want to inactivate this customer? You will to able to activate it later.",
|
||||
"credit_note_preview.dialog.title": "Credit Note PDF Preview",
|
||||
"payment_receive_preview.dialog.title": "Payment Receive PDF Preview",
|
||||
"branches.label": "Branches",
|
||||
"branches.label.new_branche": "New Branch",
|
||||
"branches.action.edit_branch": "Edit Branch",
|
||||
"branches.action.delete_branch": "Edit Branch",
|
||||
"branches.column.branch_name": "Branch name",
|
||||
"branches.column.address": "Address",
|
||||
"branches.column.phone_number": "Phone number",
|
||||
"branch.dialog.label": "New Branch",
|
||||
"branch.dialog.label.branch_name": "Branch Name",
|
||||
"branch.dialog.label.branch_address": "Branch Address",
|
||||
"branch.dialog.label.address_1": "Address 1",
|
||||
"branch.dialog.label.address_2": "Address 2",
|
||||
"branch.dialog.label.city": "City",
|
||||
"branch.dialog.label.country": "Country",
|
||||
"branch.dialog.label.phone_number": "Phone Number",
|
||||
"branch.dialog.label.email": "Email",
|
||||
"branch.dialog.label.website": "Website"
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import Currencies from 'containers/Preferences/Currencies/Currencies';
|
||||
import Item from 'containers/Preferences/Item';
|
||||
import SMSIntegration from '../containers/Preferences/SMSIntegration';
|
||||
import DefaultRoute from '../containers/Preferences/DefaultRoute';
|
||||
import Branches from '../containers/Preferences/Branches'
|
||||
|
||||
const BASE_URL = '/preferences';
|
||||
|
||||
@@ -36,6 +37,11 @@ export default [
|
||||
component: Currencies,
|
||||
exact: true,
|
||||
},
|
||||
{
|
||||
path: `${BASE_URL}/branches`,
|
||||
component: Branches,
|
||||
exact: true,
|
||||
},
|
||||
{
|
||||
path: `${BASE_URL}/accountant`,
|
||||
component: Accountant,
|
||||
|
||||
39
src/style/pages/Branches/BranchFormDialog.scss
Normal file
39
src/style/pages/Branches/BranchFormDialog.scss
Normal file
@@ -0,0 +1,39 @@
|
||||
.dialog--branch-form {
|
||||
width: 600px;
|
||||
|
||||
.bp3-dialog-body {
|
||||
.bp3-form-group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.bp3-form-group.bp3-inline {
|
||||
.bp3-label {
|
||||
font-size: 13px;
|
||||
margin-bottom: 3px;
|
||||
min-width: 150px;
|
||||
}
|
||||
.bp3-form-content {
|
||||
width: 320px;
|
||||
}
|
||||
}
|
||||
.form-group {
|
||||
&--branch_address_city {
|
||||
.bp3-control-group > * {
|
||||
flex-shrink: unset;
|
||||
padding-right: 5px;
|
||||
padding-left: 5px;
|
||||
|
||||
&:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bp3-dialog-footer {
|
||||
padding-top: 10px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user