Improve login

This commit is contained in:
Peter Maquiran
2021-06-28 11:16:21 +01:00
parent a0c42caac7
commit a97ca61578
5 changed files with 173 additions and 83 deletions
@@ -61,8 +61,8 @@ export class NewEventPage implements OnInit {
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public minDate: any;
public maxDate: any;
public minDate = new Date();
public maxDate = '';
public stepHour = 1;
public stepMinute = 5;
public stepSecond = 5;
@@ -71,7 +71,7 @@ export class NewEventPage implements OnInit {
@Input() profile:string;
@Input() selectedSegment: string;
@Input() selectedDate: Date;
@Input() taskParticipants: EventPerson[];
@Input() taskParticipants: EventPerson[] = [];
@Input() taskParticipantsCc: any = [];
@Output() setIntervenient = new EventEmitter<any>();
@@ -94,6 +94,9 @@ export class NewEventPage implements OnInit {
@ViewChild('inicio') inicio: any;
@ViewChild('picker1') picker1: any;
Form: any = {}
validateFrom = false
public options = [
{ value: true, label: 'True' },
@@ -118,7 +121,6 @@ export class NewEventPage implements OnInit {
return this.dateControlEnd.value
}
constructor(
private modalController: ModalController,
private eventService: EventsService,
@@ -154,7 +156,7 @@ export class NewEventPage implements OnInit {
let selectedEndDate = new Date(this.selectedDate);
/* Set + 30minutes to seleted datetime */
selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ;
this.minDate = this.selectedDate.toString();
if(this.selectedSegment != "Combinada"){
this.postEvent ={
@@ -222,6 +224,46 @@ export class NewEventPage implements OnInit {
this.date = new Date(2021,9,4,5,6,7);
this.getDatepickerData()
this.injectValidation()
}
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),
Categories: new FormControl(this.postEvent.Categories[0], [
Validators.required
]),
dateStart: new FormControl(this.dateStart, [
Validators.required
]),
dateEnd: new FormControl(this.dateEnd, [
Validators.required
]),
IsRecurring: new FormControl(this.postEvent.IsRecurring, [
Validators.required
]),
participantes: new FormControl(this.participantes, [
Validators.required
]),
})
}
get participantes() {
return this.taskParticipantsCc.concat(this.taskParticipants)
}
openInicio() {
@@ -283,7 +325,12 @@ export class NewEventPage implements OnInit {
}
async save(){
async save() {
this.runValidation()
// dont runt this function
if (!this.Form.valid) return false
this.getDatepickerData()