diff --git a/src/app/organization/organization-routing.module.ts b/src/app/organization/organization-routing.module.ts index ca0169a4c..67160112f 100644 --- a/src/app/organization/organization-routing.module.ts +++ b/src/app/organization/organization-routing.module.ts @@ -33,6 +33,7 @@ import { HolidaysComponent } from './holidays/holidays.component'; import { EditEmployeeComponent } from './employees/edit-employee/edit-employee.component'; import { CreateTellerComponent } from './tellers/create-teller/create-teller.component'; import { EditTellerComponent } from './tellers/edit-teller/edit-teller.component'; +import { ViewCashierComponent } from './tellers/view-cashier/view-cashier.component'; /** Custom Resolvers */ import { LoanProvisioningCriteriaResolver } from './loan-provisioning-criteria/loan-provisioning-criteria.resolver'; @@ -56,6 +57,7 @@ import { EditOfficeComponent } from './offices/edit-office/edit-office.component import { AdhocQueryTemplateResolver } from './adhoc-query/adhoc-query-template.resolver'; import { ViewLoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/view-loan-provisioning-criteria/view-loan-provisioning-criteria.component'; import { LoanProvisioningCriteriasResolver } from './loan-provisioning-criteria/loan-provisioning-criterias.resolver'; +import { CashierResolver } from './tellers/cashier.resolver'; /** Organization Routes */ const routes: Routes = [ @@ -255,6 +257,20 @@ const routes: Routes = [ teller: TellerResolver, offices: OfficesResolver } + }, + { + path: 'cashiers', + data: { title: extract('View Cashiers'), breadcrumb: 'View Cashiers', routeParamBreadcrumb: false }, + children: [ + { + path: ':id', + component: ViewCashierComponent, + data: { title: extract('View Cashier'), breadcrumb: 'View Cashier', routeParamBreadcrumb: 'id' }, + resolve: { + cashier: CashierResolver + } + } + ] } ] } @@ -361,6 +377,7 @@ const routes: Routes = [ EditOfficeResolver, AdhocQueryTemplateResolver, LoanProvisioningCriteriasResolver, + CashierResolver ] }) export class OrganizationRoutingModule { } diff --git a/src/app/organization/organization.module.ts b/src/app/organization/organization.module.ts index e5146a565..0a0e51850 100644 --- a/src/app/organization/organization.module.ts +++ b/src/app/organization/organization.module.ts @@ -33,6 +33,7 @@ import { EditEmployeeComponent } from './employees/edit-employee/edit-employee.c import { CreateTellerComponent } from './tellers/create-teller/create-teller.component'; import { EditTellerComponent } from './tellers/edit-teller/edit-teller.component'; import { ViewLoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/view-loan-provisioning-criteria/view-loan-provisioning-criteria.component'; +import { ViewCashierComponent } from './tellers/view-cashier/view-cashier.component'; /** * Organization Module @@ -72,6 +73,7 @@ import { ViewLoanProvisioningCriteriaComponent } from './loan-provisioning-crite CreateTellerComponent, EditTellerComponent, ViewLoanProvisioningCriteriaComponent, + ViewCashierComponent, ] }) export class OrganizationModule { } diff --git a/src/app/organization/organization.service.ts b/src/app/organization/organization.service.ts index f67b33ab7..bb1d1c89f 100644 --- a/src/app/organization/organization.service.ts +++ b/src/app/organization/organization.service.ts @@ -176,6 +176,16 @@ export class OrganizationService { return this.http.get(`/tellers/${tellerId}`); } + /** + * Get Cashier data. + * @param {string} tellerId Teller ID of teller. + * @param {string} cashierId Cashier ID of cashier + * @returns {Observable} Cashier data. + */ + getCashier(tellerId: string, cashierId: string): Observable { + return this.http.get(`/tellers/${tellerId}/cashiers/${cashierId}`); + } + /** * @param {string} tellerId Teller ID of teller to be deleted. * @returns {Observable} diff --git a/src/app/organization/tellers/cashier.resolver.ts b/src/app/organization/tellers/cashier.resolver.ts new file mode 100644 index 000000000..250a41aef --- /dev/null +++ b/src/app/organization/tellers/cashier.resolver.ts @@ -0,0 +1,32 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { OrganizationService } from 'app/organization/organization.service'; + +/** + * Cashier data resolver. + */ +@Injectable() +export class CashierResolver implements Resolve { + + /** + * @param {OrganizationService} organizationService Organization service. + */ + constructor(private organizationService: OrganizationService) {} + + /** + * Returns the cashier data. + * @returns {Observable} + */ + resolve(route: ActivatedRouteSnapshot): Observable { + const cashierId = route.paramMap.get('id'); + const tellerId = route.parent.paramMap.get('id'); + return this.organizationService.getCashier(tellerId, cashierId); + } + +} diff --git a/src/app/organization/tellers/tellers.component.html b/src/app/organization/tellers/tellers.component.html index a0fd87332..c029895d6 100644 --- a/src/app/organization/tellers/tellers.component.html +++ b/src/app/organization/tellers/tellers.component.html @@ -47,7 +47,7 @@ Actions - diff --git a/src/app/organization/tellers/view-cashier/view-cashier.component.html b/src/app/organization/tellers/view-cashier/view-cashier.component.html new file mode 100644 index 000000000..9f6317fc6 --- /dev/null +++ b/src/app/organization/tellers/view-cashier/view-cashier.component.html @@ -0,0 +1,71 @@ +
+ +
+ + +
+ + + + + +
+ +
+ Name +
+ +
+ {{ cashierData.staffName}} +
+ +
+ Teller +
+ +
+ {{ cashierData.tellerName }} +
+ +
+ Description +
+ +
+ {{ cashierData.description }} +
+ +
+ Start Date +
+ +
+ {{ cashierData.startDate | date }} +
+ +
+ End Date +
+ +
+ {{ cashierData.endDate | date }} +
+ +
+ Full Day? +
+ +
+ {{ cashierData.isFullDay }} +
+ +
+ +
+ +
+ +
diff --git a/src/app/organization/tellers/view-cashier/view-cashier.component.scss b/src/app/organization/tellers/view-cashier/view-cashier.component.scss new file mode 100644 index 000000000..03b97aac4 --- /dev/null +++ b/src/app/organization/tellers/view-cashier/view-cashier.component.scss @@ -0,0 +1,14 @@ +.container { + max-width: 37rem; + + .content { + div { + margin: 1rem 0; + word-wrap: break-word; + + &.header { + font-weight: 500; + } + } + } +} diff --git a/src/app/organization/tellers/view-cashier/view-cashier.component.spec.ts b/src/app/organization/tellers/view-cashier/view-cashier.component.spec.ts new file mode 100644 index 000000000..c2c29ef47 --- /dev/null +++ b/src/app/organization/tellers/view-cashier/view-cashier.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ViewCashierComponent } from './view-cashier.component'; + +describe('ViewCashierComponent', () => { + let component: ViewCashierComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewCashierComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewCashierComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/organization/tellers/view-cashier/view-cashier.component.ts b/src/app/organization/tellers/view-cashier/view-cashier.component.ts new file mode 100644 index 000000000..52ac348e2 --- /dev/null +++ b/src/app/organization/tellers/view-cashier/view-cashier.component.ts @@ -0,0 +1,28 @@ +/** Angular Imports. */ +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +/** + * View Cashier component. + */ +@Component({ + selector: 'mifosx-view-cashier', + templateUrl: './view-cashier.component.html', + styleUrls: ['./view-cashier.component.scss'] +}) +export class ViewCashierComponent { + + /** Cashier data. */ + cashierData: any; + + /** + * Get cashier data from `Resolver`. + * @param {ActivatedRoute} route Activated Route. + */ + constructor(private route: ActivatedRoute) { + this.route.data.subscribe((data: { cashier: any }) => { + this.cashierData = data.cashier; + }); + } + +}