ITOTEAM-609 search event>

This commit is contained in:
Peter Maquiran
2024-06-26 13:45:25 +01:00
parent 02891dbb9a
commit 78c13d1bfb
13 changed files with 174 additions and 78 deletions
+10 -6
View File
@@ -303,18 +303,22 @@
<span class="app-name"
*ngIf="itemIcons() == 'AccoesPresidenciais & ArquivoDespachoElect' || itemIcons() == 'Correspondencia' ">
<span class="app-name" *ngIf="searchDocument.applicationId == '8' || searchDocument.applicationId == 8"> Correspondencia </span>
<span class="app-name" *ngIf="searchDocument.applicationId == '386' || searchDocument.applicationId == 386"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="searchDocument.applicationId == '361' || searchDocument.applicationId == 361 "> ArquivoDespachoElect </span>
<span class="app-name" *ngIf="searchDocument.applicationId == '8' || searchDocument.applicationId == 8 || searchDocument.ApplicationType == 8"> Correspondencia </span>
<span class="app-name" *ngIf="searchDocument.applicationId == '386' || searchDocument.applicationId == 386 || searchDocument.ApplicationType == 386"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="searchDocument.applicationId == '361' || searchDocument.applicationId == 361 || searchDocument.ApplicationType == 361 "> ArquivoDespachoElect </span>
</span>
</div>
<div class="d-flex ion-justify-content-between ">
<span class="organic-entity">{{ searchDocument.entity }}</span>
<span class="organic-entity">{{ searchDocument.entity || searchDocument.EntidadeOrganicaNome }}</span>
<span class="documente-date">{{ formateIsoDate(searchDocument.dateEntry || searchDocument.Data) }}</span>
</div>
<div *ngIf="select" (click)="view(searchDocument)"> Ver</div>
<div *ngIf="select" (click)="view(searchDocument)" style="color: gray;">
<button mat-icon-button aria-label="Example icon-button with a menu">
<ion-icon src="assets/icon/iconmonstr-eye-9.svg" class=" font-25-em "></ion-icon>
</button>
</div>
</div>
</li>
@@ -323,7 +327,7 @@
<!-- <a href="#" class="previous">&laquo; Previous</a>
<a href="#" class="next">Next &raquo;</a> -->
<div class="nextAndPreviewDiv" >
<div class="nextAndPreviewDiv" *ngIf="type != 'Agenda' && select == true ">
<a href="#" class="previous round" (click)="previeweButton($event)">&#8249;</a>
<div>{{pageNumber + "/" + totalPage}}</div>
<a href="#" class="next round" (click)="nextButton($event)" >&#8250;</a>
+66 -49
View File
@@ -20,6 +20,9 @@ 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';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { isHttpError } from 'src/app/services/http.service';
import { ToastService } from 'src/app/services/toast.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -114,7 +117,9 @@ export class SearchPage implements OnInit {
public ThemeService: ThemeService,
private router: Router,
private httpErrorhandle: HttpErrorHandle,
private agendaDataRepository: AgendaDataRepositoryService) {
private agendaDataRepository: AgendaDataRepositoryService,
private toastService: ToastService,
) {
this.ordinance = "recent";
this.currentPath = window.location.pathname;
@@ -168,7 +173,7 @@ export class SearchPage implements OnInit {
console.log('doc item',item)
const ApplicationType = item.applicationId.toString()
const Id = item.docId
const Id = item.docId
if (ApplicationType == '8') {
@@ -363,7 +368,8 @@ export class SearchPage implements OnInit {
/**
* @description Basic search
*/
basicSearch() {
@XTracerAsync({name:'search/basicSearch', bugPrint: true})
async basicSearch(tracing?: TracingType) {
let searchDocumentDate
let searchDocumentDateEnd;
@@ -386,70 +392,81 @@ export class SearchPage implements OnInit {
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";
this.searchResult = "Campo de pesquisa está vazio, entre com assunto que deseja pesquisa";
console.log('enter text');
} else {
/* 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);
const searchEvents = await this.agendaDataRepository.searchEvent({value: this.searchSubject.trim() }, tracing)
if(searchEvents.isOk()) {
this.showDocuments = true;
this.searchDocuments = searchEvents.value
this.searchDocuments = this.sortArrayISODate(this.searchDocuments);
this.reorderList(this.ordinance);
// hide show document
if (this.searchDocuments.length >= 1) {
this.showDocuments = true;
} else {
this.searchResult = "Registo não encontrado"
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.showLoader = true;
this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
, this.searchOrganicEntiryCode, this.searchDocTypeId, '0').subscribe(res => {
console.log(res)
tracing.setAttribute('outcome', 'success');
} else {
if (!res.Categories.length) {
this.searchResult = "Não encontramos o que procura";
}
this.loadWordCloud();
this.showDocuments = true;
res.Categories.forEach(e => {
e['Active'] = false;
});
if(!isHttpError(searchEvents.error)) {
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico.')
// bind respose
this.searchCategories = res.Categories;
} else if (isHttpError(searchEvents.error)) {
this.httpErrorhandle.httpStatusHandle(searchEvents.error)
}
this.searchDocuments = this.sortArrayISODate(res.Documents);
tracing.setAttribute('outcome', 'failed');
console.log('create event error: ', searchEvents.error)
}
this.reorderList(this.ordinance);
// this.showLoader = true;
// this.search.basicSearch(this.searchSubject, searchDocumentDate, searchDocumentDateEnd, this.searchSenderId
// , this.searchOrganicEntiryCode, this.searchDocTypeId, '0').subscribe(res => {
// console.log(res)
// hide show document
if (this.searchDocuments.length >= 1) {
this.showDocuments = true;
} else {
this.showDocuments = false
}
// if (!res.Categories.length) {
// this.searchResult = "Não encontramos o que procura";
// }
this.showLoader = false;
this.loadWordCloud();
// res.Categories.forEach(e => {
// e['Active'] = false;
// });
}, error => {
this.showLoader = false;
// this.searchResult = "Registo não encontrado"
this.httpErrorhandle.httpStatusHandle(error)
// console.log(error)
});
// // bind respose
// this.searchCategories = res.Categories;
// this.searchDocuments = this.sortArrayISODate(res.Documents);
// 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.eventAgenda == true) {
@@ -1073,9 +1090,9 @@ export class SearchPage implements OnInit {
async viewDetail(searchDocument: SearchList) {
const ApplicationType = searchDocument.ApplicationType.toString()
const ApplicationType = searchDocument?.ApplicationType?.toString()
const Id = searchDocument.Id
const CalendarId = searchDocument.ApplicationName.split(':')[1]
const CalendarId = searchDocument?.ApplicationName?.split(':')[1]
const DocTypeDesc = searchDocument.DocTypeDesc
if (this.select == false) {