build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -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();
}
}
@@ -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 });
});
}
});
}
}