lot of changes

This commit is contained in:
Eudes Inácio
2024-06-02 13:53:46 +01:00
parent 599d278e57
commit e9c8e0fbd9
19 changed files with 428 additions and 264 deletions
+83 -9
View File
@@ -18,6 +18,8 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { momentG } from 'src/plugin/momentG';
import { Cy } from 'cypress/enum'
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { SessionStore } from 'src/app/store/session.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -91,9 +93,13 @@ export class SearchPage implements OnInit {
select: boolean = false;
showSearchInput = false
eventAgenda = false;
checkRoutPublication: boolean;
checkDateEnd: boolean;
datePickerPlaceholder: string;
pageNumber = 1;
pageSize = 10;
totalPage: number;
@ViewChild('picker1') picker1: any;
@@ -107,7 +113,8 @@ export class SearchPage implements OnInit {
private navParams: NavParams,
public ThemeService: ThemeService,
private router: Router,
private httpErrorhandle: HttpErrorHandle) {
private httpErrorhandle: HttpErrorHandle,
private agendaDataRepository: AgendaDataRepositoryService) {
this.ordinance = "recent";
this.currentPath = window.location.pathname;
@@ -117,6 +124,7 @@ export class SearchPage implements OnInit {
this.select = this.navParams.get('select');
this.showSearchInput = this.navParams.get('showSearchInput');
this.eventAgenda = this.navParams.get('eventAgenda')
if (this.type == null || this.type == undefined) {
@@ -141,8 +149,8 @@ export class SearchPage implements OnInit {
}
myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
if(e) {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if (e) {
e.disabled = true;
}
})
@@ -204,7 +212,7 @@ export class SearchPage implements OnInit {
ngOnInit() {
if(this.currentPath.includes('/home/publications')) {
if (this.currentPath.includes('/home/publications')) {
this.checkRoutPublication = false;
this.checkDateEnd = true;
this.datePickerPlaceholder = 'Data Inicio*'
@@ -382,8 +390,34 @@ export class SearchPage implements OnInit {
} else {
this.showLoader = true;
this.search.basicSearch(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId
this.agendaDataRepository.getDocumentAttachments(361, SessionStore.user.UserId, this.searchSubject, this.pageNumber, this.pageSize).subscribe((values) => {
this.totalPage = values.data.total / this.pageSize;
this.totalPage = Math.round(this.totalPage)
console.log(values.data.result)
this.searchDocuments = this.sortArrayISODate(values.data.result);
this.reorderList(this.ordinance);
// hide show document
if (this.searchDocuments.length >= 1) {
this.showDocuments = true;
} else {
this.showDocuments = false
}
this.showLoader = false;
this.loadWordCloud();
}, error => {
this.showLoader = false;
// this.searchResult = "Registo não encontrado"
this.httpErrorhandle.httpStatusHandle(error)
// console.log(error)
})
return
this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
, this.searchOrganicEntiryCode, this.searchDocTypeId, '0').subscribe(res => {
console.log(this.searchDocTypeId)
return
if (!res.Categories.length) {
this.searchResult = "Não encontramos o que procura";
@@ -418,6 +452,32 @@ export class SearchPage implements OnInit {
});
}
}
else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect" && this.eventAgenda == true) {
this.showLoader = true;
this.agendaDataRepository.getDocumentAttachments(361, SessionStore.user.UserId, this.searchSubject, this.pageNumber, this.pageSize).subscribe((values) => {
this.totalPage = values.data.total / this.pageSize;
this.totalPage = Math.round(this.totalPage)
console.log(values.data.result)
this.searchDocuments = this.sortArrayISODate(values.data.result);
this.reorderList(this.ordinance);
// hide show document
if (this.searchDocuments.length >= 1) {
this.showDocuments = true;
} else {
this.showDocuments = false
}
this.showLoader = false;
this.loadWordCloud();
}, error => {
this.showLoader = false;
// this.searchResult = "Registo não encontrado"
this.httpErrorhandle.httpStatusHandle(error)
// console.log(error)
})
}
else if (this.type == "AccoesPresidenciais & ArquivoDespachoElect") {
this.searchCategories = [];
@@ -536,7 +596,7 @@ export class SearchPage implements OnInit {
} else {
this.showLoader = true;
this.search.basicSearch(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId
this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
, this.searchOrganicEntiryCode, this.searchDocTypeId, '8').subscribe(res => {
if (!res.Categories.length) {
this.searchResult = "Não encontramos o que procura";
@@ -579,7 +639,7 @@ export class SearchPage implements OnInit {
}
});
}
if (this.searchSubject.trim() == "" && searchDocumentDate == null&& searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
console.log('enter text');
@@ -793,13 +853,13 @@ export class SearchPage implements OnInit {
// });
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
if (this.searchSubject.trim() == "" && searchDocumentDate == null && searchDocumentDateEnd == null && this.searchSenderId == null && this.searchOrganicEntiryCode == null && this.searchDocTypeId == null) {
this.searchResult = "Campo de pesquisa esta vazio, entre com assunto que deseja pesquisa";
console.log('enter text');
} else {
this.showLoader = true;
this.search.basicSearchPublication(this.searchSubject, searchDocumentDate,searchDocumentDateEnd, this.searchSenderId
this.search.basicSearchPublication(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
, this.searchOrganicEntiryCode, this.searchDocTypeId, '386').subscribe(res => {
if (!res.Categories.length) {
this.searchResult = "Não encontramos o que procura";
@@ -1136,4 +1196,18 @@ export class SearchPage implements OnInit {
await modal.present();
}
nextButton(event) {
event.preventDefault();
this.pageNumber++;
this.basicSearch()
}
previeweButton(event) {
event.preventDefault();
if (this.pageNumber > 1) {
this.pageNumber--;
this.basicSearch()
}
}
}