set default value to form inputs

This commit is contained in:
Peter Maquiran
2021-07-08 15:15:29 +01:00
parent b515a0454d
commit c34d7b16d9
8 changed files with 35 additions and 10 deletions
@@ -93,6 +93,7 @@ export class EditEventPage implements OnInit {
}
this.getAttachments(this.postEvent.EventId);
}
ngOnInit() {
@@ -19,7 +19,7 @@
</div>
<div *ngIf="Form && validateFrom" >
<!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Subject').invalid " class="input-errror-message">
<div *ngIf="Form.get('Subject').errors?.required">
Campo obrigatório.
@@ -28,7 +28,7 @@
O campo deve ter pelo menos 4 caracteres.
</div>
</div>
</div>
</div> -->
<div class="container-div">
<div class="ion-item-class-2">
@@ -46,7 +46,7 @@
</div>
<div *ngIf="Form && validateFrom" >
<!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Location').invalid " class="input-errror-message">
<div *ngIf="Form.get('Location').errors?.required">
Campo obrigatório.
@@ -55,7 +55,7 @@
O campo deve ter pelo menos 4 caracteres.
</div>
</div>
</div>
</div> -->
<div class="container-div">
<div class="ion-item-class-2">
@@ -75,13 +75,13 @@
</div>
</div>
<div *ngIf="Form && validateFrom" >
<!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('CalendarName').invalid " class="input-errror-message">
<div *ngIf="Form.get('CalendarName').errors?.required">
Campo obrigatório.
</div>
</div>
</div>
</div> -->
<div class="container-div">
<div class="ion-item-class-2">
@@ -102,14 +102,14 @@
</div>
</div>
<div *ngIf="Form && validateFrom" >
<!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Categories').invalid " class="input-errror-message">
{{ postEvent.Categories[0] }}
<div *ngIf="Form.get('Categories').errors?.required">
Campo obrigatório.
</div>
</div>
</div>
</div> -->
<div class="container-div">
<div class="ion-item-class-2">
@@ -74,6 +74,10 @@ export class NewEventPage implements OnInit {
this.selectedSegment = this.navParams.get('segment');
this.selectedDate = this.navParams.get('eventSelectedDate');
this.postEvent.StartDate = new Date()
this.postEvent.EndDate = (new Date(new Date().getTime() + 15 * 60000))
}
ngOnInit() {
@@ -44,14 +44,22 @@ export class EventDetailModalPage implements OnInit {
this.loadedEvent = new Event();
this.loadedEvent.Body = new EventBody();
}
ngOnInit() {
this.loadEvent();
this.loadAttachments();
this.ionicForm = this.formBuilder.group({
subject: ['', [Validators.required]]
})
// this.setDefaultTime()
}
// setDefaultTime() {
// this.loadedEvent.StartDate = new Date()
// this.loadedEvent.EndDate = (new Date(new Date().getTime() + 15 * 60000))
// }
get errorControl() {
return this.ionicForm.controls;
}
@@ -151,6 +151,12 @@ export class BookMeetingModalPage implements OnInit {
this.adding = "intervenient";
console.log(this.task);
this.getAttachments();
this.setDefaultTime()
}
setDefaultTime() {
this.postData.StartDate = new Date()
this.postData.EndDate = (new Date(new Date().getTime() + 15 * 60000))
}
getAttachments(){
@@ -22,7 +22,7 @@ export class EditActionPage implements OnInit {
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public minDate: any;
public minDate = new Date().toISOString().slice(0,10)
public maxDate: any;
public stepHour = 1;
public stepMinute = 5;
@@ -81,6 +81,12 @@ export class NewActionPage implements OnInit {
ngOnInit() {
this.segment = "Viagem";
this.setDefaultTime()
}
setDefaultTime() {
this.folder.DateBegin = new Date().toISOString()
this.folder.DateEnd = (new Date(new Date().getTime() + 15 * 60000)).toISOString()
}
segmentChanged(ev: any) {