feat: add centers action (staff assignment history) (#1194)
Fixes: #1193
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+11
@@ -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> Back
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<iframe [src]="pentahoUrl" frameborder="0" width=100% height="600px;"></iframe>
|
||||
|
||||
</mat-card>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
.container {
|
||||
max-width: 60rem;
|
||||
.back-button {
|
||||
max-height: 2%;
|
||||
margin-bottom: 2%;
|
||||
}
|
||||
}
|
||||
+25
@@ -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();
|
||||
});
|
||||
});
|
||||
+41
@@ -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':
|
||||
|
||||
@@ -25,6 +25,7 @@ import { AttachCenterMeetingComponent } from './centers-view/center-actions/atta
|
||||
import { EditCenterMeetingComponent } from './centers-view/center-actions/edit-center-meeting/edit-center-meeting.component';
|
||||
import { EditCenterMeetingScheduleComponent } from './centers-view/center-actions/edit-center-meeting-schedule/edit-center-meeting-schedule.component';
|
||||
import { ManageGroupsComponent } from './centers-view/center-actions/manage-groups/manage-groups.component';
|
||||
import { StaffAssignmentHistoryComponent } from './centers-view/center-actions/staff-assignment-history/staff-assignment-history.component';
|
||||
|
||||
/**
|
||||
* Centers Module
|
||||
@@ -55,7 +56,8 @@ import { ManageGroupsComponent } from './centers-view/center-actions/manage-grou
|
||||
AttachCenterMeetingComponent,
|
||||
EditCenterMeetingComponent,
|
||||
EditCenterMeetingScheduleComponent,
|
||||
ManageGroupsComponent
|
||||
ManageGroupsComponent,
|
||||
StaffAssignmentHistoryComponent
|
||||
]
|
||||
})
|
||||
export class CentersModule { }
|
||||
|
||||
@@ -246,4 +246,18 @@ export class CentersService {
|
||||
return this.http.put(`/centers/${centerId}/calendars/${calendarId}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run Report Data for Staff Assignement History.
|
||||
* @param {any} reportName reportName object containing 'name' of the report
|
||||
* @param {object} centerId CenterId.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getStaffAssignmentHistoryData(reportName: any, centerId: any, tenantIdentifier: string, locale: string): Observable<any> {
|
||||
const httpParams = new HttpParams()
|
||||
.set('tenantIdentifier', tenantIdentifier)
|
||||
.set('locale', locale)
|
||||
.set('R_centerId', centerId);
|
||||
return this.http.get(`/runreports/${reportName}`, { responseType: 'arraybuffer', observe: 'response', params: httpParams });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ export class CenterActionsResolver implements Resolve<Object> {
|
||||
case 'Edit Meeting Schedule':
|
||||
const calendarId = route.queryParamMap.get('calendarId');
|
||||
return this.centersService.getCalendarAndTemplate(centerId, calendarId);
|
||||
case 'Staff Assignment History':
|
||||
return this.centersService.getStaffAssignmentHistoryData('Staff Assignment History', centerId, 'default', 'en');
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user