feat: add cashiers list page (#888)

Fixes: #757
This commit is contained in:
Karan Takalkar
2020-06-23 02:44:29 +05:30
committed by GitHub
parent e01897aa66
commit 02e2155f15
11 changed files with 218 additions and 6 deletions
@@ -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<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
constructor(private organizationService: OrganizationService) {}
/**
* Returns the cashier data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const cashierId = route.paramMap.get('id');
const tellerId = route.parent.paramMap.get('id');
return this.organizationService.getCashier(tellerId, cashierId);
}
}
@@ -0,0 +1,31 @@
/** 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';
/**
* Cashiers data resolver.
*/
@Injectable()
export class CashiersResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
constructor(private organizationService: OrganizationService) {}
/**
* Returns the cashiers data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const tellerId = route.parent.paramMap.get('id');
return this.organizationService.getCashiers(tellerId);
}
}
@@ -0,0 +1,31 @@
/** 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';
/**
* Teller data resolver.
*/
@Injectable()
export class TellerResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
constructor(private organizationService: OrganizationService) {}
/**
* Returns the teller data.
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const tellerId = route.paramMap.get('id');
return this.organizationService.getTeller(tellerId);
}
}
@@ -0,0 +1,30 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Resolve } from '@angular/router';
/** rxjs Imports */
import { Observable } from 'rxjs';
/** Custom Services */
import { OrganizationService } from '../../organization.service';
/**
* Tellers data resolver.
*/
@Injectable()
export class TellersResolver implements Resolve<Object> {
/**
* @param {OrganizationService} organizationService Organization service.
*/
constructor(private organizationService: OrganizationService) {}
/**
* Returns the Tellers data.
* @returns {Observable<any>}
*/
resolve(): Observable<any> {
return this.organizationService.getTellers();
}
}