committed by
Abhay Chawla
parent
d4281628ea
commit
d6edcf0554
@@ -20,6 +20,7 @@ import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||
import { AdhocQueryComponent } from './adhoc-query/adhoc-query.component';
|
||||
import { ViewAdhocQueryComponent } from './adhoc-query/view-adhoc-query/view-adhoc-query.component';
|
||||
import { TellersComponent } from './tellers/tellers.component';
|
||||
import { ViewTellerComponent } from './tellers/view-teller/view-teller.component';
|
||||
import { PaymentTypesComponent } from './payment-types/payment-types.component';
|
||||
import { PasswordPreferencesComponent } from './password-preferences/password-preferences.component';
|
||||
import { EntityDataTableChecksComponent } from './entity-data-table-checks/entity-data-table-checks.component';
|
||||
@@ -37,6 +38,7 @@ import { SmsCampaignsResolver } from './sms-campaigns/sms-campaigns.resolver';
|
||||
import { AdhocQueriesResolver } from './adhoc-query/adhoc-queries.resolver';
|
||||
import { AdhocQueryResolver } from './adhoc-query/adhoc-query.resolver';
|
||||
import { TellersResolver } from './tellers/tellers.resolver';
|
||||
import { TellerResolver } from './tellers/teller.resolver';
|
||||
import { PaymentTypesResolver } from './payment-types/payment-types.resolver';
|
||||
import { PasswordPreferencesTemplateResolver } from './password-preferences/password-preferences-template.resolver';
|
||||
import { EntityDataTableChecksResolver } from './entity-data-table-checks/entity-data-table-checks.resolver';
|
||||
@@ -150,11 +152,24 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path: 'tellers',
|
||||
component: TellersComponent,
|
||||
data: { title: extract('Tellers'), breadcrumb: 'Tellers' },
|
||||
resolve: {
|
||||
tellers: TellersResolver
|
||||
}
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: TellersComponent,
|
||||
resolve: {
|
||||
tellers: TellersResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: ViewTellerComponent,
|
||||
data: { title: extract('View Teller'), routeResolveBreadcrumb: ['teller', 'name'] },
|
||||
resolve: {
|
||||
teller: TellerResolver
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'payment-types',
|
||||
@@ -221,6 +236,7 @@ const routes: Routes = [
|
||||
AdhocQueriesResolver,
|
||||
AdhocQueryResolver,
|
||||
TellersResolver,
|
||||
TellerResolver,
|
||||
PaymentTypesResolver,
|
||||
PasswordPreferencesTemplateResolver,
|
||||
EntityDataTableChecksResolver,
|
||||
|
||||
@@ -16,6 +16,7 @@ import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||
import { AdhocQueryComponent } from './adhoc-query/adhoc-query.component';
|
||||
import { ViewAdhocQueryComponent } from './adhoc-query/view-adhoc-query/view-adhoc-query.component';
|
||||
import { TellersComponent } from './tellers/tellers.component';
|
||||
import { ViewTellerComponent } from './tellers/view-teller/view-teller.component';
|
||||
import { PaymentTypesComponent } from './payment-types/payment-types.component';
|
||||
import { PasswordPreferencesComponent } from './password-preferences/password-preferences.component';
|
||||
import { EntityDataTableChecksComponent } from './entity-data-table-checks/entity-data-table-checks.component';
|
||||
@@ -46,6 +47,7 @@ import { ViewEmployeeComponent } from './employees/view-employee/view-employee.c
|
||||
AdhocQueryComponent,
|
||||
ViewAdhocQueryComponent,
|
||||
TellersComponent,
|
||||
ViewTellerComponent,
|
||||
PaymentTypesComponent,
|
||||
PasswordPreferencesComponent,
|
||||
EntityDataTableChecksComponent,
|
||||
|
||||
@@ -107,6 +107,22 @@ export class OrganizationService {
|
||||
return this.http.get('/tellers');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} tellerId Teller ID of teller.
|
||||
* @returns {Observable<any>} Teller.
|
||||
*/
|
||||
getTeller(tellerId: string): Observable<any> {
|
||||
return this.http.get(`/tellers/${tellerId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} tellerId Teller ID of teller to be deleted.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
deleteTeller(tellerId: string): Observable<any> {
|
||||
return this.http.delete(`/tellers/${tellerId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Payment Types data
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||
<td mat-cell *matCellDef="let teller">
|
||||
<td mat-cell *matCellDef="let teller" (click)="$event.stopPropagation()">
|
||||
<button mat-button color="primary">
|
||||
<fa-icon icon="eye"></fa-icon> View Cashiers
|
||||
</button>
|
||||
@@ -54,7 +54,7 @@
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="[row.id]" class="select-row"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
|
||||
<button mat-raised-button color="primary">
|
||||
<fa-icon icon="edit"></fa-icon>
|
||||
Edit
|
||||
</button>
|
||||
<button mat-raised-button color="warn" (click)="deleteTeller()">
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="row wrap" class="content">
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Office
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ tellerData.officeName }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong" *ngIf="tellerData.description">
|
||||
Description
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" *ngIf="tellerData.description">
|
||||
{{ tellerData.description }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Start Date
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ tellerData.startDate | date }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong" *ngIf="tellerData.endDate">
|
||||
End Date
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" *ngIf="tellerData.endDate">
|
||||
{{ tellerData.endDate | date }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Status
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ tellerData.status | titlecase }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
|
||||
.content {
|
||||
div {
|
||||
margin: 1rem 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewTellerComponent } from './view-teller.component';
|
||||
|
||||
describe('ViewTellerComponent', () => {
|
||||
let component: ViewTellerComponent;
|
||||
let fixture: ComponentFixture<ViewTellerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewTellerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewTellerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
|
||||
/** Custom Components */
|
||||
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
|
||||
|
||||
/**
|
||||
* View Teller Component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-view-teller',
|
||||
templateUrl: './view-teller.component.html',
|
||||
styleUrls: ['./view-teller.component.scss']
|
||||
})
|
||||
export class ViewTellerComponent implements OnInit {
|
||||
|
||||
/** Teller data. */
|
||||
tellerData: any;
|
||||
|
||||
/**
|
||||
* Retrieves the Teller data from `resolve`.
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog) {
|
||||
this.route.data.subscribe((data: { teller: any }) => {
|
||||
this.tellerData = data.teller;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the teller and redirects to tellers.
|
||||
*/
|
||||
deleteTeller() {
|
||||
const deleteTellerDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: `teller ${this.tellerData.id}` }
|
||||
});
|
||||
deleteTellerDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteTeller(this.tellerData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/organization/tellers']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user