build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
-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 }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user