mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Improve search page
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { from } from 'rxjs';
|
||||
import { OrganicEntityService } from 'src/app/services/organic-entity.service';
|
||||
import { OrganicEntity } from 'src/app/models/organic-entity.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-organic-entity',
|
||||
templateUrl: './organic-entity.page.html',
|
||||
styleUrls: ['./organic-entity.page.scss'],
|
||||
})
|
||||
export class OrganicEntityPage implements OnInit {
|
||||
|
||||
organicEntities: OrganicEntity[];
|
||||
showOrganicEntities: OrganicEntity[];
|
||||
findEntity: string;
|
||||
|
||||
|
||||
constructor(private modalController:ModalController,
|
||||
private OrganicEntityService: OrganicEntityService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getOrganicEntity();
|
||||
}
|
||||
|
||||
|
||||
getOrganicEntity(){
|
||||
this.OrganicEntityService.getOrganicEntity().subscribe(res=>{
|
||||
console.log(res)
|
||||
this.organicEntities = res;
|
||||
});
|
||||
}
|
||||
|
||||
filterContact(){
|
||||
|
||||
const findEntity = this.findEntity.toLowerCase();
|
||||
|
||||
const entities = this.organicEntities.filter((Entity) => {
|
||||
|
||||
if (Entity.Description.toLowerCase().indexOf(findEntity) == 0){
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
this.showOrganicEntities = entities;
|
||||
}
|
||||
|
||||
selectOrganicEntidy(selectedOraganicEntit: string){
|
||||
this.close(selectedOraganicEntit)
|
||||
}
|
||||
|
||||
close(username: string){
|
||||
this.modalController.dismiss(username);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user