feat: add centers action (staff assignment history) (#1194)

Fixes: #1193
This commit is contained in:
Muskan Khedia
2020-08-11 18:59:13 +05:30
committed by GitHub
parent cfc27b53e2
commit c620d3145e
11 changed files with 110 additions and 4 deletions
@@ -6,3 +6,4 @@
<mifosx-edit-center-meeting *ngIf="actions['Edit Meeting']"></mifosx-edit-center-meeting>
<mifosx-edit-center-meeting-schedule *ngIf="actions['Edit Meeting Schedule']"></mifosx-edit-center-meeting-schedule>
<mifosx-manage-groups *ngIf="actions['Manage Groups']"></mifosx-manage-groups>
<mifosx-staff-assignment-history *ngIf="actions['Staff Assignment History']"></mifosx-staff-assignment-history>
@@ -21,7 +21,8 @@ export class CenterActionsComponent {
'Attach Meeting': boolean,
'Edit Meeting': boolean,
'Edit Meeting Schedule': boolean,
'Manage Groups': boolean
'Manage Groups': boolean,
'Staff Assignment History': boolean
} = {
'Activate': false,
'Assign Staff': false,
@@ -30,7 +31,8 @@ export class CenterActionsComponent {
'Attach Meeting': false,
'Edit Meeting': false,
'Edit Meeting Schedule': false,
'Manage Groups': false
'Manage Groups': false,
'Staff Assignment History': false
};
/**
@@ -0,0 +1,11 @@
<mat-card class="container">
<div class="back-button">
<button type="button" color="primary" mat-raised-button [routerLink]="['../../']">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;&nbsp;Back
</button>
</div>
<iframe [src]="pentahoUrl" frameborder="0" width=100% height="600px;"></iframe>
</mat-card>
@@ -0,0 +1,7 @@
.container {
max-width: 60rem;
.back-button {
max-height: 2%;
margin-bottom: 2%;
}
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { StaffAssignmentHistoryComponent } from './staff-assignment-history.component';
describe('StaffAssignmentHistoryComponent', () => {
let component: StaffAssignmentHistoryComponent;
let fixture: ComponentFixture<StaffAssignmentHistoryComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ StaffAssignmentHistoryComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(StaffAssignmentHistoryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,41 @@
/** Angular Imports */
import { Component, OnInit, Input } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
/** Custom Services */
import { CentersService } from '../../../centers.service';
/**
* Staff Assignment History Component
*/
@Component({
selector: 'mifosx-staff-assignment-history',
templateUrl: './staff-assignment-history.component.html',
styleUrls: ['./staff-assignment-history.component.scss']
})
export class StaffAssignmentHistoryComponent implements OnInit {
/** Staff Assignment History Data */
staffAssignmentHistoryData: any;
/** trusted resource url for pentaho output */
pentahoUrl: any;
/**
* @param {DomSanitizer} sanitizer DOM Sanitizer
*/
constructor(private sanitizer: DomSanitizer,
private route: ActivatedRoute) {
this.route.data.subscribe((data: { centersActionData: any }) => {
this.staffAssignmentHistoryData = data.centersActionData;
});
}
ngOnInit() {
const contentType = this.staffAssignmentHistoryData.headers.get('Content-Type');
const file = new Blob([this.staffAssignmentHistoryData.body], { type: contentType });
const filecontent = URL.createObjectURL(file);
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
}
}
@@ -83,7 +83,7 @@
<span *ngIf="centerViewData.status.value==='Active' && !(centerViewData.collectionMeetingCalendar)">
<button mat-menu-item *mifosxHasPermission="'CREATE_MEETING'" (click)="doAction('Attach Meeting')"> Attach Meeting </button>
</span>
<button mat-menu-item *mifosxHasPermission="'READ_Staff Assignment History'" > Staff Assignment History </button>
<button mat-menu-item *mifosxHasPermission="'READ_Staff Assignment History'" (click)="doAction('Staff Assignment History')"> Staff Assignment History </button>
</mat-menu>
</mat-card-actions>
</mat-card-header>
@@ -75,6 +75,7 @@ export class CentersViewComponent implements OnInit {
case 'Attendance':
case 'Attach Meeting':
case 'Manage Groups':
case 'Staff Assignment History':
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
break;
case 'Edit Meeting':