Skip to content

Commit

Permalink
Admin ability to edit special closure status and text (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher-walsh22 authored Apr 10, 2024
1 parent e774c8e commit ce58c24
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
[ariaLabel]="'Park Visibility'"
>
</app-toggle>
<app-toggle
[control]="fields?.parkSpecialClosure"
[description]="'Status: '"
[trueText]="'Special closure notice'"
[falseText]="'Special closure notice'"
[id]="'specialClosure'"
[ariaLabel]="'Park Visibility'"
>
</app-toggle>
</section>

<section class="form-section">
Expand Down Expand Up @@ -129,6 +138,16 @@ <h4>Changes to park information will be reflected in the BC Parks Day Pass Reser
>
</app-wysiwyg-input>
</section>

<section class="form-section">
<app-wysiwyg-input *ngIf="fields?.parkSpecialClosure.value === true"
[control]="fields?.parkSpecialClosureText"
[label]="'Special Closure Statement'"
[ariaLabel]="'Special Closure Statement'"
[id]="'parkSpecialClosureText'"
>
</app-wysiwyg-input>
</section>
</form>

<section class="d-flex flex-row-reverse mt-4 mx-4">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ describe('ParkEditFormComponent', () => {
videoLink: null,
status: mockPark.status,
capacity: mockPark.capacity,
specialClosureText: null,
specialClosure: null
},
description: mockPark.description,
visible: mockPark.visible,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class ParkEditFormComponent extends BaseFormComponent {
this.data.status === 'open' ? true : false
),
parkVisibility: new UntypedFormControl(this.data.visible),
parkSpecialClosure: new UntypedFormControl(this.data.specialClosure),
parkCapacity: new UntypedFormControl(this.data.capacity),
parkSiteLink: new UntypedFormControl(
this.data.bcParksLink,
Expand All @@ -75,6 +76,7 @@ export class ParkEditFormComponent extends BaseFormComponent {
parkMapLink: new UntypedFormControl(this.data.mapLink),
parkVideoLink: new UntypedFormControl(this.data.videoLink),
parkDescription: new UntypedFormControl(this.data.description),
parkSpecialClosureText: new UntypedFormControl(this.data.specialClosureText),
});
super.updateForm();
super.addDisabledRule(this.fields.parkOrcs);
Expand All @@ -93,7 +95,7 @@ export class ParkEditFormComponent extends BaseFormComponent {
this.parkService.putPark(postObj, true, true);
this.navigateBack();
}

onFormReset() {
super.reset();
this.setForm();
Expand All @@ -110,6 +112,8 @@ export class ParkEditFormComponent extends BaseFormComponent {
videoLink: results.parkVideoLink,
status: results.parkStatus === true ? 'open' : 'closed',
capacity: results.parkCapacity,
specialClosure: results.parkSpecialClosure,
specialClosureText: results.parkSpecialClosureText,
},
description: results.parkDescription,
visible: results.parkVisibility,
Expand Down Expand Up @@ -179,7 +183,10 @@ export class ParkEditFormComponent extends BaseFormComponent {
`</br></br><strong>Link to video:</strong></br>` + parkObj.park?.videoLink;
message +=
`</br></br><strong>Description:</strong></br>` + parkObj.description;
return message;
if(parkObj.park?.specialClosureText){
message += `</br><strong>Special Closure Text: </strong></br>` + parkObj.park?.specialClosureText;
}
return message;
}

testParkSiteLink(event) {
Expand Down

0 comments on commit ce58c24

Please sign in to comment.