mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve publication forms
This commit is contained in:
@@ -14,6 +14,7 @@ import { PhotoService } from 'src/app/services/photo.service';
|
||||
//Cordova
|
||||
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-publication',
|
||||
@@ -30,6 +31,8 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
Defaultimage:any = '';
|
||||
|
||||
Form: FormGroup;
|
||||
validateFrom = false
|
||||
|
||||
photo: SafeResourceUrl;
|
||||
|
||||
@@ -134,7 +137,30 @@ export class NewPublicationPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
runValidation() {
|
||||
this.validateFrom = true
|
||||
}
|
||||
|
||||
injectValidation() {
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.pub.Title, [
|
||||
Validators.required,
|
||||
// Validators.minLength(4)
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async save(){
|
||||
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if(this.Form.invalid) return false
|
||||
|
||||
if(this.publicationType == '3'){
|
||||
|
||||
if(this.capturedImage != '') {
|
||||
|
||||
Reference in New Issue
Block a user