diff --git a/src/app/models/attachment.model.ts b/src/app/models/attachment.model.ts
index c7d8a04ad..e069beda7 100644
--- a/src/app/models/attachment.model.ts
+++ b/src/app/models/attachment.model.ts
@@ -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;
}
\ No newline at end of file
diff --git a/src/app/models/event.model.ts b/src/app/models/event.model.ts
index b6be60e83..46961931d 100644
--- a/src/app/models/event.model.ts
+++ b/src/app/models/event.model.ts
@@ -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[]
}
\ No newline at end of file
diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.ts b/src/app/pages/gabinete-digital/event-list/event-list.page.ts
index a24365d5f..6ed678863 100644
--- a/src/app/pages/gabinete-digital/event-list/event-list.page.ts
+++ b/src/app/pages/gabinete-digital/event-list/event-list.page.ts
@@ -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();
}
});
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html
index e0357154b..bb96dc2e5 100644
--- a/src/app/pages/gabinete-digital/gabinete-digital.page.html
+++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html
@@ -123,10 +123,15 @@
+
+
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
index 34ad0b2c6..12d23f4de 100644
--- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts
+++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
@@ -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){
diff --git a/src/app/services/attachments.service.ts b/src/app/services/attachments.service.ts
index 09d99702a..6476152e4 100644
--- a/src/app/services/attachments.service.ts
+++ b/src/app/services/attachments.service.ts
@@ -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(`${geturl}`, options);
}
- getAttachments(source: number, sourceid: string): Observable{
+ getAttachments(source: number, sourceid: string): Observable {
let geturl = environment.apiURL + 'attachments/GetSourceName';
let params = new HttpParams();
@@ -47,18 +47,34 @@ export class AttachmentsService {
return this.http.get(`${geturl}`, options);
}
- getAttachmentsById(eventId: string): Observable{
+
+ getAttachmentsById(eventId: string): Observable {
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(`${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);
+ }
+
}
diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts
index 2f4b88c16..61639e7a8 100644
--- a/src/app/services/events.service.ts
+++ b/src/app/services/events.service.ts
@@ -158,7 +158,7 @@ export class EventsService {
params: params
};
- return this.http.post(`${puturl}`, event, options)
+ return this.http.post(`${puturl}`, event, options)
}
postEventPr(event:Event, calendarName:string)
@@ -173,7 +173,7 @@ export class EventsService {
params: params
};
- return this.http.post(`${puturl}`, event, options)
+ return this.http.post(`${puturl}`, event, options)
}
deleteEvent(eventid:string, deletemode:number)
diff --git a/src/app/shared/agenda/new-event/new-event.component.ts b/src/app/shared/agenda/new-event/new-event.component.ts
index 174ed3084..b6e579bcf 100644
--- a/src/app/shared/agenda/new-event/new-event.component.ts
+++ b/src/app/shared/agenda/new-event/new-event.component.ts
@@ -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();
@Output() setIntervenientCC = new EventEmitter();
@@ -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