build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
+2
-3
@@ -8,9 +8,8 @@ describe('CreateProvisioningEntryComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateProvisioningEntryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateProvisioningEntryComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+18
-10
@@ -16,7 +16,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./create-provisioning-entry.component.scss']
|
||||
})
|
||||
export class CreateProvisioningEntryComponent implements OnInit {
|
||||
|
||||
/** Minimum provisioning date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum provisioning date allowed. */
|
||||
@@ -31,12 +30,14 @@ export class CreateProvisioningEntryComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) { }
|
||||
private router: Router
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Creates the provisioning entry form.
|
||||
@@ -51,8 +52,11 @@ export class CreateProvisioningEntryComponent implements OnInit {
|
||||
*/
|
||||
createProvisioningEntryForm() {
|
||||
this.provisioningEntryForm = this.formBuilder.group({
|
||||
'date': ['', Validators.required],
|
||||
'createjournalentries': [false]
|
||||
date: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
createjournalentries: [false]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -68,10 +72,14 @@ export class CreateProvisioningEntryComponent implements OnInit {
|
||||
if (provisioningEntry.date instanceof Date) {
|
||||
provisioningEntry.date = this.dateUtils.formatDate(provisioningEntry.date, this.settingsService.dateFormat);
|
||||
}
|
||||
this.accountingService.createProvisioningEntry(provisioningEntry)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../view', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.accountingService.createProvisioningEntry(provisioningEntry).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../view',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ProvisioningEntriesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ProvisioningEntriesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ProvisioningEntriesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,11 +17,17 @@ import { AccountingService } from '../accounting.service';
|
||||
styleUrls: ['./provisioning-entries.component.scss']
|
||||
})
|
||||
export class ProvisioningEntriesComponent implements OnInit {
|
||||
|
||||
/** Provisioning entry data. */
|
||||
provisioningEntryData: any;
|
||||
/** Columns to be displayed in provisioning entries table. */
|
||||
displayedColumns: string[] = ['createdUser', 'createdDate', 'journalEntry', 'viewReport', 'recreateProvisioning', 'viewJournalEntry'];
|
||||
displayedColumns: string[] = [
|
||||
'createdUser',
|
||||
'createdDate',
|
||||
'journalEntry',
|
||||
'viewReport',
|
||||
'recreateProvisioning',
|
||||
'viewJournalEntry'
|
||||
];
|
||||
/** Data source for provisioning entries table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -36,9 +42,11 @@ export class ProvisioningEntriesComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { provisioningEntries: any }) => {
|
||||
this.provisioningEntryData = data.provisioningEntries.pageItems;
|
||||
});
|
||||
@@ -74,10 +82,15 @@ export class ProvisioningEntriesComponent implements OnInit {
|
||||
* @param {string} provisioningEntryId Provisioning entry id.
|
||||
*/
|
||||
recreateProvisioning($event: Event, provisioningEntryId: string) {
|
||||
this.accountingService.recreateProvisioningEntries(provisioningEntryId)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['view', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.accountingService.recreateProvisioningEntries(provisioningEntryId).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'view',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
$event.stopPropagation();
|
||||
}
|
||||
|
||||
@@ -87,8 +100,13 @@ export class ProvisioningEntriesComponent implements OnInit {
|
||||
* @param {number} provisioningEntryId Provisioning entry id.
|
||||
*/
|
||||
viewJournalEntry($event: Event, provisioningEntryId: number) {
|
||||
this.router.navigate(['journal-entries/view', provisioningEntryId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'journal-entries/view',
|
||||
provisioningEntryId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
$event.stopPropagation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { AccountingService } from '../accounting.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ProvisioningEntriesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {AccountingService} accountingService Accounting service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class ProvisioningEntriesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.accountingService.getProvisioningEntries();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { AccountingService } from '../../accounting.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ProvisioningEntryEntriesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {AccountingService} accountingService Accounting service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class ProvisioningEntryEntriesResolver implements Resolve<Object> {
|
||||
const provisioningEntryId = route.paramMap.get('id');
|
||||
return this.accountingService.getProvisioningEntryEntries(provisioningEntryId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { AccountingService } from '../../accounting.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ProvisioningEntryResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {AccountingService} accountingService Accounting service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class ProvisioningEntryResolver implements Resolve<Object> {
|
||||
const provisioningEntryId = route.paramMap.get('id');
|
||||
return this.accountingService.getProvisioningEntry(provisioningEntryId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewProvisioningEntryComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewProvisioningEntryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewProvisioningEntryComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+63
-37
@@ -21,7 +21,6 @@ import { AccountingService } from '../../accounting.service';
|
||||
styleUrls: ['./view-provisioning-entry.component.scss']
|
||||
})
|
||||
export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Provisioning entry id. */
|
||||
provisioningEntryId: string;
|
||||
/** Provisioning entry. */
|
||||
@@ -47,7 +46,15 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
/** Filtered provisioning category data for autocomplete. */
|
||||
filteredProvisioningCategoryData: any;
|
||||
/** Columns to be displayed in provisioning entry entries table. */
|
||||
displayedColumns: string[] = ['officeName', 'productName', 'currencyCode', 'categoryName', 'amountreserved', 'liabilityAccountName', 'expenseAccountName'];
|
||||
displayedColumns: string[] = [
|
||||
'officeName',
|
||||
'productName',
|
||||
'currencyCode',
|
||||
'categoryName',
|
||||
'amountreserved',
|
||||
'liabilityAccountName',
|
||||
'expenseAccountName'
|
||||
];
|
||||
/** Data source for provisioning entry entries table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Provisioning entry entries filter. */
|
||||
@@ -69,15 +76,18 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe((data: {
|
||||
provisioningEntry: any,
|
||||
provisioningEntryEntries: any,
|
||||
offices: any,
|
||||
loanProducts: any,
|
||||
provisiningCategories: any
|
||||
constructor(
|
||||
private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe(
|
||||
(data: {
|
||||
provisioningEntry: any;
|
||||
provisioningEntryEntries: any;
|
||||
offices: any;
|
||||
loanProducts: any;
|
||||
provisiningCategories: any;
|
||||
}) => {
|
||||
this.provisioningEntryId = data.provisioningEntry.id;
|
||||
this.provisioningEntry = data.provisioningEntry;
|
||||
@@ -85,7 +95,8 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
this.officeData = data.offices;
|
||||
this.loanProductData = data.loanProducts;
|
||||
this.provisioningCategoryData = data.provisiningCategories;
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +117,7 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
this.officeName.valueChanges
|
||||
.pipe(
|
||||
map(value => value.toLowerCase()),
|
||||
map((value) => value.toLowerCase()),
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
@@ -117,7 +128,7 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
|
||||
this.loanProduct.valueChanges
|
||||
.pipe(
|
||||
map(value => value.toLowerCase()),
|
||||
map((value) => value.toLowerCase()),
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
@@ -128,7 +139,7 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
|
||||
this.provisioningCategory.valueChanges
|
||||
.pipe(
|
||||
map(value => value.toLowerCase()),
|
||||
map((value) => value.toLowerCase()),
|
||||
debounceTime(500),
|
||||
distinctUntilChanged(),
|
||||
tap((filterValue) => {
|
||||
@@ -144,9 +155,11 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* @param {any} filterValue Values to filter data by.
|
||||
*/
|
||||
filterPredicate(data: any, filterValue: any) {
|
||||
return data.officeName.toLowerCase().indexOf(filterValue['officeName']) !== -1
|
||||
&& data.productName.toLowerCase().indexOf(filterValue['productName']) !== -1
|
||||
&& data.categoryName.toLowerCase().indexOf(filterValue['categoryName']) !== -1;
|
||||
return (
|
||||
data.officeName.toLowerCase().indexOf(filterValue['officeName']) !== -1 &&
|
||||
data.productName.toLowerCase().indexOf(filterValue['productName']) !== -1 &&
|
||||
data.categoryName.toLowerCase().indexOf(filterValue['categoryName']) !== -1
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,11 +187,10 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* Sets filtered offices for autocomplete.
|
||||
*/
|
||||
setFilteredOffices() {
|
||||
this.filteredOfficeData = this.officeName.valueChanges
|
||||
.pipe(
|
||||
this.filteredOfficeData = this.officeName.valueChanges.pipe(
|
||||
startWith(''),
|
||||
map((office: any) => typeof office === 'string' ? office : office.name),
|
||||
map((officeName: string) => officeName ? this.filterOfficeAutocompleteData(officeName) : this.officeData)
|
||||
map((office: any) => (typeof office === 'string' ? office : office.name)),
|
||||
map((officeName: string) => (officeName ? this.filterOfficeAutocompleteData(officeName) : this.officeData))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -186,11 +198,12 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* Sets filtered loan products for autocomplete.
|
||||
*/
|
||||
setFilteredLoanProducts() {
|
||||
this.filteredLoanProductData = this.loanProduct.valueChanges
|
||||
.pipe(
|
||||
this.filteredLoanProductData = this.loanProduct.valueChanges.pipe(
|
||||
startWith(''),
|
||||
map((loanProduct: any) => typeof loanProduct === 'string' ? loanProduct : loanProduct.name),
|
||||
map((loanProductName: string) => loanProductName ? this.filterLoanProductAutocompleteData(loanProductName) : this.loanProductData)
|
||||
map((loanProduct: any) => (typeof loanProduct === 'string' ? loanProduct : loanProduct.name)),
|
||||
map((loanProductName: string) =>
|
||||
loanProductName ? this.filterLoanProductAutocompleteData(loanProductName) : this.loanProductData
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,11 +211,16 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* Sets filtered provisioning categories for autocomplete.
|
||||
*/
|
||||
setFilteredProvisioningCategories() {
|
||||
this.filteredProvisioningCategoryData = this.provisioningCategory.valueChanges
|
||||
.pipe(
|
||||
this.filteredProvisioningCategoryData = this.provisioningCategory.valueChanges.pipe(
|
||||
startWith(''),
|
||||
map((provisioningCategory: any) => typeof provisioningCategory === 'string' ? provisioningCategory : provisioningCategory.categoryName),
|
||||
map((provisioningCategoryName: string) => provisioningCategoryName ? this.filterProvisioningCategoryAutocompleteData(provisioningCategoryName) : this.provisioningCategoryData)
|
||||
map((provisioningCategory: any) =>
|
||||
typeof provisioningCategory === 'string' ? provisioningCategory : provisioningCategory.categoryName
|
||||
),
|
||||
map((provisioningCategoryName: string) =>
|
||||
provisioningCategoryName
|
||||
? this.filterProvisioningCategoryAutocompleteData(provisioningCategoryName)
|
||||
: this.provisioningCategoryData
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -221,7 +239,9 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* @returns {any} Filtered loan products.
|
||||
*/
|
||||
private filterLoanProductAutocompleteData(loanProductName: string): any {
|
||||
return this.loanProductData.filter((loanProduct: any) => loanProduct.name.toLowerCase().includes(loanProductName.toLocaleLowerCase()));
|
||||
return this.loanProductData.filter((loanProduct: any) =>
|
||||
loanProduct.name.toLowerCase().includes(loanProductName.toLocaleLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -230,7 +250,9 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* @returns {any} Filtered provisioning categories.
|
||||
*/
|
||||
private filterProvisioningCategoryAutocompleteData(provisioningCategoryName: string): any {
|
||||
return this.provisioningCategoryData.filter((provisioningCategory: any) => provisioningCategory.categoryName.toLowerCase().includes(provisioningCategoryName.toLocaleLowerCase()));
|
||||
return this.provisioningCategoryData.filter((provisioningCategory: any) =>
|
||||
provisioningCategory.categoryName.toLowerCase().includes(provisioningCategoryName.toLocaleLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,10 +260,14 @@ export class ViewProvisioningEntryComponent implements OnInit, AfterViewInit {
|
||||
* and redirects to created entries.
|
||||
*/
|
||||
createProvisioningJournalEntries() {
|
||||
this.accountingService.createProvisioningJournalEntries(this.provisioningEntryId)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../journal-entries/view', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.accountingService.createProvisioningJournalEntries(this.provisioningEntryId).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../journal-entries/view',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ import { AccountingService } from '../../accounting.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ProvisioningJournalEntriesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {AccountingService} accountingService Accounting service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class ProvisioningJournalEntriesResolver implements Resolve<Object> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.accountingService.getProvisioningJournalEntries(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewProvisioningJournalEntriesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewProvisioningJournalEntriesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewProvisioningJournalEntriesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+20
-7
@@ -14,11 +14,21 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
styleUrls: ['./view-provisioning-journal-entries.component.scss']
|
||||
})
|
||||
export class ViewProvisioningJournalEntriesComponent implements OnInit {
|
||||
|
||||
/** Provisioning journal entry data. */
|
||||
provisioningJournalEntryData: any;
|
||||
/** Columns to be displayed in provisioning journal entries table. */
|
||||
displayedColumns: string[] = ['id', 'officeName', 'transactionDate', 'transactionId', 'glAccountType', 'createdByUserName', 'glAccountCode', 'glAccountName', 'debit', 'credit'];
|
||||
displayedColumns: string[] = [
|
||||
'id',
|
||||
'officeName',
|
||||
'transactionDate',
|
||||
'transactionId',
|
||||
'glAccountType',
|
||||
'createdByUserName',
|
||||
'glAccountCode',
|
||||
'glAccountName',
|
||||
'debit',
|
||||
'credit'
|
||||
];
|
||||
/** Data source for provisioning journal entries table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -52,10 +62,14 @@ export class ViewProvisioningJournalEntriesComponent implements OnInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sortingDataAccessor = (transaction: any, property: any) => {
|
||||
switch (property) {
|
||||
case 'glAccountType': return transaction.glAccountType.value;
|
||||
case 'debit': return transaction.amount;
|
||||
case 'credit': return transaction.amount;
|
||||
default: return transaction[property];
|
||||
case 'glAccountType':
|
||||
return transaction.glAccountType.value;
|
||||
case 'debit':
|
||||
return transaction.amount;
|
||||
case 'credit':
|
||||
return transaction.amount;
|
||||
default:
|
||||
return transaction[property];
|
||||
}
|
||||
};
|
||||
this.dataSource.sort = this.sort;
|
||||
@@ -68,5 +82,4 @@ export class ViewProvisioningJournalEntriesComponent implements OnInit {
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user