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