diff --git a/src/app/pages/agenda/edit-event/edit-event.page.html b/src/app/pages/agenda/edit-event/edit-event.page.html index ffa971123..238d050e8 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.html +++ b/src/app/pages/agenda/edit-event/edit-event.page.html @@ -16,19 +16,43 @@
-
+
+ + +
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
+
-
+
+ +
+
+
+ Campo obrigatório. +
+
+ O campo deve ter pelo menos 4 caracteres. +
+
+
@@ -47,13 +71,22 @@
+ +
+
+ {{ postEvent.Categories[0] }} +
+ Campo obrigatório. +
+
+
-
+
+ +
+
+ {{ postEvent.Categories[0] }} +
+ Campo obrigatório. +
+
+
@@ -80,8 +122,7 @@ displayFormat="D MMM YYYY H:mm" minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" - min="2018" - max="2022" + min="minDate" > @@ -102,7 +143,6 @@ minuteValues="0,15,30,45" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" min="2018" - max="2022" > diff --git a/src/app/pages/agenda/edit-event/edit-event.page.ts b/src/app/pages/agenda/edit-event/edit-event.page.ts index b91f3358e..a958c4bd8 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.ts +++ b/src/app/pages/agenda/edit-event/edit-event.page.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { AlertController, AnimationController, ModalController, NavParams } from '@ionic/angular'; import { Attachment } from 'src/app/models/attachment.model'; @@ -18,6 +19,10 @@ import { SearchPage } from '../../search/search.page'; }) export class EditEventPage implements OnInit { + + Form: FormGroup; + validateFrom = false + postEvent: Event; isRecurring:string; isEventEdited: boolean; @@ -115,7 +120,45 @@ export class EditEventPage implements OnInit { this.router.navigate(['/home',this.caller]); } + + runValidation() { + this.validateFrom = true + } + + injectValidation() { + + this.Form = new FormGroup({ + Subject: new FormControl(this.postEvent.Subject, [ + Validators.required, + // Validators.minLength(4) + ]), + Location: new FormControl(this.postEvent.Location, [ + Validators.required, + ]), + CalendarName: new FormControl(this.postEvent.CalendarName, [ + Validators.required + ]), + Categories: new FormControl(this.postEvent.Categories[0], [ + Validators.required + ]), + IsRecurring: new FormControl(this.postEvent.IsRecurring, [ + Validators.required + ]), + // participantes: new FormControl(this.taskParticipantsCc.concat(this.taskParticipants), [ + // Validators.required + // ]), + + }) + } + + save() { + + this.injectValidation() + this.runValidation() + + if(this.Form.invalid) return false + this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc) try{ this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {