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

NRPT-729: add bcmi admin penalties to mine enforcement actions #862

Merged
merged 7 commits into from
Jun 24, 2021
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
@@ -1,4 +1,5 @@
import { Component, HostListener, OnInit, ChangeDetectorRef } from '@angular/core';
import { Router } from '@angular/router';
import { TableRowComponent } from 'nrpti-angular-components';
import { FactoryService } from '../../../services/factory.service';

Expand All @@ -12,6 +13,7 @@ export class EnforcementActionsTableRowComponent extends TableRowComponent imple
public factoryService: FactoryService;

constructor(
private router: Router,
public changeDetectionRef: ChangeDetectorRef
) {
super();
Expand All @@ -26,12 +28,24 @@ export class EnforcementActionsTableRowComponent extends TableRowComponent imple
return this.rowData[attribute] || '-';
}

private getSchemaRoute(schemaName) {
switch (schemaName) {
case 'AdministrativePenalty':
return 'administrative-penalties';
case 'CourtConviction':
return 'court-convictions';
}
}
goToDetails() {
// to be implemented
this.router.navigate(
['mines', 'enforcement-actions', this.getSchemaRoute(this.rowData._schemaName), this.rowData._id]
);
}

goToEdit() {
// to be implemented
this.router.navigate(
['mines', 'enforcement-actions', this.getSchemaRoute(this.rowData._schemaName), this.rowData._id, 'edit']
);
}

