2021-01-29 09:45:27 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2022-04-26 16:53:10 +01:00
|
|
|
import { ModalController, NavParams } from '@ionic/angular';
|
2021-04-23 10:35:53 +01:00
|
|
|
import { EventAttachment } from 'src/app/models/attachment.model';
|
2021-01-29 14:13:31 +01:00
|
|
|
import { EventBody } from 'src/app/models/eventbody.model';
|
|
|
|
|
import { EventPerson } from 'src/app/models/eventperson.model';
|
2021-08-20 12:02:27 +01:00
|
|
|
import { SearchList } from 'src/app/models/search-document';
|
2021-08-27 15:21:15 +01:00
|
|
|
import { LoginUserRespose } from 'src/app/models/user.model';
|
2021-04-23 10:35:53 +01:00
|
|
|
import { AttachmentsService } from 'src/app/services/attachments.service';
|
2021-06-16 13:29:57 +01:00
|
|
|
import { AuthService } from 'src/app/services/auth.service';
|
2021-01-29 14:13:31 +01:00
|
|
|
import { EventsService } from 'src/app/services/events.service';
|
2021-06-15 15:09:20 +01:00
|
|
|
import { ToastService } from 'src/app/services/toast.service';
|
2021-01-29 14:13:31 +01:00
|
|
|
import { Event } from '../../../models/event.model';
|
2021-06-15 15:28:03 +01:00
|
|
|
import { AttendeesPageModal } from '../../events/attendees/attendees.page';
|
2021-04-19 11:35:48 +01:00
|
|
|
import { SearchPage } from '../../search/search.page';
|
2021-07-02 10:45:27 +01:00
|
|
|
import { ThemePalette } from '@angular/material/core';
|
|
|
|
|
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
2022-01-21 14:30:03 +01:00
|
|
|
import { ThemeService } from 'src/app/services/theme.service';
|
|
|
|
|
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
|
|
|
|
|
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
|
|
|
|
|
|
|
|
|
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
|
|
|
|
parse: {
|
|
|
|
|
dateInput: "YYYY-MMMM-DD HH:mm"
|
|
|
|
|
},
|
|
|
|
|
display: {
|
|
|
|
|
dateInput: "DD MMM YYYY H:mm",
|
|
|
|
|
monthYearLabel: "MMM YYYY",
|
|
|
|
|
dateA11yLabel: "LL",
|
|
|
|
|
monthYearA11yLabel: "MMMM YYYY"
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-29 09:45:27 +01:00
|
|
|
@Component({
|
|
|
|
|
selector: 'app-new-event',
|
|
|
|
|
templateUrl: './new-event.page.html',
|
|
|
|
|
styleUrls: ['./new-event.page.scss'],
|
2022-01-21 14:30:03 +01:00
|
|
|
providers: [
|
|
|
|
|
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },
|
|
|
|
|
]
|
2021-01-29 09:45:27 +01:00
|
|
|
})
|
2021-04-07 11:52:28 +01:00
|
|
|
|
2021-01-29 09:45:27 +01:00
|
|
|
export class NewEventPage implements OnInit {
|
2021-07-02 10:45:27 +01:00
|
|
|
// date picker
|
|
|
|
|
public date: any;
|
|
|
|
|
public disabled = false;
|
|
|
|
|
public showSpinners = true;
|
|
|
|
|
public showSeconds = false;
|
|
|
|
|
public touchUi = false;
|
|
|
|
|
public enableMeridian = false;
|
|
|
|
|
public stepHour = 1;
|
|
|
|
|
public stepMinute = 5;
|
|
|
|
|
public stepSecond = 5;
|
|
|
|
|
public color: ThemePalette = 'primary';
|
|
|
|
|
|
|
|
|
|
Form: FormGroup;
|
|
|
|
|
validateFrom = false
|
|
|
|
|
|
2021-01-29 14:13:31 +01:00
|
|
|
postEvent: Event;
|
|
|
|
|
eventBody: EventBody;
|
|
|
|
|
segment:string = "true";
|
|
|
|
|
profile:string;
|
|
|
|
|
eventAttendees: EventPerson[];
|
|
|
|
|
selectedSegment: string;
|
|
|
|
|
selectedDate: Date;
|
2021-07-08 21:31:14 +01:00
|
|
|
recurringTypes: any;
|
|
|
|
|
selectedRecurringType: any;
|
2021-01-29 09:45:27 +01:00
|
|
|
|
2021-04-07 11:52:28 +01:00
|
|
|
adding: "intervenient" | "CC";
|
|
|
|
|
|
|
|
|
|
taskParticipants: any = [];
|
|
|
|
|
taskParticipantsCc: any = [];
|
|
|
|
|
|
2021-08-20 12:02:27 +01:00
|
|
|
documents:SearchList[] = [];
|
2021-04-23 10:35:53 +01:00
|
|
|
|
2021-08-27 15:21:15 +01:00
|
|
|
loggeduser: LoginUserRespose;
|
2021-08-18 09:23:53 +01:00
|
|
|
members:any;
|
2021-12-21 15:56:23 +01:00
|
|
|
CalendarName;
|
2021-06-16 13:29:57 +01:00
|
|
|
|
2022-01-21 14:30:03 +01:00
|
|
|
public listColors = ['primary', 'accent', 'warn'];
|
|
|
|
|
public stepHours = [1, 2, 3, 4, 5];
|
|
|
|
|
public stepMinutes = [1, 5, 10, 15, 20, 25];
|
|
|
|
|
public stepSeconds = [1, 5, 10, 15, 20, 25];
|
|
|
|
|
|
|
|
|
|
autoStartTime;
|
|
|
|
|
autoEndTime;
|
2022-05-12 16:54:11 +01:00
|
|
|
CalendarNamesOptions = ['Oficial', 'Pessoal']
|
2022-01-21 14:30:03 +01:00
|
|
|
|
2021-01-29 09:45:27 +01:00
|
|
|
constructor(
|
|
|
|
|
private modalController: ModalController,
|
2021-01-29 14:13:31 +01:00
|
|
|
private navParams: NavParams,
|
2022-05-12 16:54:11 +01:00
|
|
|
public eventService: EventsService,
|
2021-06-08 15:59:06 +01:00
|
|
|
private attachmentsService: AttachmentsService,
|
2021-06-15 15:09:20 +01:00
|
|
|
private toastService: ToastService,
|
2021-06-16 13:29:57 +01:00
|
|
|
userService: AuthService,
|
2021-10-22 15:43:57 +01:00
|
|
|
public ThemeService: ThemeService
|
2021-07-12 14:32:43 +01:00
|
|
|
) {
|
2021-06-16 13:29:57 +01:00
|
|
|
this.loggeduser = userService.ValidatedUser;
|
2021-01-29 14:13:31 +01:00
|
|
|
this.postEvent = new Event();
|
2021-07-09 11:51:22 +01:00
|
|
|
this.postEvent.EventRecurrence = {Type:'-1'};
|
2021-01-29 14:13:31 +01:00
|
|
|
this.eventBody = { BodyType : "1", Text : ""};
|
2021-04-07 11:52:28 +01:00
|
|
|
this.postEvent.Body = this.eventBody;
|
2021-06-16 13:29:57 +01:00
|
|
|
/* this.profile = this.navParams.get('profile'); */
|
2021-01-29 14:13:31 +01:00
|
|
|
|
|
|
|
|
this.selectedSegment = this.navParams.get('segment');
|
|
|
|
|
this.selectedDate = this.navParams.get('eventSelectedDate');
|
2021-08-18 09:23:53 +01:00
|
|
|
this.taskParticipants = this.navParams.get('attendees');
|
2021-07-08 15:15:29 +01:00
|
|
|
|
2022-01-21 14:30:03 +01:00
|
|
|
let now = new Date();
|
|
|
|
|
|
|
|
|
|
if(now.getMinutes() <= 30){
|
|
|
|
|
this.autoStartTime = new Date(now.setMinutes(30));
|
|
|
|
|
this.postEvent.StartDate = this.autoStartTime;
|
|
|
|
|
this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000);
|
|
|
|
|
this.postEvent.EndDate = this.autoEndTime;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.autoStartTime = new Date(now.setHours(now.getHours()+1));
|
|
|
|
|
this.autoStartTime = new Date(this.autoStartTime.setMinutes(0));
|
|
|
|
|
this.postEvent.StartDate = this.autoStartTime;
|
|
|
|
|
this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000);
|
|
|
|
|
this.postEvent.EndDate = this.autoEndTime;
|
|
|
|
|
}
|
2021-01-29 14:13:31 +01:00
|
|
|
}
|
2021-01-29 09:45:27 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
2021-12-21 15:56:23 +01:00
|
|
|
|
|
|
|
|
this.CalendarName = this.loggeduser.Profile;
|
2021-07-08 21:31:14 +01:00
|
|
|
this.selectedRecurringType = "-1";
|
2022-04-28 09:32:27 +01:00
|
|
|
|
|
|
|
|
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2022-01-21 14:30:03 +01:00
|
|
|
this.getRecurrenceTypes();
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-01-29 14:13:31 +01:00
|
|
|
if(this.selectedSegment != "Combinada"){
|
|
|
|
|
this.postEvent ={
|
|
|
|
|
EventId: '',
|
|
|
|
|
Subject: '',
|
|
|
|
|
Body: this.eventBody,
|
|
|
|
|
Location: '',
|
|
|
|
|
CalendarId: '',
|
2022-01-21 14:30:03 +01:00
|
|
|
CalendarName: 'Oficial',
|
|
|
|
|
StartDate: this.autoStartTime,
|
|
|
|
|
EndDate: this.autoEndTime,
|
2021-01-29 14:13:31 +01:00
|
|
|
EventType: 'Reunião',
|
|
|
|
|
Attendees: null,
|
|
|
|
|
IsMeeting: false,
|
|
|
|
|
IsRecurring: false,
|
|
|
|
|
AppointmentState: 0,
|
|
|
|
|
TimeZone: '',
|
|
|
|
|
Organizer: '',
|
2021-07-15 08:53:54 +01:00
|
|
|
Category: 'Reunião',
|
2021-01-29 14:13:31 +01:00
|
|
|
HasAttachments: false,
|
2022-01-21 14:30:03 +01:00
|
|
|
EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime},
|
2021-01-29 14:13:31 +01:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.postEvent ={
|
|
|
|
|
EventId: '',
|
|
|
|
|
Subject: '',
|
|
|
|
|
Body: this.eventBody,
|
|
|
|
|
Location: '',
|
|
|
|
|
CalendarId: '',
|
|
|
|
|
CalendarName: 'Oficial',
|
2022-01-21 14:30:03 +01:00
|
|
|
StartDate: this.autoStartTime,
|
|
|
|
|
EndDate: this.autoEndTime,
|
2021-01-29 14:13:31 +01:00
|
|
|
EventType: 'Reunião',
|
|
|
|
|
Attendees: null,
|
|
|
|
|
IsMeeting: false,
|
|
|
|
|
IsRecurring: false,
|
|
|
|
|
AppointmentState: 0,
|
|
|
|
|
TimeZone: '',
|
|
|
|
|
Organizer: '',
|
2021-07-15 08:53:54 +01:00
|
|
|
Category: 'Reunião',
|
2021-01-29 14:13:31 +01:00
|
|
|
HasAttachments: false,
|
2022-01-21 14:30:03 +01:00
|
|
|
EventRecurrence: {Type:'-1',LastOccurrence:this.autoEndTime},
|
2021-01-29 14:13:31 +01:00
|
|
|
};
|
|
|
|
|
}
|
2021-02-24 20:23:15 +01:00
|
|
|
|
|
|
|
|
window.onresize = (event) => {
|
|
|
|
|
// if not mobile remove all component
|
|
|
|
|
if( window.innerWidth >= 1024){
|
|
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
};
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-07-12 14:32:43 +01:00
|
|
|
|
|
|
|
|
|
2021-01-29 09:45:27 +01:00
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-01-29 09:45:27 +01:00
|
|
|
close(){
|
|
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
2021-07-08 21:31:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
getRecurrenceTypes() {
|
|
|
|
|
this.eventService.getRecurrenceTypes().subscribe(res=>{
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-07-08 21:31:14 +01:00
|
|
|
this.recurringTypes = res;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onSelectedRecurringChanged(ev:any){
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-07-08 21:31:14 +01:00
|
|
|
if(ev.length > 1){
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-07-08 21:31:14 +01:00
|
|
|
this.selectedRecurringType = ev.filter(data => data != '-1');
|
|
|
|
|
}
|
|
|
|
|
if(ev.length == 0){
|
|
|
|
|
this.selectedRecurringType = "-1";
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-07-02 10:45:27 +01:00
|
|
|
|
|
|
|
|
runValidation() {
|
2021-12-13 15:34:16 +01:00
|
|
|
this.validateFrom = true;
|
|
|
|
|
if(new Date(this.postEvent.StartDate).getTime() > new Date(this.postEvent.EndDate).getTime()){
|
|
|
|
|
this.toastService._badRequest("A data de fim não pode ser inferior a data de início do evento")
|
|
|
|
|
}
|
2021-07-02 10:45:27 +01:00
|
|
|
}
|
|
|
|
|
|
2021-07-05 15:28:54 +01:00
|
|
|
|
|
|
|
|
get dateValid() {
|
|
|
|
|
if (window.innerWidth <= 800) {
|
|
|
|
|
return this.postEvent.StartDate < this.postEvent.EndDate? ['ok']: []
|
|
|
|
|
} else {
|
|
|
|
|
return ['ok']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-02 10:45:27 +01:00
|
|
|
injectValidation() {
|
|
|
|
|
|
|
|
|
|
this.Form = new FormGroup({
|
|
|
|
|
Subject: new FormControl(this.postEvent.Subject, [
|
|
|
|
|
Validators.required,
|
|
|
|
|
// Validators.minLength(4)
|
|
|
|
|
]),
|
|
|
|
|
Location: new FormControl(this.postEvent.Location, [
|
|
|
|
|
Validators.required,
|
|
|
|
|
]),
|
2021-07-02 11:07:08 +01:00
|
|
|
CalendarName: new FormControl(this.postEvent.CalendarName, [
|
|
|
|
|
Validators.required
|
|
|
|
|
]),
|
2021-07-05 15:28:54 +01:00
|
|
|
Date: new FormControl(this.dateValid, [
|
|
|
|
|
Validators.required
|
|
|
|
|
]),
|
2021-07-15 08:53:54 +01:00
|
|
|
Categories: new FormControl(this.postEvent.Category, [
|
2021-07-02 10:45:27 +01:00
|
|
|
Validators.required
|
|
|
|
|
]),
|
2021-07-13 13:41:09 +01:00
|
|
|
participantes: new FormControl(this.taskParticipants, [
|
|
|
|
|
Validators.required
|
|
|
|
|
]),
|
2021-07-02 10:45:27 +01:00
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2022-01-21 14:30:03 +01:00
|
|
|
openInicio() {
|
|
|
|
|
let input: any = document.querySelector('#new-inicio')
|
|
|
|
|
if(input) {
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2022-01-21 14:30:03 +01:00
|
|
|
input.click()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openFim() {
|
|
|
|
|
let input: any = document.querySelector('#new-fim')
|
|
|
|
|
if(input) {
|
|
|
|
|
input.click()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openLastOccurrence() {
|
|
|
|
|
let input: any = document.querySelector('#last-occurrence')
|
|
|
|
|
if(input) {
|
|
|
|
|
input.click()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-30 14:12:45 +01:00
|
|
|
async save() {
|
2021-07-02 10:45:27 +01:00
|
|
|
this.injectValidation()
|
|
|
|
|
this.runValidation()
|
|
|
|
|
|
2021-07-14 09:46:03 +01:00
|
|
|
if(this.Form.invalid) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-04-23 10:35:53 +01:00
|
|
|
if(this.documents.length >= 0) {
|
|
|
|
|
this.postEvent.HasAttachments = true;
|
|
|
|
|
}
|
2021-07-09 11:51:22 +01:00
|
|
|
if(this.selectedRecurringType != '-1'){
|
|
|
|
|
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
|
|
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-08-18 09:23:53 +01:00
|
|
|
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
|
|
|
|
|
2021-06-16 13:29:57 +01:00
|
|
|
let eventId: any;
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-07-15 08:59:59 +01:00
|
|
|
const loader = this.toastService.loading()
|
|
|
|
|
|
2021-05-24 16:49:25 +01:00
|
|
|
try {
|
|
|
|
|
|
2022-05-12 16:54:11 +01:00
|
|
|
const CalendarId = this.selectedCalendarId()
|
2021-07-09 19:27:08 +01:00
|
|
|
|
2022-04-02 14:51:57 +01:00
|
|
|
if(this.loggeduser.Profile == 'MDGPR') {
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2022-05-12 16:54:11 +01:00
|
|
|
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
|
|
|
|
|
|
2021-05-24 16:49:25 +01:00
|
|
|
}
|
2022-04-02 14:51:57 +01:00
|
|
|
else if(this.loggeduser.Profile == 'PR') {
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2022-05-12 16:54:11 +01:00
|
|
|
const CalendarId = this.selectedCalendarId()
|
|
|
|
|
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
|
2022-04-02 09:40:09 +01:00
|
|
|
} else {
|
2022-05-12 16:54:11 +01:00
|
|
|
|
|
|
|
|
const CalendarId = this.selectedCalendarId()
|
|
|
|
|
eventId = await this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).toPromise();
|
2021-05-24 16:49:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const DocumentToSave: EventAttachment[] = this.documents.map((e) => {
|
|
|
|
|
return {
|
|
|
|
|
SourceTitle: e.Assunto,
|
|
|
|
|
ParentId: eventId,
|
|
|
|
|
Source: '1',
|
|
|
|
|
SourceId: e.Id,
|
|
|
|
|
ApplicationId: e.ApplicationType.toString(),
|
|
|
|
|
Id: '',
|
|
|
|
|
Link: '',
|
|
|
|
|
SerialNumber: ''
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await DocumentToSave.forEach( async (attachments, i) => {
|
|
|
|
|
try {
|
|
|
|
|
await this.attachmentsService.setEventAttachmentById(attachments).toPromise();
|
|
|
|
|
} catch(error) {
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-05-24 16:49:25 +01:00
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-05-24 16:49:25 +01:00
|
|
|
});
|
|
|
|
|
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-11-07 20:56:34 +01:00
|
|
|
this.toastService._successMessage()
|
2021-05-24 16:49:25 +01:00
|
|
|
this.modalController.dismiss(this.postEvent);
|
|
|
|
|
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-05-24 16:49:25 +01:00
|
|
|
} catch (error) {
|
2021-11-07 20:56:34 +01:00
|
|
|
this.toastService._badRequest()
|
2021-07-15 08:59:59 +01:00
|
|
|
} finally {
|
|
|
|
|
loader.remove()
|
2021-01-29 14:13:31 +01:00
|
|
|
}
|
2021-04-23 10:35:53 +01:00
|
|
|
|
2021-05-24 16:49:25 +01:00
|
|
|
}
|
2021-04-23 10:35:53 +01:00
|
|
|
|
2022-05-12 16:54:11 +01:00
|
|
|
|
|
|
|
|
selectedCalendarId () {
|
|
|
|
|
|
|
|
|
|
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
|
|
|
|
|
return this.eventService.calendarNamesType[this.CalendarName]['OficialId']
|
|
|
|
|
|
|
|
|
|
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
|
|
|
|
|
|
|
|
|
return this.eventService.calendarNamesType[this.CalendarName]['PessoalId']
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
return '11:11'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeAgenda() {
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
|
|
|
|
if(this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
|
|
|
|
|
|
|
|
|
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
|
|
|
|
|
|
|
|
|
|
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
|
|
|
|
|
this.CalendarNamesOptions = ['Oficial']
|
|
|
|
|
this.postEvent.CalendarName = 'Oficial'
|
|
|
|
|
|
|
|
|
|
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
|
|
|
|
this.CalendarNamesOptions = ['Pessoal']
|
|
|
|
|
this.postEvent.CalendarName = 'Pessoal'
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
|
|
|
|
|
}
|
|
|
|
|
}, 50)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-07 11:52:28 +01:00
|
|
|
async openAttendees() {
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-01-29 14:13:31 +01:00
|
|
|
const modal = await this.modalController.create({
|
2021-06-15 15:28:03 +01:00
|
|
|
component: AttendeesPageModal,
|
2021-01-29 14:13:31 +01:00
|
|
|
componentProps: {
|
2021-04-07 11:52:28 +01:00
|
|
|
adding: this.adding,
|
2021-08-30 14:32:15 +01:00
|
|
|
taskParticipants: this.taskParticipants,
|
|
|
|
|
taskParticipantsCc: this.taskParticipantsCc
|
2021-01-29 14:13:31 +01:00
|
|
|
},
|
2021-04-16 14:32:22 +01:00
|
|
|
cssClass: 'attendee modal modal-desktop',
|
2021-01-29 14:13:31 +01:00
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await modal.present();
|
|
|
|
|
|
|
|
|
|
modal.onDidDismiss().then((data) => {
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-08-30 14:32:15 +01:00
|
|
|
if(data) {
|
2021-04-07 11:52:28 +01:00
|
|
|
data = data['data'];
|
2021-08-30 14:32:15 +01:00
|
|
|
if(data) {
|
|
|
|
|
|
|
|
|
|
const newAttendees: EventPerson[] = data['taskParticipants'];
|
|
|
|
|
const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];
|
2021-12-13 15:34:16 +01:00
|
|
|
|
2021-08-30 14:32:15 +01:00
|
|
|
if(newAttendees.length) {
|
|
|
|
|
this.setIntervenient(newAttendees);
|
|
|
|
|
}
|
|
|
|
|
if(newAttendeesCC) {
|
|
|
|
|
this.setIntervenientCC(newAttendeesCC);
|
|
|
|
|
}
|
2021-12-13 15:34:16 +01:00
|
|
|
|
2021-08-30 14:32:15 +01:00
|
|
|
}
|
2021-04-07 11:52:28 +01:00
|
|
|
|
2021-01-29 14:13:31 +01:00
|
|
|
}
|
|
|
|
|
});
|
2021-04-07 11:52:28 +01:00
|
|
|
}
|
|
|
|
|
|
2021-08-30 14:32:15 +01:00
|
|
|
setIntervenient(data) {
|
2021-04-07 11:52:28 +01:00
|
|
|
this.taskParticipants = data;
|
|
|
|
|
this.postEvent.Attendees = data;
|
|
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
|
2021-04-07 11:52:28 +01:00
|
|
|
setIntervenientCC(data){
|
|
|
|
|
this.taskParticipantsCc = data;
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-30 14:32:15 +01:00
|
|
|
addParticipants() {
|
2021-04-07 11:52:28 +01:00
|
|
|
this.adding = 'intervenient'
|
|
|
|
|
this.openAttendees();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addParticipantsCC(){
|
|
|
|
|
this.adding = 'CC'
|
|
|
|
|
this.openAttendees();
|
|
|
|
|
}
|
2021-01-29 14:13:31 +01:00
|
|
|
|
2021-04-23 10:35:53 +01:00
|
|
|
|
|
|
|
|
async getDoc(){
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: SearchPage,
|
|
|
|
|
cssClass: 'modal-width-100-width-background modal',
|
|
|
|
|
componentProps: {
|
2021-04-29 15:25:14 +01:00
|
|
|
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
2021-04-30 14:12:45 +01:00
|
|
|
showSearchInput: true,
|
|
|
|
|
select: true
|
2021-04-23 10:35:53 +01:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss().then((res)=>{
|
|
|
|
|
if(res){
|
|
|
|
|
const data = res.data;
|
|
|
|
|
this.documents.push(data.selected);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeAttachment(index: number){
|
|
|
|
|
|
|
|
|
|
this.documents = this.documents.filter( (e, i) => index != i);
|
|
|
|
|
|
|
|
|
|
}
|
2021-07-12 14:32:43 +01:00
|
|
|
}
|