This commit is contained in:
Tiago Kayaya
2020-09-04 14:28:00 +01:00
parent b801fbbf0e
commit 2b7af8ddc8
11 changed files with 74 additions and 508 deletions
+30 -21
View File
@@ -13,42 +13,48 @@
<div class="div-ion-content">
<form [formGroup]="ionicForm" novalidate>
<ion-item>
<ion-label position="floating">Assunto</ion-label>
<ion-label position="floating">Assunto <span class="span-color">*</span></ion-label>
<ion-input formControlName="subject" type="text" [(ngModel)]="postEvent.Subject" required></ion-input>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.subject.errors?.required">
<span class="error ion-padding" *ngIf="formSubjectSatus">
Campo obrigatório
</span>
</span>
<ion-item>
<ion-label position="floating">Descrição</ion-label>
<ion-label position="floating">Descrição <span class="span-color">*</span></ion-label>
<ion-input formControlName="description" type="text" [(ngModel)]="postEvent.Body.Text" required></ion-input>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.startdate.errors?.required">
<span class="error ion-padding" *ngIf="formDescriptionSatus">
Campo obrigatório
</span>
</span>
<ion-item>
<ion-label position="floating">Localização</ion-label>
<ion-label position="floating">Localização <span class="span-color">*</span></ion-label>
<ion-input formControlName="location" type="text" [(ngModel)]="postEvent.Location" required></ion-input>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.startdate.errors?.required">
<span class="error ion-padding" *ngIf="formLocationSatus">
Campo obrigatório
</span>
</span>
<!-- <span class="error ion-padding" *ngIf="errorControl.location.errors?.required">
Campo obrigatório
</span> -->
<ion-item>
<ion-label position="floating">Selecione a Agenda</ion-label>
<ion-label position="floating">Selecione a Agenda <span class="span-color">*</span></ion-label>
<ion-select selectedText="{{postEvent.CalendarName}}" formControlName="agenda" [(ngModel)]="postEvent.CalendarName" interface="action-sheet" class="custom-options" Cancel-text="Cancelar" required>
<ion-select-option Pessoal="Reunião">Pessoal</ion-select-option>
<ion-select-option Oficial="Viagem">Oficial</ion-select-option>
</ion-select>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.agenda.errors?.required">
<span class="error ion-padding" *ngIf="formEventTypeSatus">
Campo obrigatório
</span>
</span>
<!-- <span class="error ion-padding" *ngIf="errorControl.agenda.errors?.required">
Campo obrigatório
</span> -->
<ion-item>
<ion-label position="floating">Tipo de evento</ion-label>
<ion-label position="floating">Tipo de evento <span class="span-color">*</span></ion-label>
<ion-select formControlName="eventtype" [(ngModel)]="postEvent.EventType" interface="action-sheet" class="custom-options" Cancel-text="Cancelar" required>
<ion-select-option value="Reunião">Reunião</ion-select-option>
<ion-select-option value="Viagem">Viagem</ion-select-option>
@@ -57,11 +63,14 @@
</ion-select>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.startdate.errors?.required">
<span class="error ion-padding" *ngIf="formEventTypeSatus">
Campo obrigatório
</span>
</span>
<!-- <span class="error ion-padding" *ngIf="errorControl.eventtype.errors?.required">
Campo obrigatório
</span> -->
<ion-item>
<ion-label position="floating">Data Início</ion-label>
<ion-label position="floating">Data Início <span class="span-color">*</span></ion-label>
<ion-datetime placeholder="{{postEvent.StartDate | date: 'dd MMM yyyy H:mm'}}" formControlName="startdate" [(ngModel)]="postEvent.StartDate" min="2020" max="2100"
displayFormat="D MMM YYYY H:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
@@ -69,20 +78,20 @@
</ion-datetime>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.startdate.errors?.required">
<!-- <span class="error ion-padding" *ngIf="errorControl.startdate.errors?.required">
Campo obrigatório
</span>
</span> -->
<ion-item>
<ion-label position="floating">Data Fim</ion-label>
<ion-label position="floating">Data Fim <span class="span-color">*</span></ion-label>
<ion-datetime placeholder="{{postEvent.EndDate | date: 'dd MMM yyyy H:mm'}}" formControlName="enddate" [(ngModel)]="postEvent.EndDate" min="2020" max="2100"
displayFormat="D MMM YYYY H:mm" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
required></ion-datetime>
</ion-item>
<!-- Error messages -->
<span class="error ion-padding" *ngIf="errorControl.enddate.errors?.required">
<!-- <span class="error ion-padding" *ngIf="errorControl.enddate.errors?.required">
Campo obrigatório
</span>
</span> -->
</form>
<div class="div-attach">
<ion-item lines="none">
+4 -1
View File
@@ -25,4 +25,7 @@
border: 1px solid red;
width: 100%;
float: left;
} */
} */
.span-color{
color:red;
}
+38 -8
View File
@@ -38,6 +38,11 @@ export class CalModalPage implements OnInit {
ionicForm: FormGroup;
isSubmitted = false;
formSubjectSatus: boolean = false;
formDescriptionSatus: boolean = false;
formLocationSatus: boolean = false;
formEventTypeSatus: boolean = false;
constructor(public formBuilder: FormBuilder, private modalCtrl: ModalController, private eventService: EventsService, private alertController:AlertService,
private navParams: NavParams) {
this.postEvent = new Event();
@@ -67,7 +72,7 @@ export class CalModalPage implements OnInit {
CalendarName: this.selectedSegment,
StartDate: selectedStartdDate,
EndDate: new Date(selectedEndDate),
EventType: '',
EventType: 'Reunião',
Attendees: null,
IsMeeting: false,
IsRecurring: false,
@@ -85,10 +90,10 @@ export class CalModalPage implements OnInit {
Body: this.eventBody,
Location: '',
CalendarId: '',
CalendarName: '',
CalendarName: 'Oficial',
StartDate: selectedStartdDate,
EndDate: new Date(selectedEndDate),
EventType: '',
EventType: 'Reunião',
Attendees: null,
IsMeeting: false,
IsRecurring: false,
@@ -126,6 +131,35 @@ export class CalModalPage implements OnInit {
this.eventService.postEvent(this.postEvent, this.postEvent.CalendarName).subscribe();
this.modalCtrl.dismiss(this.postEvent);
}
else{
this.validateFormInputs();
}
}
validateFormInputs(){
let formSubject = this.postEvent.Subject.trim();
let formDescription = this.postEvent.Body.Text.trim();
let formLocation = this.postEvent.Location.trim();
if (!this.postEvent.Subject && formSubject.length <= 0){
this.formSubjectSatus=true;
}
else{
this.formSubjectSatus=false;
if(!this.postEvent.Body.Text && formDescription.length <= 0){
this.formDescriptionSatus=true;
}
else{
this.formDescriptionSatus=false;
if (!this.postEvent.Location && formLocation.length <= 0){
this.formLocationSatus=true;
}
else{
this.formLocationSatus=false;
}
}
}
/* return (this.postEvent.Subject && formSubject.length > 0); */
}
onViewTitleChanged(title){
@@ -142,8 +176,6 @@ export class CalModalPage implements OnInit {
/* this.modalCtrl.dismiss(this.postEvent); */
}
async addAttendees()
{
const modal = await this.modalCtrl.create({
@@ -206,8 +238,6 @@ export class CalModalPage implements OnInit {
}
});
}
example(){
console.log("Mensagem");
}
}