mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
Merge branch 'master' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -31,7 +31,7 @@ const defaultBill = {
|
|||||||
index: 0,
|
index: 0,
|
||||||
item_id: '',
|
item_id: '',
|
||||||
rate: '',
|
rate: '',
|
||||||
discount: '',
|
discount: 0,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
description: '',
|
description: '',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const BillFormSchema = Yup.object().shape({
|
|||||||
.min(1)
|
.min(1)
|
||||||
.max(DATATYPES_LENGTH.TEXT)
|
.max(DATATYPES_LENGTH.TEXT)
|
||||||
.label(formatMessage({ id: 'note' })),
|
.label(formatMessage({ id: 'note' })),
|
||||||
open: Yup.boolean().required(),
|
open: Yup.boolean(),
|
||||||
entries: Yup.array().of(
|
entries: Yup.array().of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
quantity: Yup.number()
|
quantity: Yup.number()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
import { useHistory } from 'react-router';
|
import { useHistory } from 'react-router';
|
||||||
|
import { FormattedMessage as T } from 'react-intl';
|
||||||
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
||||||
import { useParams, withRouter } from 'react-router-dom';
|
import { useParams, withRouter } from 'react-router-dom';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@@ -80,7 +81,7 @@ function PaymentMadeViewTabs({
|
|||||||
<NavbarGroup align={Alignment.LEFT}>
|
<NavbarGroup align={Alignment.LEFT}>
|
||||||
<DashboardViewsTabs
|
<DashboardViewsTabs
|
||||||
initialViewId={customViewId}
|
initialViewId={customViewId}
|
||||||
baseUrl={'/payment-mades'}
|
defaultTabText={<T id={'all_payments'} />}
|
||||||
tabs={tabs}
|
tabs={tabs}
|
||||||
onNewViewTabClick={handleClickNewView}
|
onNewViewTabClick={handleClickNewView}
|
||||||
onChange={handleTabsChange}
|
onChange={handleTabsChange}
|
||||||
|
|||||||
@@ -102,11 +102,11 @@ export default function EstimateFloatingActions({
|
|||||||
content={
|
content={
|
||||||
<Menu>
|
<Menu>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={<T id={'publish_and_new'} />}
|
text={<T id={'deliver_and_new'} />}
|
||||||
onClick={handleSubmitDeliverAndNewBtnClick}
|
onClick={handleSubmitDeliverAndNewBtnClick}
|
||||||
/>
|
/>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
text={<T id={'publish_continue_editing'} />}
|
text={<T id={'deliver_continue_editing'} />}
|
||||||
onClick={handleSubmitDeliverContinueEditingBtnClick}
|
onClick={handleSubmitDeliverContinueEditingBtnClick}
|
||||||
/>
|
/>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ const MIN_LINES_NUMBER = 4;
|
|||||||
const defaultEstimate = {
|
const defaultEstimate = {
|
||||||
index: 0,
|
index: 0,
|
||||||
item_id: '',
|
item_id: '',
|
||||||
rate: 0,
|
rate: '',
|
||||||
discount: '',
|
discount: 0,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
description: '',
|
description: '',
|
||||||
};
|
};
|
||||||
@@ -164,6 +164,8 @@ const EstimateForm = ({
|
|||||||
values,
|
values,
|
||||||
{ setSubmitting, setErrors, resetForm },
|
{ setSubmitting, setErrors, resetForm },
|
||||||
) => {
|
) => {
|
||||||
|
setSubmitting(true);
|
||||||
|
|
||||||
const entries = values.entries.filter(
|
const entries = values.entries.filter(
|
||||||
(item) => item.item_id && item.quantity,
|
(item) => item.item_id && item.quantity,
|
||||||
);
|
);
|
||||||
@@ -211,7 +213,9 @@ const EstimateForm = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onError = (errors) => {
|
const onError = (errors) => {
|
||||||
handleErrors(errors, { setErrors });
|
if (errors) {
|
||||||
|
handleErrors(errors, { setErrors });
|
||||||
|
}
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -246,11 +250,13 @@ const EstimateForm = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(
|
<div
|
||||||
CLASSES.PAGE_FORM,
|
className={classNames(
|
||||||
CLASSES.PAGE_FORM_STRIP_STYLE,
|
CLASSES.PAGE_FORM,
|
||||||
CLASSES.PAGE_FORM_ESTIMATE,
|
CLASSES.PAGE_FORM_STRIP_STYLE,
|
||||||
)}>
|
CLASSES.PAGE_FORM_ESTIMATE,
|
||||||
|
)}
|
||||||
|
>
|
||||||
<Formik
|
<Formik
|
||||||
validationSchema={
|
validationSchema={
|
||||||
isNewMode ? CreateEstimateFormSchema : EditEstimateFormSchema
|
isNewMode ? CreateEstimateFormSchema : EditEstimateFormSchema
|
||||||
@@ -258,13 +264,13 @@ const EstimateForm = ({
|
|||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
onSubmit={handleFormSubmit}
|
onSubmit={handleFormSubmit}
|
||||||
>
|
>
|
||||||
{({ isSubmitting ,values }) => (
|
{({ isSubmitting, values }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<EstimateFormHeader
|
<EstimateFormHeader
|
||||||
onEstimateNumberChanged={handleEstimateNumberChange}
|
onEstimateNumberChanged={handleEstimateNumberChange}
|
||||||
/>
|
/>
|
||||||
<EstimateNumberWatcher estimateNumber={estimateNumber} />
|
<EstimateNumberWatcher estimateNumber={estimateNumber} />
|
||||||
<EstimateFormBody />
|
<EstimateFormBody defaultEstimate={defaultEstimate} />
|
||||||
<EstimateFormFooter />
|
<EstimateFormFooter />
|
||||||
<EstimateFloatingActions
|
<EstimateFloatingActions
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const Schema = Yup.object().shape({
|
|||||||
.min(1)
|
.min(1)
|
||||||
.max(DATATYPES_LENGTH.TEXT)
|
.max(DATATYPES_LENGTH.TEXT)
|
||||||
.label(formatMessage({ id: 'note' })),
|
.label(formatMessage({ id: 'note' })),
|
||||||
delivered: Yup.boolean().required(),
|
delivered: Yup.boolean(),
|
||||||
entries: Yup.array().of(
|
entries: Yup.array().of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
quantity: Yup.number()
|
quantity: Yup.number()
|
||||||
@@ -44,7 +44,7 @@ const Schema = Yup.object().shape({
|
|||||||
is: (quantity, rate) => !isBlank(quantity) && !isBlank(rate),
|
is: (quantity, rate) => !isBlank(quantity) && !isBlank(rate),
|
||||||
then: Yup.number().required(),
|
then: Yup.number().required(),
|
||||||
}),
|
}),
|
||||||
discount: Yup.number().nullable().min(0).max(DATATYPES_LENGTH.INT_10),
|
discount: Yup.number().nullable().min(0).max(100),
|
||||||
description: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
|
description: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import classNames from 'classnames';
|
|||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
import EditableItemsEntriesTable from 'containers/Entries/EditableItemsEntriesTable';
|
import EditableItemsEntriesTable from 'containers/Entries/EditableItemsEntriesTable';
|
||||||
|
|
||||||
export default function EstimateFormBody() {
|
export default function EstimateFormBody({ defaultEstimate }) {
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_BODY)}>
|
<div className={classNames(CLASSES.PAGE_FORM_BODY)}>
|
||||||
<EditableItemsEntriesTable filterSellableItems={true} />
|
<EditableItemsEntriesTable
|
||||||
|
defaultEntry={defaultEstimate}
|
||||||
|
filterSellableItems={true}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { compose } from 'utils';
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { sumBy } from 'lodash';
|
import { sumBy } from 'lodash';
|
||||||
import { useFormikContext } from 'formik';
|
import { useFormikContext } from 'formik';
|
||||||
|
|
||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
|
|
||||||
import { PageFormBigNumber } from 'components';
|
|
||||||
|
|
||||||
import withCustomers from 'containers/Customers/withCustomers';
|
|
||||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
|
||||||
|
|
||||||
import EstimateFormHeaderFields from './EstimateFormHeaderFields';
|
import EstimateFormHeaderFields from './EstimateFormHeaderFields';
|
||||||
|
import { PageFormBigNumber } from 'components';
|
||||||
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
|
import { compose } from 'utils';
|
||||||
|
|
||||||
// Estimate form top header.
|
// Estimate form top header.
|
||||||
function EstimateFormHeader({
|
function EstimateFormHeader({
|
||||||
// #ownProps
|
// #ownProps
|
||||||
onEstimateNumberChanged,
|
onEstimateNumberChanged,
|
||||||
|
|
||||||
|
// #withSettings
|
||||||
|
baseCurrency,
|
||||||
}) {
|
}) {
|
||||||
const { values } = useFormikContext();
|
const { values } = useFormikContext();
|
||||||
|
|
||||||
@@ -33,15 +33,14 @@ function EstimateFormHeader({
|
|||||||
<PageFormBigNumber
|
<PageFormBigNumber
|
||||||
label={'Amount'}
|
label={'Amount'}
|
||||||
amount={totalDueAmount}
|
amount={totalDueAmount}
|
||||||
currencyCode={'LYD'}
|
currencyCode={baseCurrency}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withCustomers(({ customers }) => ({
|
withSettings(({ organizationSettings }) => ({
|
||||||
customers,
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
})),
|
})),
|
||||||
withDialogActions,
|
|
||||||
)(EstimateFormHeader);
|
)(EstimateFormHeader);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function EstimateFormHeader({
|
|||||||
{...momentFormatter('YYYY/MM/DD')}
|
{...momentFormatter('YYYY/MM/DD')}
|
||||||
value={tansformDateValue(value)}
|
value={tansformDateValue(value)}
|
||||||
onChange={handleDateChange((formattedDate) => {
|
onChange={handleDateChange((formattedDate) => {
|
||||||
form.setFieldValue('estimate_date', formatMessage);
|
form.setFieldValue('estimate_date', formattedDate);
|
||||||
})}
|
})}
|
||||||
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const defaultInvoice = {
|
|||||||
index: 0,
|
index: 0,
|
||||||
item_id: '',
|
item_id: '',
|
||||||
rate: '',
|
rate: '',
|
||||||
discount: '',
|
discount: 0,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
description: '',
|
description: '',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const Schema = Yup.object().shape({
|
|||||||
.max(DATATYPES_LENGTH.STRING)
|
.max(DATATYPES_LENGTH.STRING)
|
||||||
.label(formatMessage({ id: 'invoice_no_' })),
|
.label(formatMessage({ id: 'invoice_no_' })),
|
||||||
reference_no: Yup.string().min(1).max(DATATYPES_LENGTH.STRING),
|
reference_no: Yup.string().min(1).max(DATATYPES_LENGTH.STRING),
|
||||||
delivered: Yup.boolean().required(),
|
delivered: Yup.boolean(),
|
||||||
invoice_message: Yup.string()
|
invoice_message: Yup.string()
|
||||||
.trim()
|
.trim()
|
||||||
.min(1)
|
.min(1)
|
||||||
@@ -43,7 +43,7 @@ const Schema = Yup.object().shape({
|
|||||||
is: (quantity, rate) => !isBlank(quantity) && !isBlank(rate),
|
is: (quantity, rate) => !isBlank(quantity) && !isBlank(rate),
|
||||||
then: Yup.number().required(),
|
then: Yup.number().required(),
|
||||||
}),
|
}),
|
||||||
discount: Yup.number().nullable().min(0).max(DATATYPES_LENGTH.INT_10),
|
discount: Yup.number().nullable().min(0).max(100),
|
||||||
description: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
|
description: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,16 +4,20 @@ import { sumBy } from 'lodash';
|
|||||||
import { useFormikContext } from 'formik';
|
import { useFormikContext } from 'formik';
|
||||||
|
|
||||||
import { CLASSES } from 'common/classes';
|
import { CLASSES } from 'common/classes';
|
||||||
|
|
||||||
import InvoiceFormHeaderFields from './InvoiceFormHeaderFields';
|
import InvoiceFormHeaderFields from './InvoiceFormHeaderFields';
|
||||||
|
|
||||||
import { PageFormBigNumber } from 'components';
|
import { PageFormBigNumber } from 'components';
|
||||||
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
|
import { compose } from 'redux';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoice form header section.
|
* Invoice form header section.
|
||||||
*/
|
*/
|
||||||
export default function InvoiceFormHeader({
|
function InvoiceFormHeader({
|
||||||
// #ownProps
|
// #ownProps
|
||||||
onInvoiceNumberChanged,
|
onInvoiceNumberChanged,
|
||||||
|
// #withSettings
|
||||||
|
baseCurrency,
|
||||||
}) {
|
}) {
|
||||||
const { values } = useFormikContext();
|
const { values } = useFormikContext();
|
||||||
|
|
||||||
@@ -30,8 +34,13 @@ export default function InvoiceFormHeader({
|
|||||||
<PageFormBigNumber
|
<PageFormBigNumber
|
||||||
label={'Due Amount'}
|
label={'Due Amount'}
|
||||||
amount={totalDueAmount}
|
amount={totalDueAmount}
|
||||||
currencyCode={'LYD'}
|
currencyCode={baseCurrency}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export default compose(
|
||||||
|
withSettings(({ organizationSettings }) => ({
|
||||||
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
|
})),
|
||||||
|
)(InvoiceFormHeader);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React, { useEffect, useRef } from 'react';
|
|||||||
import { useHistory } from 'react-router';
|
import { useHistory } from 'react-router';
|
||||||
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
import { Alignment, Navbar, NavbarGroup } from '@blueprintjs/core';
|
||||||
import { useParams, withRouter } from 'react-router-dom';
|
import { useParams, withRouter } from 'react-router-dom';
|
||||||
|
import { FormattedMessage as T } from 'react-intl';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { pick, debounce } from 'lodash';
|
import { pick, debounce } from 'lodash';
|
||||||
|
|
||||||
@@ -82,8 +83,8 @@ function PaymentReceiveViewTabs({
|
|||||||
<NavbarGroup align={Alignment.LEFT}>
|
<NavbarGroup align={Alignment.LEFT}>
|
||||||
<DashboardViewsTabs
|
<DashboardViewsTabs
|
||||||
initialViewId={customViewId}
|
initialViewId={customViewId}
|
||||||
baseUrl={'/payment-receives'}
|
|
||||||
tabs={tabs}
|
tabs={tabs}
|
||||||
|
defaultTabText={<T id={'all_payments'}/>}
|
||||||
onNewViewTabClick={handleClickNewView}
|
onNewViewTabClick={handleClickNewView}
|
||||||
onChange={handleTabsChange}
|
onChange={handleTabsChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ function ReceiptForm({
|
|||||||
onReceiptNumberChanged={handleReceiptNumberChanged}
|
onReceiptNumberChanged={handleReceiptNumberChanged}
|
||||||
/>
|
/>
|
||||||
<ReceiptNumberWatcher receiptNumber={receiptNumber} />
|
<ReceiptNumberWatcher receiptNumber={receiptNumber} />
|
||||||
<ReceiptFormBody />
|
<ReceiptFormBody defaultReceipt ={defaultReceipt} />
|
||||||
<ReceiptFormFooter />
|
<ReceiptFormFooter />
|
||||||
<ReceiptFormFloatingActions
|
<ReceiptFormFloatingActions
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const Schema = Yup.object().shape({
|
|||||||
.min(1)
|
.min(1)
|
||||||
.max(DATATYPES_LENGTH.TEXT)
|
.max(DATATYPES_LENGTH.TEXT)
|
||||||
.label(formatMessage({ id: 'note' })),
|
.label(formatMessage({ id: 'note' })),
|
||||||
closed: Yup.boolean().required(),
|
closed: Yup.boolean(),
|
||||||
entries: Yup.array().of(
|
entries: Yup.array().of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
quantity: Yup.number()
|
quantity: Yup.number()
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ import { CLASSES } from 'common/classes';
|
|||||||
|
|
||||||
import EditableItemsEntriesTable from 'containers/Entries/EditableItemsEntriesTable';
|
import EditableItemsEntriesTable from 'containers/Entries/EditableItemsEntriesTable';
|
||||||
|
|
||||||
export default function ExpenseFormBody() {
|
export default function ExpenseFormBody({ defaultReceipt }) {
|
||||||
return (
|
return (
|
||||||
<div className={classNames(CLASSES.PAGE_FORM_BODY)}>
|
<div className={classNames(CLASSES.PAGE_FORM_BODY)}>
|
||||||
<EditableItemsEntriesTable filterSellableItems={true} />
|
<EditableItemsEntriesTable
|
||||||
|
defaultEntry={defaultReceipt}
|
||||||
|
filterSellableItems={true}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,17 @@ import { CLASSES } from 'common/classes';
|
|||||||
import ReceiptFormHeaderFields from './ReceiptFormHeaderFields';
|
import ReceiptFormHeaderFields from './ReceiptFormHeaderFields';
|
||||||
|
|
||||||
import { PageFormBigNumber } from 'components';
|
import { PageFormBigNumber } from 'components';
|
||||||
|
import withSettings from 'containers/Settings/withSettings';
|
||||||
|
import { compose } from 'redux';
|
||||||
|
|
||||||
export default function ReceiptFormHeader({
|
/**
|
||||||
|
* Receipt form header section.
|
||||||
|
*/
|
||||||
|
function ReceiptFormHeader({
|
||||||
// #ownProps
|
// #ownProps
|
||||||
onReceiptNumberChanged,
|
onReceiptNumberChanged,
|
||||||
|
// #withSettings
|
||||||
|
baseCurrency,
|
||||||
}) {
|
}) {
|
||||||
const { values } = useFormikContext();
|
const { values } = useFormikContext();
|
||||||
|
|
||||||
@@ -27,8 +34,14 @@ export default function ReceiptFormHeader({
|
|||||||
<PageFormBigNumber
|
<PageFormBigNumber
|
||||||
label={'Due Amount'}
|
label={'Due Amount'}
|
||||||
amount={totalDueAmount}
|
amount={totalDueAmount}
|
||||||
currencyCode={'LYD'}
|
currencyCode={baseCurrency}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default compose(
|
||||||
|
withSettings(({ organizationSettings }) => ({
|
||||||
|
baseCurrency: organizationSettings?.baseCurrency,
|
||||||
|
})),
|
||||||
|
)(ReceiptFormHeader);
|
||||||
|
|||||||
@@ -928,4 +928,5 @@ export default {
|
|||||||
'Are you sure you want to activate this item? You will be able to inactivate it later',
|
'Are you sure you want to activate this item? You will be able to inactivate it later',
|
||||||
inactivate_item: 'Inactivate Item',
|
inactivate_item: 'Inactivate Item',
|
||||||
activate_item: 'Activate Item',
|
activate_item: 'Activate Item',
|
||||||
|
all_payments:'All Payments'
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user