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); this.getAttachments(this.postEvent.EventId);
} }
ngOnInit() { ngOnInit() {
@@ -19,7 +19,7 @@
</div> </div>
<div *ngIf="Form && validateFrom" > <!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Subject').invalid " class="input-errror-message"> <div *ngIf="Form.get('Subject').invalid " class="input-errror-message">
<div *ngIf="Form.get('Subject').errors?.required"> <div *ngIf="Form.get('Subject').errors?.required">
Campo obrigatório. Campo obrigatório.
@@ -28,7 +28,7 @@
O campo deve ter pelo menos 4 caracteres. O campo deve ter pelo menos 4 caracteres.
</div> </div>
</div> </div>
</div> </div> -->
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
@@ -46,7 +46,7 @@
</div> </div>
<div *ngIf="Form && validateFrom" > <!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Location').invalid " class="input-errror-message"> <div *ngIf="Form.get('Location').invalid " class="input-errror-message">
<div *ngIf="Form.get('Location').errors?.required"> <div *ngIf="Form.get('Location').errors?.required">
Campo obrigatório. Campo obrigatório.
@@ -55,7 +55,7 @@
O campo deve ter pelo menos 4 caracteres. O campo deve ter pelo menos 4 caracteres.
</div> </div>
</div> </div>
</div> </div> -->
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
@@ -75,13 +75,13 @@
</div> </div>
</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').invalid " class="input-errror-message">
<div *ngIf="Form.get('CalendarName').errors?.required"> <div *ngIf="Form.get('CalendarName').errors?.required">
Campo obrigatório. Campo obrigatório.
</div> </div>
</div> </div>
</div> </div> -->
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
@@ -102,14 +102,14 @@
</div> </div>
</div> </div>
<div *ngIf="Form && validateFrom" > <!-- <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Categories').invalid " class="input-errror-message"> <div *ngIf="Form.get('Categories').invalid " class="input-errror-message">
{{ postEvent.Categories[0] }} {{ postEvent.Categories[0] }}
<div *ngIf="Form.get('Categories').errors?.required"> <div *ngIf="Form.get('Categories').errors?.required">
Campo obrigatório. Campo obrigatório.
</div> </div>
</div> </div>
</div> </div> -->
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
@@ -74,6 +74,10 @@ export class NewEventPage implements OnInit {
this.selectedSegment = this.navParams.get('segment'); this.selectedSegment = this.navParams.get('segment');
this.selectedDate = this.navParams.get('eventSelectedDate'); this.selectedDate = this.navParams.get('eventSelectedDate');
this.postEvent.StartDate = new Date()
this.postEvent.EndDate = (new Date(new Date().getTime() + 15 * 60000))
} }
ngOnInit() { ngOnInit() {
@@ -44,14 +44,22 @@ export class EventDetailModalPage implements OnInit {
this.loadedEvent = new Event(); this.loadedEvent = new Event();
this.loadedEvent.Body = new EventBody(); this.loadedEvent.Body = new EventBody();
} }
ngOnInit() { ngOnInit() {
this.loadEvent(); this.loadEvent();
this.loadAttachments(); this.loadAttachments();
this.ionicForm = this.formBuilder.group({ this.ionicForm = this.formBuilder.group({
subject: ['', [Validators.required]] subject: ['', [Validators.required]]
}) })
// this.setDefaultTime()
} }
// setDefaultTime() {
// this.loadedEvent.StartDate = new Date()
// this.loadedEvent.EndDate = (new Date(new Date().getTime() + 15 * 60000))
// }
get errorControl() { get errorControl() {
return this.ionicForm.controls; return this.ionicForm.controls;
} }
@@ -151,6 +151,12 @@ export class BookMeetingModalPage implements OnInit {
this.adding = "intervenient"; this.adding = "intervenient";
console.log(this.task); console.log(this.task);
this.getAttachments(); this.getAttachments();
this.setDefaultTime()
}
setDefaultTime() {
this.postData.StartDate = new Date()
this.postData.EndDate = (new Date(new Date().getTime() + 15 * 60000))
} }
getAttachments(){ getAttachments(){
@@ -22,7 +22,7 @@ export class EditActionPage implements OnInit {
public showSeconds = false; public showSeconds = false;
public touchUi = false; public touchUi = false;
public enableMeridian = false; public enableMeridian = false;
public minDate: any; public minDate = new Date().toISOString().slice(0,10)
public maxDate: any; public maxDate: any;
public stepHour = 1; public stepHour = 1;
public stepMinute = 5; public stepMinute = 5;
@@ -81,6 +81,12 @@ export class NewActionPage implements OnInit {
ngOnInit() { ngOnInit() {
this.segment = "Viagem"; 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) { segmentChanged(ev: any) {
@@ -102,7 +102,7 @@
<ion-datetime <ion-datetime
class="d-block d-md-none" class="d-block d-md-none"
placeholder="Início" placeholder="Início"
[(ngModel)]="dateControlEnd" [(ngModel)]="eventProcess.workflowInstanceDataFields.StartDate"
displayFormat="D MMM YYYY H:mm" displayFormat="D MMM YYYY H:mm"
minuteValues="0,15,30,45" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"