Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Draft Report Save Issue #1851 #1925

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ const ComplianceObligationDetailsPage = (props) => {
} = props

const [showModal, setShowModal] = useState(false)
const [buttonClicked, setButtonClicked] = useState(false)

const handleButtonClick = () => {
handleSave();
setButtonClicked(true);
};

let disabledCheckboxes = ''
let hoverText = ''

Expand Down Expand Up @@ -212,14 +219,14 @@ const ComplianceObligationDetailsPage = (props) => {
{!user.isGovernment && (
<Button
buttonType="save"
disabled={
disabled={ buttonClicked ||
['SAVED', 'UNSAVED'].indexOf(
statuses.complianceObligation.status
) < 0
}
optionalClassname="button primary"
action={() => {
handleSave()
handleButtonClick()
}}
/>
)}
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/compliance/components/ConsumerSalesDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ const ConsumerSalesDetailsPage = (props) => {
} = props

const [showModal, setShowModal] = useState(false)
const [buttonClicked, setButtonClicked] = useState(false)
let disabledCheckboxes = propsDisabledCheckboxes

const handleButtonClick = (event) => {
handleSave(event);
setButtonClicked(true);
};

if (loading) {
return <Loading />
}
Expand Down Expand Up @@ -208,14 +214,14 @@ const ConsumerSalesDetailsPage = (props) => {
{!user.isGovernment && (
<Button
buttonType="save"
disabled={
disabled={ buttonClicked ||
['SAVED', 'UNSAVED'].indexOf(
statuses.consumerSales.status
) < 0 || disableSave()
}
optionalClassname="button primary"
action={(event) => {
handleSave(event)
handleButtonClick(event)
}}
/>
)}
Expand Down Expand Up @@ -254,4 +260,4 @@ ConsumerSalesDetailsPage.propTypes = {
modelYear: PropTypes.number.isRequired,
statuses: PropTypes.shape().isRequired
}
export default ConsumerSalesDetailsPage
export default ConsumerSalesDetailsPage
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ const SupplierInformationDetailsPage = (props) => {
id
} = props
const [showModal, setShowModal] = useState(false)
const [buttonClicked, setButtonClicked] = useState(false)
let disabledCheckboxes = propsDisabledCheckboxes
let disabledInputs = false
if (loading) {
return <Loading />
}

const handleButtonClick = (event) => {
handleSubmit(event);
setButtonClicked(true);
};

const modal = (
<Modal
cancelLabel="No"
Expand Down Expand Up @@ -345,14 +351,14 @@ const SupplierInformationDetailsPage = (props) => {
{!user.isGovernment && (
<Button
buttonType="save"
disabled={
disabled={ buttonClicked ||
['SAVED', 'UNSAVED'].indexOf(
statuses.supplierInformation.status
) < 0
}
optionalClassname="button primary"
action={(event) => {
handleSubmit(event)
handleButtonClick(event)
}}
/>
)}
Expand Down Expand Up @@ -395,4 +401,4 @@ SupplierInformationDetailsPage.propTypes = {
modelYear: PropTypes.number.isRequired,
statuses: PropTypes.shape().isRequired
}
export default SupplierInformationDetailsPage
export default SupplierInformationDetailsPage