This commit is contained in:
Peter Maquiran
2023-01-24 14:31:05 +01:00
parent 16e9087098
commit 5733874d5f
5 changed files with 153 additions and 40 deletions
+10 -4
View File
@@ -37,19 +37,25 @@
<div class="advance-search pa-0 pt-10 pr-10 flex-md-grow-1" > <div class="advance-search pa-0 pt-10 pr-10 flex-md-grow-1" >
<ion-form [class.d-none]="!showSearchInput"> <ion-form [class.d-none]="!showSearchInput">
<div class="d-flex search-input-container ion-justify-content-between" > <div class="d-flex search-input-container ion-justify-content-between" >
<div class="icon"> <!-- <div class="icon">
<button class="btn-no-color" (click)="basicSearch()"> <button class="btn-no-color" (click)="basicSearch()">
<ion-icon class="icon-z" slot="end" src="assets/images/theme/gov/search.svg"></ion-icon> <ion-icon class="icon-z" slot="end" src="assets/images/theme/gov/search.svg"></ion-icon>
</button> </button>
</div> </div> -->
<div class="input-text d-flex ion-align-items-center"> <div class="input-text d-flex ion-align-items-center pm-10">
<ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject' class="search-input" type="search" placeholder="Pesquisar"></ion-input> <ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject' class="search-input" type="search" placeholder="Pesquisar"></ion-input>
</div> </div>
<div (click)="clearSearchInput()" class="d-flex align-center icon"> <!-- <div (click)="clearSearchInput()" class="d-flex align-center icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-25" name="restaurant-outline" src="assets/images/icons-search-close.svg"></ion-icon> <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-25" name="restaurant-outline" src="assets/images/icons-search-close.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-25" name="restaurant-outline" src="assets/images/theme/gov/icons-search-close.svg"></ion-icon> <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-25" name="restaurant-outline" src="assets/images/theme/gov/icons-search-close.svg"></ion-icon>
</div> -->
<div (click)="basicSearch()" class="d-flex align-center icon">
<ion-icon class="icon-z" slot="end" src="assets/images/theme/gov/search.svg"></ion-icon>
</div> </div>
</div> </div>
</ion-form> </ion-form>
+95 -19
View File
@@ -11,6 +11,7 @@ import { DocumentDetailPage } from 'src/app/modals/document-detail/document-deta
import { SearchCategory, SearchList } from 'src/app/models/search-document'; import { SearchCategory, SearchList } from 'src/app/models/search-document';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'app-search', selector: 'app-search',
@@ -62,7 +63,8 @@ export class SearchPage implements OnInit {
private search: SearchService, private search: SearchService,
private modalCtrl: ModalController, private modalCtrl: ModalController,
private navParams: NavParams, private navParams: NavParams,
public ThemeService: ThemeService) public ThemeService: ThemeService,
private router: Router)
{ {
this.ordinance = "recent"; this.ordinance = "recent";
this.currentPath= window.location.pathname; this.currentPath= window.location.pathname;
@@ -166,9 +168,7 @@ export class SearchPage implements OnInit {
wordCloud() { wordCloud() {
this.search.mostSeachWord("15").subscribe(res=>{ this.search.mostSeachWord("15").subscribe( res => {
console.log('LOAD LIST');
const highest= res[0].Hits; const highest= res[0].Hits;
const lowest = res[res.length-1].Hits; const lowest = res[res.length-1].Hits;
@@ -191,7 +191,6 @@ export class SearchPage implements OnInit {
}); });
this.list = list this.list = list
console.log('set list')
const elem = document.documentElement.querySelector('.most-searched-word-container'); const elem = document.documentElement.querySelector('.most-searched-word-container');
@@ -213,7 +212,7 @@ export class SearchPage implements OnInit {
loadWordCloud() { loadWordCloud() {
setTimeout(()=>{ setTimeout(() => {
const elem = document.documentElement.querySelector('.most-searched-word-container'); const elem = document.documentElement.querySelector('.most-searched-word-container');
WordCloud( WordCloud(
@@ -386,7 +385,7 @@ export class SearchPage implements OnInit {
let counter = 0; let counter = 0;
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '8').subscribe(res=>{ ,this.searchOrganicEntiry, this.searchDocTypeId, '8').subscribe(res => {
res.Categories.forEach( e => { res.Categories.forEach( e => {
e['Active'] = false; e['Active'] = false;
this.searchCategories.push(e) this.searchCategories.push(e)
@@ -544,6 +543,61 @@ export class SearchPage implements OnInit {
counter++; counter++;
if(counter ==2) {
this.showLoader = false;
}
this.loadWordCloud();
},error => {
counter++;
if(counter ==2) {
this.showLoader = false;
}
this.searchResult = "Registo não encontrado"
console.log(error)
});
}
}
else if (this.type == "AccoesPresidenciais") {
let counter = 0;
this.showLoader = true;
this.searchCategories = []
this.searchDocuments = []
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res=>{
res.Categories.forEach( e => {
e['Active'] = false;
e['Name'] = "Publicações"
});
// bind respose
for ( const a of res.Categories) {
this.searchCategories.push(a);
}
for ( const a of this.sortArrayISODate(res.Documents)) {
a.DocTypeDesc = "Publicações"
this.searchDocuments.push(a);
}
this.reorderList(this.ordinance);
// hide show document
if(this.searchDocuments.length >= 1){
this.showDocuments = true;
} else {
this.showDocuments = false
}
counter++;
if(counter ==2){ if(counter ==2){
this.showLoader = false; this.showLoader = false;
} }
@@ -558,42 +612,55 @@ export class SearchPage implements OnInit {
this.searchResult = "Registo não encontrado" this.searchResult = "Registo não encontrado"
console.log(error) console.log(error)
}); });
}
}
else if (this.type == "AccoesPresidenciais"){
this.showLoader = true;
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender this.search.basicSearchPublication(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res=>{ ,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res => {
res.Categories.forEach( e => { res.Categories.forEach( e => {
e['Active'] = false; e['Active'] = false;
e['Name'] = "Acções"
}); });
// bind respose // bind respose
this.searchCategories = res.Categories; for ( const a of res.Categories) {
this.searchCategories.push(a);
}
this.searchDocuments = this.sortArrayISODate(res.Documents);
for ( const a of this.sortArrayISODate(res.Documents)) {
a.DocTypeDesc = "Acções"
this.searchDocuments.push(a);
}
this.reorderList(this.ordinance); this.reorderList(this.ordinance);
// hide show document // hide show document
if(this.searchDocuments.length >= 1){ if(this.searchDocuments.length >= 1) {
this.showDocuments = true; this.showDocuments = true;
} else { } else {
this.showDocuments = false this.showDocuments = false
} }
counter++;
if(counter ==2) {
this.showLoader = false; this.showLoader = false;
}
this.loadWordCloud(); this.loadWordCloud();
},error => { }, error => {
counter++;
if(counter ==2) {
this.showLoader = false; this.showLoader = false;
}
this.searchResult = "Registo não encontrado" this.searchResult = "Registo não encontrado"
console.log(error) console.log(error)
}); });
} }
} }
@@ -757,6 +824,7 @@ export class SearchPage implements OnInit {
const ApplicationType = searchDocument.ApplicationType.toString() const ApplicationType = searchDocument.ApplicationType.toString()
const Id = searchDocument.Id const Id = searchDocument.Id
const CalendarId = searchDocument.ApplicationName.split(':')[1] const CalendarId = searchDocument.ApplicationName.split(':')[1]
const DocTypeDesc = searchDocument.DocTypeDesc
if(this.select == false) { if(this.select == false) {
if(this.type == "Agenda") { if(this.type == "Agenda") {
@@ -776,7 +844,7 @@ export class SearchPage implements OnInit {
} else if(this.type == "AccoesPresidenciais") { } else if(this.type == "AccoesPresidenciais") {
this.viewPublicationDetail(Id); this.viewPublicationDetail(Id, DocTypeDesc);
} }
else if(this.type == "AccoesPresidenciais & ArquivoDespachoElect") { else if(this.type == "AccoesPresidenciais & ArquivoDespachoElect") {
@@ -790,7 +858,12 @@ export class SearchPage implements OnInit {
} }
} }
async viewPublicationDetail(publicationId:string) { async viewPublicationDetail(publicationId:string, DocTypeDesc) {
// validation my friend
if(DocTypeDesc == 'Acções') {
this.router.navigate(['/home/publications', publicationId]);
} else if( DocTypeDesc == 'Publicações') {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: PublicationDetailPage, component: PublicationDetailPage,
componentProps:{ componentProps:{
@@ -803,6 +876,9 @@ export class SearchPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then(()=>{}); modal.onDidDismiss().then(()=>{});
}
} }
+26
View File
@@ -66,6 +66,32 @@ export class SearchService {
return this.http.get<EventSearch>(`${geturl}`, options); return this.http.get<EventSearch>(`${geturl}`, options);
} }
basicSearchPublication(subject:string, date:string = null, sender:string = null, organicEntity:string = null, docTypeId:string = null, applicationType:string): Observable<EventSearch>{
// Endpoint
const geturl = environment.apiURL + 'search';
// store params
let params = new HttpParams();
// set https params
params = params.set("assunto", subject);
params = params.set("data", date);
params = params.set("remetente", sender);
params = params.set("entidadeOrganica", organicEntity);
params = params.set("docTypeId", docTypeId);
params = params.set("applicationType", applicationType);
params = params.set("listOnlyFolders", true)
const options = {
headers: this.headers,
params: params
};
return this.http.get<EventSearch>(`${geturl}`, options);
}
mostSeachWord(size:string):Observable<any>{ mostSeachWord(size:string):Observable<any>{
// Endpoint // Endpoint
+8 -3
View File
@@ -127,18 +127,23 @@
<div *ngIf="showSearch"> <div *ngIf="showSearch">
<div class="d-flex search-input-container ml-10 justify-between" *ngIf="showSearch"> <div class="d-flex search-input-container ml-10 justify-between" *ngIf="showSearch">
<div class="icon" (click)="basicSearch()"> <!-- <div class="icon" (click)="basicSearch()">
<ion-icon class="icon-z" slot="end" name="search"></ion-icon> <ion-icon class="icon-z" slot="end" name="search"></ion-icon>
</div> </div> -->
<div class="input-text d-flex ion-align-items-center"> <div class="input-text d-flex ion-align-items-center">
<ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject' (ngModelChange)="dynamicSearch()" <ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject' (ngModelChange)="dynamicSearch()"
class="search-input text-black" type="search" placeholder="Pesquisar"></ion-input> class="search-input text-black" type="search" placeholder="Pesquisar"></ion-input>
</div> </div>
<div class="icon" (click)="clearSearchInput()"> <!-- <div class="icon" (click)="clearSearchInput()">
<ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'default' "name="restaurant-outline" src="assets/images/icons-search-close.svg"></ion-icon> <ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'default' "name="restaurant-outline" src="assets/images/icons-search-close.svg"></ion-icon>
<ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'doneIt' "name="restaurant-outline" src="assets/images/theme/doneIt/icons-search.svg"></ion-icon> <ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'doneIt' "name="restaurant-outline" src="assets/images/theme/doneIt/icons-search.svg"></ion-icon>
<ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'gov' " name="restaurant-outline" src="assets/images/theme/gov/icons-search-close.svg"></ion-icon> <ion-icon title="Limpar" *ngIf="ThemeService.currentTheme == 'gov' " name="restaurant-outline" src="assets/images/theme/gov/icons-search-close.svg"></ion-icon>
</div> -->
<div (click)="basicSearch()" class="d-flex align-center icon">
<ion-icon class="icon-z" slot="end" src="assets/images/theme/gov/search.svg"></ion-icon>
</div> </div>
</div> </div>
</div> </div>
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = { export let versionData = {
"shortSHA": "47cc0257f", "shortSHA": "16e908709",
"SHA": "47cc0257f828b4bf00b5497bb71a21143388c73e", "SHA": "16e90870988f16410f86e49b4783850132982004",
"branch": "no_bug_movemente", "branch": "no_bug_movemente",
"lastCommitAuthor": "'Peter Maquiran'", "lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Mon Jan 23 10:00:16 2023 +0100'", "lastCommitTime": "'Mon Jan 23 15:24:35 2023 +0100'",
"lastCommitMessage": "Select agenda by default", "lastCommitMessage": "hot fix",
"lastCommitNumber": "4679", "lastCommitNumber": "4680",
"change": "", "change": "",
"changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/agenda/agenda.page.scss\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/pages/events/events.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/pages/search/search.page.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/popover/opts-expediente/opts-expediente.page.html\n\tmodified: src/app/shared/popover/opts-expediente/opts-expediente.page.ts", "changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/search/search.page.html\n\tmodified: src/app/pages/search/search.page.ts\n\tmodified: src/app/services/search.service.ts\n\tmodified: src/app/shared/header/header.page.html",
"changeAuthor": "peter.maquiran" "changeAuthor": "peter.maquiran"
} }