Skip to content

Commit

Permalink
Add view/edit record buttons to collections edit
Browse files Browse the repository at this point in the history
  • Loading branch information
BcGovNeal committed Apr 6, 2021
1 parent 87c7efd commit ba4ca55
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ <h3 class="border-0 mb-0">Associated Records</h3>
<i class="material-icons">more_vert</i>
</button>
<mat-menu #menu="matMenu">
<button
mat-menu-item
(click)="goToRecordDetails(idx)"
title="View record details">
View Record Details
</button>
<button
mat-menu-item
(click)="goToRecordEdit(idx)"
title="Edit record">
Edit Record
</button>
<button
mat-menu-item
(click)="removeRecordFromCollection(idx)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,28 @@ export class MinesCollectionsAddEditComponent implements OnInit, OnDestroy {
this.myForm.get('collectionRecords').markAsDirty();
}

/**
* Navigate to record details page.
*
* @memberof MinesCollectionsAddEditComponent
*/
goToRecordDetails(idx: number) {
const recordControl = (this.myForm.get('collectionRecords') as FormArray).at(idx);
const record = recordControl.value.record;
window.open(`/mines/${this.mine._id}/records/${record._id}/detail`, '_blank');
}

/**
* Navigate to record details page.
*
* @memberof MinesCollectionsAddEditComponent
*/
goToRecordEdit(idx: number) {
const recordControl = (this.myForm.get('collectionRecords') as FormArray).at(idx);
const record = recordControl.value.record;
window.open(`/mines/${this.mine._id}/records/${record._id}/edit`, '_blank');
}

/**
* Submit form data to API.
*
Expand Down

0 comments on commit ba4ca55

Please sign in to comment.