mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
Fix delete publication
This commit is contained in:
@@ -151,6 +151,7 @@
|
|||||||
(goBacktoPublicationDetails)="goBacktoPublicationDetails()"
|
(goBacktoPublicationDetails)="goBacktoPublicationDetails()"
|
||||||
(goBackToViewPublications)="goBackToViewPublications()"
|
(goBackToViewPublications)="goBackToViewPublications()"
|
||||||
(closeDesktopComponent)="closeDesktopComponent($event)"
|
(closeDesktopComponent)="closeDesktopComponent($event)"
|
||||||
|
(getActions)="getActions()"
|
||||||
>
|
>
|
||||||
</app-view-publications>
|
</app-view-publications>
|
||||||
|
|
||||||
@@ -164,6 +165,7 @@
|
|||||||
(closeDesktopComponent)="closeDesktopComponent($event)"
|
(closeDesktopComponent)="closeDesktopComponent($event)"
|
||||||
(goBacktoPublicationDetails)="goBacktoPublicationDetails()"
|
(goBacktoPublicationDetails)="goBacktoPublicationDetails()"
|
||||||
(goBackToViewPublications)="goBackToViewPublications()"
|
(goBackToViewPublications)="goBackToViewPublications()"
|
||||||
|
(getActions)="getActions()"
|
||||||
>
|
>
|
||||||
</app-new-publication>
|
</app-new-publication>
|
||||||
|
|
||||||
@@ -176,12 +178,14 @@
|
|||||||
(closeDesktopComponent)="closeDesktopComponent($event)"
|
(closeDesktopComponent)="closeDesktopComponent($event)"
|
||||||
(goBacktoPublicationDetails)="goBacktoPublicationDetails()"
|
(goBacktoPublicationDetails)="goBacktoPublicationDetails()"
|
||||||
(goBackToViewPublications)="goBackToViewPublications()"
|
(goBackToViewPublications)="goBackToViewPublications()"
|
||||||
|
(getActions)="getActions()"
|
||||||
></app-publication-detail-shared>
|
></app-publication-detail-shared>
|
||||||
|
|
||||||
<app-new-action
|
<app-new-action
|
||||||
*ngIf="desktopComponent.showAddActions"
|
*ngIf="desktopComponent.showAddActions"
|
||||||
class="height-100 d-flex flex-column overflow-hidden background-white flex-grow-1"
|
class="height-100 d-flex flex-column overflow-hidden background-white flex-grow-1"
|
||||||
(closeDesktopComponent)="closeDesktopComponent($event)"
|
(closeDesktopComponent)="closeDesktopComponent($event)"
|
||||||
|
(getActions)="getActions()"
|
||||||
></app-new-action>
|
></app-new-action>
|
||||||
|
|
||||||
<app-edit-action
|
<app-edit-action
|
||||||
@@ -190,6 +194,7 @@
|
|||||||
class="height-100 d-flex flex-column overflow-hidden background-white flex-grow-1"
|
class="height-100 d-flex flex-column overflow-hidden background-white flex-grow-1"
|
||||||
(closeDesktopComponent)="closeDesktopComponent($event)"
|
(closeDesktopComponent)="closeDesktopComponent($event)"
|
||||||
(updateDesktopComponent)="updateDesktopComponent($event)"
|
(updateDesktopComponent)="updateDesktopComponent($event)"
|
||||||
|
(getActions)="getActions()"
|
||||||
>
|
>
|
||||||
</app-edit-action>
|
</app-edit-action>
|
||||||
|
|
||||||
|
|||||||
@@ -360,6 +360,8 @@ export class PublicationsPage implements OnInit {
|
|||||||
if(res['data']=='edit'){
|
if(res['data']=='edit'){
|
||||||
this.closeDesktopComponent();
|
this.closeDesktopComponent();
|
||||||
this.desktopComponent.showEditActions = true;
|
this.desktopComponent.showEditActions = true;
|
||||||
|
} else if (res['data']=='delete') {
|
||||||
|
this.getActions();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class ActionsOptionsPage implements OnInit {
|
|||||||
|
|
||||||
deleteAction(){
|
deleteAction(){
|
||||||
this.publicationsService.DeletePresidentialAction(this.id).toPromise();
|
this.publicationsService.DeletePresidentialAction(this.id).toPromise();
|
||||||
this.close();
|
this.modalController.dismiss('delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ export class EditActionPage implements OnInit {
|
|||||||
@Input() folderId: string;
|
@Input() folderId: string;
|
||||||
@Output() closeDesktopComponent= new EventEmitter<any>();
|
@Output() closeDesktopComponent= new EventEmitter<any>();
|
||||||
@Output() updateDesktopComponent= new EventEmitter<any>();
|
@Output() updateDesktopComponent= new EventEmitter<any>();
|
||||||
|
@Output() getActions= new EventEmitter<any>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private publicationsService: PublicationsService,
|
private publicationsService: PublicationsService,
|
||||||
@@ -103,6 +104,8 @@ export class EditActionPage implements OnInit {
|
|||||||
this.close();
|
this.close();
|
||||||
this.updateDesktopComponent.emit();
|
this.updateDesktopComponent.emit();
|
||||||
this.toastService.successMessage('Acção presidencial atualizada')
|
this.toastService.successMessage('Acção presidencial atualizada')
|
||||||
|
this.getActions.emit()
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.toastService.badRequest('Não foi possivel atualizar a acção presidencial')
|
this.toastService.badRequest('Não foi possivel atualizar a acção presidencial')
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
<mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block">
|
<mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block">
|
||||||
<input matInput [ngxMatDatetimePicker]="picker1"
|
<input matInput [ngxMatDatetimePicker]="picker1"
|
||||||
placeholder="Choose a date*"
|
placeholder="Choose a date*"
|
||||||
[formControl]="dateControlStart"
|
[(ngModel)]="folder.DateBegin"
|
||||||
[min]="minDate"
|
[min]="minDate"
|
||||||
[disabled]="disabled"
|
[disabled]="disabled"
|
||||||
>
|
>
|
||||||
@@ -81,14 +81,14 @@
|
|||||||
</ion-datetime>
|
</ion-datetime>
|
||||||
|
|
||||||
<mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block">
|
<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*"
|
placeholder="Choose a date*"
|
||||||
[formControl]="dateControlEnd"
|
[(ngModel)]="folder.DateEnd"
|
||||||
[min]="minDate"
|
[min]="minDate"
|
||||||
[disabled]="disabled"
|
[disabled]="disabled"
|
||||||
>
|
>
|
||||||
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
|
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker2"></mat-datepicker-toggle>
|
||||||
<ngx-mat-datetime-picker #picker1
|
<ngx-mat-datetime-picker #picker2
|
||||||
[showSpinners]="showSpinners"
|
[showSpinners]="showSpinners"
|
||||||
[showSeconds]="showSeconds"
|
[showSeconds]="showSeconds"
|
||||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ export class NewActionPage implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
@Output() closeDesktopComponent= new EventEmitter<any>();
|
@Output() closeDesktopComponent= new EventEmitter<any>();
|
||||||
|
@Output() getActions= new EventEmitter<any>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private publication: PublicationsService,
|
private publication: PublicationsService,
|
||||||
@@ -46,8 +47,11 @@ export class NewActionPage implements OnInit {
|
|||||||
) {
|
) {
|
||||||
this.folder = new PublicationFolder();
|
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() {
|
get dateValid() {
|
||||||
if (window.innerWidth >= 800) {
|
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 {
|
} else {
|
||||||
return ['ok']
|
return ['ok']
|
||||||
}
|
}
|
||||||
@@ -81,6 +85,8 @@ export class NewActionPage implements OnInit {
|
|||||||
|
|
||||||
injectValidation() {
|
injectValidation() {
|
||||||
|
|
||||||
|
console.log(this.dateValid)
|
||||||
|
|
||||||
this.Form = new FormGroup({
|
this.Form = new FormGroup({
|
||||||
Subject: new FormControl(this.folder.Description, [
|
Subject: new FormControl(this.folder.Description, [
|
||||||
Validators.required,
|
Validators.required,
|
||||||
@@ -98,7 +104,13 @@ export class NewActionPage implements OnInit {
|
|||||||
this.injectValidation()
|
this.injectValidation()
|
||||||
this.runValidation()
|
this.runValidation()
|
||||||
|
|
||||||
if(this.Form.invalid) return false
|
if(this.Form.invalid) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
console.log ('not passded')
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('pass')
|
||||||
|
|
||||||
this.folder = {
|
this.folder = {
|
||||||
ProcessId: null,
|
ProcessId: null,
|
||||||
@@ -116,6 +128,8 @@ export class NewActionPage implements OnInit {
|
|||||||
await this.publication.CreatePublicationFolder(this.folder).toPromise()
|
await this.publication.CreatePublicationFolder(this.folder).toPromise()
|
||||||
this.close();
|
this.close();
|
||||||
this.toastService.successMessage('Acção presidencial criada')
|
this.toastService.successMessage('Acção presidencial criada')
|
||||||
|
|
||||||
|
this.getActions.emit()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.toastService.badRequest('Não foi possivel criar a acção presidencial')
|
this.toastService.badRequest('Não foi possivel criar a acção presidencial')
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user