Improve search

This commit is contained in:
Peter Maquiran
2021-04-19 15:21:35 +01:00
parent bd2a2fd3f4
commit 8b26ffd9a5
8 changed files with 116 additions and 36 deletions
+12
View File
@@ -19,3 +19,15 @@ export enum Sources
Exchange = 3, Exchange = 3,
File = 4 File = 4
} }
export class EventAttachment {
Id?: string; // id do evento
ParentId: string;
Source: string;
SourceId: string;
Link?: string;
SerialNumber?: string;
ApplicationId: string;
}
+2
View File
@@ -1,5 +1,6 @@
import { EventBody } from './eventbody.model'; import { EventBody } from './eventbody.model';
import { EventPerson } from './eventperson.model'; import { EventPerson } from './eventperson.model';
import { SearchDocument } from './search-document';
export class Event{ export class Event{
EventId: string; EventId: string;
@@ -19,4 +20,5 @@ export class Event{
Organizer: string; Organizer: string;
Categories: string[]; Categories: string[];
HasAttachments: boolean; HasAttachments: boolean;
// documents?: SearchDocument[]
} }
@@ -41,12 +41,12 @@ export class EventListPage implements OnInit {
} }
this.LoadToApproveEvents(); // this.LoadToApproveEvents();
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) { if(event instanceof NavigationEnd && event.url == this.router.url) {
this.LoadToApproveEvents(); // this.LoadToApproveEvents();
} }
}); });
@@ -123,10 +123,15 @@
<!-- Aside right --> <!-- Aside right -->
<div class="aside-content d-none flex-column height-100"> <div class="aside-content d-none flex-column height-100">
<!--
<app-empty-container [texto]="emptyTextDescription" *ngIf="showEmptyContainer" class="d-flex height-100 flex-column"></app-empty-container> <app-empty-container [texto]="emptyTextDescription" *ngIf="showEmptyContainer" class="d-flex height-100 flex-column"></app-empty-container>
<app-events-to-approve [profile]="'MDGPR'" *ngIf="showEventsToApprove" class="d-flex height-100 flex-column"></app-events-to-approve> <app-events-to-approve [profile]="'MDGPR'" *ngIf="showEventsToApprove" class="d-flex height-100 flex-column"></app-events-to-approve>
<app-expedients (openExpedientDetail)="openExpedientPage($event)" [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showExpedients"></app-expedients>
<app-expediente (openExpedientList)="openExpedientListPage()" [profile]="profile" [serialNumber]="serialNumber" class="d-flex height-100 flex-column" *ngIf="showExpedientDetail"></app-expediente>
<app-expedients (openExpedientDetail)="openExpedientPage($event)" [profile]="profile" class="d-flex height-100 flex-column" *ngIf="showExpedients"></app-expedients>
<app-expediente (openExpedientList)="openExpedientListPage()" [profile]="profile" [serialNumber]="serialNumber" class="d-flex height-100 flex-column" *ngIf="showExpedientDetail"></app-expediente>
-->
</div> </div>
</div> </div>
</ion-content> </ion-content>
@@ -56,15 +56,14 @@ export class GabineteDigitalPage implements OnInit {
if( window.innerWidth <= 1024){ if( window.innerWidth <= 1024){
this.modalController.dismiss(); this.modalController.dismiss();
} }
}; };
this.activatedRoute.queryParams.subscribe(params => { this.activatedRoute.queryParams.subscribe(params => {
if(params["show"]){ if(params["show"]){
this.openExpedientListPage(); // this.openExpedientListPage();
} }
else if(params["events"]){ else if(params["events"]){
this.openEventsToApprovePage("MDGPR"); // this.openEventsToApprovePage("MDGPR");
} }
}); });
@@ -84,23 +83,21 @@ export class GabineteDigitalPage implements OnInit {
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) { if(event instanceof NavigationEnd && event.url == this.router.url) {
this.LoadCounts(); //this.LoadCounts();
} }
}); });
// this.LoadCounts();
this.LoadCounts();
/* this.eventService.getAllMdEvents.subscribe(res=>{ /* this.eventService.getAllMdEvents.subscribe(res=>{
console.log(res); console.log(res);
}); });
console.log(this.eventService.getAllPrEvents.length); console.log(this.eventService.getAllPrEvents.length);
*/ */
this.processesbackend.GetActionsList().subscribe(res=>{ // this.processesbackend.GetActionsList().subscribe(res=>{
console.log(res); // console.log(res);
}); //});
} }
@@ -190,7 +187,7 @@ this.processesbackend.GetActionsList().subscribe(res=>{
} }
openExpedientPage(data){ openExpedientPage(data){
console.log(data); /* console.log(data); */
this.closeAllDesktopComponents(); this.closeAllDesktopComponents();
if( window.innerWidth <= 1024){ if( window.innerWidth <= 1024){
+19 -3
View File
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Attachment } from '../models/attachment.model'; import { Attachment, EventAttachment } from '../models/attachment.model';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
@@ -33,7 +33,7 @@ export class AttachmentsService {
return this.http.get<Attachment[]>(`${geturl}`, options); return this.http.get<Attachment[]>(`${geturl}`, options);
} }
getAttachments(source: number, sourceid: string): Observable<Attachment[]>{ getAttachments(source: number, sourceid: string): Observable<Attachment[]> {
let geturl = environment.apiURL + 'attachments/GetSourceName'; let geturl = environment.apiURL + 'attachments/GetSourceName';
let params = new HttpParams(); let params = new HttpParams();
@@ -47,7 +47,8 @@ export class AttachmentsService {
return this.http.get<Attachment[]>(`${geturl}`, options); return this.http.get<Attachment[]>(`${geturl}`, options);
} }
getAttachmentsById(eventId: string): Observable<Attachment[]>{
getAttachmentsById(eventId: string): Observable<Attachment[]> {
let geturl = environment.apiURL + 'attachments/GetAttachmentsByEventId'; let geturl = environment.apiURL + 'attachments/GetAttachmentsByEventId';
let params = new HttpParams(); let params = new HttpParams();
@@ -61,4 +62,19 @@ export class AttachmentsService {
return this.http.get<Attachment[]>(`${geturl}`, options); return this.http.get<Attachment[]>(`${geturl}`, options);
} }
setEventAttachmentById(body: EventAttachment) {
let geturl = environment.apiURL + 'Attachments/Create';
let options = {
headers: this.headers,
}
alert('send');
console.log('send', body);
return this.http.post(`${geturl}`, body, options);
}
} }
+2 -2
View File
@@ -158,7 +158,7 @@ export class EventsService {
params: params params: params
}; };
return this.http.post<Event>(`${puturl}`, event, options) return this.http.post<string>(`${puturl}`, event, options)
} }
postEventPr(event:Event, calendarName:string) postEventPr(event:Event, calendarName:string)
@@ -173,7 +173,7 @@ export class EventsService {
params: params params: params
}; };
return this.http.post<Event>(`${puturl}`, event, options) return this.http.post<string>(`${puturl}`, event, options)
} }
deleteEvent(eventid:string, deletemode:number) deleteEvent(eventid:string, deletemode:number)
@@ -2,11 +2,13 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { EventBody } from 'src/app/models/eventbody.model'; import { EventBody } from 'src/app/models/eventbody.model';
import { EventPerson } from 'src/app/models/eventperson.model'; import { EventPerson } from 'src/app/models/eventperson.model';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { Event } from 'src/app/models/event.model'; import { Event } from 'src/app/models/event.model';
import { ModalController } from '@ionic/angular'; import { ModalController } from '@ionic/angular';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js' import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { SearchPage } from 'src/app/pages/search/search.page'; import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from "src/app/models/search-document"; import { SearchDocument } from "src/app/models/search-document";
import { EventAttachment } from 'src/app/models/attachment.model';
@Component({ @Component({
selector: 'app-new-event', selector: 'app-new-event',
templateUrl: './new-event.component.html', templateUrl: './new-event.component.html',
@@ -24,7 +26,6 @@ export class NewEventPage implements OnInit {
@Input() taskParticipants: EventPerson[]; @Input() taskParticipants: EventPerson[];
@Input() taskParticipantsCc: any = []; @Input() taskParticipantsCc: any = [];
@Output() setIntervenient = new EventEmitter<any>(); @Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>(); @Output() setIntervenientCC = new EventEmitter<any>();
@@ -42,6 +43,7 @@ export class NewEventPage implements OnInit {
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private eventService: EventsService, private eventService: EventsService,
private attachmentsService: AttachmentsService
) {} ) {}
ngOnInit() { ngOnInit() {
@@ -154,24 +156,70 @@ export class NewEventPage implements OnInit {
save(){ async save(){
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
if(this.documents.length >= 0){
this.postEvent.HasAttachments = true;
}
if(this.profile=='mdgpr') { if(this.profile=='mdgpr') {
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(); this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
(id) => {
const eventId: string = id;
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
return {
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
Id: '',
Link: '',
SerialNumber: ''
};
});
DocumentToSave.forEach((attachments) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe();
});
});
} }
else if(this.profile=='pr') { else if(this.profile=='pr') {
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(); this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
(id) => {
const eventId: string = id;
const toDocumentTosSave: EventAttachment[] = this.documents.map((e) => {
return {
ParentId: eventId,
Source: '1',
SourceId: e.Id,
ApplicationId: e.ApplicationType.toString(),
};
});
toDocumentTosSave.forEach((attachments) => {
this.attachmentsService.setEventAttachmentById(attachments);
});
});
} }
this.deleteTemporaryData(); this.gobackOnSave();
}
this.onAddEvent.emit(this.postEvent); async gobackOnSave(){
this.GoBackEditOrAdd.emit(); //this.onAddEvent.emit(this.postEvent);
//this.GoBackEditOrAdd.emit();
this.setIntervenient.emit([]); //this.deleteTemporaryData();
this.setIntervenientCC.emit([]); //this.setIntervenient.emit([]);
//this.setIntervenientCC.emit([]);
} }
@@ -211,7 +259,7 @@ export class NewEventPage implements OnInit {
const restoredData = window['temp.path:/home/agenda/new-event.component.ts'] const restoredData = window['temp.path:/home/agenda/new-event.component.ts']
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData){ if(JSON.stringify(restoredData) != "{}" && undefined != restoredData) {
this.postEvent = restoredData.postEvent this.postEvent = restoredData.postEvent
this.eventBody = restoredData.eventBody this.eventBody = restoredData.eventBody
this.segment = restoredData.segment this.segment = restoredData.segment