Skip to content

Commit

Permalink
[Upd #18] Added validation for reject and complete buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Dec 13, 2023
1 parent 5eff6b2 commit cf1c5c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/components/record/Record.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import HorizontalInput from "../HorizontalInput";
import RecordForm from "./RecordForm";
import RecordProvenance from "./RecordProvenance";
import RequiredAttributes from "./RequiredAttributes";
import {ACTION_STATUS, ALERT_TYPES, EXTENSION_CONSTANTS, ROLE} from "../../constants/DefaultConstants";
import {ACTION_STATUS, ALERT_TYPES, EXTENSION_CONSTANTS, RECORD_PHASE, ROLE} from "../../constants/DefaultConstants";
import AlertMessage from "../AlertMessage";
import {LoaderCard, LoaderSmall} from "../Loader";
import {processTypeaheadOptions} from "./TypeaheadAnswer";
Expand Down Expand Up @@ -120,15 +120,15 @@ class Record extends React.Component {
{EXTENSIONS === EXTENSION_CONSTANTS.SUPPLIER &&
<Button className="mx-1" variant='danger' size='sm'
disabled={formgen.status === ACTION_STATUS.PENDING || recordSaved.status === ACTION_STATUS.PENDING
|| !this.state.isFormValid || !record.state.isComplete()}
|| !this.state.isFormValid || !record.state.isComplete()|| record.phase === RECORD_PHASE.REJECTED}
onClick={this.props.handlers.onReject}>
{this.i18n('reject')}{recordSaved.status === ACTION_STATUS.PENDING && <LoaderSmall/>}
</Button>
}
{EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR &&
<Button className="mx-1" variant='success' size='sm'
disabled={formgen.status === ACTION_STATUS.PENDING || recordSaved.status === ACTION_STATUS.PENDING
|| !this.state.isFormValid || !record.state.isComplete()}
|| !this.state.isFormValid || !record.state.isComplete() || record.phase === RECORD_PHASE.COMPLETED}
onClick={this.props.handlers.onComplete}>
{this.i18n('complete')}{recordSaved.status === ACTION_STATUS.PENDING && <LoaderSmall/>}
</Button>}
Expand Down

0 comments on commit cf1c5c9

Please sign in to comment.