build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -8,9 +8,8 @@ describe('AllocateCashComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AllocateCashComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AllocateCashComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./allocate-cash.component.scss']
|
||||
})
|
||||
export class AllocateCashComponent implements OnInit {
|
||||
|
||||
/** Minimum Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Date allowed. */
|
||||
@@ -36,13 +35,15 @@ export class AllocateCashComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {Router} router Router.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { cashierTemplate: any}) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { cashierTemplate: any }) => {
|
||||
this.cashierData = data.cashierTemplate;
|
||||
});
|
||||
}
|
||||
@@ -57,14 +58,34 @@ export class AllocateCashComponent implements OnInit {
|
||||
*/
|
||||
setCashierForm() {
|
||||
this.allocateCashForm = this.formBuilder.group({
|
||||
'office': [{value: this.cashierData.officeName, disabled: true}],
|
||||
'tellerName': [{value: this.cashierData.tellerName, disabled: true}],
|
||||
'cashier': [{value: this.cashierData.cashierName, disabled: true}],
|
||||
'assignmentPeriod': [{value: this.dateUtils.formatDate(this.cashierData.startDate, 'dd MMMM yyyy') + ' - ' + this.dateUtils.formatDate(this.cashierData.endDate, 'dd MMMM yyyy'), disabled: true}],
|
||||
'txnDate': [new Date(), Validators.required],
|
||||
'currencyCode': ['', Validators.required],
|
||||
'txnAmount': ['', Validators.required],
|
||||
'txnNote': ['', Validators.required]
|
||||
office: [{ value: this.cashierData.officeName, disabled: true }],
|
||||
tellerName: [{ value: this.cashierData.tellerName, disabled: true }],
|
||||
cashier: [{ value: this.cashierData.cashierName, disabled: true }],
|
||||
assignmentPeriod: [
|
||||
{
|
||||
value:
|
||||
this.dateUtils.formatDate(this.cashierData.startDate, 'dd MMMM yyyy') +
|
||||
' - ' +
|
||||
this.dateUtils.formatDate(this.cashierData.endDate, 'dd MMMM yyyy'),
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
txnDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
txnAmount: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
txnNote: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,9 +105,10 @@ export class AllocateCashComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.organizationService.allocateCash(this.cashierData.tellerId, this.cashierData.cashierId, data).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], {relativeTo: this.route});
|
||||
});
|
||||
this.organizationService
|
||||
.allocateCash(this.cashierData.tellerId, this.cashierData.cashierId, data)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CashiersComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CashiersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CashiersComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,11 +14,15 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./cashiers.component.scss']
|
||||
})
|
||||
export class CashiersComponent implements OnInit {
|
||||
|
||||
/** Cashiers data. */
|
||||
cashiersData: any;
|
||||
/** Columns to be displayed in cashiers table. */
|
||||
displayedColumns: string[] = ['period', 'staffName', 'isFullDay', 'vaultActions'];
|
||||
displayedColumns: string[] = [
|
||||
'period',
|
||||
'staffName',
|
||||
'isFullDay',
|
||||
'vaultActions'
|
||||
];
|
||||
/** Data source for cashiers table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -32,7 +36,7 @@ export class CashiersComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { cashiersData: any }) => {
|
||||
this.route.data.subscribe((data: { cashiersData: any }) => {
|
||||
this.cashiersData = data.cashiersData.cashiers;
|
||||
});
|
||||
}
|
||||
@@ -68,5 +72,4 @@ export class CashiersComponent implements OnInit {
|
||||
routeEdit($event: MouseEvent) {
|
||||
$event.stopPropagation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateCashierComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateCashierComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateCashierComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./create-cashier.component.scss']
|
||||
})
|
||||
export class CreateCashierComponent implements OnInit {
|
||||
|
||||
/** Minimum Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Date allowed. */
|
||||
@@ -36,12 +35,14 @@ export class CreateCashierComponent implements OnInit {
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService ) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { cashierTemplate: any }) => {
|
||||
this.cashierTemplate = data.cashierTemplate;
|
||||
});
|
||||
@@ -57,11 +58,20 @@ export class CreateCashierComponent implements OnInit {
|
||||
*/
|
||||
setCreateCashierForm() {
|
||||
this.createCashierForm = this.formBuilder.group({
|
||||
'staffId': ['', Validators.required],
|
||||
'description': [''],
|
||||
'startDate': ['', Validators.required],
|
||||
'endDate': ['', Validators.required],
|
||||
'isFullDay': [false]
|
||||
staffId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
description: [''],
|
||||
startDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
endDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
isFullDay: [false]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,8 +96,7 @@ export class CreateCashierComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
this.organizationService.createCashier(this.cashierTemplate.tellerId, data).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], {relativeTo: this.route});
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditCashierComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditCashierComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditCashierComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./edit-cashier.component.scss']
|
||||
})
|
||||
export class EditCashierComponent implements OnInit {
|
||||
|
||||
/** Cashier Data. */
|
||||
cashierData: any = new Object();
|
||||
/** Edit cashier form. */
|
||||
@@ -38,16 +37,20 @@ export class EditCashierComponent implements OnInit {
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService ) {
|
||||
this.route.data.subscribe((data: { cashier: any, cashierTemplate: any }) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { cashier: any; cashierTemplate: any }) => {
|
||||
this.cashierData.data = data.cashier;
|
||||
this.cashierData.template = data.cashierTemplate;
|
||||
this.isStaffId = this.cashierData.template.staffOptions.some((element: any) => element.id === this.cashierData.data.staffId);
|
||||
this.isStaffId = this.cashierData.template.staffOptions.some(
|
||||
(element: any) => element.id === this.cashierData.data.staffId
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,11 +64,20 @@ export class EditCashierComponent implements OnInit {
|
||||
*/
|
||||
setEditChargeForm() {
|
||||
this.editCashierForm = this.formBuilder.group({
|
||||
'staffId': [{value: this.cashierData.data.staffId, disabled: true}],
|
||||
'description': [this.cashierData.data.description],
|
||||
'startDate': [this.cashierData.data.startDate && new Date(this.cashierData.data.startDate), Validators.required],
|
||||
'endDate': [this.cashierData.data.endDate && new Date(this.cashierData.data.endDate), Validators.required],
|
||||
'isFullDay': [this.cashierData.data.isFullDay, Validators.required]
|
||||
staffId: [{ value: this.cashierData.data.staffId, disabled: true }],
|
||||
description: [this.cashierData.data.description],
|
||||
startDate: [
|
||||
this.cashierData.data.startDate && new Date(this.cashierData.data.startDate),
|
||||
Validators.required
|
||||
],
|
||||
endDate: [
|
||||
this.cashierData.data.endDate && new Date(this.cashierData.data.endDate),
|
||||
Validators.required
|
||||
],
|
||||
isFullDay: [
|
||||
this.cashierData.data.isFullDay,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -90,9 +102,10 @@ export class EditCashierComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.organizationService.updateCashier(this.cashierData.data.tellerId, this.cashierData.data.id, data).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], {relativeTo: this.route});
|
||||
});
|
||||
this.organizationService
|
||||
.updateCashier(this.cashierData.data.tellerId, this.cashierData.data.id, data)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('SettleCashComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SettleCashComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SettleCashComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./settle-cash.component.scss']
|
||||
})
|
||||
export class SettleCashComponent implements OnInit {
|
||||
|
||||
/** Minimum Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Date allowed. */
|
||||
@@ -33,13 +32,15 @@ export class SettleCashComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {Router} router Router.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: { cashierTemplate: any}) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { cashierTemplate: any }) => {
|
||||
this.cashierData = data.cashierTemplate;
|
||||
});
|
||||
}
|
||||
@@ -54,14 +55,34 @@ export class SettleCashComponent implements OnInit {
|
||||
*/
|
||||
setCashierForm() {
|
||||
this.settleCashForm = this.formBuilder.group({
|
||||
'office': [{value: this.cashierData.officeName, disabled: true}],
|
||||
'tellerName': [{value: this.cashierData.tellerName, disabled: true}],
|
||||
'cashier': [{value: this.cashierData.cashierName, disabled: true}],
|
||||
'assignmentPeriod': [{value: this.dateUtils.formatDate(this.cashierData.startDate, 'dd MMMM yyyy') + ' - ' + this.dateUtils.formatDate(this.cashierData.endDate, 'dd MMMM yyyy'), disabled: true}],
|
||||
'txnDate': [new Date(), Validators.required],
|
||||
'currencyCode': ['', Validators.required],
|
||||
'txnAmount': ['', Validators.required],
|
||||
'txnNote': ['', Validators.required]
|
||||
office: [{ value: this.cashierData.officeName, disabled: true }],
|
||||
tellerName: [{ value: this.cashierData.tellerName, disabled: true }],
|
||||
cashier: [{ value: this.cashierData.cashierName, disabled: true }],
|
||||
assignmentPeriod: [
|
||||
{
|
||||
value:
|
||||
this.dateUtils.formatDate(this.cashierData.startDate, 'dd MMMM yyyy') +
|
||||
' - ' +
|
||||
this.dateUtils.formatDate(this.cashierData.endDate, 'dd MMMM yyyy'),
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
txnDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
txnAmount: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
txnNote: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -81,9 +102,10 @@ export class SettleCashComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.organizationService.settleCash(this.cashierData.tellerId, this.cashierData.cashierId, data).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], {relativeTo: this.route});
|
||||
});
|
||||
this.organizationService
|
||||
.settleCash(this.cashierData.tellerId, this.cashierData.cashierId, data)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('TransactionsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TransactionsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [TransactionsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
styleUrls: ['./transactions.component.scss']
|
||||
})
|
||||
export class TransactionsComponent implements OnInit {
|
||||
|
||||
/** Currency selector. */
|
||||
currencySelector = new UntypedFormControl();
|
||||
/** Cashier Id */
|
||||
@@ -30,7 +29,14 @@ export class TransactionsComponent implements OnInit {
|
||||
/** Currencys data. */
|
||||
currencyData: any;
|
||||
/** Columns to be displayed in transactions table. */
|
||||
displayedColumns: string[] = ['date', 'transactions', 'allocation', 'cashIn', 'cashOut', 'settlement'];
|
||||
displayedColumns: string[] = [
|
||||
'date',
|
||||
'transactions',
|
||||
'allocation',
|
||||
'cashIn',
|
||||
'cashOut',
|
||||
'settlement'
|
||||
];
|
||||
/** Data source for transactions table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -44,9 +50,11 @@ export class TransactionsComponent implements OnInit {
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { currencies: any }) => {
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute
|
||||
) {
|
||||
this.route.data.subscribe((data: { currencies: any }) => {
|
||||
this.currencyData = data.currencies.selectedCurrencyOptions;
|
||||
});
|
||||
this.tellerId = this.route.parent.parent.parent.snapshot.params['id'];
|
||||
@@ -73,7 +81,8 @@ export class TransactionsComponent implements OnInit {
|
||||
*/
|
||||
onChangeCurrency() {
|
||||
this.currencySelector.valueChanges.subscribe((currencyCode: any) => {
|
||||
this.organizationService.getCashierSummaryAndTransactions(this.tellerId, this.cashierId, currencyCode)
|
||||
this.organizationService
|
||||
.getCashierSummaryAndTransactions(this.tellerId, this.cashierId, currencyCode)
|
||||
.subscribe((response: any) => {
|
||||
this.cashierData = response;
|
||||
this.setTransactions();
|
||||
@@ -89,5 +98,4 @@ export class TransactionsComponent implements OnInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewCashierComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewCashierComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewCashierComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
styleUrls: ['./view-cashier.component.scss']
|
||||
})
|
||||
export class ViewCashierComponent {
|
||||
|
||||
/** Cashier data. */
|
||||
cashierData: any;
|
||||
|
||||
@@ -29,10 +28,12 @@ export class ViewCashierComponent {
|
||||
* @param {OrganizationService} organizationService Organization Service
|
||||
* @param {MatDialog} dialog Mat Dialog
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private organizationService: OrganizationService,
|
||||
public dialog: MatDialog) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private organizationService: OrganizationService,
|
||||
public dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { cashier: any }) => {
|
||||
this.cashierData = data.cashier;
|
||||
});
|
||||
@@ -48,10 +49,9 @@ export class ViewCashierComponent {
|
||||
deleteCashierDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteCashier(this.cashierData.tellerId, this.cashierData.id).subscribe(() => {
|
||||
this.router.navigate(['../'], {relativeTo: this.route});
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CashierResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -28,5 +27,4 @@ export class CashierResolver implements Resolve<Object> {
|
||||
const tellerId = route.parent.parent.paramMap.get('id');
|
||||
return this.organizationService.getCashier(tellerId, cashierId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CashiersResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class CashiersResolver implements Resolve<Object> {
|
||||
const tellerId = route.parent.paramMap.get('id');
|
||||
return this.organizationService.getCashiers(tellerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class EditCashierResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class EditCashierResolver implements Resolve<Object> {
|
||||
const tellerId = route.parent.parent.paramMap.get('id');
|
||||
return this.organizationService.getCashierTemplate(tellerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CashierTransactionTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -28,5 +27,4 @@ export class CashierTransactionTemplateResolver implements Resolve<Object> {
|
||||
const tellerId = route.parent.parent.paramMap.get('id');
|
||||
return this.organizationService.getCashierTransactionTemplate(tellerId, cashierId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class TellerResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class TellerResolver implements Resolve<Object> {
|
||||
const tellerId = route.paramMap.get('id');
|
||||
return this.organizationService.getTeller(tellerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from '../../organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class TellersResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class TellersResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getTellers();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateTellerComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateTellerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateTellerComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./create-teller.component.scss']
|
||||
})
|
||||
export class CreateTellerComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -38,17 +37,21 @@ export class CreateTellerComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {Dates} dateUtils Date Utils to format date.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
this.officeData = data.offices;
|
||||
});
|
||||
this.tellerStatusesData = [{'id': 300, 'code': '300', 'value': 'Active'},
|
||||
{'id': 400, 'code': '400', 'value': 'Inactive'}];
|
||||
this.tellerStatusesData = [
|
||||
{ id: 300, code: '300', value: 'Active' },
|
||||
{ id: 400, code: '400', value: 'Inactive' }
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,12 +67,26 @@ export class CreateTellerComponent implements OnInit {
|
||||
*/
|
||||
createTellerForm() {
|
||||
this.tellerForm = this.formBuilder.group({
|
||||
'officeId': ['', Validators.required],
|
||||
'name': ['', [Validators.required, Validators.pattern('(^[A-z]).*')]],
|
||||
'description': [''],
|
||||
'startDate': ['', Validators.required],
|
||||
'endDate': [''],
|
||||
'status': ['', Validators.required],
|
||||
officeId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
name: [
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('(^[A-z]).*')]
|
||||
],
|
||||
description: [''],
|
||||
startDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
endDate: [''],
|
||||
status: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -95,8 +112,13 @@ export class CreateTellerComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
this.organizationService.createTeller(data).subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditTellerComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditTellerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditTellerComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,8 +18,7 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./edit-teller.component.scss']
|
||||
})
|
||||
export class EditTellerComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
@@ -41,26 +40,30 @@ export class EditTellerComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {Dates} dateUtils Date Utils to format date.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates) {
|
||||
this.route.data.subscribe((data: { teller: any, offices: any }) => {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates
|
||||
) {
|
||||
this.route.data.subscribe((data: { teller: any; offices: any }) => {
|
||||
this.tellerData = data.teller;
|
||||
this.officeData = data.offices;
|
||||
});
|
||||
|
||||
if (this.tellerData.status) {
|
||||
if (this.tellerData.status === 'ACTIVE') {
|
||||
this.tellerData.status = 300;
|
||||
this.tellerData.status = 300;
|
||||
} else {
|
||||
this.tellerData.status = 400;
|
||||
this.tellerData.status = 400;
|
||||
}
|
||||
}
|
||||
this.tellerStatusesData = [ {'id': 300, 'code': '300', 'value': 'Active'},
|
||||
{'id': 400, 'code': '400', 'value': 'Inactive'}];
|
||||
this.tellerStatusesData = [
|
||||
{ id: 300, code: '300', value: 'Active' },
|
||||
{ id: 400, code: '400', value: 'Inactive' }
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,12 +79,23 @@ export class EditTellerComponent implements OnInit {
|
||||
*/
|
||||
createEditTellerForm() {
|
||||
this.tellerForm = this.formBuilder.group({
|
||||
'officeId': [{value: this.tellerData.officeId, disabled: true}],
|
||||
'name': [this.tellerData.name, [Validators.required, Validators.pattern('(^[A-z]).*')]],
|
||||
'description': [this.tellerData.description],
|
||||
'startDate': [this.tellerData.startDate && new Date(this.tellerData.startDate), Validators.required],
|
||||
'endDate': [this.tellerData.endDate && new Date(this.tellerData.endDate)],
|
||||
'status': [this.tellerData.status, Validators.required]
|
||||
officeId: [{ value: this.tellerData.officeId, disabled: true }],
|
||||
name: [
|
||||
this.tellerData.name,
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('(^[A-z]).*')]
|
||||
],
|
||||
description: [this.tellerData.description],
|
||||
startDate: [
|
||||
this.tellerData.startDate && new Date(this.tellerData.startDate),
|
||||
Validators.required
|
||||
],
|
||||
endDate: [this.tellerData.endDate && new Date(this.tellerData.endDate)],
|
||||
status: [
|
||||
this.tellerData.status,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -108,8 +122,13 @@ export class EditTellerComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
this.organizationService.updateTeller(this.tellerData.id, data).subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { OrganizationService } from 'app/organization/organization.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CashierTransactionTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
@@ -28,5 +27,4 @@ export class CashierTransactionTemplateResolver implements Resolve<Object> {
|
||||
const tellerId = route.parent.parent.paramMap.get('id');
|
||||
return this.organizationService.getCashierTransactionTemplate(tellerId, cashierId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('TellersComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TellersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [TellersComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,11 +17,16 @@ import { of } from 'rxjs';
|
||||
styleUrls: ['./tellers.component.scss']
|
||||
})
|
||||
export class TellersComponent implements OnInit {
|
||||
|
||||
/** Tellers data. */
|
||||
tellersData: any;
|
||||
/** Columns to be displayed in tellers table. */
|
||||
displayedColumns: string[] = ['officeName', 'name', 'status', 'startDate', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'officeName',
|
||||
'name',
|
||||
'status',
|
||||
'startDate',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for tellers table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -35,7 +40,7 @@ export class TellersComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { tellers: any }) => {
|
||||
this.route.data.subscribe((data: { tellers: any }) => {
|
||||
this.tellersData = data.tellers;
|
||||
});
|
||||
}
|
||||
@@ -63,5 +68,4 @@ export class TellersComponent implements OnInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewTellerComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewTellerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewTellerComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dial
|
||||
styleUrls: ['./view-teller.component.scss']
|
||||
})
|
||||
export class ViewTellerComponent {
|
||||
|
||||
/** Teller data. */
|
||||
tellerData: any;
|
||||
|
||||
@@ -29,10 +28,12 @@ export class ViewTellerComponent {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog) {
|
||||
constructor(
|
||||
private organizationService: OrganizationService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { teller: any }) => {
|
||||
this.tellerData = data.teller;
|
||||
});
|
||||
@@ -47,12 +48,10 @@ export class ViewTellerComponent {
|
||||
});
|
||||
deleteTellerDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.organizationService.deleteTeller(this.tellerData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/organization/tellers']);
|
||||
});
|
||||
this.organizationService.deleteTeller(this.tellerData.id).subscribe(() => {
|
||||
this.router.navigate(['/organization/tellers']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user