mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Fix delete publication
This commit is contained in:
@@ -32,7 +32,7 @@ export class ActionsOptionsPage implements OnInit {
|
||||
|
||||
deleteAction(){
|
||||
this.publicationsService.DeletePresidentialAction(this.id).toPromise();
|
||||
this.close();
|
||||
this.modalController.dismiss('delete');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ export class EditActionPage implements OnInit {
|
||||
@Input() folderId: string;
|
||||
@Output() closeDesktopComponent= new EventEmitter<any>();
|
||||
@Output() updateDesktopComponent= new EventEmitter<any>();
|
||||
@Output() getActions= new EventEmitter<any>();
|
||||
|
||||
constructor(
|
||||
private publicationsService: PublicationsService,
|
||||
@@ -103,6 +104,8 @@ export class EditActionPage implements OnInit {
|
||||
this.close();
|
||||
this.updateDesktopComponent.emit();
|
||||
this.toastService.successMessage('Acção presidencial atualizada')
|
||||
this.getActions.emit()
|
||||
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Não foi possivel atualizar a acção presidencial')
|
||||
} finally {
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block">
|
||||
<input matInput [ngxMatDatetimePicker]="picker1"
|
||||
placeholder="Choose a date*"
|
||||
[formControl]="dateControlStart"
|
||||
[(ngModel)]="folder.DateBegin"
|
||||
[min]="minDate"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
@@ -81,14 +81,14 @@
|
||||
</ion-datetime>
|
||||
|
||||
<mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block">
|
||||
<input matInput [ngxMatDatetimePicker]="picker1"
|
||||
<input matInput [ngxMatDatetimePicker]="picker2"
|
||||
placeholder="Choose a date*"
|
||||
[formControl]="dateControlEnd"
|
||||
[(ngModel)]="folder.DateEnd"
|
||||
[min]="minDate"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #picker1
|
||||
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker2"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #picker2
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
|
||||
@@ -39,6 +39,7 @@ export class NewActionPage implements OnInit {
|
||||
|
||||
|
||||
@Output() closeDesktopComponent= new EventEmitter<any>();
|
||||
@Output() getActions= new EventEmitter<any>();
|
||||
|
||||
constructor(
|
||||
private publication: PublicationsService,
|
||||
@@ -46,8 +47,11 @@ export class NewActionPage implements OnInit {
|
||||
) {
|
||||
this.folder = new PublicationFolder();
|
||||
|
||||
this.dateControlStart = new FormControl(moment(new Date()));
|
||||
this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000)));
|
||||
|
||||
this.folder = Object.assign(this.folder, {
|
||||
DateBegin: moment(new Date()),
|
||||
DateEnd: moment(new Date(new Date().getTime() + 15 * 60000)),
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +73,7 @@ export class NewActionPage implements OnInit {
|
||||
|
||||
get dateValid() {
|
||||
if (window.innerWidth >= 800) {
|
||||
return this.folder.DateBegin < this.folder.DateEnd? ['ok']: []
|
||||
return new Date(this.folder.DateBegin).toLocaleString('pt') < new Date(this.folder.DateEnd).toLocaleString("pt")? ['ok'] : []
|
||||
} else {
|
||||
return ['ok']
|
||||
}
|
||||
@@ -81,6 +85,8 @@ export class NewActionPage implements OnInit {
|
||||
|
||||
injectValidation() {
|
||||
|
||||
console.log(this.dateValid)
|
||||
|
||||
this.Form = new FormGroup({
|
||||
Subject: new FormControl(this.folder.Description, [
|
||||
Validators.required,
|
||||
@@ -98,7 +104,13 @@ export class NewActionPage implements OnInit {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if(this.Form.invalid) return false
|
||||
if(this.Form.invalid) {
|
||||
return false
|
||||
} else {
|
||||
console.log ('not passded')
|
||||
}
|
||||
|
||||
console.log('pass')
|
||||
|
||||
this.folder = {
|
||||
ProcessId: null,
|
||||
@@ -116,6 +128,8 @@ export class NewActionPage implements OnInit {
|
||||
await this.publication.CreatePublicationFolder(this.folder).toPromise()
|
||||
this.close();
|
||||
this.toastService.successMessage('Acção presidencial criada')
|
||||
|
||||
this.getActions.emit()
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Não foi possivel criar a acção presidencial')
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user