mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: inventory adjustment form loading button state.
This commit is contained in:
@@ -18,7 +18,8 @@ function InventoryAdjustmentFloatingActions({
|
|||||||
const { isSubmitting, submitForm } = useFormikContext();
|
const { isSubmitting, submitForm } = useFormikContext();
|
||||||
|
|
||||||
// Inventory adjustment dialog context.
|
// Inventory adjustment dialog context.
|
||||||
const { dialogName, setSubmitPayload } = useInventoryAdjContext();
|
const { dialogName, setSubmitPayload, submitPayload } =
|
||||||
|
useInventoryAdjContext();
|
||||||
|
|
||||||
// handle submit as draft button click.
|
// handle submit as draft button click.
|
||||||
const handleSubmitDraftBtnClick = (event) => {
|
const handleSubmitDraftBtnClick = (event) => {
|
||||||
@@ -34,27 +35,34 @@ function InventoryAdjustmentFloatingActions({
|
|||||||
|
|
||||||
// Handle close button click.
|
// Handle close button click.
|
||||||
const handleCloseBtnClick = (event) => {
|
const handleCloseBtnClick = (event) => {
|
||||||
closeDialog(dialogName)
|
closeDialog(dialogName);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={Classes.DIALOG_FOOTER}>
|
<div className={Classes.DIALOG_FOOTER}>
|
||||||
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
||||||
<Button onClick={handleCloseBtnClick} style={{ minWidth: '75px' }}>
|
<Button
|
||||||
|
disabled={isSubmitting}
|
||||||
|
onClick={handleCloseBtnClick}
|
||||||
|
style={{ minWidth: '75px' }}
|
||||||
|
>
|
||||||
<T id={'close'} />
|
<T id={'close'} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
|
loading={isSubmitting && !submitPayload.publish}
|
||||||
style={{ minWidth: '75px' }}
|
style={{ minWidth: '75px' }}
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={handleSubmitDraftBtnClick}
|
onClick={handleSubmitDraftBtnClick}
|
||||||
>
|
>
|
||||||
{<T id={'save_as_draft'} />}
|
{<T id={'save_as_draft'} />}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
intent={Intent.PRIMARY}
|
intent={Intent.PRIMARY}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
|
loading={isSubmitting && submitPayload.publish}
|
||||||
style={{ minWidth: '75px' }}
|
style={{ minWidth: '75px' }}
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={handleSubmitMakeAdjustmentBtnClick}
|
onClick={handleSubmitMakeAdjustmentBtnClick}
|
||||||
@@ -66,6 +74,4 @@ function InventoryAdjustmentFloatingActions({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose(
|
export default compose(withDialogActions)(InventoryAdjustmentFloatingActions);
|
||||||
withDialogActions
|
|
||||||
)(InventoryAdjustmentFloatingActions);
|
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ function InventoryAdjustmentForm({
|
|||||||
createInventoryAdjMutate,
|
createInventoryAdjMutate,
|
||||||
} = useInventoryAdjContext();
|
} = useInventoryAdjContext();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Initial form values.
|
// Initial form values.
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
...defaultInitialValues,
|
...defaultInitialValues,
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ function ItemCategoryFormFooter({
|
|||||||
return (
|
return (
|
||||||
<div className={Classes.DIALOG_FOOTER}>
|
<div className={Classes.DIALOG_FOOTER}>
|
||||||
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
|
||||||
<Button onClick={handleCloseBtnClick}>
|
<Button disabled={isSubmitting} onClick={handleCloseBtnClick}>
|
||||||
<T id={'close'} />
|
<T id={'close'} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button intent={Intent.PRIMARY} type="submit" disabled={isSubmitting}>
|
<Button intent={Intent.PRIMARY} type="submit" loading={isSubmitting}>
|
||||||
{isNewMode ? <T id={'submit'} /> : <T id={'edit'} />}
|
{isNewMode ? <T id={'submit'} /> : <T id={'edit'} />}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ function EstimateFormHeader({
|
|||||||
form.setFieldValue('customer_id', customer.id);
|
form.setFieldValue('customer_id', customer.id);
|
||||||
}}
|
}}
|
||||||
popoverFill={true}
|
popoverFill={true}
|
||||||
|
intent={inputIntent({ error, touched })}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user