2023-03-09 15:15:06 +01:00
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
2023-08-15 18:09:03 +01:00
|
|
|
import { ModalController, NavParams } from '@ionic/angular';
|
2021-02-08 16:55:55 +01:00
|
|
|
import { SearchService } from "../../services/search.service";
|
2021-01-08 11:04:36 +01:00
|
|
|
import { formatDate } from '@angular/common';
|
2021-01-16 17:45:09 +01:00
|
|
|
import { SenderPage } from 'src/app/pages/search/sender/sender.page';
|
2021-01-19 16:44:39 +01:00
|
|
|
import { OrganicEntityPage } from 'src/app/pages/search/organic-entity/organic-entity.page';
|
2023-08-15 18:09:03 +01:00
|
|
|
import WordCloud from 'src/plugin/wordcloud2.js';
|
2021-02-11 14:42:10 +01:00
|
|
|
import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page';
|
2021-02-11 15:18:27 +01:00
|
|
|
import { PublicationDetailPage } from '../publications/view-publications/publication-detail/publication-detail.page';
|
2021-04-09 04:34:21 +01:00
|
|
|
import { DocumentDetailPage } from 'src/app/modals/document-detail/document-detail.page';
|
2021-08-20 17:14:25 +01:00
|
|
|
import { SearchCategory, SearchList } from 'src/app/models/search-document';
|
2021-10-25 13:54:34 +01:00
|
|
|
import { ThemeService } from 'src/app/services/theme.service'
|
2022-05-23 14:54:40 +01:00
|
|
|
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
2023-01-24 15:56:47 +01:00
|
|
|
import { Router } from '@angular/router';
|
2023-01-25 15:49:16 +01:00
|
|
|
import { environment } from 'src/environments/environment';
|
2023-02-27 09:34:36 +01:00
|
|
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
2023-03-09 15:15:06 +01:00
|
|
|
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
|
|
|
|
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
2023-06-10 10:26:47 +01:00
|
|
|
import { momentG } from 'src/plugin/momentG';
|
2024-04-18 16:32:28 +01:00
|
|
|
import { Cy } from 'cypress/enum'
|
2023-03-09 15:15:06 +01:00
|
|
|
|
|
|
|
|
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
|
|
|
|
parse: {
|
2023-10-11 18:23:13 +01:00
|
|
|
dateInput: "YYYY-MMMM-DD"
|
2023-03-09 15:15:06 +01:00
|
|
|
},
|
|
|
|
|
display: {
|
2023-10-11 18:23:13 +01:00
|
|
|
dateInput: "DD MMM YYYY",
|
2023-03-09 15:15:06 +01:00
|
|
|
monthYearLabel: "MMM YYYY",
|
|
|
|
|
dateA11yLabel: "LL",
|
|
|
|
|
monthYearA11yLabel: "MMMM YYYY"
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-19 11:35:48 +01:00
|
|
|
|
2020-08-05 15:39:16 +01:00
|
|
|
@Component({
|
|
|
|
|
selector: 'app-search',
|
|
|
|
|
templateUrl: './search.page.html',
|
|
|
|
|
styleUrls: ['./search.page.scss'],
|
2023-03-09 15:15:06 +01:00
|
|
|
providers: [
|
|
|
|
|
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },
|
|
|
|
|
]
|
2020-08-05 15:39:16 +01:00
|
|
|
})
|
|
|
|
|
export class SearchPage implements OnInit {
|
|
|
|
|
|
2023-03-09 15:15:06 +01:00
|
|
|
public showSpinners = true;
|
|
|
|
|
public showSeconds = false;
|
|
|
|
|
public touchUi = false;
|
|
|
|
|
public enableMeridian = false;
|
|
|
|
|
public stepHour = 1;
|
|
|
|
|
public stepMinute = 15;
|
|
|
|
|
public stepSecond = 15;
|
|
|
|
|
//
|
|
|
|
|
|
2021-01-08 11:04:36 +01:00
|
|
|
// https params
|
2021-01-24 23:40:03 +01:00
|
|
|
searchSubject: string;
|
|
|
|
|
searchDocumentDate: string;
|
2023-10-19 16:51:12 +01:00
|
|
|
searchDocumentDateEnd: string;
|
2023-08-11 16:14:25 +01:00
|
|
|
searchSenderdescription: string;
|
|
|
|
|
searchSenderId: number;
|
|
|
|
|
searchOrganicEntiryDescription: string;
|
|
|
|
|
searchOrganicEntiryCode: number;
|
2021-01-24 23:40:03 +01:00
|
|
|
searchDocTypeId: string;
|
|
|
|
|
ordinance: string;
|
2021-01-08 11:04:36 +01:00
|
|
|
|
2021-04-09 05:46:01 +01:00
|
|
|
searchCategories: SearchCategory[] = [];
|
2021-08-20 12:02:27 +01:00
|
|
|
showSearchDocuments: SearchList[] = [];
|
2021-01-18 14:59:09 +01:00
|
|
|
showCategory: string;
|
2023-08-15 18:09:03 +01:00
|
|
|
searchDocuments: SearchList[] = [];
|
2021-01-18 14:59:09 +01:00
|
|
|
|
2021-01-15 08:16:36 +01:00
|
|
|
showDocuments = false;
|
|
|
|
|
showAdvanceSearch = false;
|
|
|
|
|
|
2021-01-29 17:13:15 +01:00
|
|
|
showLoader: boolean;
|
|
|
|
|
|
2021-04-14 11:04:28 +01:00
|
|
|
currentPath: string
|
2022-05-10 11:12:56 +01:00
|
|
|
searchResult = "Assuntos mais recebidos";
|
2021-04-14 11:04:28 +01:00
|
|
|
|
2021-01-16 17:45:09 +01:00
|
|
|
// See http://idangero.us/swiper/api/ for valid options.
|
|
|
|
|
slideOpts = {
|
2023-08-15 18:09:03 +01:00
|
|
|
slidesPerView: parseInt(`${window.innerWidth / 147}`, 10),
|
2021-01-16 17:45:09 +01:00
|
|
|
initialSlide: 0,
|
|
|
|
|
speed: 400,
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
loadedAttachments: any;
|
2021-02-11 14:31:43 +01:00
|
|
|
|
2021-02-08 12:27:45 +01:00
|
|
|
list = []
|
|
|
|
|
|
2021-02-26 10:05:00 +01:00
|
|
|
windowWidth: number;
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
type: "Agenda" | "Correspondencia" | "AccoesPresidenciais" | "ArquivoDespachoElect" | "AccoesPresidenciais & ArquivoDespachoElect" = "Agenda";
|
2021-04-19 11:38:34 +01:00
|
|
|
select: boolean = false;
|
2021-04-19 11:35:48 +01:00
|
|
|
|
2021-04-29 15:25:14 +01:00
|
|
|
showSearchInput = false
|
2023-10-11 17:15:29 +01:00
|
|
|
checkRoutPublication: boolean;
|
2023-10-19 16:51:12 +01:00
|
|
|
checkDateEnd: boolean;
|
|
|
|
|
datePickerPlaceholder: string;
|
2021-04-29 15:25:14 +01:00
|
|
|
|
2023-03-09 15:15:06 +01:00
|
|
|
|
|
|
|
|
@ViewChild('picker1') picker1: any;
|
2023-10-19 16:51:12 +01:00
|
|
|
checkAgenda: boolean;
|
2023-03-09 15:15:06 +01:00
|
|
|
|
2024-04-18 16:32:28 +01:00
|
|
|
Cy = Cy
|
|
|
|
|
|
2021-01-08 11:04:36 +01:00
|
|
|
constructor(private modalController: ModalController,
|
2021-02-11 14:42:10 +01:00
|
|
|
private search: SearchService,
|
2021-04-19 11:35:48 +01:00
|
|
|
private modalCtrl: ModalController,
|
2021-10-25 13:54:34 +01:00
|
|
|
private navParams: NavParams,
|
2023-01-24 15:56:47 +01:00
|
|
|
public ThemeService: ThemeService,
|
2023-02-27 09:34:36 +01:00
|
|
|
private router: Router,
|
2023-08-15 18:09:03 +01:00
|
|
|
private httpErrorhandle: HttpErrorHandle) {
|
|
|
|
|
this.ordinance = "recent";
|
|
|
|
|
this.currentPath = window.location.pathname;
|
2021-04-19 11:35:48 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
this.type = this.navParams.get('type');
|
2021-04-29 15:25:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
this.type = this.navParams.get('type');
|
|
|
|
|
this.select = this.navParams.get('select');
|
2021-04-29 15:25:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
this.showSearchInput = this.navParams.get('showSearchInput');
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.type == null || this.type == undefined) {
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.currentPath.includes('/home/agenda')) {
|
|
|
|
|
this.type = "Agenda"
|
2024-03-04 22:11:26 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else if (this.currentPath.includes('/home/gabinete-digital')) {
|
|
|
|
|
this.type = "AccoesPresidenciais & ArquivoDespachoElect"
|
2024-03-04 22:11:26 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
|
|
|
|
|
} else if (this.currentPath.includes('/home/publications')) {
|
|
|
|
|
this.type = "AccoesPresidenciais"
|
2024-03-04 22:11:26 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
2024-03-04 22:11:26 +01:00
|
|
|
|
2021-04-19 11:35:48 +01:00
|
|
|
}
|
2023-08-15 18:09:03 +01:00
|
|
|
}
|
2021-04-19 11:35:48 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-22 08:35:44 +01:00
|
|
|
ngOnDestroy() {
|
|
|
|
|
clearInterval(this.myInterval)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
myInterval = setInterval(() => {
|
|
|
|
|
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
|
|
|
|
|
if(e) {
|
|
|
|
|
e.disabled = true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
2021-08-20 12:02:27 +01:00
|
|
|
selectItem(item: SearchList) {
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.select) {
|
2021-04-19 11:35:48 +01:00
|
|
|
this.modalController.dismiss({
|
|
|
|
|
selected: item
|
|
|
|
|
});
|
2021-01-08 11:04:36 +01:00
|
|
|
}
|
2022-05-23 14:54:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async view(item: SearchList) {
|
|
|
|
|
|
|
|
|
|
const ApplicationType = item.ApplicationType.toString()
|
|
|
|
|
const Id = item.Id
|
2021-04-30 14:12:45 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (ApplicationType == '8') {
|
|
|
|
|
|
2022-06-30 16:57:31 +01:00
|
|
|
// this.viewDocumentDetail(Id, ApplicationType);
|
2022-05-23 14:54:40 +01:00
|
|
|
|
2022-06-30 16:47:45 +01:00
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: ViewDocumentPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
trustedUrl: '',
|
|
|
|
|
file: {
|
|
|
|
|
title: item.Assunto,
|
|
|
|
|
url: '',
|
|
|
|
|
title_link: '',
|
|
|
|
|
},
|
|
|
|
|
applicationId: ApplicationType,
|
|
|
|
|
docId: item.Id,
|
|
|
|
|
},
|
2023-06-09 15:29:03 +01:00
|
|
|
cssClass: 'modal-width-100-width-background modal'
|
2022-06-30 16:47:45 +01:00
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
|
2022-05-23 14:54:40 +01:00
|
|
|
} else if (ApplicationType == '361') {
|
|
|
|
|
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: ViewDocumentPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
trustedUrl: '',
|
|
|
|
|
file: {
|
|
|
|
|
title: item.Assunto,
|
|
|
|
|
url: '',
|
|
|
|
|
title_link: '',
|
|
|
|
|
},
|
|
|
|
|
applicationId: ApplicationType,
|
|
|
|
|
docId: item.Id,
|
|
|
|
|
},
|
2023-06-09 15:29:03 +01:00
|
|
|
cssClass: 'modal-width-100-width-background modal'
|
2022-05-23 14:54:40 +01:00
|
|
|
});
|
|
|
|
|
await modal.present();
|
2023-08-15 18:09:03 +01:00
|
|
|
}
|
|
|
|
|
|
2021-04-19 11:35:48 +01:00
|
|
|
}
|
2020-08-05 15:39:16 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
2021-02-08 12:27:45 +01:00
|
|
|
|
2023-10-11 17:15:29 +01:00
|
|
|
if(this.currentPath.includes('/home/publications')) {
|
|
|
|
|
this.checkRoutPublication = false;
|
2023-10-19 16:51:12 +01:00
|
|
|
this.checkDateEnd = true;
|
|
|
|
|
this.datePickerPlaceholder = 'Data Inicio*'
|
2023-10-11 17:15:29 +01:00
|
|
|
console.log(this.checkRoutPublication)
|
|
|
|
|
} else {
|
|
|
|
|
this.checkRoutPublication = true;
|
2023-10-19 16:51:12 +01:00
|
|
|
this.checkDateEnd = false;
|
|
|
|
|
this.datePickerPlaceholder = 'Data*'
|
2023-10-11 17:15:29 +01:00
|
|
|
console.log(this.checkRoutPublication)
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-26 10:05:00 +01:00
|
|
|
this.wordCloud();
|
|
|
|
|
|
|
|
|
|
window.onresize = (event) => {
|
|
|
|
|
this.windowWidth = window.innerWidth
|
|
|
|
|
this.loadWordCloud()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.windowWidth = window.innerWidth
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
window['dynamicSearch'] = (search: string) => {
|
2021-03-05 14:54:10 +01:00
|
|
|
this.searchSubject = search;
|
|
|
|
|
}
|
2021-03-05 16:04:15 +01:00
|
|
|
|
2022-10-13 14:37:03 +01:00
|
|
|
window['searchTriger'] = () => {
|
2021-03-05 14:54:10 +01:00
|
|
|
this.basicSearch();
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-11 11:06:56 +01:00
|
|
|
}
|
|
|
|
|
|
2021-07-29 10:13:39 +01:00
|
|
|
wordCloud() {
|
2021-02-11 14:31:43 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
this.search.mostSeachWord("15").subscribe(res => {
|
2021-02-11 14:31:43 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
const highest = res[0].Hits;
|
|
|
|
|
const lowest = res[res.length - 1].Hits;
|
|
|
|
|
const range = highest - lowest;
|
2021-02-12 10:16:27 +01:00
|
|
|
const perPercent = range / 100;
|
|
|
|
|
let list = [];
|
|
|
|
|
|
|
|
|
|
// minimum font sixe
|
|
|
|
|
// Editable -----------------------------------
|
|
|
|
|
const minimumSize = 9;
|
|
|
|
|
// Editable ------------------------------------
|
2021-03-05 16:04:15 +01:00
|
|
|
// 64
|
2021-02-12 16:56:26 +01:00
|
|
|
const maximum = 64;
|
2021-02-12 10:16:27 +01:00
|
|
|
|
|
|
|
|
res.forEach(e => {
|
2023-08-15 18:09:03 +01:00
|
|
|
const array: any = Object.values(e);
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
array[1] = (((array[1] - lowest) / perPercent) * (maximum - minimumSize) / 100) + minimumSize;
|
2021-02-12 10:16:27 +01:00
|
|
|
list.push(array)
|
2021-02-08 12:27:45 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.list = list
|
2021-03-05 16:04:15 +01:00
|
|
|
|
2021-02-08 12:27:45 +01:00
|
|
|
const elem = document.documentElement.querySelector('.most-searched-word-container');
|
|
|
|
|
|
2023-01-04 11:11:30 +01:00
|
|
|
setTimeout(() => {
|
2021-02-26 10:05:00 +01:00
|
|
|
WordCloud(
|
|
|
|
|
elem,
|
2021-09-15 13:38:14 +01:00
|
|
|
{
|
2021-02-26 10:05:00 +01:00
|
|
|
list: this.list,
|
|
|
|
|
Family: 'Times, serif',
|
|
|
|
|
gridSize: 15
|
|
|
|
|
},
|
|
|
|
|
);
|
2023-06-11 23:00:12 +01:00
|
|
|
// console.log('set visualy')
|
2024-04-18 16:32:28 +01:00
|
|
|
}, 1000)
|
2021-02-26 10:05:00 +01:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-03-09 15:15:06 +01:00
|
|
|
roundTimeQuarterHour(timeToReturn = new Date()) {
|
|
|
|
|
let date: any = new Date(timeToReturn) || new Date();
|
|
|
|
|
const minutes = date.getMinutes();
|
|
|
|
|
date.setSeconds(0);
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (minutes % 15 != 0) {
|
|
|
|
|
|
2023-03-09 15:15:06 +01:00
|
|
|
if (minutes > 45) {
|
|
|
|
|
date.setMinutes(60)
|
|
|
|
|
} else if (minutes > 30) {
|
|
|
|
|
date.setMinutes(45)
|
|
|
|
|
} else if (minutes > 15) {
|
|
|
|
|
date.setMinutes(30)
|
|
|
|
|
} else if (minutes > 0) {
|
|
|
|
|
date.setMinutes(15)
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
}
|
2023-03-09 15:15:06 +01:00
|
|
|
|
|
|
|
|
return date
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clickDate() {
|
2023-08-15 18:09:03 +01:00
|
|
|
if (!this.searchDocumentDate) {
|
2023-03-09 15:15:06 +01:00
|
|
|
this.searchDocumentDate = this.roundTimeQuarterHour()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clearInputDocumentDate() {
|
|
|
|
|
this.searchDocumentDate = "";
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-29 10:13:39 +01:00
|
|
|
loadWordCloud() {
|
2021-02-26 10:05:00 +01:00
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
setTimeout(() => {
|
2021-02-26 10:05:00 +01:00
|
|
|
const elem = document.documentElement.querySelector('.most-searched-word-container');
|
|
|
|
|
|
2021-02-08 12:27:45 +01:00
|
|
|
WordCloud(
|
|
|
|
|
elem,
|
2021-09-15 13:38:14 +01:00
|
|
|
{
|
2021-02-08 12:27:45 +01:00
|
|
|
list: this.list,
|
|
|
|
|
Family: 'Times, serif',
|
|
|
|
|
gridSize: 15
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2021-08-13 16:07:17 +01:00
|
|
|
}, 100);
|
2021-02-26 10:05:00 +01:00
|
|
|
|
2020-08-05 15:39:16 +01:00
|
|
|
}
|
2021-01-20 10:41:38 +01:00
|
|
|
|
2021-07-29 10:13:39 +01:00
|
|
|
close() {
|
2021-01-07 10:57:42 +01:00
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
2020-08-05 15:39:16 +01:00
|
|
|
|
2021-01-18 09:52:33 +01:00
|
|
|
|
2021-07-29 10:13:39 +01:00
|
|
|
reorderList(orderBy: string) {
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2021-01-20 10:41:38 +01:00
|
|
|
this.ordinance = orderBy;
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.ordinance == 'recent') {
|
2021-01-20 10:41:38 +01:00
|
|
|
this.showSearchDocuments = this.sortArrayISODate(this.searchDocuments).reverse();
|
2021-01-20 13:52:25 +01:00
|
|
|
} else {
|
|
|
|
|
this.showSearchDocuments = this.sortArrayISODate(this.searchDocuments)
|
2021-01-20 10:41:38 +01:00
|
|
|
}
|
2021-01-19 16:44:39 +01:00
|
|
|
}
|
|
|
|
|
|
2021-07-29 10:13:39 +01:00
|
|
|
sortArrayISODate(myArray: any) {
|
2023-08-15 18:09:03 +01:00
|
|
|
return myArray.sort(function (a, b) {
|
2021-01-18 14:59:09 +01:00
|
|
|
return (a.Data < b.Data) ? -1 : ((a.Data > b.Data) ? 1 : 0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-08 11:43:47 +01:00
|
|
|
/**
|
2021-01-15 08:16:36 +01:00
|
|
|
* @description Basic search
|
2021-01-08 11:43:47 +01:00
|
|
|
*/
|
2023-08-15 18:09:03 +01:00
|
|
|
basicSearch() {
|
2021-01-15 08:16:36 +01:00
|
|
|
|
2023-06-10 10:26:47 +01:00
|
|
|
let searchDocumentDate
|
2023-10-19 16:51:12 +01:00
|
|
|
let searchDocumentDateEnd;
|
2023-06-10 10:26:47 +01:00
|
|
|
|
|
|
|
|
if (this.searchDocumentDate) {
|
|
|
|
|
searchDocumentDate = momentG(new Date(this.searchDocumentDate), 'yyyy-MM-dd')
|
|
|
|
|
}
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchDocumentDateEnd) {
|
|
|
|
|
searchDocumentDateEnd = momentG(new Date(this.searchDocumentDate), 'yyyy-MM-dd')
|
|
|
|
|
}
|
2023-06-10 10:26:47 +01:00
|
|
|
|
|
|
|
|
searchDocumentDate;
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.searchSubject == undefined || this.searchSubject == null) {
|
2023-06-10 10:52:13 +01:00
|
|
|
this.searchSubject = ""
|
2023-06-10 10:26:47 +01:00
|
|
|
}
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.type == "Agenda") {
|
2021-01-29 17:13:15 +01:00
|
|
|
|
2021-01-29 16:25:03 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.showLoader = true;
|
2023-10-19 16:51:12 +01:00
|
|
|
this.search.basicSearch(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId
|
2023-08-15 18:09:03 +01:00
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '0').subscribe(res => {
|
2024-03-04 22:11:26 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.Categories.forEach(e => {
|
2022-05-10 11:12:56 +01:00
|
|
|
e['Active'] = false;
|
|
|
|
|
});
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2022-05-10 11:12:56 +01:00
|
|
|
// bind respose
|
|
|
|
|
this.searchCategories = res.Categories;
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2022-05-10 11:12:56 +01:00
|
|
|
this.searchDocuments = this.sortArrayISODate(res.Documents);
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2022-05-10 11:12:56 +01:00
|
|
|
this.reorderList(this.ordinance);
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2022-05-10 11:12:56 +01:00
|
|
|
// hide show document
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.searchDocuments.length >= 1) {
|
2022-05-10 11:12:56 +01:00
|
|
|
this.showDocuments = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.showDocuments = false
|
|
|
|
|
}
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2022-05-10 11:12:56 +01:00
|
|
|
this.showLoader = false;
|
|
|
|
|
this.loadWordCloud();
|
2021-02-26 10:05:00 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
}, error => {
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
// this.searchResult = "Registo não encontrado"
|
|
|
|
|
this.httpErrorhandle.httpStatusHandle(error)
|
|
|
|
|
// console.log(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-12-13 12:49:47 +01:00
|
|
|
}
|
2023-08-15 18:09:03 +01:00
|
|
|
else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect") {
|
2021-01-29 16:25:03 +01:00
|
|
|
|
2021-04-13 10:35:43 +01:00
|
|
|
this.searchCategories = [];
|
|
|
|
|
this.searchDocuments = [];
|
|
|
|
|
this.showSearchDocuments = [];
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.select) {
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
let counter = 0;
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
2021-05-07 13:19:50 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
2024-03-04 22:11:26 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
this.search.searchForDoc(this.searchSubject, searchDocumentDate, this.searchSenderId
|
|
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '8').subscribe(res => {
|
|
|
|
|
this.showLoader = true;
|
|
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.Categories.forEach(e => {
|
|
|
|
|
e['Active'] = false;
|
|
|
|
|
this.searchCategories.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// bind respose
|
|
|
|
|
|
|
|
|
|
this.sortArrayISODate(res.Documents).forEach(e => {
|
|
|
|
|
e['appName'] = 'Correspondencia'
|
|
|
|
|
this.searchDocuments.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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 => {
|
|
|
|
|
this.searchResult = "Registo não encontrado"
|
|
|
|
|
counter++;
|
|
|
|
|
console.log('application 8 failed', error)
|
|
|
|
|
if (counter == 2) {
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-10-13 14:37:03 +01:00
|
|
|
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
2022-10-13 14:37:03 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
|
|
|
|
this.showLoader = true;
|
|
|
|
|
this.search.searchForDoc(this.searchSubject, searchDocumentDate, this.searchSenderId
|
|
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '361').subscribe(res => {
|
|
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.Categories.forEach(e => {
|
|
|
|
|
e['Active'] = false;
|
|
|
|
|
this.searchCategories.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.sortArrayISODate(res.Documents).forEach(e => {
|
|
|
|
|
e['appName'] = 'ArquivoDespachoElect'
|
|
|
|
|
this.searchDocuments.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.reorderList(this.ordinance);
|
|
|
|
|
|
|
|
|
|
// hide show document
|
|
|
|
|
if (this.searchDocuments.length >= 1) {
|
|
|
|
|
this.showDocuments = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.showDocuments = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.loadWordCloud();
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
|
|
if (counter == 2) {
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
}
|
|
|
|
|
}, error => {
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
|
|
if (counter == 2) {
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
}
|
|
|
|
|
this.searchResult = "Registo não encontrado"
|
|
|
|
|
|
|
|
|
|
console.log('application 361 failed', error);
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2021-05-07 13:19:50 +01:00
|
|
|
} else {
|
2021-12-13 12:49:47 +01:00
|
|
|
let counter = 0;
|
2021-05-07 13:19:50 +01:00
|
|
|
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
|
|
|
|
this.showLoader = true;
|
2023-10-19 16:51:12 +01:00
|
|
|
this.search.basicSearch(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId
|
2023-08-15 18:09:03 +01:00
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '8').subscribe(res => {
|
|
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
|
|
|
|
res.Categories.forEach(e => {
|
|
|
|
|
e['Active'] = false;
|
|
|
|
|
this.searchCategories.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// bind respose
|
|
|
|
|
|
|
|
|
|
this.sortArrayISODate(res.Documents).forEach(e => {
|
|
|
|
|
e['appName'] = 'Correspondencia'
|
|
|
|
|
this.searchDocuments.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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 => {
|
|
|
|
|
console.log('application 8 failed', error)
|
|
|
|
|
this.searchResult = "Registo não encontrado"
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
|
|
if (counter == 2) {
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null&& searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
2021-05-07 13:19:50 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
|
|
|
|
this.showLoader = true;
|
|
|
|
|
this.search.searchForDoc(this.searchSubject, searchDocumentDate, this.searchSenderId
|
|
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '361').subscribe(res => {
|
|
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.Categories.forEach(e => {
|
|
|
|
|
e['Active'] = false;
|
|
|
|
|
this.searchCategories.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.sortArrayISODate(res.Documents).forEach(e => {
|
|
|
|
|
e['appName'] = 'ArquivoDespachoElect'
|
|
|
|
|
this.searchDocuments.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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 => {
|
|
|
|
|
this.searchResult = "Registo não encontrado"
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
|
|
console.log('application 361 faield', error);
|
|
|
|
|
if (counter == 2) {
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-05-07 13:19:50 +01:00
|
|
|
}
|
2021-12-13 12:49:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
else if (this.type == "Correspondencia") {
|
2021-12-13 12:49:47 +01:00
|
|
|
|
|
|
|
|
this.searchCategories = [];
|
|
|
|
|
this.searchDocuments = [];
|
|
|
|
|
this.showSearchDocuments = [];
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.select) {
|
2021-12-13 12:49:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
let counter = 0;
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
2021-12-13 12:49:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
|
|
|
|
this.showLoader = true;
|
|
|
|
|
this.search.searchForDoc(this.searchSubject, searchDocumentDate, this.searchSenderId
|
|
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '8').subscribe(res => {
|
|
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.Categories.forEach(e => {
|
|
|
|
|
e['Active'] = false;
|
|
|
|
|
this.searchCategories.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// bind respose
|
|
|
|
|
|
|
|
|
|
this.sortArrayISODate(res.Documents).forEach(e => {
|
|
|
|
|
e['appName'] = 'Correspondencia'
|
|
|
|
|
this.searchDocuments.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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.showLoader = false;
|
|
|
|
|
this.loadWordCloud();
|
|
|
|
|
}, error => {
|
|
|
|
|
this.searchResult = "Registo não encontrado"
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-12-13 12:49:47 +01:00
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
let counter = 0;
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
2021-12-13 12:49:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
|
|
|
|
this.showLoader = true;
|
2023-10-19 16:51:12 +01:00
|
|
|
this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
|
2023-08-15 18:09:03 +01:00
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '8').subscribe(res => {
|
|
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res.Categories.forEach(e => {
|
|
|
|
|
e['Active'] = false;
|
|
|
|
|
this.searchCategories.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// bind respose
|
|
|
|
|
|
|
|
|
|
this.sortArrayISODate(res.Documents).forEach(e => {
|
|
|
|
|
e['appName'] = 'Correspondencia'
|
|
|
|
|
this.searchDocuments.push(e)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-12-13 12:49:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
2021-04-13 10:35:43 +01:00
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
else if (this.type == "AccoesPresidenciais") {
|
|
|
|
|
|
|
|
|
|
let counter = 0;
|
|
|
|
|
this.searchCategories = []
|
|
|
|
|
this.searchDocuments = []
|
2021-01-29 17:13:15 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// this.search.basicSearchPublication(this.searchSubject, searchDocumentDate, this.searchSender
|
|
|
|
|
// ,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res=>{
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// res.Categories.forEach( e => {
|
|
|
|
|
// e['Active'] = false;
|
|
|
|
|
// e['Name'] = "Publicações"
|
|
|
|
|
// });
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// // bind respose
|
|
|
|
|
// for ( const a of res.Categories) {
|
|
|
|
|
// this.searchCategories.push(a);
|
|
|
|
|
// }
|
2021-01-20 10:41:38 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// for ( const a of this.sortArrayISODate(res.Documents)) {
|
|
|
|
|
// a.DocTypeDesc = "Publicações"
|
|
|
|
|
// this.searchDocuments.push(a);
|
|
|
|
|
// }
|
2021-01-08 11:43:47 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// this.reorderList(this.ordinance);
|
2021-01-20 13:52:25 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// // hide show document
|
|
|
|
|
// if(this.searchDocuments.length >= 1){
|
|
|
|
|
// this.showDocuments = true;
|
|
|
|
|
// } else {
|
|
|
|
|
// this.showDocuments = false
|
|
|
|
|
// }
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// counter++;
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// if(counter ==2){
|
|
|
|
|
// this.showLoader = false;
|
|
|
|
|
// }
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// this.loadWordCloud();
|
|
|
|
|
// }, error => {
|
|
|
|
|
// counter++;
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-03 11:37:35 +01:00
|
|
|
// if(counter == 2) {
|
|
|
|
|
// this.showLoader = false;
|
|
|
|
|
// }
|
|
|
|
|
// this.searchResult = "Registo não encontrado"
|
|
|
|
|
// console.log(error)
|
|
|
|
|
// });
|
2023-01-24 15:56:47 +01:00
|
|
|
|
|
|
|
|
|
2023-10-19 16:51:12 +01:00
|
|
|
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
|
2023-08-15 18:09:03 +01:00
|
|
|
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
|
|
|
|
|
console.log('enter text');
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
|
|
|
|
this.showLoader = true;
|
2023-10-19 16:51:12 +01:00
|
|
|
this.search.basicSearchPublication(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId
|
2023-08-15 18:09:03 +01:00
|
|
|
, this.searchOrganicEntiryCode, this.searchDocTypeId, '386').subscribe(res => {
|
|
|
|
|
if (!res.Categories.length) {
|
|
|
|
|
this.searchResult = "Não encontramos o que procura";
|
|
|
|
|
}
|
2023-01-24 15:56:47 +01:00
|
|
|
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
res.Categories.forEach(e => {
|
|
|
|
|
e['Active'] = false;
|
|
|
|
|
e['Name'] = "Acções"
|
|
|
|
|
});
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (!environment.presidential) {
|
|
|
|
|
// bind respose
|
|
|
|
|
for (const a of res.Categories) {
|
|
|
|
|
this.searchCategories.push(a);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-24 15:56:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
for (const a of this.sortArrayISODate(res.Documents)) {
|
|
|
|
|
a.DocTypeDesc = "Acções"
|
|
|
|
|
this.searchDocuments.push(a);
|
|
|
|
|
}
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
this.reorderList(this.ordinance);
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
// hide show document
|
|
|
|
|
if (this.searchDocuments.length >= 1) {
|
|
|
|
|
this.showDocuments = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.showDocuments = false
|
|
|
|
|
}
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
counter++;
|
2023-08-03 11:37:35 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
this.showLoader = false;
|
|
|
|
|
this.loadWordCloud();
|
|
|
|
|
}, error => {
|
|
|
|
|
counter++;
|
|
|
|
|
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
|
|
|
|
|
this.searchResult = "Registo não encontrado"
|
|
|
|
|
console.log(error)
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2021-01-29 16:25:03 +01:00
|
|
|
}
|
2021-04-19 11:35:48 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
}
|
2021-01-08 11:43:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
/**
|
|
|
|
|
* @description set empty value to searchSubject
|
|
|
|
|
*/
|
2021-07-22 16:06:52 +01:00
|
|
|
clearSearchInput() {
|
2021-01-08 12:29:59 +01:00
|
|
|
this.searchSubject = ""
|
2021-02-11 11:06:56 +01:00
|
|
|
|
|
|
|
|
this.searchCategories = [];
|
|
|
|
|
this.searchDocuments = [];
|
|
|
|
|
this.showDocuments = false;
|
|
|
|
|
|
|
|
|
|
this.wordCloud();
|
2021-07-22 16:06:52 +01:00
|
|
|
}
|
2021-01-08 12:29:59 +01:00
|
|
|
|
2021-01-08 11:04:36 +01:00
|
|
|
/**
|
|
|
|
|
* @param isoDate String Iso date
|
2021-01-08 13:00:34 +01:00
|
|
|
* @returns date in format dd/MM/yyyy
|
2021-01-08 12:29:59 +01:00
|
|
|
* @description convert Iso date to dd/MM/yyyy
|
2021-01-08 11:04:36 +01:00
|
|
|
*/
|
2023-08-15 18:09:03 +01:00
|
|
|
formateIsoDate(isoDate: string): string {
|
2021-01-08 11:04:36 +01:00
|
|
|
const date = new Date(isoDate);
|
|
|
|
|
return formatDate(date, 'dd/MM/yyyy', 'pt');
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
activeCategoty(i) {
|
2021-01-20 13:52:25 +01:00
|
|
|
|
2021-02-10 16:55:27 +01:00
|
|
|
this.searchCategories.forEach((e, j) => {
|
2023-08-15 18:09:03 +01:00
|
|
|
if (i != j) {
|
2021-02-10 16:55:27 +01:00
|
|
|
e['Active'] = false;
|
2021-09-15 13:38:14 +01:00
|
|
|
}
|
2021-01-20 13:52:25 +01:00
|
|
|
})
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.searchCategories[i]['Active']) {
|
2021-02-10 16:55:27 +01:00
|
|
|
this.searchCategories[i]['Active'] = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.searchCategories[i]['Active'] = true
|
|
|
|
|
}
|
2021-01-20 13:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
clearInputRemetente() {
|
2023-08-11 16:14:25 +01:00
|
|
|
this.searchSenderdescription = "";
|
|
|
|
|
this.searchSenderId = null;
|
2021-01-18 14:59:09 +01:00
|
|
|
}
|
|
|
|
|
|
2023-03-09 15:15:06 +01:00
|
|
|
|
2021-01-18 14:59:09 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
clearInputOrganicEntity() {
|
2023-08-11 16:14:25 +01:00
|
|
|
this.searchOrganicEntiryDescription = "";
|
|
|
|
|
this.searchOrganicEntiryCode = null;
|
2021-01-18 14:59:09 +01:00
|
|
|
}
|
|
|
|
|
|
2021-01-15 08:16:36 +01:00
|
|
|
/**
|
|
|
|
|
* @description Clean inputs
|
|
|
|
|
*/
|
2023-08-15 18:09:03 +01:00
|
|
|
showHideAdvanceSearch(show: boolean) {
|
2021-01-15 08:16:36 +01:00
|
|
|
this.showAdvanceSearch = show;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-16 17:45:09 +01:00
|
|
|
async openAdvanceSearchSelection() {
|
|
|
|
|
|
2021-03-11 10:31:46 +01:00
|
|
|
let classs;
|
2023-08-15 18:09:03 +01:00
|
|
|
if (window.innerWidth <= 1024) {
|
2021-03-11 10:31:46 +01:00
|
|
|
classs = 'modal modal-desktop'
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
2021-03-11 10:31:46 +01:00
|
|
|
classs = 'search-desktop-modal search-submodal'
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-16 17:45:09 +01:00
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: SenderPage,
|
2021-03-11 10:31:46 +01:00
|
|
|
cssClass: classs,
|
2021-01-16 17:45:09 +01:00
|
|
|
componentProps: {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2023-07-15 11:01:09 +01:00
|
|
|
|
2021-01-19 16:44:39 +01:00
|
|
|
|
|
|
|
|
modal.onDidDismiss().then((data) => {
|
2023-08-11 16:14:25 +01:00
|
|
|
this.searchSenderdescription = data.data.Name;
|
|
|
|
|
this.searchSenderId = data.data.Id
|
2021-01-19 16:44:39 +01:00
|
|
|
});
|
2023-07-15 11:01:09 +01:00
|
|
|
await modal.present();
|
2021-01-19 16:44:39 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2022-06-22 16:37:51 +01:00
|
|
|
async openOrganicEntitySelection() {
|
2021-01-19 16:44:39 +01:00
|
|
|
|
2021-03-11 10:31:46 +01:00
|
|
|
let classs;
|
2023-08-15 18:09:03 +01:00
|
|
|
if (window.innerWidth <= 1024) {
|
2021-03-11 10:31:46 +01:00
|
|
|
classs = 'modal modal-desktop'
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
2021-03-11 10:31:46 +01:00
|
|
|
classs = 'search-desktop-modal search-submodal'
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-19 16:44:39 +01:00
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: OrganicEntityPage,
|
2021-03-11 10:31:46 +01:00
|
|
|
cssClass: classs,
|
2021-01-19 16:44:39 +01:00
|
|
|
componentProps: {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2021-01-19 16:44:39 +01:00
|
|
|
modal.onDidDismiss().then((data) => {
|
2023-08-15 18:09:03 +01:00
|
|
|
console.log('SerachEntity', data.data)
|
2023-08-11 16:14:25 +01:00
|
|
|
this.searchOrganicEntiryDescription = data.data.Description;
|
|
|
|
|
this.searchOrganicEntiryCode = data.data.Code;
|
2021-01-19 16:44:39 +01:00
|
|
|
});
|
2023-07-15 11:01:09 +01:00
|
|
|
await modal.present();
|
|
|
|
|
|
2021-01-16 17:45:09 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
TodosCategory = true
|
2023-08-15 18:09:03 +01:00
|
|
|
async filterDocList(categoryName: string) {
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2021-01-18 14:59:09 +01:00
|
|
|
// show all category
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.showCategory == categoryName) {
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2021-01-18 14:59:09 +01:00
|
|
|
this.showSearchDocuments = this.searchDocuments;
|
|
|
|
|
|
|
|
|
|
} else { // filter category
|
|
|
|
|
this.showSearchDocuments = this.searchDocuments.filter((e) => e.DocTypeDesc == categoryName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.showCategory = categoryName;
|
2023-01-24 15:56:47 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
for (let category of this.searchCategories) {
|
|
|
|
|
if (category['Active']) {
|
2023-01-24 15:56:47 +01:00
|
|
|
this.TodosCategory = false
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.TodosCategory = true
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
noFilter() {
|
|
|
|
|
this.TodosCategory = true
|
|
|
|
|
let n = 0
|
2023-08-15 18:09:03 +01:00
|
|
|
for (let category of this.searchCategories) {
|
2023-01-24 15:56:47 +01:00
|
|
|
this.searchCategories[n]['Active'] = false
|
|
|
|
|
n++
|
|
|
|
|
}
|
|
|
|
|
this.showSearchDocuments = this.searchDocuments;
|
2021-01-18 14:59:09 +01:00
|
|
|
}
|
2021-02-11 14:31:43 +01:00
|
|
|
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
itemIcons(): string {
|
2021-04-19 11:35:48 +01:00
|
|
|
return this.type
|
2021-02-11 14:31:43 +01:00
|
|
|
}
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
viewDocument() {
|
|
|
|
|
const url: string = this.loadedAttachments.DocumentURL.replace("webTRIX.Viewer", "webTRIX.Viewer.Branch1");
|
2021-02-11 14:31:43 +01:00
|
|
|
// const browser = this.iab.create(url,"_blank");
|
|
|
|
|
// browser.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-08-20 12:02:27 +01:00
|
|
|
async viewDetail(searchDocument: SearchList) {
|
2021-04-30 14:12:45 +01:00
|
|
|
|
|
|
|
|
const ApplicationType = searchDocument.ApplicationType.toString()
|
2023-08-15 18:09:03 +01:00
|
|
|
const Id = searchDocument.Id
|
2022-06-13 16:49:36 +01:00
|
|
|
const CalendarId = searchDocument.ApplicationName.split(':')[1]
|
2023-01-24 15:56:47 +01:00
|
|
|
const DocTypeDesc = searchDocument.DocTypeDesc
|
2022-06-13 16:49:36 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (this.select == false) {
|
|
|
|
|
if (this.type == "Agenda") {
|
2021-02-11 15:18:27 +01:00
|
|
|
|
2021-04-19 11:35:48 +01:00
|
|
|
const modal = await this.modalCtrl.create({
|
|
|
|
|
component: ViewEventPage,
|
2022-06-14 14:34:54 +01:00
|
|
|
componentProps: {
|
2021-07-26 11:34:46 +01:00
|
|
|
eventId: Id,
|
2022-06-13 16:49:36 +01:00
|
|
|
CalendarId: CalendarId,
|
2021-08-25 12:34:02 +01:00
|
|
|
isModal: true,
|
|
|
|
|
header: false
|
2021-04-19 11:35:48 +01:00
|
|
|
},
|
|
|
|
|
cssClass: 'modal modal-desktop',
|
|
|
|
|
});
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
modal.onDidDismiss().then((res) => { });
|
2023-07-15 11:01:09 +01:00
|
|
|
await modal.present();
|
2023-08-15 18:09:03 +01:00
|
|
|
} else if (this.type == "AccoesPresidenciais") {
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
this.viewPublicationDetail(Id, DocTypeDesc);
|
2021-04-19 11:35:48 +01:00
|
|
|
}
|
2023-08-15 18:09:03 +01:00
|
|
|
else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect") {
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
// 361
|
2023-08-15 18:09:03 +01:00
|
|
|
if (ApplicationType == '8') {
|
2021-07-23 15:57:01 +01:00
|
|
|
this.viewDocumentDetail(Id, ApplicationType);
|
2023-01-24 15:56:47 +01:00
|
|
|
} else if (ApplicationType == '361') {
|
|
|
|
|
this.viewDocumentModal(searchDocument)
|
2021-07-23 15:57:01 +01:00
|
|
|
}
|
2021-04-19 11:35:48 +01:00
|
|
|
}
|
2021-04-07 09:32:17 +01:00
|
|
|
}
|
2021-02-11 14:46:34 +01:00
|
|
|
}
|
2021-02-11 14:42:10 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
async viewPublicationDetail(publicationId: string, DocTypeDesc) {
|
2023-01-24 15:56:47 +01:00
|
|
|
// validation my friend
|
|
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (DocTypeDesc == 'Acções') {
|
2023-01-24 15:56:47 +01:00
|
|
|
this.router.navigate(['/home/publications', publicationId]);
|
2023-08-15 18:09:03 +01:00
|
|
|
} else if (DocTypeDesc == 'Publicações') {
|
2023-01-24 15:56:47 +01:00
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: PublicationDetailPage,
|
2023-08-15 18:09:03 +01:00
|
|
|
componentProps: {
|
2023-01-24 15:56:47 +01:00
|
|
|
publicationId: publicationId,
|
|
|
|
|
isModal: true
|
|
|
|
|
},
|
|
|
|
|
cssClass: 'publication-detail modal modal-desktop ',
|
|
|
|
|
//backdropDismiss: false
|
|
|
|
|
});
|
2023-07-15 11:01:09 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
|
|
|
|
|
modal.onDidDismiss().then(() => { });
|
2023-07-15 11:01:09 +01:00
|
|
|
await modal.present();
|
2023-01-24 15:56:47 +01:00
|
|
|
}
|
2023-08-15 18:09:03 +01:00
|
|
|
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2021-02-11 15:18:27 +01:00
|
|
|
|
|
|
|
|
}
|
2021-04-07 09:32:17 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
async viewDocumentDetail(docId: string, applicationId: string) {
|
2021-04-07 09:32:17 +01:00
|
|
|
let classs;
|
2021-07-23 15:57:01 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
if (window.innerWidth < 701) {
|
2021-04-19 11:35:48 +01:00
|
|
|
classs = 'modal modal-desktop'
|
2023-08-15 18:09:03 +01:00
|
|
|
} else {
|
2021-04-09 04:34:21 +01:00
|
|
|
classs = 'modal modal-desktop showAsideOptions'
|
2021-04-07 09:32:17 +01:00
|
|
|
}
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2021-04-07 09:32:17 +01:00
|
|
|
const modal = await this.modalController.create({
|
2021-04-09 04:34:21 +01:00
|
|
|
component: DocumentDetailPage,
|
2023-08-15 18:09:03 +01:00
|
|
|
componentProps: {
|
2021-04-09 04:34:21 +01:00
|
|
|
docId: docId,
|
|
|
|
|
applicationId: applicationId,
|
2021-04-07 09:32:17 +01:00
|
|
|
},
|
|
|
|
|
cssClass: classs,
|
|
|
|
|
});
|
2023-07-15 11:01:09 +01:00
|
|
|
|
2023-08-15 18:09:03 +01:00
|
|
|
modal.onDidDismiss().then((res) => { });
|
2023-07-15 11:01:09 +01:00
|
|
|
await modal.present();
|
2021-07-23 15:57:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2021-09-15 13:38:14 +01:00
|
|
|
|
2023-01-24 15:56:47 +01:00
|
|
|
|
|
|
|
|
async viewDocumentModal(LoadedDocument) {
|
|
|
|
|
|
|
|
|
|
let task = {
|
|
|
|
|
serialNumber: '',
|
|
|
|
|
taskStartDate: '',
|
|
|
|
|
isEvent: true,
|
|
|
|
|
workflowInstanceDataFields: {
|
|
|
|
|
FolderID: '',
|
|
|
|
|
Subject: LoadedDocument.SourceName || LoadedDocument.Assunto,
|
|
|
|
|
SourceSecFsID: LoadedDocument.ApplicationId || LoadedDocument.ApplicationType,
|
|
|
|
|
SourceType: 'DOC',
|
|
|
|
|
SourceID: LoadedDocument.Id || LoadedDocument.Id,
|
|
|
|
|
DispatchNumber: ''
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: ViewDocumentPage,
|
|
|
|
|
componentProps: {
|
|
|
|
|
trustedUrl: '',
|
|
|
|
|
file: {
|
|
|
|
|
title: task.workflowInstanceDataFields.Subject,
|
|
|
|
|
url: '',
|
|
|
|
|
title_link: '',
|
|
|
|
|
},
|
|
|
|
|
Document: LoadedDocument,
|
|
|
|
|
applicationId: task.workflowInstanceDataFields.SourceSecFsID,
|
2023-08-15 18:09:03 +01:00
|
|
|
docId: task.workflowInstanceDataFields.SourceID,
|
2023-01-24 15:56:47 +01:00
|
|
|
folderId: '',
|
|
|
|
|
task: task
|
|
|
|
|
},
|
|
|
|
|
cssClass: 'modal modal-desktop'
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-11 15:18:27 +01:00
|
|
|
}
|