mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-13 11:20:31 +00:00
revert: form changes
This commit is contained in:
@@ -29,7 +29,7 @@ export default function EstimateFloatingActions() {
|
||||
|
||||
// Handle submit & deliver button click.
|
||||
const handleSubmitDeliverBtnClick = (event) => {
|
||||
setSubmitPayload({ redirect: false, deliverViaMail: true });
|
||||
setSubmitPayload({ redirect: true, deliver: true });
|
||||
submitForm();
|
||||
};
|
||||
|
||||
|
||||
@@ -36,16 +36,11 @@ import {
|
||||
handleErrors,
|
||||
resetFormState,
|
||||
} from './utils';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
|
||||
/**
|
||||
* Estimate form.
|
||||
*/
|
||||
function EstimateForm({
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #withSettings
|
||||
estimateNextNumber,
|
||||
estimateNumberPrefix,
|
||||
@@ -113,7 +108,7 @@ function EstimateForm({
|
||||
delivered: submitPayload.deliver,
|
||||
};
|
||||
// Handle the request success.
|
||||
const onSuccess = (res) => {
|
||||
const onSuccess = (response) => {
|
||||
AppToaster.show({
|
||||
message: intl.get(
|
||||
isNewMode
|
||||
@@ -131,11 +126,6 @@ function EstimateForm({
|
||||
if (submitPayload.resetForm) {
|
||||
resetFormState({ resetForm, initialValues, values });
|
||||
}
|
||||
if (submitPayload.deliverViaMail) {
|
||||
openDialog(DialogsName.EstimateFormMailDeliver, {
|
||||
estimateId: res.data.id,
|
||||
});
|
||||
}
|
||||
};
|
||||
// Handle the request error.
|
||||
const onError = ({
|
||||
@@ -190,7 +180,6 @@ function EstimateForm({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withDialogActions,
|
||||
withSettings(({ estimatesSettings }) => ({
|
||||
estimateNextNumber: estimatesSettings?.nextNumber,
|
||||
estimateNumberPrefix: estimatesSettings?.numberPrefix,
|
||||
|
||||
@@ -30,19 +30,19 @@ export default function InvoiceFloatingActions() {
|
||||
const { setSubmitPayload, invoice } = useInvoiceFormContext();
|
||||
|
||||
// Handle submit & deliver button click.
|
||||
const handleSubmitDeliverBtnClick = () => {
|
||||
setSubmitPayload({ redirectToEdit: true, deliverViaMail: true });
|
||||
const handleSubmitDeliverBtnClick = (event) => {
|
||||
setSubmitPayload({ redirect: true, deliver: true });
|
||||
submitForm();
|
||||
};
|
||||
|
||||
// Handle submit, deliver & new button click.
|
||||
const handleSubmitDeliverAndNewBtnClick = () => {
|
||||
const handleSubmitDeliverAndNewBtnClick = (event) => {
|
||||
setSubmitPayload({ redirect: false, deliver: true, resetForm: true });
|
||||
submitForm();
|
||||
};
|
||||
|
||||
// Handle submit, deliver & continue editing button click.
|
||||
const handleSubmitDeliverContinueEditingBtnClick = () => {
|
||||
const handleSubmitDeliverContinueEditingBtnClick = (event) => {
|
||||
setSubmitPayload({ redirect: false, deliver: true });
|
||||
submitForm();
|
||||
};
|
||||
|
||||
@@ -34,20 +34,12 @@ import {
|
||||
transformValueToRequest,
|
||||
resetFormState,
|
||||
} from './utils';
|
||||
import {
|
||||
InvoiceExchangeRateSync,
|
||||
InvoiceNoSyncSettingsToForm,
|
||||
} from './components';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { InvoiceExchangeRateSync, InvoiceNoSyncSettingsToForm } from './components';
|
||||
|
||||
/**
|
||||
* Invoice form.
|
||||
*/
|
||||
function InvoiceForm({
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #withSettings
|
||||
invoiceNextNumber,
|
||||
invoiceNumberPrefix,
|
||||
@@ -119,7 +111,7 @@ function InvoiceForm({
|
||||
from_estimate_id: estimateId,
|
||||
};
|
||||
// Handle the request success.
|
||||
const onSuccess = (res) => {
|
||||
const onSuccess = () => {
|
||||
AppToaster.show({
|
||||
message: intl.get(
|
||||
isNewMode
|
||||
@@ -131,11 +123,6 @@ function InvoiceForm({
|
||||
});
|
||||
setSubmitting(false);
|
||||
|
||||
if (submitPayload.deliverViaMail) {
|
||||
openDialog(DialogsName.InvoiceFormMailDeliver, {
|
||||
invoiceId: res.data.id,
|
||||
});
|
||||
}
|
||||
if (submitPayload.redirect) {
|
||||
history.push('/invoices');
|
||||
}
|
||||
@@ -214,5 +201,4 @@ export default compose(
|
||||
invoiceTermsConditions: invoiceSettings?.termsConditions,
|
||||
})),
|
||||
withCurrentOrganization(),
|
||||
withDialogActions,
|
||||
)(InvoiceForm);
|
||||
|
||||
@@ -34,20 +34,12 @@ import {
|
||||
transformFormValuesToRequest,
|
||||
resetFormState,
|
||||
} from './utils';
|
||||
import {
|
||||
ReceiptSyncAutoExRateToForm,
|
||||
ReceiptSyncIncrementSettingsToForm,
|
||||
} from './components';
|
||||
import withDialogActions from '@/containers/Dialog/withDialogActions';
|
||||
import { DialogsName } from '@/constants/dialogs';
|
||||
import { ReceiptSyncAutoExRateToForm, ReceiptSyncIncrementSettingsToForm } from './components';
|
||||
|
||||
/**
|
||||
* Receipt form.
|
||||
*/
|
||||
function ReceiptForm({
|
||||
// #withDialogActions
|
||||
openDialog,
|
||||
|
||||
// #withSettings
|
||||
receiptNextNumber,
|
||||
receiptNumberPrefix,
|
||||
@@ -92,7 +84,10 @@ function ReceiptForm({
|
||||
}),
|
||||
};
|
||||
// Handle the form submit.
|
||||
const handleFormSubmit = (values, { setErrors, setSubmitting }) => {
|
||||
const handleFormSubmit = (
|
||||
values,
|
||||
{ setErrors, setSubmitting, resetForm },
|
||||
) => {
|
||||
const entries = values.entries.filter(
|
||||
(item) => item.item_id && item.quantity,
|
||||
);
|
||||
@@ -129,11 +124,6 @@ function ReceiptForm({
|
||||
if (submitPayload.resetForm) {
|
||||
resetFormState();
|
||||
}
|
||||
if (submitPayload.deliverMail) {
|
||||
openDialog(DialogsName.ReceiptFormMailDeliver, {
|
||||
receiptId: response.data.id,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Handle the request error.
|
||||
@@ -189,7 +179,6 @@ function ReceiptForm({
|
||||
}
|
||||
|
||||
export default compose(
|
||||
withDialogActions,
|
||||
withDashboardActions,
|
||||
withSettings(({ receiptSettings }) => ({
|
||||
receiptNextNumber: receiptSettings?.nextNumber,
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function ReceiptFormFloatingActions() {
|
||||
|
||||
// Handle submit & close button click.
|
||||
const handleSubmitCloseBtnClick = (event) => {
|
||||
setSubmitPayload({ redirect: false, deliverMail: true, status: true });
|
||||
setSubmitPayload({ redirect: true, status: true });
|
||||
submitForm();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user