mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 16:19:49 +00:00
fix hot bugs.
This commit is contained in:
@@ -2,14 +2,14 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { IntlProvider } from 'react-intl';
|
import { IntlProvider } from 'react-intl';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { Router } from 'react-router';
|
import { Router, Switch } from 'react-router';
|
||||||
|
import { createBrowserHistory } from 'history';
|
||||||
import PrivateRoute from 'components/PrivateRoute';
|
import PrivateRoute from 'components/PrivateRoute';
|
||||||
import Authentication from 'components/Authentication';
|
import Authentication from 'components/Authentication';
|
||||||
import Dashboard from 'components/Dashboard/Dashboard';
|
import Dashboard from 'components/Dashboard/Dashboard';
|
||||||
import { isAuthenticated } from 'store/authentication/authentication.reducer'
|
import { isAuthenticated } from 'store/authentication/authentication.reducer'
|
||||||
import messages from 'lang/en';
|
import messages from 'lang/en';
|
||||||
import 'style/App.scss';
|
import 'style/App.scss';
|
||||||
import { createBrowserHistory } from 'history';
|
|
||||||
|
|
||||||
function App(props) {
|
function App(props) {
|
||||||
const history = createBrowserHistory();
|
const history = createBrowserHistory();
|
||||||
|
|||||||
@@ -1,12 +1,27 @@
|
|||||||
import React from 'react';
|
import React, { useMemo, useCallback } from 'react';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
import {Menu, MenuItem, MenuDivider, Button, Popover} from '@blueprintjs/core';
|
import {useHistory} from 'react-router-dom';
|
||||||
|
import {
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
MenuDivider,
|
||||||
|
Button,
|
||||||
|
Popover
|
||||||
|
} from '@blueprintjs/core';
|
||||||
import t from 'store/types';
|
import t from 'store/types';
|
||||||
|
|
||||||
function DashboardTopbarUser({ logout }) {
|
function DashboardTopbarUser({ logout }) {
|
||||||
const onClickLogout = () => { logout(); };
|
const history = useHistory();
|
||||||
|
|
||||||
const userAvatarDropMenu = (
|
const onClickLogout = useCallback(() => {
|
||||||
|
logout();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
history.push('/auth/login');
|
||||||
|
}, 100);
|
||||||
|
}, [history, logout]);
|
||||||
|
|
||||||
|
const userAvatarDropMenu = useMemo(() => (
|
||||||
<Menu>
|
<Menu>
|
||||||
<MenuItem icon="graph" text="Graph" />
|
<MenuItem icon="graph" text="Graph" />
|
||||||
<MenuItem icon="map" text="Map" />
|
<MenuItem icon="map" text="Map" />
|
||||||
@@ -15,7 +30,7 @@ function DashboardTopbarUser({ logout }) {
|
|||||||
<MenuDivider />
|
<MenuDivider />
|
||||||
<MenuItem icon="cog" text="Logout" onClick={onClickLogout} />
|
<MenuItem icon="cog" text="Logout" onClick={onClickLogout} />
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
), [onClickLogout]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover content={userAvatarDropMenu}>
|
<Popover content={userAvatarDropMenu}>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ function PrivateRoute({
|
|||||||
return (
|
return (
|
||||||
<Route
|
<Route
|
||||||
{...rest}
|
{...rest}
|
||||||
|
path="/dashboard"
|
||||||
render={_props =>
|
render={_props =>
|
||||||
isAuthenticated ? (<Component {..._props} />) :
|
isAuthenticated ? (<Component {..._props} />) :
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -23,30 +23,18 @@ function Invite({ requestSubmitInvite }) {
|
|||||||
|
|
||||||
const phoneRegExp = /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;
|
const phoneRegExp = /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;
|
||||||
|
|
||||||
const language = useMemo(
|
const language = useMemo(() => [
|
||||||
() => [
|
|
||||||
{ value: null, label: 'Select Country' },
|
{ value: null, label: 'Select Country' },
|
||||||
{ value: 'Arabic', label: 'Arabic' },
|
{ value: 'Arabic', label: 'Arabic' },
|
||||||
{ value: 'English', label: 'English' },
|
{ value: 'English', label: 'English' },
|
||||||
],
|
], []);
|
||||||
[]
|
|
||||||
);
|
|
||||||
const ValidationSchema = Yup.object().shape({
|
const ValidationSchema = Yup.object().shape({
|
||||||
first_name: Yup.string().required(intl.formatMessage({ id: 'required' })),
|
first_name: Yup.string().required(),
|
||||||
|
last_name: Yup.string().required(),
|
||||||
last_name: Yup.string().required(intl.formatMessage({ id: 'required' })),
|
email: Yup.string().email().required(),
|
||||||
|
phone_number: Yup.string().matches(phoneRegExp).required(),
|
||||||
email: Yup.string()
|
language: Yup.string().required(),
|
||||||
.email()
|
|
||||||
.required(intl.formatMessage({ id: 'required' })),
|
|
||||||
phone_number: Yup.string()
|
|
||||||
.matches(phoneRegExp)
|
|
||||||
.required(intl.formatMessage({ id: 'required' })),
|
|
||||||
language: Yup.string().required(
|
|
||||||
intl.formatMessage({
|
|
||||||
id: 'required',
|
|
||||||
})
|
|
||||||
),
|
|
||||||
password: Yup.string()
|
password: Yup.string()
|
||||||
.min(4, 'Password has to be longer than 4 characters!')
|
.min(4, 'Password has to be longer than 4 characters!')
|
||||||
.required('Password is required!'),
|
.required('Password is required!'),
|
||||||
@@ -63,15 +51,20 @@ function Invite({ requestSubmitInvite }) {
|
|||||||
}),
|
}),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
const formik = useFormik({
|
const {
|
||||||
|
handleSubmit,
|
||||||
|
errors,
|
||||||
|
values,
|
||||||
|
touched,
|
||||||
|
getFieldProps,
|
||||||
|
} = useFormik({
|
||||||
enableReinitialize: true,
|
enableReinitialize: true,
|
||||||
validationSchema: ValidationSchema,
|
validationSchema: ValidationSchema,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
...initialValues,
|
...initialValues,
|
||||||
},
|
},
|
||||||
onSubmit: (values, { setSubmitting }) => {
|
onSubmit: (values, { setSubmitting }) => {
|
||||||
requestSubmitInvite(values, token)
|
requestSubmitInvite(values, token).then((response) => {
|
||||||
.then((response) => {
|
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: 'success',
|
message: 'success',
|
||||||
});
|
});
|
||||||
@@ -82,35 +75,34 @@ function Invite({ requestSubmitInvite }) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { errors, values, touched } = useMemo(() => formik, [formik]);
|
|
||||||
const requiredSpan = useMemo(() => <span class='required'>*</span>, []);
|
const requiredSpan = useMemo(() => <span class='required'>*</span>, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'invite-form'}>
|
<div className={'invite-form'}>
|
||||||
<form onSubmit={formik.handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'First Name'}
|
label={'First Name'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--first_name'}
|
className={'form-group--first_name'}
|
||||||
intent={errors.first_name && touched.first_name && Intent.DANGER}
|
intent={errors.first_name && touched.first_name && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'first_name'} {...formik} />}
|
helperText={<ErrorMessage name={'first_name'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={errors.first_name && touched.first_name && Intent.DANGER}
|
intent={errors.first_name && touched.first_name && Intent.DANGER}
|
||||||
{...formik.getFieldProps('first_name')}
|
{...getFieldProps('first_name')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'Last Name'}
|
label={'Last Name'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--last_name'}
|
className={'form-group--last_name'}
|
||||||
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'last_name'} {...formik} />}
|
helperText={<ErrorMessage name={'last_name'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
||||||
{...formik.getFieldProps('last_name')}
|
{...getFieldProps('last_name')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -119,13 +111,11 @@ function Invite({ requestSubmitInvite }) {
|
|||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--phone_number'}
|
className={'form-group--phone_number'}
|
||||||
intent={errors.phone_number && touched.phone_number && Intent.DANGER}
|
intent={errors.phone_number && touched.phone_number && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'phone_number'} {...formik} />}
|
helperText={<ErrorMessage name={'phone_number'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={
|
intent={(errors.phone_number && touched.phone_number) && Intent.DANGER}
|
||||||
errors.phone_number && touched.phone_number && Intent.DANGER
|
{...getFieldProps('phone_number')}
|
||||||
}
|
|
||||||
{...formik.getFieldProps('phone_number')}
|
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -133,13 +123,13 @@ function Invite({ requestSubmitInvite }) {
|
|||||||
label={'Language'}
|
label={'Language'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--language'}
|
className={'form-group--language'}
|
||||||
intent={errors.language && touched.language && Intent.DANGER}
|
intent={(errors.language && touched.language) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'language'} {...formik} />}
|
helperText={<ErrorMessage name={'language'} />}
|
||||||
>
|
>
|
||||||
<HTMLSelect
|
<HTMLSelect
|
||||||
fill={true}
|
fill={true}
|
||||||
options={language}
|
options={language}
|
||||||
{...formik.getFieldProps('language')}
|
{...getFieldProps('language')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -147,26 +137,27 @@ function Invite({ requestSubmitInvite }) {
|
|||||||
label={'Email'}
|
label={'Email'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--email'}
|
className={'form-group--email'}
|
||||||
intent={errors.email && touched.email && Intent.DANGER}
|
intent={(errors.email && touched.email) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'email'} {...formik} />}
|
helperText={<ErrorMessage name={'email'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={errors.email && touched.email && Intent.DANGER}
|
intent={errors.email && touched.email && Intent.DANGER}
|
||||||
{...formik.getFieldProps('email')}
|
{...getFieldProps('email')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'Password'}
|
label={'Password'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--password'}
|
className={'form-group--password'}
|
||||||
intent={errors.password && touched.password && Intent.DANGER}
|
intent={(errors.password && touched.password) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'password'} {...formik} />}
|
helperText={<ErrorMessage name={'password'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
lang={true}
|
lang={true}
|
||||||
type={'password'}
|
type={'password'}
|
||||||
intent={errors.password && touched.password && Intent.DANGER}
|
intent={(errors.password && touched.password) && Intent.DANGER}
|
||||||
{...formik.getFieldProps('password')}
|
{...getFieldProps('password')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import {Link} from 'react-router-dom';
|
import {Link, useHistory} from 'react-router-dom';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import {useFormik} from 'formik';
|
import {useFormik} from 'formik';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
FormGroup,
|
FormGroup,
|
||||||
} from "@blueprintjs/core";
|
} from "@blueprintjs/core";
|
||||||
import login from 'store/authentication/authentication.actions';
|
import login from 'store/authentication/authentication.actions';
|
||||||
import {hasErrorType} from 'store/authentication/authentication.reducer';
|
import {hasErrorType, isAuthenticated} from 'store/authentication/authentication.reducer';
|
||||||
import AuthenticationToaster from 'components/AppToaster';
|
import AuthenticationToaster from 'components/AppToaster';
|
||||||
import t from 'store/types';
|
import t from 'store/types';
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ function Login({
|
|||||||
hasError,
|
hasError,
|
||||||
}) {
|
}) {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
// Validation schema.
|
// Validation schema.
|
||||||
const loginValidationSchema = Yup.object().shape({
|
const loginValidationSchema = Yup.object().shape({
|
||||||
@@ -119,9 +120,13 @@ function Login({
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div className="authentication-page__footer">
|
<div className="authentication-page__footer">
|
||||||
<Link to="/auth/reset_password">
|
<Link to="/auth/send_reset_password">
|
||||||
{intl.formatMessage({'id': 'reset_password '})}
|
{intl.formatMessage({'id': 'reset_password '})}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
<Link to="/auth/register">
|
||||||
|
{intl.formatMessage({'id': 'register '})}
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,37 +9,27 @@ import {
|
|||||||
FormGroup,
|
FormGroup,
|
||||||
HTMLSelect,
|
HTMLSelect,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
|
|
||||||
import RegisterFromConnect from 'connectors/RegisterForm.connect';
|
import RegisterFromConnect from 'connectors/RegisterForm.connect';
|
||||||
import ErrorMessage from 'components/ErrorMessage';
|
import ErrorMessage from 'components/ErrorMessage';
|
||||||
import AppToaster from 'components/AppToaster';
|
import AppToaster from 'components/AppToaster';
|
||||||
import { compose } from 'utils';
|
import { compose, regExpCollection } from 'utils';
|
||||||
|
|
||||||
function Register({ requestSubmitRegister }) {
|
function Register({
|
||||||
|
requestSubmitRegister,
|
||||||
|
}) {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
const Country = useMemo(() => [
|
||||||
const phoneRegExp = /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;
|
|
||||||
|
|
||||||
const Country = useMemo(
|
|
||||||
() => [
|
|
||||||
{ value: null, label: 'Select Country' },
|
{ value: null, label: 'Select Country' },
|
||||||
{ value: 'libya', label: 'Libya' },
|
{ value: 'libya', label: 'Libya' },
|
||||||
],
|
], []);
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const ValidationSchema = Yup.object().shape({
|
const ValidationSchema = Yup.object().shape({
|
||||||
organization_name: Yup.string().required(
|
organization_name: Yup.string().required(),
|
||||||
intl.formatMessage({ id: 'required' })
|
first_name: Yup.string().required(),
|
||||||
),
|
last_name: Yup.string().required(),
|
||||||
first_name: Yup.string().required(intl.formatMessage({ id: 'required' })),
|
email: Yup.string().email().required(),
|
||||||
|
|
||||||
last_name: Yup.string().required(intl.formatMessage({ id: 'required' })),
|
|
||||||
email: Yup.string()
|
|
||||||
.email()
|
|
||||||
.required(intl.formatMessage({ id: 'required' })),
|
|
||||||
phone_number: Yup.string()
|
phone_number: Yup.string()
|
||||||
.matches(phoneRegExp)
|
.matches(regExpCollection.phoneNumber)
|
||||||
.required(intl.formatMessage({ id: 'required' })),
|
.required(intl.formatMessage({ id: 'required' })),
|
||||||
password: Yup.string()
|
password: Yup.string()
|
||||||
.min(4, 'Password has to be longer than 8 characters!')
|
.min(4, 'Password has to be longer than 8 characters!')
|
||||||
@@ -47,8 +37,7 @@ function Register({ requestSubmitRegister }) {
|
|||||||
country: Yup.string().required(intl.formatMessage({ id: 'required' })),
|
country: Yup.string().required(intl.formatMessage({ id: 'required' })),
|
||||||
});
|
});
|
||||||
|
|
||||||
const initialValues = useMemo(
|
const initialValues = useMemo(() => ({
|
||||||
() => ({
|
|
||||||
organization_name: '',
|
organization_name: '',
|
||||||
first_name: '',
|
first_name: '',
|
||||||
last_name: '',
|
last_name: '',
|
||||||
@@ -56,11 +45,16 @@ function Register({ requestSubmitRegister }) {
|
|||||||
phone_number: '',
|
phone_number: '',
|
||||||
password: '',
|
password: '',
|
||||||
country: '',
|
country: '',
|
||||||
}),
|
}), []);
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const formik = useFormik({
|
const {
|
||||||
|
getFieldProps,
|
||||||
|
getFieldMeta,
|
||||||
|
errors,
|
||||||
|
values,
|
||||||
|
touched,
|
||||||
|
handleSubmit,
|
||||||
|
} = useFormik({
|
||||||
enableReinitialize: true,
|
enableReinitialize: true,
|
||||||
validationSchema: ValidationSchema,
|
validationSchema: ValidationSchema,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
@@ -80,30 +74,28 @@ function Register({ requestSubmitRegister }) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { errors, values, touched } = useMemo(() => formik, [formik]);
|
|
||||||
const requiredSpan = useMemo(() => <span class='required'>*</span>, []);
|
const requiredSpan = useMemo(() => <span class='required'>*</span>, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'register-form'}>
|
<div className={'register-form'}>
|
||||||
<form onSubmit={formik.handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'Organization Name'}
|
label={'Organization Name'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--name'}
|
className={'form-group--name'}
|
||||||
intent={
|
intent={
|
||||||
errors.organization_name &&
|
(errors.organization_name && touched.organization_name) &&
|
||||||
touched.organization_name &&
|
|
||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
helperText={<ErrorMessage name={'organization_name'} {...formik} />}
|
helperText={<ErrorMessage name={'organization_name'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={
|
intent={
|
||||||
errors.organization_name &&
|
(errors.organization_name &&
|
||||||
touched.organization_name &&
|
touched.organization_name) &&
|
||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
{...formik.getFieldProps('organization_name')}
|
{...getFieldProps('organization_name')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -111,24 +103,25 @@ function Register({ requestSubmitRegister }) {
|
|||||||
label={'First Name'}
|
label={'First Name'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--first_name'}
|
className={'form-group--first_name'}
|
||||||
intent={errors.first_name && touched.first_name && Intent.DANGER}
|
intent={(errors.first_name && touched.first_name) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'first_name'} {...formik} />}
|
helperText={<ErrorMessage name={'first_name'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={errors.first_name && touched.first_name && Intent.DANGER}
|
intent={errors.first_name && touched.first_name && Intent.DANGER}
|
||||||
{...formik.getFieldProps('first_name')}
|
{...getFieldProps('first_name')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'Last Name'}
|
label={'Last Name'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--last_name'}
|
className={'form-group--last_name'}
|
||||||
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'last_name'} {...formik} />}
|
helperText={<ErrorMessage name={'last_name'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
intent={errors.last_name && touched.last_name && Intent.DANGER}
|
||||||
{...formik.getFieldProps('last_name')}
|
{...getFieldProps('last_name')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -136,13 +129,13 @@ function Register({ requestSubmitRegister }) {
|
|||||||
label={'Country'}
|
label={'Country'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--country'}
|
className={'form-group--country'}
|
||||||
intent={errors.country && touched.country && Intent.DANGER}
|
intent={(errors.country && touched.country) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'country'} {...formik} />}
|
helperText={<ErrorMessage name={'country'} />}
|
||||||
>
|
>
|
||||||
<HTMLSelect
|
<HTMLSelect
|
||||||
fill={true}
|
fill={true}
|
||||||
options={Country}
|
options={Country}
|
||||||
{...formik.getFieldProps('country')}
|
{...getFieldProps('country')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -150,26 +143,25 @@ function Register({ requestSubmitRegister }) {
|
|||||||
label={'Phone Number'}
|
label={'Phone Number'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--phone_number'}
|
className={'form-group--phone_number'}
|
||||||
intent={errors.phone_number && touched.phone_number && Intent.DANGER}
|
intent={(errors.phone_number && touched.phone_number) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'phone_number'} {...formik} />}
|
helperText={<ErrorMessage name={'phone_number'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={
|
intent={(errors.phone_number && touched.phone_number) && Intent.DANGER}
|
||||||
errors.phone_number && touched.phone_number && Intent.DANGER
|
{...getFieldProps('phone_number')}
|
||||||
}
|
|
||||||
{...formik.getFieldProps('phone_number')}
|
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'Email'}
|
label={'Email'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--email'}
|
className={'form-group--email'}
|
||||||
intent={errors.email && touched.email && Intent.DANGER}
|
intent={(errors.email && touched.email) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'email'} {...formik} />}
|
helperText={<ErrorMessage name={'email'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
intent={errors.email && touched.email && Intent.DANGER}
|
intent={errors.email && touched.email && Intent.DANGER}
|
||||||
{...formik.getFieldProps('email')}
|
{...getFieldProps('email')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -177,14 +169,14 @@ function Register({ requestSubmitRegister }) {
|
|||||||
label={'Password'}
|
label={'Password'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--password'}
|
className={'form-group--password'}
|
||||||
intent={errors.password && touched.password && Intent.DANGER}
|
intent={(errors.password && touched.password) && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'password'} {...formik} />}
|
helperText={<ErrorMessage name={'password'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
lang={true}
|
lang={true}
|
||||||
type={'password'}
|
type={'password'}
|
||||||
intent={errors.password && touched.password && Intent.DANGER}
|
intent={(errors.password && touched.password) && Intent.DANGER}
|
||||||
{...formik.getFieldProps('password')}
|
{...getFieldProps('password')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
@@ -198,4 +190,6 @@ function Register({ requestSubmitRegister }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(RegisterFromConnect)(Register);
|
export default compose(
|
||||||
|
RegisterFromConnect,
|
||||||
|
)(Register);
|
||||||
|
|||||||
@@ -14,26 +14,32 @@ import AppToaster from 'components/AppToaster';
|
|||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
import SendResetPasswordConnect from 'connectors/ResetPassword.connect';
|
import SendResetPasswordConnect from 'connectors/ResetPassword.connect';
|
||||||
|
|
||||||
function ResetPassword({ requestSendResetPassword }) {
|
function ResetPassword({
|
||||||
|
requestSendResetPassword,
|
||||||
|
}) {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const ValidationSchema = Yup.object().shape({
|
const ValidationSchema = Yup.object().shape({
|
||||||
password: Yup.string()
|
password: Yup.string()
|
||||||
.min(4, 'Password has to be longer than 4 characters!')
|
.min(4, 'Password has to be longer than 4 characters!')
|
||||||
.required('Password is required!'),
|
.required('Password is required!'),
|
||||||
|
|
||||||
confirm_password: Yup.string()
|
confirm_password: Yup.string()
|
||||||
.oneOf([Yup.ref('password'), null], 'Passwords must match')
|
.oneOf([Yup.ref('password'), null], 'Passwords must match')
|
||||||
.required('Confirm Password is required'),
|
.required('Confirm Password is required'),
|
||||||
});
|
});
|
||||||
|
|
||||||
const initialValues = useMemo(
|
const initialValues = useMemo(() => ({
|
||||||
() => ({
|
|
||||||
password: '',
|
password: '',
|
||||||
confirm_password: '',
|
confirm_password: '',
|
||||||
}),
|
}), []);
|
||||||
[]
|
|
||||||
);
|
const {
|
||||||
const formik = useFormik({
|
errors,
|
||||||
|
values,
|
||||||
|
touched,
|
||||||
|
getFieldMeta,
|
||||||
|
getFieldProps,
|
||||||
|
handleSubmit,
|
||||||
|
} = useFormik({
|
||||||
enableReinitialize: true,
|
enableReinitialize: true,
|
||||||
validationSchema: ValidationSchema,
|
validationSchema: ValidationSchema,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
@@ -53,26 +59,26 @@ function ResetPassword({ requestSendResetPassword }) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { errors, values, touched } = useMemo(() => formik, [formik]);
|
|
||||||
const requiredSpan = useMemo(() => <span class='required'>*</span>, []);
|
const requiredSpan = useMemo(() => <span class='required'>*</span>, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'sendRestPassword-form'}>
|
<div className={'sendRestPassword-form'}>
|
||||||
<form onSubmit={formik.handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'Password'}
|
label={'Password'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
className={'form-group--password'}
|
className={'form-group--password'}
|
||||||
intent={errors.password && touched.password && Intent.DANGER}
|
intent={errors.password && touched.password && Intent.DANGER}
|
||||||
helperText={<ErrorMessage name={'password'} {...formik} />}
|
helperText={<ErrorMessage name={'password'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
lang={true}
|
lang={true}
|
||||||
type={'password'}
|
type={'password'}
|
||||||
intent={errors.password && touched.password && Intent.DANGER}
|
intent={errors.password && touched.password && Intent.DANGER}
|
||||||
{...formik.getFieldProps('password')}
|
{...getFieldProps('password')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={'Confirm Password'}
|
label={'Confirm Password'}
|
||||||
labelInfo={requiredSpan}
|
labelInfo={requiredSpan}
|
||||||
@@ -80,7 +86,7 @@ function ResetPassword({ requestSendResetPassword }) {
|
|||||||
intent={
|
intent={
|
||||||
errors.confirm_password && touched.confirm_password && Intent.DANGER
|
errors.confirm_password && touched.confirm_password && Intent.DANGER
|
||||||
}
|
}
|
||||||
helperText={<ErrorMessage name={'confirm_password'} {...formik} />}
|
helperText={<ErrorMessage name={'confirm_password'} />}
|
||||||
>
|
>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
lang={true}
|
lang={true}
|
||||||
@@ -90,9 +96,10 @@ function ResetPassword({ requestSendResetPassword }) {
|
|||||||
touched.confirm_password &&
|
touched.confirm_password &&
|
||||||
Intent.DANGER
|
Intent.DANGER
|
||||||
}
|
}
|
||||||
{...formik.getFieldProps('confirm_password')}
|
{...getFieldProps('confirm_password')}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<div class='form__floating-footer'>
|
<div class='form__floating-footer'>
|
||||||
<Button intent={Intent.PRIMARY} type='submit'>
|
<Button intent={Intent.PRIMARY} type='submit'>
|
||||||
Reset Password
|
Reset Password
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
import React, { useEffect, useMemo } from 'react';
|
|
||||||
import * as Yup from 'yup';
|
|
||||||
import { useFormik } from 'formik';
|
|
||||||
import { useIntl } from 'react-intl';
|
|
||||||
import ErrorMessage from 'components/ErrorMessage';
|
|
||||||
import AppToaster from 'components/AppToaster';
|
|
||||||
import InviteFormConnect from 'connectors/InviteForm.connect';
|
|
||||||
|
|
||||||
import { compose } from 'utils';
|
|
||||||
import {
|
|
||||||
Button,
|
|
||||||
InputGroup,
|
|
||||||
Intent,
|
|
||||||
FormGroup,
|
|
||||||
HTMLSelect,
|
|
||||||
} from '@blueprintjs/core';
|
|
||||||
|
|
||||||
function SendInvite({ requestSendInvite }) {
|
|
||||||
const intl = useIntl();
|
|
||||||
const ValidationSchema = Yup.object().shape({
|
|
||||||
email: Yup.string()
|
|
||||||
.email()
|
|
||||||
.required(intl.formatMessage({ id: 'required' })),
|
|
||||||
});
|
|
||||||
|
|
||||||
const initialValues = useMemo(
|
|
||||||
() => ({
|
|
||||||
email: '',
|
|
||||||
}),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const formik = useFormik({
|
|
||||||
enableReinitialize: true,
|
|
||||||
validationSchema: ValidationSchema,
|
|
||||||
initialValues: {
|
|
||||||
...initialValues,
|
|
||||||
},
|
|
||||||
onSubmit: (values, { setSubmitting }) => {
|
|
||||||
requestSendInvite(values)
|
|
||||||
.then((response) => {
|
|
||||||
AppToaster.show({
|
|
||||||
message: 'success',
|
|
||||||
});
|
|
||||||
setSubmitting(false);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
setSubmitting(false);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { errors, values, touched } = useMemo(() => formik, [formik]);
|
|
||||||
const requiredSpan = useMemo(() => <span class='required'>*</span>, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<form onSubmit={formik.handleSubmit}>
|
|
||||||
<FormGroup
|
|
||||||
label={'Email'}
|
|
||||||
labelInfo={requiredSpan}
|
|
||||||
className={'form-group--email'}
|
|
||||||
intent={errors.email && touched.email && Intent.DANGER}
|
|
||||||
helperText={<ErrorMessage name={'email'} {...formik} />}
|
|
||||||
>
|
|
||||||
<InputGroup
|
|
||||||
intent={errors.email && touched.email && Intent.DANGER}
|
|
||||||
{...formik.getFieldProps('email')}
|
|
||||||
/>
|
|
||||||
</FormGroup>
|
|
||||||
<div class='form__floating-footer'>
|
|
||||||
<Button intent={Intent.PRIMARY} type='submit'>
|
|
||||||
Send Invite
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default compose(InviteFormConnect)(SendInvite);
|
|
||||||
@@ -126,7 +126,7 @@ function AccountsChart({
|
|||||||
addAccountsTableQueries({
|
addAccountsTableQueries({
|
||||||
...(sortBy.length > 0) ? {
|
...(sortBy.length > 0) ? {
|
||||||
column_sort_by: sortBy[0].id,
|
column_sort_by: sortBy[0].id,
|
||||||
sort_by: sortBy[0].desc ? 'desc' : 'asc',
|
sort_order: sortBy[0].desc ? 'desc' : 'asc',
|
||||||
} : {},
|
} : {},
|
||||||
});
|
});
|
||||||
fetchAccountsHook.execute();
|
fetchAccountsHook.execute();
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ export default [
|
|||||||
loader: () => import('containers/Authentication/Register'),
|
loader: () => import('containers/Authentication/Register'),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: `${BASE_URL}/send_reset_password`,
|
path: `${BASE_URL}/send_reset_password`,
|
||||||
name: 'auth.reset_password',
|
name: 'auth.reset_password',
|
||||||
@@ -25,7 +24,6 @@ export default [
|
|||||||
loader: () => import('containers/Authentication/SendResetPassword'),
|
loader: () => import('containers/Authentication/SendResetPassword'),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
path: `${BASE_URL}/reset_password`,
|
path: `${BASE_URL}/reset_password`,
|
||||||
name: 'auth.send.reset_password',
|
name: 'auth.send.reset_password',
|
||||||
@@ -34,17 +32,10 @@ export default [
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: `${BASE_URL}/send_invite`,
|
path: `${BASE_URL}/invite/:token/accept`,
|
||||||
name: 'auth.send_invite',
|
name: 'auth.invite.accept',
|
||||||
component: LazyLoader({
|
component: LazyLoader({
|
||||||
loader: () => import('containers/Authentication/SendInvite'),
|
loader: () => import('containers/Authentication/InviteAccept'),
|
||||||
}),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: `${BASE_URL}/invite/:token`,
|
|
||||||
name: 'auth.invite',
|
|
||||||
component: LazyLoader({
|
|
||||||
loader: () => import('containers/Authentication/Invite'),
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -106,8 +106,6 @@ export default [
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Financial Reports.
|
// Financial Reports.
|
||||||
{
|
{
|
||||||
path: `${BASE_URL}/accounting/general-ledger`,
|
path: `${BASE_URL}/accounting/general-ledger`,
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ const http = axios.create();
|
|||||||
|
|
||||||
http.interceptors.request.use((request) => {
|
http.interceptors.request.use((request) => {
|
||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
const token = state.authentication.token;
|
const { token, organization } = state.authentication;
|
||||||
const locale = 'en';
|
const locale = 'en';
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
request.headers.common['x-access-token'] = token;
|
request.headers.common['x-access-token'] = token;
|
||||||
}
|
}
|
||||||
|
if (organization) {
|
||||||
|
request.headers.common['organization-id'] = organization;
|
||||||
|
}
|
||||||
if (locale) {
|
if (locale) {
|
||||||
request.headers.common['Accept-Language'] = locale;
|
request.headers.common['Accept-Language'] = locale;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,10 @@ export default function login({ form }) {
|
|||||||
if (data.token && data.user) {
|
if (data.token && data.user) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: t.LOGIN_SUCCESS,
|
type: t.LOGIN_SUCCESS,
|
||||||
|
payload: {
|
||||||
user: data.user,
|
user: data.user,
|
||||||
token: data.token,
|
token: data.token,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
resolve(response);
|
resolve(response);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import t from 'store/types';
|
|||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
token: '',
|
token: '',
|
||||||
|
organization: '',
|
||||||
user: '',
|
user: '',
|
||||||
locale: '',
|
locale: '',
|
||||||
errors: [],
|
errors: [],
|
||||||
@@ -10,8 +11,10 @@ const initialState = {
|
|||||||
|
|
||||||
export default createReducer(initialState, {
|
export default createReducer(initialState, {
|
||||||
[t.LOGIN_SUCCESS]: (state, action) => {
|
[t.LOGIN_SUCCESS]: (state, action) => {
|
||||||
state.token = action.token;
|
const { token, user } = action.payload;
|
||||||
state.user = action.user;
|
state.token = token;
|
||||||
|
state.user = user;
|
||||||
|
state.organization = user.tenant.organization_id;
|
||||||
},
|
},
|
||||||
|
|
||||||
[t.LOGIN_FAILURE]: (state, action) => {
|
[t.LOGIN_FAILURE]: (state, action) => {
|
||||||
@@ -21,6 +24,7 @@ export default createReducer(initialState, {
|
|||||||
[t.LOGOUT]: (state) => {
|
[t.LOGOUT]: (state) => {
|
||||||
state.token = '';
|
state.token = '';
|
||||||
state.user = {};
|
state.user = {};
|
||||||
|
state.organization = '';
|
||||||
},
|
},
|
||||||
|
|
||||||
[t.LOGIN_CLEAR_ERRORS]: (state) => {
|
[t.LOGIN_CLEAR_ERRORS]: (state) => {
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ const createStore = (initialState = {
|
|||||||
|
|
||||||
store.subscribe(() => {
|
store.subscribe(() => {
|
||||||
saveState({
|
saveState({
|
||||||
authentication: {
|
authentication: store.getState().authentication,
|
||||||
token: store.getState().authentication.token,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return store;
|
return store;
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ global.rootPath = rootPath.path;
|
|||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
i18n.configure({
|
// i18n.configure({
|
||||||
locales: ['en'],
|
// locales: ['en'],
|
||||||
directory: `${__dirname}/resources/locale`,
|
// directory: `${__dirname}/resources/locale`,
|
||||||
});
|
// });
|
||||||
|
|
||||||
// i18n init parses req for language headers, cookies, etc.
|
// // i18n init parses req for language headers, cookies, etc.
|
||||||
app.use(i18n.init);
|
// app.use(i18n.init);
|
||||||
|
|
||||||
// Express configuration
|
// Express configuration
|
||||||
app.set('port', process.env.PORT || 3000);
|
app.set('port', process.env.PORT || 3000);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import JWTAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -8,7 +7,6 @@ export default {
|
|||||||
*/
|
*/
|
||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(JWTAuth);
|
|
||||||
|
|
||||||
router.get('/',
|
router.get('/',
|
||||||
this.getAccountTypesList.validation,
|
this.getAccountTypesList.validation,
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ import express from 'express';
|
|||||||
import { difference } from 'lodash';
|
import { difference } from 'lodash';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import JWTAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import JournalPoster from '@/services/Accounting/JournalPoster';
|
import JournalPoster from '@/services/Accounting/JournalPoster';
|
||||||
import JournalEntry from '@/services/Accounting/JournalEntry';
|
import JournalEntry from '@/services/Accounting/JournalEntry';
|
||||||
import TenancyMiddleware from '@/http/middleware/TenancyMiddleware';
|
|
||||||
import {
|
import {
|
||||||
mapViewRolesToConditionals,
|
mapViewRolesToConditionals,
|
||||||
mapFilterRolesToDynamicFilter,
|
mapFilterRolesToDynamicFilter,
|
||||||
@@ -25,8 +23,6 @@ export default {
|
|||||||
*/
|
*/
|
||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(JWTAuth);
|
|
||||||
router.use(TenancyMiddleware);
|
|
||||||
|
|
||||||
router.get('/manual-journals/:id',
|
router.get('/manual-journals/:id',
|
||||||
this.getManualJournal.validation,
|
this.getManualJournal.validation,
|
||||||
@@ -94,6 +90,8 @@ export default {
|
|||||||
}
|
}
|
||||||
const { Resource, View, ManualJournal } = req.models;
|
const { Resource, View, ManualJournal } = req.models;
|
||||||
|
|
||||||
|
console.log(req.models);
|
||||||
|
|
||||||
const errorReasons = [];
|
const errorReasons = [];
|
||||||
const manualJournalsResource = await Resource.query()
|
const manualJournalsResource = await Resource.query()
|
||||||
.where('name', 'manual_journals')
|
.where('name', 'manual_journals')
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import { difference } from 'lodash';
|
|||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import JournalPoster from '@/services/Accounting/JournalPoster';
|
import JournalPoster from '@/services/Accounting/JournalPoster';
|
||||||
import NestedSet from '@/collection/NestedSet';
|
import NestedSet from '@/collection/NestedSet';
|
||||||
import JWTAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import TenancyMiddleware from '@/http/middleware/TenancyMiddleware';
|
|
||||||
import {
|
import {
|
||||||
mapViewRolesToConditionals,
|
mapViewRolesToConditionals,
|
||||||
mapFilterRolesToDynamicFilter,
|
mapFilterRolesToDynamicFilter,
|
||||||
@@ -30,9 +28,6 @@ export default {
|
|||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(JWTAuth);
|
|
||||||
router.use(TenancyMiddleware);
|
|
||||||
|
|
||||||
router.post('/',
|
router.post('/',
|
||||||
this.newAccount.validation,
|
this.newAccount.validation,
|
||||||
asyncMiddleware(this.newAccount.handler));
|
asyncMiddleware(this.newAccount.handler));
|
||||||
@@ -243,7 +238,7 @@ export default {
|
|||||||
|
|
||||||
query('stringified_filter_roles').optional().isJSON(),
|
query('stringified_filter_roles').optional().isJSON(),
|
||||||
|
|
||||||
query('column_sort_order').optional(),
|
query('column_sort_by').optional(),
|
||||||
query('sort_order').optional().isIn(['desc', 'asc']),
|
query('sort_order').optional().isIn(['desc', 'asc']),
|
||||||
],
|
],
|
||||||
async handler(req, res) {
|
async handler(req, res) {
|
||||||
@@ -293,12 +288,13 @@ export default {
|
|||||||
});
|
});
|
||||||
const dynamicFilter = new DynamicFilter(Account.tableName);
|
const dynamicFilter = new DynamicFilter(Account.tableName);
|
||||||
|
|
||||||
if (filter.column_sort_order) {
|
if (filter.column_sort_by) {
|
||||||
if (resourceFieldsKeys.indexOf(filter.column_sort_order) === -1) {
|
console.log(filter);
|
||||||
|
if (resourceFieldsKeys.indexOf(filter.column_sort_by) === -1) {
|
||||||
errorReasons.push({ type: 'COLUMN.SORT.ORDER.NOT.FOUND', code: 300 });
|
errorReasons.push({ type: 'COLUMN.SORT.ORDER.NOT.FOUND', code: 300 });
|
||||||
}
|
}
|
||||||
const sortByFilter = new DynamicFilterSortBy(
|
const sortByFilter = new DynamicFilterSortBy(
|
||||||
filter.column_sort_order,
|
filter.column_sort_by,
|
||||||
filter.sort_order,
|
filter.sort_order,
|
||||||
);
|
);
|
||||||
dynamicFilter.setFilter(sortByFilter);
|
dynamicFilter.setFilter(sortByFilter);
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { check, param, validationResult } from 'express-validator';
|
import { check, param, validationResult } from 'express-validator';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
/**
|
||||||
|
* Router constructor.
|
||||||
|
*/
|
||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(jwtAuth);
|
|
||||||
|
|
||||||
router.get('/',
|
router.get('/',
|
||||||
this.all.validation,
|
this.all.validation,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
} from 'express-validator';
|
} from 'express-validator';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +14,6 @@ export default {
|
|||||||
*/
|
*/
|
||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(jwtAuth);
|
|
||||||
|
|
||||||
router.get('/',
|
router.get('/',
|
||||||
this.exchangeRates.validation,
|
this.exchangeRates.validation,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { query, oneOf, validationResult } from 'express-validator';
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { pick, difference, groupBy } from 'lodash';
|
import { pick, difference, groupBy } from 'lodash';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import JournalPoster from '@/services/Accounting/JournalPoster';
|
import JournalPoster from '@/services/Accounting/JournalPoster';
|
||||||
import { dateRangeCollection } from '@/utils';
|
import { dateRangeCollection } from '@/utils';
|
||||||
|
|
||||||
@@ -25,7 +24,6 @@ export default {
|
|||||||
*/
|
*/
|
||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
router.use(jwtAuth);
|
|
||||||
|
|
||||||
router.get('/journal',
|
router.get('/journal',
|
||||||
this.journal.validation,
|
this.journal.validation,
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ import {
|
|||||||
query,
|
query,
|
||||||
} from 'express-validator';
|
} from 'express-validator';
|
||||||
import asyncMiddleware from '../middleware/asyncMiddleware';
|
import asyncMiddleware from '../middleware/asyncMiddleware';
|
||||||
import ItemCategory from '@/models/ItemCategory';
|
|
||||||
import Authorization from '@/http/middleware/authorization';
|
|
||||||
import JWTAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import Resource from '@/models/Resource';
|
|
||||||
import {
|
import {
|
||||||
DynamicFilter,
|
DynamicFilter,
|
||||||
DynamicFilterSortBy,
|
DynamicFilterSortBy,
|
||||||
@@ -27,8 +23,6 @@ export default {
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
// const permit = Authorization('items_categories');
|
// const permit = Authorization('items_categories');
|
||||||
|
|
||||||
router.use(JWTAuth);
|
|
||||||
|
|
||||||
router.post('/:id',
|
router.post('/:id',
|
||||||
this.editCategory.validation,
|
this.editCategory.validation,
|
||||||
asyncMiddleware(this.editCategory.handler));
|
asyncMiddleware(this.editCategory.handler));
|
||||||
@@ -62,7 +56,10 @@ export default {
|
|||||||
.optional({ nullable: true, checkFalsy: true })
|
.optional({ nullable: true, checkFalsy: true })
|
||||||
.isNumeric()
|
.isNumeric()
|
||||||
.toInt(),
|
.toInt(),
|
||||||
check('description').optional().trim().escape()
|
check('description')
|
||||||
|
.optional()
|
||||||
|
.trim()
|
||||||
|
.escape(),
|
||||||
],
|
],
|
||||||
async handler(req, res) {
|
async handler(req, res) {
|
||||||
const validationErrors = validationResult(req);
|
const validationErrors = validationResult(req);
|
||||||
@@ -74,6 +71,7 @@ export default {
|
|||||||
}
|
}
|
||||||
const { user } = req;
|
const { user } = req;
|
||||||
const form = { ...req.body };
|
const form = { ...req.body };
|
||||||
|
const { ItemCategory } = req.models;
|
||||||
|
|
||||||
if (form.parent_category_id) {
|
if (form.parent_category_id) {
|
||||||
const foundParentCategory = await ItemCategory.query()
|
const foundParentCategory = await ItemCategory.query()
|
||||||
@@ -82,7 +80,7 @@ export default {
|
|||||||
|
|
||||||
if (!foundParentCategory) {
|
if (!foundParentCategory) {
|
||||||
return res.boom.notFound('The parent category ID is not found.', {
|
return res.boom.notFound('The parent category ID is not found.', {
|
||||||
errors: [{ type: 'PARENT_CATEGORY_NOT_FOUND', code: 100 }]
|
errors: [{ type: 'PARENT_CATEGORY_NOT_FOUND', code: 100 }],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +89,7 @@ export default {
|
|||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
});
|
});
|
||||||
return res.status(200).send({ category });
|
return res.status(200).send({ category });
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,18 +117,19 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const form = { ...req.body };
|
const form = { ...req.body };
|
||||||
|
const { ItemCategory } = req.models;
|
||||||
const itemCategory = await ItemCategory.query()
|
const itemCategory = await ItemCategory.query()
|
||||||
.where('id', id)
|
.where('id', id)
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
if (!itemCategory) {
|
if (!itemCategory) {
|
||||||
return res.boom.notFound({
|
return res.boom.notFound({
|
||||||
errors: [{ type: 'ITEM_CATEGORY.NOT.FOUND', code: 100 }]
|
errors: [{ type: 'ITEM_CATEGORY.NOT.FOUND', code: 100 }],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
form.parent_category_id &&
|
form.parent_category_id
|
||||||
form.parent_category_id !== itemCategory.parent_category_id
|
&& form.parent_category_id !== itemCategory.parent_category_id
|
||||||
) {
|
) {
|
||||||
const foundParentCategory = await ItemCategory.query()
|
const foundParentCategory = await ItemCategory.query()
|
||||||
.where('id', form.parent_category_id)
|
.where('id', form.parent_category_id)
|
||||||
@@ -138,7 +137,7 @@ export default {
|
|||||||
|
|
||||||
if (!foundParentCategory) {
|
if (!foundParentCategory) {
|
||||||
return res.boom.notFound('The parent category ID is not found.', {
|
return res.boom.notFound('The parent category ID is not found.', {
|
||||||
errors: [{ type: 'PARENT_CATEGORY_NOT_FOUND', code: 100 }]
|
errors: [{ type: 'PARENT_CATEGORY_NOT_FOUND', code: 100 }],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,10 +154,11 @@ export default {
|
|||||||
*/
|
*/
|
||||||
deleteItem: {
|
deleteItem: {
|
||||||
validation: [
|
validation: [
|
||||||
param('id').exists().toInt()
|
param('id').exists().toInt(),
|
||||||
],
|
],
|
||||||
async handler(req, res) {
|
async handler(req, res) {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
|
const { ItemCategory } = req.models;
|
||||||
const itemCategory = await ItemCategory.query()
|
const itemCategory = await ItemCategory.query()
|
||||||
.where('id', id)
|
.where('id', id)
|
||||||
.first();
|
.first();
|
||||||
@@ -166,13 +166,12 @@ export default {
|
|||||||
if (!itemCategory) {
|
if (!itemCategory) {
|
||||||
return res.boom.notFound();
|
return res.boom.notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
await ItemCategory.query()
|
await ItemCategory.query()
|
||||||
.where('id', itemCategory.id)
|
.where('id', itemCategory.id)
|
||||||
.delete();
|
.delete();
|
||||||
|
|
||||||
return res.status(200).send();
|
return res.status(200).send();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,15 +192,16 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { Resource, ItemCategory } = req.models;
|
||||||
const categoriesResource = await Resource.query()
|
const categoriesResource = await Resource.query()
|
||||||
.where('name', 'items_categories')
|
.where('name', 'items_categories')
|
||||||
.withGraphFetched('fields')
|
.withGraphFetched('fields')
|
||||||
.first();
|
.first();
|
||||||
|
|
||||||
if (!categoriesResource) {
|
if (!categoriesResource) {
|
||||||
return res.status(400).send({ errors: [
|
return res.status(400).send({
|
||||||
{ type: 'ITEMS.CATEGORIES.RESOURCE.NOT.FOUND', code: 200, }
|
errors: [{ type: 'ITEMS.CATEGORIES.RESOURCE.NOT.FOUND', code: 200 }],
|
||||||
]});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
@@ -256,7 +256,7 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return res.status(200).send({ categories });
|
return res.status(200).send({ categories });
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,15 +266,16 @@ export default {
|
|||||||
validation: [param('category_id').toInt()],
|
validation: [param('category_id').toInt()],
|
||||||
async handler(req, res) {
|
async handler(req, res) {
|
||||||
const { category_id: categoryId } = req.params;
|
const { category_id: categoryId } = req.params;
|
||||||
|
const { ItemCategory } = req.models;
|
||||||
const item = await ItemCategory.where('id', categoryId).fetch();
|
const item = await ItemCategory.where('id', categoryId).fetch();
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return res.boom.notFound(null, {
|
return res.boom.notFound(null, {
|
||||||
errors: [{ type: 'CATEGORY_NOT_FOUND', code: 100 }]
|
errors: [{ type: 'CATEGORY_NOT_FOUND', code: 100 }],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return res.status(200).send({ category: item.toJSON() });
|
return res.status(200).send({ category: item.toJSON() });
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import { check, query, validationResult } from 'express-validator';
|
|||||||
import { difference } from 'lodash';
|
import { difference } from 'lodash';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import TenancyMiddleware from '@/http/middleware/TenancyMiddleware';
|
|
||||||
import {
|
import {
|
||||||
mapViewRolesToConditionals,
|
mapViewRolesToConditionals,
|
||||||
mapFilterRolesToDynamicFilter,
|
mapFilterRolesToDynamicFilter,
|
||||||
@@ -16,7 +14,6 @@ import {
|
|||||||
DynamicFilterFilterRoles,
|
DynamicFilterFilterRoles,
|
||||||
} from '@/lib/DynamicFilter';
|
} from '@/lib/DynamicFilter';
|
||||||
import Logger from '@/services/Logger';
|
import Logger from '@/services/Logger';
|
||||||
import ConfiguredMiddleware from '@/http/middleware/ConfiguredMiddleware';
|
|
||||||
|
|
||||||
const fsPromises = fs.promises;
|
const fsPromises = fs.promises;
|
||||||
|
|
||||||
@@ -27,10 +24,6 @@ export default {
|
|||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(jwtAuth);
|
|
||||||
router.use(TenancyMiddleware);
|
|
||||||
router.use(ConfiguredMiddleware);
|
|
||||||
|
|
||||||
router.post('/:id',
|
router.post('/:id',
|
||||||
this.editItem.validation,
|
this.editItem.validation,
|
||||||
asyncMiddleware(this.editItem.handler));
|
asyncMiddleware(this.editItem.handler));
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { check, param, query, validationResult } from 'express-validator';
|
import {
|
||||||
|
param,
|
||||||
|
query,
|
||||||
|
validationResult,
|
||||||
|
} from 'express-validator';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import TenancyMiddleware from '@/http/middleware/TenancyMiddleware';
|
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import Logger from '@/services/Logger';
|
import Logger from '@/services/Logger';
|
||||||
|
|
||||||
const fsPromises = fs.promises;
|
const fsPromises = fs.promises;
|
||||||
@@ -16,9 +18,6 @@ export default {
|
|||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(jwtAuth);
|
|
||||||
router.use(TenancyMiddleware);
|
|
||||||
|
|
||||||
router.post('/upload',
|
router.post('/upload',
|
||||||
this.upload.validation,
|
this.upload.validation,
|
||||||
asyncMiddleware(this.upload.handler));
|
asyncMiddleware(this.upload.handler));
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import express from 'express';
|
|||||||
import { body, query, validationResult } from 'express-validator';
|
import { body, query, validationResult } from 'express-validator';
|
||||||
import { pick } from 'lodash';
|
import { pick } from 'lodash';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
@@ -11,8 +10,6 @@ export default {
|
|||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(jwtAuth);
|
|
||||||
|
|
||||||
router.post('/',
|
router.post('/',
|
||||||
this.saveOptions.validation,
|
this.saveOptions.validation,
|
||||||
asyncMiddleware(this.saveOptions.handler));
|
asyncMiddleware(this.saveOptions.handler));
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
query,
|
query,
|
||||||
} from 'express-validator';
|
} from 'express-validator';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
@@ -13,8 +12,6 @@ export default {
|
|||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(jwtAuth);
|
|
||||||
|
|
||||||
router.get('/:resource_slug/columns',
|
router.get('/:resource_slug/columns',
|
||||||
this.resourceColumns.validation,
|
this.resourceColumns.validation,
|
||||||
asyncMiddleware(this.resourceColumns.handler));
|
asyncMiddleware(this.resourceColumns.handler));
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
validationResult,
|
validationResult,
|
||||||
} from 'express-validator';
|
} from 'express-validator';
|
||||||
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
import asyncMiddleware from '@/http/middleware/asyncMiddleware';
|
||||||
import jwtAuth from '@/http/middleware/jwtAuth';
|
|
||||||
import {
|
import {
|
||||||
validateViewRoles,
|
validateViewRoles,
|
||||||
} from '@/lib/ViewRolesBuilder';
|
} from '@/lib/ViewRolesBuilder';
|
||||||
@@ -22,8 +21,6 @@ export default {
|
|||||||
router() {
|
router() {
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.use(jwtAuth);
|
|
||||||
|
|
||||||
router.get('/',
|
router.get('/',
|
||||||
this.listViews.validation,
|
this.listViews.validation,
|
||||||
asyncMiddleware(this.listViews.handler));
|
asyncMiddleware(this.listViews.handler));
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// import OAuth2 from '@/http/controllers/OAuth2';
|
// import OAuth2 from '@/http/controllers/OAuth2';
|
||||||
|
import express from 'express';
|
||||||
import Authentication from '@/http/controllers/Authentication';
|
import Authentication from '@/http/controllers/Authentication';
|
||||||
import InviteUsers from '@/http/controllers/InviteUsers';
|
import InviteUsers from '@/http/controllers/InviteUsers';
|
||||||
// import Users from '@/http/controllers/Users';
|
// import Users from '@/http/controllers/Users';
|
||||||
@@ -26,33 +27,43 @@ import ExchangeRates from '@/http/controllers/ExchangeRates';
|
|||||||
// import SalesReports from '@/http/controllers/SalesReports';
|
// import SalesReports from '@/http/controllers/SalesReports';
|
||||||
// import PurchasesReports from '@/http/controllers/PurchasesReports';
|
// import PurchasesReports from '@/http/controllers/PurchasesReports';
|
||||||
import Media from '@/http/controllers/Media';
|
import Media from '@/http/controllers/Media';
|
||||||
|
import JWTAuth from '@/http/middleware/jwtAuth';
|
||||||
|
import TenancyMiddleware from '@/http/middleware/TenancyMiddleware';
|
||||||
|
|
||||||
export default (app) => {
|
export default (app) => {
|
||||||
// app.use('/api/oauth2', OAuth2.router());
|
// app.use('/api/oauth2', OAuth2.router());
|
||||||
app.use('/api/auth', Authentication.router());
|
app.use('/api/auth', Authentication.router());
|
||||||
app.use('/api/invite', InviteUsers.router());
|
|
||||||
app.use('/api/currencies', Currencies.router());
|
const dashboard = express.Router();
|
||||||
|
|
||||||
|
dashboard.use(JWTAuth);
|
||||||
|
dashboard.use(TenancyMiddleware);
|
||||||
|
|
||||||
|
dashboard.use('/api/invite', InviteUsers.router());
|
||||||
|
dashboard.use('/api/currencies', Currencies.router());
|
||||||
// app.use('/api/users', Users.router());
|
// app.use('/api/users', Users.router());
|
||||||
// app.use('/api/roles', Roles.router());
|
// app.use('/api/roles', Roles.router());
|
||||||
app.use('/api/accounts', Accounts.router());
|
dashboard.use('/api/accounts', Accounts.router());
|
||||||
app.use('/api/account_types', AccountTypes.router());
|
dashboard.use('/api/account_types', AccountTypes.router());
|
||||||
app.use('/api/accounting', Accounting.router());
|
dashboard.use('/api/accounting', Accounting.router());
|
||||||
// app.use('/api/accounts_opening_balances', AccountOpeningBalance.router());
|
// app.use('/api/accounts_opening_balances', AccountOpeningBalance.router());
|
||||||
app.use('/api/views', Views.router());
|
dashboard.use('/api/views', Views.router());
|
||||||
// app.use('/api/fields', CustomFields.router());
|
// app.use('/api/fields', CustomFields.router());
|
||||||
app.use('/api/items', Items.router());
|
dashboard.use('/api/items', Items.router());
|
||||||
app.use('/api/item_categories', ItemCategories.router());
|
dashboard.use('/api/item_categories', ItemCategories.router());
|
||||||
// app.use('/api/expenses', Expenses.router());
|
// app.use('/api/expenses', Expenses.router());
|
||||||
app.use('/api/financial_statements', FinancialStatements.router());
|
dashboard.use('/api/financial_statements', FinancialStatements.router());
|
||||||
app.use('/api/options', Options.router());
|
dashboard.use('/api/options', Options.router());
|
||||||
// app.use('/api/budget_reports', BudgetReports.router());
|
// app.use('/api/budget_reports', BudgetReports.router());
|
||||||
// app.use('/api/customers', Customers.router());
|
// app.use('/api/customers', Customers.router());
|
||||||
// app.use('/api/suppliers', Suppliers.router());
|
// app.use('/api/suppliers', Suppliers.router());
|
||||||
// app.use('/api/bills', Bills.router());
|
// app.use('/api/bills', Bills.router());
|
||||||
// app.use('/api/budget', Budget.router());
|
// app.use('/api/budget', Budget.router());
|
||||||
app.use('/api/resources', Resources.router());
|
dashboard.use('/api/resources', Resources.router());
|
||||||
app.use('/api/exchange_rates', ExchangeRates.router());
|
dashboard.use('/api/exchange_rates', ExchangeRates.router());
|
||||||
app.use('/api/media', Media.router());
|
dashboard.use('/api/media', Media.router());
|
||||||
|
|
||||||
|
app.use('/', dashboard);
|
||||||
// app.use('/api/currency_adjustment', CurrencyAdjustment.router());
|
// app.use('/api/currency_adjustment', CurrencyAdjustment.router());
|
||||||
// app.use('/api/reports/sales', SalesReports.router());
|
// app.use('/api/reports/sales', SalesReports.router());
|
||||||
// app.use('/api/reports/purchases', PurchasesReports.router());
|
// app.use('/api/reports/purchases', PurchasesReports.router());
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import TenantModel from '@/models/TenantModel';
|
|
||||||
|
|
||||||
export default class JournalEntry extends TenantModel {
|
|
||||||
/**
|
|
||||||
* Table name.
|
|
||||||
*/
|
|
||||||
static get tableName() {
|
|
||||||
return 'manual_journals';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import TenantModel from '@/models/Model';
|
import TenantModel from '@/models/TenantModel';
|
||||||
|
|
||||||
export default class ManualJournal extends TenantModel {
|
export default class ManualJournal extends TenantModel {
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user