diff --git a/src/app/pages/events/edit-event/app-edit-event-home.page.html b/src/app/pages/events/edit-event/app-edit-event-home.page.html new file mode 100644 index 000000000..95d9fe4c5 --- /dev/null +++ b/src/app/pages/events/edit-event/app-edit-event-home.page.html @@ -0,0 +1,215 @@ + + + + + + Visualizar Evento + + + + + + + + + + + + + + + Assunto + + + + + Campo obrigatório + + + + Descrição + + + + Localização + + + + Calendário + + Pessoal + Oficial + + + + Tipo do evento + + Reunião + Viagem + Conferência + Encontro + + + + Data Início + + + + Data Fim + + + + + + + Editar + + Participantes + + + + + + + + {{attendee.Name}} + + + + + + 1"> + + Ver mais... + + + + + + + + Editar + + Anexos + + + + + + + + + + {{ att.Description }} + {{ att.CreateDate }} + + + + + + 1"> + + Ver mais... + + + + + + + + + + Sem anexos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gravar + + + + diff --git a/src/app/pages/events/edit-event/app-edit-event-home.page.scss b/src/app/pages/events/edit-event/app-edit-event-home.page.scss new file mode 100644 index 000000000..0224ee793 --- /dev/null +++ b/src/app/pages/events/edit-event/app-edit-event-home.page.scss @@ -0,0 +1,165 @@ + +.content{ + padding: 30px 20px 0 20px !important; + margin: 0; + float: left; + border-left: 1px solid #d8d8d8 !important; + } + .main-header{ + font-family: Roboto; + background-color: #fff; + overflow:hidden; + color:#000; + transform: translate3d(0, 1px, 0); + + .title-content{ + margin: 0px auto; + overflow: auto; + padding: 0 !important; + background: #fff; + .middle{ + padding: 0!important; + float: left; + } + } + + .title{ + font-size: 25px; + } + + } + .ion-item-container{ + margin: 15px auto; + border: 1px solid #ebebeb; + border-radius: 5px; + padding-left: 10px; + } + .ion-item-container-no-border{ + width: 100%; + margin: 0px auto; + padding: 0 !important; + overflow: auto; + } + .container-div{ + margin-bottom: 15px; + float: left; + overflow: auto; + } + .ion-item-class-2{ + margin: 0px auto; + } + .ion-icon-class{ + width: 45px; + height: 45px; + float: left; + padding: 10px; + font-size: 25px; + } + ion-select{ + padding-left: 5px; + margin-left: 0; + } + .ion-input-class{ + width: calc(100% - 45px); + height: 45px; + border: 1px solid #ebebeb; + border-radius: 5px; + padding-left: 5px; + padding-right: 10px; + float: left; + } + .ion-input-class-no-height{ + border: 1px solid #ebebeb; + border-radius: 5px; + overflow: auto; + } + .list-people{ + //width: 256px; + float: left; + + } + .add-people{ + width: 45px; + float: right; + overflow: auto; + font-size: 25px; + padding: 10px; + } + .list-people-title{ + /* font-size: 13px; */ + color: #797979; + } + .attach-document{ + font-size: 15px; + color: #0d89d1; + margin: 5px 5px 5px 10px; + padding: 5px; + float: left; + } + .attach-icon{ + width: 37px; + font-size: 35px; + float: left; + } + .attach-title-item{ + width: 100%; + font-size: 15px; + color:#0d89d1; + } + /* SPAN */ + .span-left{ + float: left; + font-size: 15x; + } + .span-right{ + text-align: right; + float: right; + font-size: 13px; + } + .container-footer{ + margin:0 auto; + overflow: auto; + } + .button-cancel { + width: 170px; + height: 44px; + border-radius: 22.5px; + --background: #e0e9ee; + --color: #061b52; + margin:10px; + } + .button-save { + width: 170px; + height: 44px; + border-radius: 22.5px; + --background: #42b9fe; + --color:#ffffff; + margin:10px; + } + + .text-input{ + width: 100%; + border: 1px solid #ebebeb; + margin: 0px 15px 15px 0px; + padding: 0 !important; + border-radius: 5px; + } + + /* Error Messages */ + .error{ + color:red; + font-size: 12px; + font-weight: bold; + padding-bottom: 20px; + } + .span-color{ + color:red; + } + + + .buttons{ + display: flex; + justify-content: space-between; + padding: 20px; + overflow: auto; + } \ No newline at end of file diff --git a/src/app/pages/events/edit-event/edit-event.component.spec.ts b/src/app/pages/events/edit-event/edit-event.component.spec.ts new file mode 100644 index 000000000..018a13b51 --- /dev/null +++ b/src/app/pages/events/edit-event/edit-event.component.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { IonicModule } from '@ionic/angular'; + +import { EditEventComponent } from './edit-event.component'; + +describe('EditEventComponent', () => { + let component: EditEventComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ EditEventComponent ], + imports: [IonicModule.forRoot()] + }).compileComponents(); + + fixture = TestBed.createComponent(EditEventComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/events/edit-event/edit-event.component.ts b/src/app/pages/events/edit-event/edit-event.component.ts new file mode 100644 index 000000000..e84f8ea28 --- /dev/null +++ b/src/app/pages/events/edit-event/edit-event.component.ts @@ -0,0 +1,243 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { EventsService } from 'src/app/services/events.service'; +import { Router } from '@angular/router'; +import { Event } from '../../../models/event.model'; +import { EventBody } from 'src/app/models/eventbody.model'; +import { AlertController, ModalController } from '@ionic/angular'; +import { EventPerson } from 'src/app/models/eventperson.model'; +import { AttendeesPage } from 'src/app/pages/events/attendees/attendees.page'; +import { AlertService } from 'src/app/services/alert.service'; +import { Attachment } from 'src/app/models/attachment.model'; +import { AttachmentsService } from 'src/app/services/attachments.service'; +import { FormGroup, FormBuilder, Validators } from "@angular/forms"; +import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; +import { AttachmentsPage } from '../attachments/attachments.page'; + + +@Component({ + selector: 'app-edit-event-home', + templateUrl: './app-edit-event-home.page.html', + styleUrls: ['./app-edit-event-home.page.scss'], +}) + +export class EventEditPage implements OnInit { + + loadedEvent: Event; + loadedEventAttachments: Attachment[]; + pageId: string; + showLoader: boolean; + backURL: string; + ionicForm: FormGroup; + isSubmitted = false; + + minDate: Date; + + profile:string; + + + constructor( + public formBuilder: FormBuilder, + public alertController: AlertController, + private router: Router, + private activatedRoute: ActivatedRoute, + private eventsService: EventsService, + private modalCtrl: ModalController, + private alertService: AlertService, + private attachamentsService: AttachmentsService, + private route: Router, + private iab: InAppBrowser) { + this.loadedEvent = new Event(); + this.loadedEvent.Body = new EventBody(); + } + + ngOnInit() { + this.loadEvent(); + this.loadAttachments(); + this.ionicForm = this.formBuilder.group({ + subject: ['', [Validators.required]] + }) + } + + get errorControl() { + return this.ionicForm.controls; + } + + loadEvent(){ + let eventid: string; + this.activatedRoute.paramMap.subscribe(paramMap => + { + if (!paramMap.has("eventId")){ + return; + } + else{ + this.pageId = paramMap.get('eventId'); + eventid = paramMap.get('eventId'); + console.log(eventid); + + } + if (paramMap.has("caller")){ + this.backURL = "/home/" + paramMap.get('caller'); + } + } + ); + this.eventsService.getEvent(eventid).subscribe(response => { + this.loadedEvent = response; + }); + } + + async openAttendees(){ + const modal = await this.modalCtrl.create({ + component: AttendeesPage, + componentProps: { + eventAttendees: this.loadedEvent.Attendees + }, + cssClass: 'attendee', + backdropDismiss: false + }); + + await modal.present(); + + modal.onDidDismiss().then((data) => { + if (data['data'] != null) + { + let newattendees: EventPerson[] = data['data']; + this.loadedEvent.Attendees = newattendees; + } + }); +} + + getEventAttendees(): EventPerson[] + { + return this.loadedEvent.Attendees; + } + + setEventAttendees(newattendes: EventPerson[]) + { + this.loadedEvent.Attendees = newattendes; + } + + async deleteConfirm() + { + const alert = await this.alertController.create({ + cssClass: 'my-custom-class', + header: 'Apagar evento!', + message: 'Deseja apagar o evento da agenda ' + this.loadedEvent.CalendarName + '?', + buttons: [ + { + text: 'Não', + role: 'cancel', + cssClass: 'secondary', + handler: () => { } + }, { + text: 'Sim', + handler: () => { + this.Delete(); + } + } + ] + }); + + await alert.present(); + } + + Delete() + { + this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async () => + { + const alert = await this.alertController.create({ + cssClass: 'my-custom-class', + header: 'Evento removido', + buttons: ['OK'] + }); + + await alert.present(); + + this.router.navigate(['/home/events']); + }); + } + + Save() + { + if (this.ionicForm.valid){ + + this.activatedRoute.paramMap.subscribe(paramMap =>{ + if (paramMap.has("profile")){ + console.log(paramMap.get('profile')); + + } + }); + + this.eventsService.editEvent(this.loadedEvent, 2, 3).subscribe(async () => + { + const alert = await this.alertController.create({ + cssClass: 'my-custom-class', + header: 'Evento actualizado', + buttons: ['OK'] + }); + + await alert.present(); + }); + } + } + + showAlert(){ + this.alertService.presentAlert("Funcionalidade em desenvolvimento"); + } + + loadAttachments() + { + /* console.log(this.pageId); */ + + this.attachamentsService.getAttachmentsById(this.pageId).subscribe(res => { + this.loadedEventAttachments = res; + console.log(res); + + }); + } + async viewDocument(documenturl:string) + { + const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); + const browser = this.iab.create(url,"_blank"); + browser.show(); + } + + back() + { + //this.back(); + } + doRefresh(event){ + /* this.RefreshEvents(); */ + event.target.complete(); + setTimeout(() => { + event.target.complete(); + }, 2000); + + } + navigateTo(ev){ + this.route.navigate(['/home/events',ev]); + } + async openAttachments(){ + const modal = await this.modalCtrl.create({ + component: AttachmentsPage, + componentProps: { + eventId: this.pageId, + attachments: this.loadedEventAttachments + }, + cssClass: 'attachments', + backdropDismiss: false + }); + + await modal.present(); + + modal.onDidDismiss().then((data) => { + if (data['data'] != null) + { + let newattendees: EventPerson[] = data['data']; + this.loadedEvent.Attendees = newattendees; + } + }); + + } + +} diff --git a/src/app/pages/events/events.page.ts b/src/app/pages/events/events.page.ts index 3b8fb1834..9085176a3 100644 --- a/src/app/pages/events/events.page.ts +++ b/src/app/pages/events/events.page.ts @@ -15,6 +15,7 @@ import { DailyWorkTask } from '../../models/dailyworktask.model'; import { ViewEventPage } from '../agenda/view-event/view-event.page'; import { ExpedientePage } from '../gabinete-digital/expediente/expediente.page'; import { ExpedienteDetailPage } from '../gabinete-digital/expediente/expediente-detail/expediente-detail.page'; +import { EventEditPage } from './edit-event/edit-event.component'; import { GabineteDigitalPage } from '../gabinete-digital/gabinete-digital.page'; import { EditEventPage } from '../agenda/edit-event/edit-event.page'; @@ -265,7 +266,6 @@ export class EventsPage implements OnInit { } else { classs = 'modal modal-desktop showAsideOptions' } - console.log(this.profile); const modal = await this.modalController.create({ component: ViewEventPage, @@ -284,6 +284,34 @@ export class EventsPage implements OnInit { }); } + + async editEventDetail(eventId:any) { + + let classs; + if( window.innerWidth <= 800){ + classs = 'modal' + } else { + classs = 'modal modal-desktop showAsideOptions' + } + + const modal = await this.modalController.create({ + component: EventEditPage, + componentProps:{ + eventId: eventId, + profile: this.profile, + }, + cssClass: classs, + }); + + await modal.present(); + modal.onDidDismiss().then((res)=>{ + if(res){ + console.log(res); + this.RefreshEvents(); + } + }); + } + async viewExpedientDetail(serialNumber:any) { let classs; if( window.innerWidth <= 800){ diff --git a/src/app/shared/event/attendee-modal/attendee-modal.page.html b/src/app/shared/event/attendee-modal/attendee-modal.page.html index 99f6943e6..f8b429f47 100644 --- a/src/app/shared/event/attendee-modal/attendee-modal.page.html +++ b/src/app/shared/event/attendee-modal/attendee-modal.page.html @@ -6,9 +6,9 @@ - + - + @@ -26,10 +26,27 @@ - = 1">Destinatário - = 1" class="flex-grow-1 overflow-y-auto height-100 pb-0" > + + = 1 || taskParticipantsCc.length >= 1" >Destinatário + = 1 && adding == 'intervenient' " class="flex-grow-1 overflow-y-auto height-100 pb-0" > - + + + + + + {{ attendee.Name }} + {{ attendee.EmailAddress }} + + + X + + + + + = 1 && adding == 'CC' " class="flex-grow-1 overflow-y-auto height-100 pb-0" > + + diff --git a/src/app/shared/event/attendee-modal/attendee-modal.page.ts b/src/app/shared/event/attendee-modal/attendee-modal.page.ts index 60743606b..586fb1351 100644 --- a/src/app/shared/event/attendee-modal/attendee-modal.page.ts +++ b/src/app/shared/event/attendee-modal/attendee-modal.page.ts @@ -2,6 +2,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { ModalController } from '@ionic/angular'; import { ContactsService } from 'src/app/services/contacts.service'; import { EventPerson } from 'src/app/models/eventperson.model'; +import { el } from 'date-fns/locale'; @Component({ selector: 'app-attendee-modal', @@ -16,33 +17,43 @@ export class AttendeeModalPage implements OnInit { selectedContact: EventPerson[] =[]; eventPersons: EventPerson[]; + @Input() taskParticipants = []; + @Input() taskParticipantsCc= []; + @Input() eventAttendees: EventPerson[]; constructor(private modalCtrl: ModalController, private contactsService: ContactsService) { } @Output() closeComponent = new EventEmitter(); - @Output() setContact = new EventEmitter(); + + @Output() setIntervenient = new EventEmitter(); + @Output() setIntervenientCC = new EventEmitter(); currentPath = window.location.pathname; + @Input() adding: "intervenient" | "CC"; ngOnInit() { this.fetchContacts(""); - this.selectedContact = this.eventAttendees; + + this.taskParticipants = this.taskParticipants + this.taskParticipantsCc = this.taskParticipantsCc; + } - ngOnChanges(){ - console.log('change !!!') - } + ngOnChanges(event){} save(){ - // set data to agenda component - this.setContact.emit(this.selectedContact); + + this.setIntervenient.emit(this.taskParticipants); + this.setIntervenientCC.emit(this.taskParticipantsCc); + this.closeComponent.emit(); } setContactWithClose(){ if(this.currentPath == '/home/gabinete-digital'){ - this.setContact.emit(this.selectedContact); + this.setIntervenient.emit(this.taskParticipants); + this.setIntervenientCC.emit(this.taskParticipantsCc); } } @@ -58,37 +69,75 @@ export class AttendeeModalPage implements OnInit { filterSearchList(itm: EventPerson): boolean { - const result = this.selectedContact.find((contact, index)=>{ - - if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){ - index = index; - return contact; - } - }); - return undefined == result; + if(this.adding == "intervenient"){ + const result = this.taskParticipants.find((contact, index)=>{ + + if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){ + index = index; + return contact; + } + }); + return undefined == result; + + } else if (this.adding == "CC") { + + const result = this.taskParticipantsCc.find((contact, index)=>{ + + if(contact.Name == itm.Name && contact.EmailAddress == itm.EmailAddress){ + index = index; + return contact; + } + }); + + return undefined == result; + } + } remove(itm: EventPerson){ - this.selectedContact = this.selectedContact.filter((contact, index) =>{ + if(this.adding == "intervenient"){ - if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){ - return contact; - } - return false; + this.taskParticipants = this.taskParticipants.filter((contact, index) =>{ - }); + if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){ + return contact; + } + return false; + + }); + + + + } else if (this.adding == "CC") { + + this.taskParticipantsCc = this.taskParticipantsCc.filter((contact, index) =>{ + + if(contact.Name != itm.Name && contact.EmailAddress != itm.EmailAddress){ + return contact; + } + return false; + + }); + + } - // run only in gabinete digital this.setContactWithClose(); } async selectContact(itm: EventPerson){ - this.selectedContact.push(itm); + if(this.adding == "intervenient"){ + this.taskParticipants.push(itm); + + } else if (this.adding == "CC") { + + this.taskParticipantsCc.push(itm); + } + // run only in gabinete digital this.setContactWithClose(); }
{{ att.Description }}
{{ att.CreateDate }}
+ +
{{ attendee.EmailAddress }}