publish() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class EnforcementActionsComponent implements OnInit {


add(item) {
this.router.navigate(['records', item, 'add']);
this.router.navigate(['mines', 'enforcement-actions', item, 'add']);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
<main class="container-fluid-padding">
<form *ngIf="!loading" [formGroup]="myForm" novalidate>
<section>
<div class="row">
<div class="col-6">
<h4 class="blue-header">{{ componentTitle }}</h4>
<span *ngIf="isEditing" class="grey-subtext ml-2">{{ lastEditedSubText }}</span>
</div>
<div class="col-6 right-justified-action-btn">
<div class="row mb-2">
<div class="col-12">
<button type="button" class="btn btn-link" (click)="cancel()">Cancel</button>
<button class="btn btn-primary" type="submit" (click)="submit()">
<em class="material-icons">
save
</em>
&nbsp;
<span *ngIf="!isEditing">Save Record</span>
<span *ngIf="isEditing">Update Record</span>
</button>
</div>
</div>
<div class="row">
<div class="col-7"></div>
<div class="col-5">
<span class="grey-subtext">
If content is published on any site, clicking the Save/Update Record button will update the public site
immediately
</span>
</div>
</div>
</div>
</div>
<h4>Basic Information</h4>
<div class="flex-container">
<div class="label-pair" *ngIf="myForm && myForm.controls.dateIssued">
<label for="dateIssued">Date Issued</label>
<lib-date-picker
[control]="myForm.controls.dateIssued"
[isValidate]="true"
[minDate]="datepickerMinDate"
[maxDate]="datepickerMaxDate">
</lib-date-picker>
</div>
<div class="label-pair">
<label for="recordType">Type</label>
<span class="grey-subtext ml-2">(This value cannot be changed)</span>
<input
readonly
name="recordType"
id="recordType"
type="text"
value="Administrative Penalty"
class="form-control" />
</div>
<div class="label-pair">
<label for="issuingAgency">Issuing Agency</label>
<input
readonly
name="issuingAgency"
id="issuingAgency"
type="text"
value="{{ this.convertAcronyms(defaultAgency) }}"
class="form-control" />
</div>
<div class="label-pair">
<label for="author">Author</label>
<input
readonly
name="author"
id="author"
type="text"
value="{{ defaultAuthor }}"
class="form-control" />
</div>
<div class="label-pair">
<label for="recordName">Record Name</label>
<input name="recordName" id="recordName" type="text" formControlName="recordName" class="form-control" />
</div>
</div>
<record-association-edit
[formGroup]="this.myForm.get('association')"
[mines]="this.storeService.getItem('mines')"
[epicProjects]="[]"
[minesOnly]="true"
(mineLocation)="mineLocation = $event"
>
</record-association-edit>
</section>

<section>
<h4>Contravention</h4>
<app-legislation-add-edit [formGroup]="this.myForm.get('legislation')"></app-legislation-add-edit>
<div class="flex-container">
<div class="label-pair">
<label for="offence">Offence</label>
<input readonly name="offence" id="offence" formControlName="offence" class="form-control" />
<span
*ngIf="this.myForm.get('legislation.act').value && !this.myForm.get('offence').value"
class="grey-subtext"
>
No description available for the selected combination of act, regulation, section, subsection and paragraph.
Please double-check that you have filled out those fields correctly; if they are correct, please contact the
system administrator at
<a href="mailto:[email protected]">[email protected]</a>
to request a new description be added to the system.
</span>
</div>
</div>
<h4>Penalties</h4>
<app-penalty-add-edit [formArray]="this.myForm.controls.penalties"></app-penalty-add-edit>
</section>

<section>
<h4>Issued To</h4>
<div class="flex-container">
<div class="label-pair">
<label for="projectName">Project</label>
<span class="grey-subtext ml-2">(If Applicable)</span>
<div name="projectName" class="radio-group">
<div class="radio">
<input default type="radio" id="Other" value="" formControlName="projectName" name="projectName" />
<label for="Other">Other</label>
</div>
<div class="radio">
<input
type="radio"
id="coastalGaslink"
value="Coastal Gaslink"
formControlName="projectName"
name="projectName" />
<label for="coastalGaslink">Coastal Gaslink</label>
</div>
<div class="radio">
<input type="radio" id="lngCanada" value="LNG Canada" formControlName="projectName" name="projectName" />
<label for="lngCanada">LNG Canada</label>
</div>
</div>
</div>
</div>
<app-entity-add-edit [formGroup]="this.myForm.controls.issuedTo"></app-entity-add-edit>
</section>

<section>
<h4>Location Details</h4>
<div class="flex-container">
<div class="label-pair">
<label for="location">Location Description</label>
<input name="location" id="location" type="text" formControlName="location" class="form-control" />
</div>
<div class="label-pair xsm">
<label for="latitude">Latitude</label>
<input name="latitude" id="latitude" type="number" formControlName="latitude" class="form-control" />
</div>
<div class="label-pair xsm">
<label for="longitude">Longitude</label>
<input name="longitude" id="longitude" type="number" formControlName="longitude" class="form-control" />
</div>
</div>
</section>

<section>
<h4>Documents</h4>
<app-document-edit
[documents]="currentRecord ? currentRecord.documents : []"
(documentsToDelete)="documentsToDelete = $event"></app-document-edit>
<app-document-link-staging
(linksChanged)="links = $event"
(documentsChanged)="documents = $event"></app-document-link-staging>
</section>

<section>
<div class="row mb-4">
<div class="col-2">
<h4 class="blue-header mb-0">BMCI Site Content</h4>
<span class="grey-subtext d-block">{{ bcmiPublishSubtext }}</span>
</div>
<div class="col-4">
<mat-slide-toggle
name="publishBcmi"
id="publishBcmi"
formControlName="publishBcmi"
(change)="togglePublish($event, 'bcmi')"
[checked]="myForm.controls.publishBcmi.value"
ngDefaultControl>
{{ myForm.controls.publishBcmi.value ? 'Published' : 'Unpublished' }}
</mat-slide-toggle>
<span class="grey-subtext d-block">*Changes made will take effect once you click "Update Record"</span>
</div>
</div>
<div class="flex-container">
<div class="label-pair med">
<label for="bcmiSummary">Summmary</label>
<textarea
name="bcmiSummary"
id="bcmiSummary"
type="text"
formControlName="bcmiSummary"
class="form-control"
rows="5"></textarea>
</div>
</div>
</section>
<section>
<div class="row mb-4">
<div class="col-2">
<h4 class="blue-header mb-0">NRCED Site Content</h4>
<span class="grey-subtext d-block">{{ nrcedPublishSubtext }}</span>
</div>
<div class="col-4">
<mat-slide-toggle
name="publishNrced"
id="publishNrced"
formControlName="publishNrced"
(change)="togglePublish($event, 'nrced')"
[checked]="myForm.controls.publishNrced.value"
ngDefaultControl>
{{ myForm.controls.publishNrced.value ? 'Published' : 'Unpublished' }}
</mat-slide-toggle>
<span class="grey-subtext d-block">*Changes made will take effect once you click "Update Record"</span>
</div>
</div>
<div class="flex-container">
<div class="label-pair med">
<label for="nrcedSummary">Summary</label>
<textarea
name="nrcedSummary"
id="nrcedSummary"
type="text"
formControlName="nrcedSummary"
class="form-control"
rows="5"></textarea>
</div>
</div>
</section>
</form>
<div class="row mt-4">
<div class="col-6"></div>
<div class="col-6 right-justified-action-btn">
<div class="row mb-2">
<div class="col-12">
<button type="button" class="btn btn-link" (click)="cancel()">Cancel</button>
<button class="btn btn-primary" type="submit" (click)="submit()">
<em class="material-icons">
save
</em>
&nbsp;
<span *ngIf="!isEditing">Save Record</span>
<span *ngIf="isEditing">Update Record</span>
</button>
</div>
</div>
<div class="row">
<div class="col-7"></div>
<div class="col-5">
<span class="grey-subtext">
If content is published on any site, clicking the Save/Update Record button will update the public site
immediately
</span>
</div>
</div>
</div>
</div>
</main>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@import "assets/styles/base/base.scss";
@import "assets/styles/components/add-edit.scss";

.grey-subtext {
color: $gray6;
font-size: 15px;
font-style: italic;
}

.blue-header {
display: inline-block;
color: $content-header-color;
}

.right-justified-action-btn {
text-align: right;
}

section {
border-bottom: 1px solid lightgrey;
}
Loading