Skip to content

Commit

Permalink
Merge branch 'feature/unknown-option-producer' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
tsubik committed Dec 5, 2023
2 parents e92a2f3 + 1f8b99e commit af372dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/app/pages/observations/observation-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</otp-operator-detail>
</otp-modal>

<form *ngIf="!loading" name="form" class="c-form" (ngSubmit)="!isDisabled() && f.valid && onSubmitForReview()" #f="ngForm" novalidate>
<form *ngIf="!loading" name="form" class="c-form" (ngSubmit)="!isDisabled() && !unknownOperatorSelected && f.valid && onSubmitForReview()" #f="ngForm" novalidate>
<div class="c-container -j-between -t-d-column -t-a-start">
<h2 *ngIf="isDisabled() && !isCopied">{{'Observation details' | translate}}</h2>
<h2 *ngIf="(!isDisabled() && !observation) || isCopied">{{'New observation' | translate}}</h2>
Expand Down Expand Up @@ -196,7 +196,7 @@ <h3>{{'Upload report' | translate}}</h3>
</div>

<!-- 3. Operator -->
<div class="form-group -required" [ngClass]="{ 'has-error': f.submitted && !operator_id.valid }">
<div class="form-group -required" [ngClass]="{ 'has-error': f.submitted && (!operator_id.valid || unknownOperatorSelected) }">
<label for="operator_id">{{'Operator' | translate}}</label>
<ss-multiselect-dropdown
[texts]="multiSelectTexts"
Expand All @@ -207,8 +207,10 @@ <h3>{{'Upload report' | translate}}</h3>
name="operator_id"
#operator_id="ngModel"
[disabled]="isDisabled()"
required
></ss-multiselect-dropdown>
<div *ngIf="f.submitted && !operator_id.valid" class="help-text">{{'Please select an operator' | translate}}</div>
<div *ngIf="unknownOperatorSelected" class="help-text">{{'You will not be able to submit this observation to review with unknown operator selected' | translate}}</div>
<div class="note" *ngIf="!isDisabled()">
<button type="button" class="c-button -primary" (click)="onClickAddOperator('operator')">{{'Add a new producer to the list' | translate}}</button>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/app/pages/observations/observation-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ export class ObservationDetailComponent implements OnDestroy {
this.operatorsSelection = [];
}
}
get unknownOperatorSelected() {
return this.operatorChoice && this.unknownOperator && +this.operatorChoice.id === +this.unknownOperator.id;
}

get fmu() { return this.observation ? this.observation.fmu : this._fmu; }
set fmu(fmu) {
Expand Down
3 changes: 2 additions & 1 deletion src/assets/locale/zu.json
Original file line number Diff line number Diff line change
Expand Up @@ -396,5 +396,6 @@
"Please pick sub-category first.": "Please pick sub-category first.",
"Add a new government entity to the list": "Add a new government entity to the list",
"Add a new producer to the list": "Add a new producer to the list",
"Please select an existing report or upload a new one": "Please select an existing report or upload a new one"
"Please select an existing report or upload a new one": "Please select an existing report or upload a new one",
"You will not be able to submit this observation to review with unknown operator selected": "You will not be able to submit this observation to review with unknown operator selected"
}

0 comments on commit af372dd

Please sign in to comment.