mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
disable and validate past dates on new and edit accoes on mobile view
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
<mat-form-field appearance="none" class="width-100 date-hour-picker d-none d-md-block">
|
<mat-form-field appearance="none" class="width-100 date-hour-picker d-none d-md-block">
|
||||||
<input matInput [ngxMatDatetimePicker]="picker1"
|
<input matInput [ngxMatDatetimePicker]="picker1"
|
||||||
placeholder="Choose a date*"
|
placeholder="Choose a date*"
|
||||||
[formControl]="dateControlEnd"
|
[formControl]="dateControlStart"
|
||||||
[min]="minDate"
|
[min]="minDate"
|
||||||
[disabled]="disabled"
|
[disabled]="disabled"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ 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 = new Date().toISOString().slice(0,10)
|
public minDate = new Date().toISOString()
|
||||||
public maxDate: any;
|
public maxDate: any;
|
||||||
public stepHour = 1;
|
public stepHour = 1;
|
||||||
public stepMinute = 5;
|
public stepMinute = 5;
|
||||||
public stepSecond = 5;
|
public stepSecond = 5;
|
||||||
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
|
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
|
||||||
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
|
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
|
||||||
|
currentDate = new Date();
|
||||||
|
|
||||||
folder: PublicationFolder;
|
folder: PublicationFolder;
|
||||||
folderId: string;
|
folderId: string;
|
||||||
@@ -64,8 +65,15 @@ export class EditActionPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get dateValid() {
|
get dateValid() {
|
||||||
|
var validado: boolean;
|
||||||
|
|
||||||
if (window.innerWidth <= 800) {
|
if (window.innerWidth <= 800) {
|
||||||
return this.folder.DateBegin < this.folder.DateEnd? ['ok']: []
|
if ((this.folder.DateBegin < this.folder.DateEnd) && (new Date(this.folder.DateBegin).getTime() > this.currentDate.getTime())) {
|
||||||
|
validado = true;
|
||||||
|
}else{
|
||||||
|
validado = false;
|
||||||
|
}
|
||||||
|
return validado == true ? ['ok']: [];
|
||||||
} else {
|
} else {
|
||||||
return ['ok']
|
return ['ok']
|
||||||
}
|
}
|
||||||
@@ -89,6 +97,11 @@ export class EditActionPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
|
this.injectValidation()
|
||||||
|
this.runValidation()
|
||||||
|
|
||||||
|
if(this.Form.invalid) return false
|
||||||
|
|
||||||
let body = {
|
let body = {
|
||||||
ProcessId: this.folderId,
|
ProcessId: this.folderId,
|
||||||
Description: this.folder.Description,
|
Description: this.folder.Description,
|
||||||
|
|||||||
@@ -43,13 +43,14 @@ export class NewActionPage implements OnInit {
|
|||||||
public showSeconds = false;
|
public showSeconds = false;
|
||||||
public touchUi = false;
|
public touchUi = false;
|
||||||
public enableMeridian = false;
|
public enableMeridian = false;
|
||||||
public minDate = new Date().toISOString().slice(0,10)
|
public minDate = new Date().toISOString()
|
||||||
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
|
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
|
||||||
public stepHour = 1;
|
public stepHour = 1;
|
||||||
public stepMinute = 5;
|
public stepMinute = 5;
|
||||||
public stepSecond = 5;
|
public stepSecond = 5;
|
||||||
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
|
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
|
||||||
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
|
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
|
||||||
|
currentDate = new Date();
|
||||||
|
|
||||||
showLoader = false
|
showLoader = false
|
||||||
|
|
||||||
@@ -94,8 +95,15 @@ export class NewActionPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get dateValid() {
|
get dateValid() {
|
||||||
|
var validado: boolean;
|
||||||
|
|
||||||
if (window.innerWidth <= 800) {
|
if (window.innerWidth <= 800) {
|
||||||
return this.folder.DateBegin < this.folder.DateEnd? ['ok']: []
|
if ((this.folder.DateBegin < this.folder.DateEnd) && (new Date(this.folder.DateBegin).getTime() > this.currentDate.getTime())) {
|
||||||
|
validado = true;
|
||||||
|
}else{
|
||||||
|
validado = false;
|
||||||
|
}
|
||||||
|
return validado == true ? ['ok']: [];
|
||||||
} else {
|
} else {
|
||||||
return ['ok']
|
return ['ok']
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user