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" >
<ion-form [class.d-none]="!showSearchInput">
<div class="d-flex search-input-container ion-justify-content-between" >
<div class="icon">
<!-- <div class="icon">
<button class="btn-no-color" (click)="basicSearch()">
<ion-icon class="icon-z" slot="end" src="assets/images/theme/gov/search.svg"></ion-icon>
</button>
</div>
<div class="input-text d-flex ion-align-items-center">
</div> -->
<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>
</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 == '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>
</ion-form>
+103 -27
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 { ThemeService } from 'src/app/services/theme.service'
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { Router } from '@angular/router';
@Component({
selector: 'app-search',
@@ -62,7 +63,8 @@ export class SearchPage implements OnInit {
private search: SearchService,
private modalCtrl: ModalController,
private navParams: NavParams,
public ThemeService: ThemeService)
public ThemeService: ThemeService,
private router: Router)
{
this.ordinance = "recent";
this.currentPath= window.location.pathname;
@@ -166,9 +168,7 @@ export class SearchPage implements OnInit {
wordCloud() {
this.search.mostSeachWord("15").subscribe(res=>{
console.log('LOAD LIST');
this.search.mostSeachWord("15").subscribe( res => {
const highest= res[0].Hits;
const lowest = res[res.length-1].Hits;
@@ -191,7 +191,6 @@ export class SearchPage implements OnInit {
});
this.list = list
console.log('set list')
const elem = document.documentElement.querySelector('.most-searched-word-container');
@@ -213,7 +212,7 @@ export class SearchPage implements OnInit {
loadWordCloud() {
setTimeout(()=>{
setTimeout(() => {
const elem = document.documentElement.querySelector('.most-searched-word-container');
WordCloud(
@@ -386,7 +385,7 @@ export class SearchPage implements OnInit {
let counter = 0;
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 => {
e['Active'] = false;
this.searchCategories.push(e)
@@ -544,7 +543,7 @@ export class SearchPage implements OnInit {
counter++;
if(counter ==2){
if(counter ==2) {
this.showLoader = false;
}
@@ -552,7 +551,7 @@ export class SearchPage implements OnInit {
},error => {
counter++;
if(counter ==2){
if(counter ==2) {
this.showLoader = false;
}
this.searchResult = "Registo não encontrado"
@@ -561,9 +560,13 @@ export class SearchPage implements OnInit {
}
}
else if (this.type == "AccoesPresidenciais"){
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=>{
@@ -571,12 +574,18 @@ export class SearchPage implements OnInit {
res.Categories.forEach( e => {
e['Active'] = false;
e['Name'] = "Publicações"
});
// 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 = "Publicações"
this.searchDocuments.push(a);
}
this.reorderList(this.ordinance);
@@ -587,13 +596,71 @@ export class SearchPage implements OnInit {
this.showDocuments = false
}
this.showLoader = false;
counter++;
if(counter ==2){
this.showLoader = false;
}
this.loadWordCloud();
},error => {
this.showLoader = false;
counter++;
if(counter ==2){
this.showLoader = false;
}
this.searchResult = "Registo não encontrado"
console.log(error)
});
this.search.basicSearchPublication(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res => {
res.Categories.forEach( e => {
e['Active'] = false;
e['Name'] = "Acções"
});
// bind respose
for ( const a of res.Categories) {
this.searchCategories.push(a);
}
for ( const a of this.sortArrayISODate(res.Documents)) {
a.DocTypeDesc = "Acçõ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) {
this.showLoader = false;
}
this.loadWordCloud();
}, error => {
counter++;
if(counter ==2) {
this.showLoader = false;
}
this.searchResult = "Registo não encontrado"
console.log(error)
});
}
}
@@ -757,6 +824,7 @@ export class SearchPage implements OnInit {
const ApplicationType = searchDocument.ApplicationType.toString()
const Id = searchDocument.Id
const CalendarId = searchDocument.ApplicationName.split(':')[1]
const DocTypeDesc = searchDocument.DocTypeDesc
if(this.select == false) {
if(this.type == "Agenda") {
@@ -776,7 +844,7 @@ export class SearchPage implements OnInit {
} else if(this.type == "AccoesPresidenciais") {
this.viewPublicationDetail(Id);
this.viewPublicationDetail(Id, DocTypeDesc);
}
else if(this.type == "AccoesPresidenciais & ArquivoDespachoElect") {
@@ -790,19 +858,27 @@ export class SearchPage implements OnInit {
}
}
async viewPublicationDetail(publicationId:string) {
const modal = await this.modalController.create({
component: PublicationDetailPage,
componentProps:{
publicationId: publicationId,
isModal: true
},
cssClass: 'publication-detail modal modal-desktop ',
//backdropDismiss: false
});
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({
component: PublicationDetailPage,
componentProps:{
publicationId: publicationId,
isModal: true
},
cssClass: 'publication-detail modal modal-desktop ',
//backdropDismiss: false
});
await modal.present();
modal.onDidDismiss().then(()=>{});
}
await modal.present();
modal.onDidDismiss().then(()=>{});
}
+26
View File
@@ -66,6 +66,32 @@ export class SearchService {
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>{
// Endpoint
+8 -3
View File
@@ -127,18 +127,23 @@
<div *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>
</div>
</div> -->
<div class="input-text d-flex ion-align-items-center">
<ion-input (keyup.enter)="basicSearch()" [(ngModel)]='searchSubject' (ngModelChange)="dynamicSearch()"
class="search-input text-black" type="search" placeholder="Pesquisar"></ion-input>
</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 == '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>
</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>
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = {
"shortSHA": "47cc0257f",
"SHA": "47cc0257f828b4bf00b5497bb71a21143388c73e",
"shortSHA": "16e908709",
"SHA": "16e90870988f16410f86e49b4783850132982004",
"branch": "no_bug_movemente",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Mon Jan 23 10:00:16 2023 +0100'",
"lastCommitMessage": "Select agenda by default",
"lastCommitNumber": "4679",
"lastCommitTime": "'Mon Jan 23 15:24:35 2023 +0100'",
"lastCommitMessage": "hot fix",
"lastCommitNumber": "4680",
"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"
}