mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
Improve search page
This commit is contained in:
@@ -5,6 +5,8 @@ import { SearchService } from "../../services/search.service";
|
||||
import { SearchCategory } from "src/app/models/search-category";
|
||||
import { SearchDocument } from "src/app/models/search-document";
|
||||
import { formatDate } from '@angular/common';
|
||||
import { CloudData, CloudOptions } from 'angular-tag-cloud-module';
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
templateUrl: './search.page.html',
|
||||
@@ -14,18 +16,36 @@ export class SearchPage implements OnInit {
|
||||
|
||||
// https params
|
||||
private searchSubject: string;
|
||||
private searchDate: string;
|
||||
private advanceSearchSubject: string;
|
||||
private searchDocumentDate: string;
|
||||
private searchSender: string;
|
||||
private searchOrganicEntiry: string;
|
||||
private searchDocTypeId: string;
|
||||
|
||||
searchCategories: SearchCategory[];
|
||||
searchDocuments: SearchDocument[];
|
||||
showDocuments: boolean;
|
||||
showDocuments = false;
|
||||
showAdvanceSearch = false;
|
||||
|
||||
|
||||
|
||||
options: CloudOptions = {
|
||||
// if width is between 0 and 1 it will be set to the width of the upper element multiplied by the value
|
||||
width: 1000,
|
||||
// if height is between 0 and 1 it will be set to the height of the upper element multiplied by the value
|
||||
height: 400,
|
||||
overflow: false,
|
||||
};
|
||||
|
||||
data: CloudData[] = [
|
||||
{text: 'Weight-8-link-color', weight: 8, link: 'https://google.com', color: '#ffaaee'},
|
||||
{text: 'Weight-10-link', weight: 10, link: 'https://google.com', tooltip: 'display a tooltip'},
|
||||
// ...
|
||||
];
|
||||
|
||||
constructor(private modalController: ModalController,
|
||||
private search: SearchService) {
|
||||
this.showDocuments = false;
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -35,12 +55,30 @@ export class SearchPage implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* @description get respose from the server
|
||||
* @description Basic search
|
||||
*/
|
||||
basicSearch(){
|
||||
// search in API
|
||||
|
||||
this.search.basicSearch(this.searchSubject, this.searchDate, this.searchSender
|
||||
this.search.basicSearch(this.searchSubject, "", "", "", "").subscribe(res=>{
|
||||
|
||||
// bind respose
|
||||
this.searchCategories = res.Categories;
|
||||
this.searchDocuments = res.Documents;
|
||||
|
||||
// hide show document
|
||||
if(this.searchDocuments.length >= 1){
|
||||
this.showDocuments = true;
|
||||
} else {
|
||||
this.showDocuments = false
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
advanceSearch(){
|
||||
|
||||
this.search.basicSearch(this.advanceSearchSubject, this.searchDocumentDate, this.searchSender
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId).subscribe(res=>{
|
||||
|
||||
// bind respose
|
||||
@@ -75,4 +113,19 @@ export class SearchPage implements OnInit {
|
||||
return formatDate(date, 'dd/MM/yyyy', 'pt');
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Clean inputs
|
||||
*/
|
||||
showHideAdvanceSearch(show:boolean) {
|
||||
this.showAdvanceSearch = show;
|
||||
|
||||
/* Clear inputs */
|
||||
this.searchDocumentDate = "";
|
||||
this.searchSender = "";
|
||||
this.searchOrganicEntiry = "";
|
||||
this.searchDocTypeId = "";
|
||||
this.advanceSearchSubject = "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user