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
@@ -18,4 +18,16 @@ export enum Sources
K2 = 2,
Exchange = 3,
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 { EventPerson } from './eventperson.model';
import { SearchDocument } from './search-document';
export class Event{
EventId: string;
@@ -19,4 +20,5 @@ export class Event{
Organizer: string;
Categories: string[];
HasAttachments: boolean;
// documents?: SearchDocument[]
}
@@ -41,12 +41,12 @@ export class EventListPage implements OnInit {
}
this.LoadToApproveEvents();
// this.LoadToApproveEvents();
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
this.LoadToApproveEvents();
// this.LoadToApproveEvents();
}
});
@@ -123,10 +123,15 @@
<!-- Aside right -->
<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-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>
</ion-content>
@@ -56,15 +56,14 @@ export class GabineteDigitalPage implements OnInit {
if( window.innerWidth <= 1024){
this.modalController.dismiss();
}
};
this.activatedRoute.queryParams.subscribe(params => {
if(params["show"]){
this.openExpedientListPage();
// this.openExpedientListPage();
}
else if(params["events"]){
this.openEventsToApprovePage("MDGPR");
// this.openEventsToApprovePage("MDGPR");
}
});
@@ -84,23 +83,21 @@ export class GabineteDigitalPage implements OnInit {
this.router.events.forEach((event) => {
if(event instanceof NavigationEnd && event.url == this.router.url) {
this.LoadCounts();
//this.LoadCounts();
}
});
this.LoadCounts();
// this.LoadCounts();
/* this.eventService.getAllMdEvents.subscribe(res=>{
console.log(res);
});
console.log(this.eventService.getAllPrEvents.length);
*/
this.processesbackend.GetActionsList().subscribe(res=>{
console.log(res);
});
console.log(this.eventService.getAllPrEvents.length);
*/
// this.processesbackend.GetActionsList().subscribe(res=>{
// console.log(res);
//});
}
@@ -190,7 +187,7 @@ this.processesbackend.GetActionsList().subscribe(res=>{
}
openExpedientPage(data){
console.log(data);
/* console.log(data); */
this.closeAllDesktopComponents();
if( window.innerWidth <= 1024){
+20 -4
View File
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { Attachment } from '../models/attachment.model';
import { Attachment, EventAttachment } from '../models/attachment.model';
import { Observable } from 'rxjs';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
@@ -33,7 +33,7 @@ export class AttachmentsService {
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 params = new HttpParams();
@@ -47,18 +47,34 @@ export class AttachmentsService {
return this.http.get<Attachment[]>(`${geturl}`, options);
}
getAttachmentsById(eventId: string): Observable<Attachment[]>{
getAttachmentsById(eventId: string): Observable<Attachment[]> {
let geturl = environment.apiURL + 'attachments/GetAttachmentsByEventId';
let params = new HttpParams();
params = params.set("ParentId", eventId);
/* params = params.set("SourceId", sourceid); */
let options = {
let options = {
headers: this.headers,
params: params
};
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
};
return this.http.post<Event>(`${puturl}`, event, options)
return this.http.post<string>(`${puturl}`, event, options)
}
postEventPr(event:Event, calendarName:string)
@@ -173,7 +173,7 @@ export class EventsService {
params: params
};
return this.http.post<Event>(`${puturl}`, event, options)
return this.http.post<string>(`${puturl}`, event, options)
}
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 { EventPerson } from 'src/app/models/eventperson.model';
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 { ModalController } from '@ionic/angular';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from "src/app/models/search-document";
import { EventAttachment } from 'src/app/models/attachment.model';
@Component({
selector: 'app-new-event',
templateUrl: './new-event.component.html',
@@ -23,7 +25,6 @@ export class NewEventPage implements OnInit {
@Input() selectedDate: Date;
@Input() taskParticipants: EventPerson[];
@Input() taskParticipantsCc: any = [];
@Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>();
@@ -42,6 +43,7 @@ export class NewEventPage implements OnInit {
constructor(
private modalController: ModalController,
private eventService: EventsService,
private attachmentsService: AttachmentsService
) {}
ngOnInit() {
@@ -154,24 +156,70 @@ export class NewEventPage implements OnInit {
save(){
async save(){
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
if(this.documents.length >= 0){
this.postEvent.HasAttachments = true;
}
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') {
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.onAddEvent.emit(this.postEvent);
this.GoBackEditOrAdd.emit();
this.gobackOnSave();
}
this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]);
async gobackOnSave(){
//this.onAddEvent.emit(this.postEvent);
//this.GoBackEditOrAdd.emit();
//this.deleteTemporaryData();
//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']
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData){
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData) {
this.postEvent = restoredData.postEvent
this.eventBody = restoredData.eventBody
this.segment = restoredData.segment