mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
add message errors in new action.
This commit is contained in:
@@ -66,7 +66,7 @@ export class NewActionPage implements OnInit {
|
||||
private publication: PublicationsService,
|
||||
private toastService: ToastService
|
||||
|
||||
) {
|
||||
) {
|
||||
|
||||
|
||||
this.folder = new PublicationFolder();
|
||||
@@ -76,7 +76,7 @@ export class NewActionPage implements OnInit {
|
||||
|
||||
this.folder.DateBegin = new Date().toISOString()
|
||||
this.folder.DateEnd = (new Date(new Date().getTime() + 15 * 60000)).toISOString()
|
||||
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -102,7 +102,13 @@ export class NewActionPage implements OnInit {
|
||||
}
|
||||
|
||||
runValidation() {
|
||||
this.validateFrom = true
|
||||
this.validateFrom = true;
|
||||
if(new Date(this.folder.DateBegin).toISOString() > new Date(this.folder.DateEnd).toISOString()){
|
||||
this.toastService.badRequest("A data de início não pode ser superior a data de fim");
|
||||
}
|
||||
else if(this.folder.DateBegin > new Date().toISOString()){
|
||||
this.toastService.badRequest("A data de início não pode ser superior a data actual");
|
||||
}
|
||||
}
|
||||
|
||||
injectValidation() {
|
||||
@@ -134,8 +140,8 @@ export class NewActionPage implements OnInit {
|
||||
DateEnd: this.folder.DateEnd,
|
||||
ActionType: this.segment,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
@@ -144,7 +150,7 @@ export class NewActionPage implements OnInit {
|
||||
this.toastService.successMessage("Ação presidencial criado");
|
||||
this.close();
|
||||
} catch (error) {
|
||||
|
||||
|
||||
this.toastService.badRequest("Ação presidencial não criado");
|
||||
} finally {
|
||||
loader.remove()
|
||||
@@ -156,5 +162,5 @@ export class NewActionPage implements OnInit {
|
||||
close(){
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user