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('SearchPageComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SearchPageComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SearchPageComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -19,7 +19,15 @@ export class SearchPageComponent {
|
||||
/** Datasource for loans disbursal table */
|
||||
dataSource: MatTableDataSource<SearchData>;
|
||||
/** Displayed Columns for serach results */
|
||||
displayedColumns: string[] = ['entityType', 'entityName', 'entityAccount', 'externalId', 'parentType', 'parentName', 'details'];
|
||||
displayedColumns: string[] = [
|
||||
'entityType',
|
||||
'entityName',
|
||||
'entityAccount',
|
||||
'externalId',
|
||||
'parentType',
|
||||
'parentName',
|
||||
'details'
|
||||
];
|
||||
/** Paginator for the table */
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
@@ -29,12 +37,14 @@ export class SearchPageComponent {
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.route.data.subscribe(( data: { searchResults: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.route.data.subscribe((data: { searchResults: any }) => {
|
||||
this.dataSource = new MatTableDataSource(data.searchResults);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.hasResults = (data.searchResults.length > 0);
|
||||
this.hasResults = data.searchResults.length > 0;
|
||||
this.overload = data.searchResults.length > 200 ? true : false;
|
||||
if (this.overload) {
|
||||
this.dataSource = new MatTableDataSource(data.searchResults.slice(0, 200));
|
||||
@@ -49,33 +59,75 @@ export class SearchPageComponent {
|
||||
navigate(entity: SearchData) {
|
||||
switch (entity.entityType) {
|
||||
case 'CLIENT':
|
||||
this.router.navigate(['clients', entity.entityId, 'general']);
|
||||
this.router.navigate([
|
||||
'clients',
|
||||
entity.entityId,
|
||||
'general'
|
||||
]);
|
||||
break;
|
||||
case 'CLIENTIDENTIFIER':
|
||||
this.router.navigate(['clients', entity.parentId, 'general']);
|
||||
this.router.navigate([
|
||||
'clients',
|
||||
entity.parentId,
|
||||
'general'
|
||||
]);
|
||||
break;
|
||||
case 'CENTER':
|
||||
this.router.navigate(['centers', entity.entityId]);
|
||||
this.router.navigate([
|
||||
'centers',
|
||||
entity.entityId
|
||||
]);
|
||||
break;
|
||||
case 'GROUP':
|
||||
this.router.navigate(['groups', entity.entityId]);
|
||||
this.router.navigate([
|
||||
'groups',
|
||||
entity.entityId
|
||||
]);
|
||||
break;
|
||||
case 'SHARE':
|
||||
this.router.navigate(['clients', entity.parentId, 'shares-accounts', entity.entityId]);
|
||||
this.router.navigate([
|
||||
'clients',
|
||||
entity.parentId,
|
||||
'shares-accounts',
|
||||
entity.entityId
|
||||
]);
|
||||
break;
|
||||
case 'SAVING':
|
||||
if (entity.subEntityType === 'depositAccountType.recurringDeposit') {
|
||||
this.router.navigate(['clients', entity.parentId, 'recurring-deposits-accounts', entity.entityId, 'transactions']);
|
||||
this.router.navigate([
|
||||
'clients',
|
||||
entity.parentId,
|
||||
'recurring-deposits-accounts',
|
||||
entity.entityId,
|
||||
'transactions'
|
||||
]);
|
||||
} else if (entity.subEntityType === 'depositAccountType.fixedDeposit') {
|
||||
this.router.navigate(['clients', entity.parentId, 'fixed-deposits-accounts', entity.entityId, 'transactions']);
|
||||
this.router.navigate([
|
||||
'clients',
|
||||
entity.parentId,
|
||||
'fixed-deposits-accounts',
|
||||
entity.entityId,
|
||||
'transactions'
|
||||
]);
|
||||
} else if (entity.subEntityType === 'depositAccountType.savingsDeposit') {
|
||||
this.router.navigate(['clients', entity.parentId, 'savings-accounts', entity.entityId, 'transactions']);
|
||||
this.router.navigate([
|
||||
'clients',
|
||||
entity.parentId,
|
||||
'savings-accounts',
|
||||
entity.entityId,
|
||||
'transactions'
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'LOAN':
|
||||
this.router.navigate(['clients', entity.parentId, 'loans-accounts', entity.entityId, 'general']);
|
||||
this.router.navigate([
|
||||
'clients',
|
||||
entity.parentId,
|
||||
'loans-accounts',
|
||||
entity.entityId,
|
||||
'general'
|
||||
]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ const routes: Routes = [
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
@@ -31,4 +32,4 @@ const routes: Routes = [
|
||||
providers: [SearchResolver],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class SearchRoutingModule { }
|
||||
export class SearchRoutingModule {}
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
export interface SearchData {
|
||||
entityId: number;
|
||||
entityAccountNo: string;
|
||||
entityExternalId: string;
|
||||
entityName: string;
|
||||
entityType: string;
|
||||
parentId: number;
|
||||
parentName: string;
|
||||
entityStatus: EntityStatus;
|
||||
parentType: string;
|
||||
subEntityType: string;
|
||||
entityId: number;
|
||||
entityAccountNo: string;
|
||||
entityExternalId: string;
|
||||
entityName: string;
|
||||
entityType: string;
|
||||
parentId: number;
|
||||
parentName: string;
|
||||
entityStatus: EntityStatus;
|
||||
parentType: string;
|
||||
subEntityType: string;
|
||||
}
|
||||
|
||||
export interface EntityStatus {
|
||||
id: number;
|
||||
code: string;
|
||||
value: string;
|
||||
id: number;
|
||||
code: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,4 +20,4 @@ import { PipesModule } from 'app/pipes/pipes.module';
|
||||
SearchRoutingModule
|
||||
]
|
||||
})
|
||||
export class SearchModule { }
|
||||
export class SearchModule {}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SearchService } from './search.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class SearchResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SearchService} searchService Notifications service.
|
||||
*/
|
||||
@@ -29,5 +28,4 @@ export class SearchResolver implements Resolve<Object> {
|
||||
const resource = route.queryParams['resource'];
|
||||
return this.searchService.getSearchResults(query, resource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,11 +12,10 @@ import { Observable } from 'rxjs';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class SearchService {
|
||||
|
||||
/**
|
||||
* @param {HttpClient} http Http Client to send requests.
|
||||
*/
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
/**
|
||||
* @param {string} query Query String
|
||||
@@ -24,11 +23,7 @@ export class SearchService {
|
||||
* @returns {Observable<any>} Search Results.
|
||||
*/
|
||||
getSearchResults(query: string, resource: string): Observable<any> {
|
||||
const httpParams = new HttpParams()
|
||||
.set('exactMatch', 'false')
|
||||
.set('query', query)
|
||||
.set('resource', resource);
|
||||
const httpParams = new HttpParams().set('exactMatch', 'false').set('query', query).set('resource', resource);
|
||||
return this.http.get('/search', { params: httpParams });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user