Improve publication forms

This commit is contained in:
Peter Maquiran
2021-07-06 12:26:45 +01:00
parent 1ab3b43d5f
commit de45a55b5a
5 changed files with 122 additions and 9 deletions
@@ -1,6 +1,7 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { AnimationController, ModalController } from '@ionic/angular';
import * as moment from 'moment';
import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
@@ -16,10 +17,15 @@ export class NewActionPage implements OnInit {
folder: PublicationFolder;
segment:string;
public minDate = new Date();
public endMinDate = new Date(new Date().getTime() + 15 * 60000);
Form: FormGroup;
validateFrom = false
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
@Output() closeDesktopComponent= new EventEmitter<any>();
@@ -28,6 +34,18 @@ export class NewActionPage implements OnInit {
private toastService: ToastService
) {
this.folder = new PublicationFolder();
this.dateControlStart = new FormControl(moment(new Date()));
this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000)));
}
get dateStart () {
return this.dateControlStart.value
}
get dateEnd () {
return this.dateControlEnd.value
}
ngOnInit() {
@@ -55,8 +73,13 @@ export class NewActionPage implements OnInit {
}
async save() {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
this.folder = {
ProcessId: null,
Description: this.folder.Description,