Files
doneit-web/src/app/shared/publication/edit-action/edit-action.page.ts
T

65 lines
1.7 KiB
TypeScript
Raw Normal View History

2021-07-01 09:36:17 +01:00
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2021-06-30 16:12:47 +01:00
import { PublicationFolder } from 'src/app/models/publicationfolder';
2021-06-30 16:33:53 +01:00
import { PublicationsService } from 'src/app/services/publications.service';
2021-07-01 09:36:17 +01:00
import { ToastService } from 'src/app/services/toast.service';
2021-06-30 16:12:47 +01:00
@Component({
selector: 'app-edit-action',
templateUrl: './edit-action.page.html',
styleUrls: ['./edit-action.page.scss'],
})
export class EditActionPage implements OnInit {
2021-07-01 09:36:17 +01:00
@Input() folderId: string;
2021-06-30 16:12:47 +01:00
folder: PublicationFolder;
2021-07-01 09:36:17 +01:00
segment:string;
2021-06-30 16:12:47 +01:00
@Output() closeDesktopComponent= new EventEmitter<any>();
2021-06-30 16:33:53 +01:00
constructor(
private publicationsService: PublicationsService,
2021-07-01 09:36:17 +01:00
private toastService: ToastService,
2021-06-30 16:33:53 +01:00
) {
2021-06-30 16:12:47 +01:00
this.folder = new PublicationFolder();
}
ngOnInit() {
2021-07-01 09:36:17 +01:00
console.log(this.folderId);
this.getPublicationDetail();
2021-06-30 16:12:47 +01:00
}
close(){
this.closeDesktopComponent.emit();
}
2021-07-01 09:36:17 +01:00
getPublicationDetail(){
this.publicationsService.GetPresidentialAction(this.folderId).subscribe(res=>{
this.folder = res;
2021-06-30 16:33:53 +01:00
});
}
2021-07-01 09:36:17 +01:00
async save(){
console.log(this.folder);
this.folder = {
2021-06-30 16:12:47 +01:00
ProcessId: null,
Description: this.folder.Description,
Detail: this.folder.Detail,
DateBegin: this.folder.DateBegin,
DateEnd: this.folder.DateEnd,
2021-07-01 09:36:17 +01:00
ActionType: this.folder.ActionType,
2021-06-30 16:12:47 +01:00
}
console.log(this.folder);
2021-07-01 09:36:17 +01:00
/* try {
await this.publicationsService.UpdatePresidentialAction(this.folder).toPromise()
2021-06-30 16:12:47 +01:00
this.close();
this.toastService.successMessage('Acção presidencial criada')
} catch (error) {
this.toastService.badRequest('Não foi possivel criar a acção presidencial')
2021-07-01 09:36:17 +01:00
}
*/
2021-06-30 16:12:47 +01:00
}
}