Skip to content

Commit

Permalink
2380 Disable Transaction Page "Save" Button (#2406)
Browse files Browse the repository at this point in the history
* Disable Save button if vehicle supplier, transaction type, or effective date is not entered.

* Disable "Submit to Director" button if credit quantity is missing.
  • Loading branch information
rogerlcleung authored Jan 2, 2025
1 parent bc1c9a3 commit cf8f899
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const CreditAgreementsDetailsPage = (props) => {
user,
} = props;

const typesExemptFromCreditContent = [
"Automatic Administrative Penalty"
];

const [showModal, setShowModal] = useState(false);
const showComments =
details?.filteredIdirComments && details?.filteredIdirComments.length > 0;
Expand Down Expand Up @@ -301,6 +305,15 @@ const CreditAgreementsDetailsPage = (props) => {
buttonType="submit"
optionalClassname="button primary"
optionalText="Submit to Director"
disabled={
!typesExemptFromCreditContent.includes(details.transactionType) && (
details.creditAgreementContent.length === 0 ||
details.creditAgreementContent.some(content => content.numberOfCredits == 0)
)
}
buttonTooltip={
`Please fill in all quantities of credits to enable the "Submit to Director" button.`
}
action={() => {
setShowModal(true);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,14 @@ const CreditAgreementsForm = (props) => {
buttonType="save"
optionalClassname="button primary"
optionalText="Save"
disabled={
!agreementDetails.vehicleSupplier ||
!agreementDetails.transactionType ||
!agreementDetails.effectiveDate
}
buttonTooltip={
`Please fill in all the required fields to enable the "Save" button.`
}
action={() => {
handleSubmit('')
}}
Expand Down

0 comments on commit cf8f899

Please sign in to comment.