This commit is contained in:
Peter Maquiran
2023-09-19 10:21:23 +01:00
parent 527cc0f2a6
commit f51bd246fc
29 changed files with 754 additions and 261 deletions
@@ -53,7 +53,8 @@
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi">
[hideTime]="true"
>
</ngx-mat-datetime-picker>
</mat-form-field>
@@ -89,7 +90,9 @@
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond">
[stepSecond]="stepSecond"
[hideTime]="true"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
@@ -5,12 +5,29 @@ import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
dateInput: "YYYY-MMMM-DD HH:mm"
},
display: {
dateInput: "DD MMM YYYY",
monthYearLabel: "MMM YYYY",
dateA11yLabel: "LL",
monthYearA11yLabel: "MMMM YYYY"
}
}
@Component({
selector: 'app-new-action',
templateUrl: './new-action.page.html',
styleUrls: ['./new-action.page.scss'],
providers: [
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },
]
})
export class NewActionPage implements OnInit {
@@ -42,7 +59,7 @@ export class NewActionPage implements OnInit {
) {
this.folder = new PublicationFolder();
this.setStartDate()
this.setEndDate()
}
@@ -53,7 +70,7 @@ export class NewActionPage implements OnInit {
}
segmentChanged(ev: any) {
}
get dateValid() {
@@ -103,10 +120,10 @@ export class NewActionPage implements OnInit {
if(this.Form.invalid) {
return false
} else {
}
this.folder = {
ProcessId: null,
@@ -116,7 +133,7 @@ export class NewActionPage implements OnInit {
DateEnd: this.folder.DateEnd,
ActionType: this.segment,
}
const loader = this.toastService.loading()
@@ -145,7 +162,7 @@ export class NewActionPage implements OnInit {
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
} else if (minutes > 30) {
@@ -156,18 +173,18 @@ export class NewActionPage implements OnInit {
date.setMinutes(15)
}
}
}
return date
}
roundTimeQuarterHour() {
let date = new Date();
const minutes = date.getMinutes();
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
} else if (minutes > 30) {
@@ -178,7 +195,7 @@ export class NewActionPage implements OnInit {
date.setMinutes(15)
}
}
}
return date
}
@@ -187,9 +204,9 @@ export class NewActionPage implements OnInit {
const _date = new Date(date);
const minutes = _date .getMinutes();
_date .setMinutes(minutes + 15)
return _date
return _date
}
setStartDate() {
this.folder.DateBegin = this.roundTimeQuarterHour()