committed by
Abhay Chawla
parent
d4281628ea
commit
d6edcf0554
@@ -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