This commit is contained in:
tiago.kayaya
2021-07-01 09:36:17 +01:00
parent 64b3602f49
commit d4887c1958
7 changed files with 39 additions and 21 deletions
@@ -124,6 +124,7 @@
<app-edit-action <app-edit-action
*ngIf="desktopComponent.showEditActions" *ngIf="desktopComponent.showEditActions"
[folderId]="folderId"
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)"
> >
@@ -280,6 +280,7 @@ export class PublicationsPage implements OnInit {
} }
async openOptions(id?: string) { async openOptions(id?: string) {
this.folderId = id;
const enterAnimation = (baseEl: any) => { const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create() const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!) .addElement(baseEl.querySelector('ion-backdrop')!)
@@ -66,7 +66,7 @@ export class ViewPublicationsPage implements OnInit {
} }
getPublicationDetail(){ getPublicationDetail(){
this.publications.PresidentialAction(this.folderId).subscribe(res=>{ this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
console.log(res); console.log(res);
this.item = res; this.item = res;
}); });
+10 -1
View File
@@ -29,7 +29,16 @@ export class PublicationsService {
return this.http.get<any>(`${geturl}`, options); return this.http.get<any>(`${geturl}`, options);
} }
PresidentialAction(id:any){ GetPresidentialAction(id:any){
const geturl = environment.apiURL + 'presidentialActions/'+id;
let options = {
headers: this.headers,
};
return this.http.get<any>(`${geturl}`, options);
}
UpdatePresidentialAction(id:any){
const geturl = environment.apiURL + 'presidentialActions/'+id; const geturl = environment.apiURL + 'presidentialActions/'+id;
let options = { let options = {
@@ -62,8 +62,7 @@
padding: 0 !important; padding: 0 !important;
} }
.div-title{ .div-title{
width: 180px; width: fit-content;
/* padding: 0!important; */
float: left; float: left;
margin: 2.5px 0 0 5px; margin: 2.5px 0 0 5px;
} }
@@ -1,6 +1,7 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service';
@Component({ @Component({
selector: 'app-edit-action', selector: 'app-edit-action',
@@ -9,48 +10,55 @@ import { PublicationsService } from 'src/app/services/publications.service';
}) })
export class EditActionPage implements OnInit { export class EditActionPage implements OnInit {
folderId:string; @Input() folderId: string;
folder: PublicationFolder; folder: PublicationFolder;
segment:string;
@Output() closeDesktopComponent= new EventEmitter<any>(); @Output() closeDesktopComponent= new EventEmitter<any>();
constructor( constructor(
private publicationsService: PublicationsService, private publicationsService: PublicationsService,
private toastService: ToastService,
) { ) {
this.folder = new PublicationFolder(); this.folder = new PublicationFolder();
} }
ngOnInit() { ngOnInit() {
console.log(this.folderId);
this.getPublicationDetail();
} }
close(){ close(){
this.closeDesktopComponent.emit(); this.closeDesktopComponent.emit();
} }
getPublicationDetail() { getPublicationDetail(){
this.publicationsService.PresidentialAction(this.folderId).subscribe(res=>{ this.publicationsService.GetPresidentialAction(this.folderId).subscribe(res=>{
console.log(res); this.folder = res;
}); });
} }
save(){ async save(){
/* this.folder = { console.log(this.folder);
this.folder = {
ProcessId: null, ProcessId: null,
Description: this.folder.Description, Description: this.folder.Description,
Detail: this.folder.Detail, Detail: this.folder.Detail,
DateBegin: this.folder.DateBegin, DateBegin: this.folder.DateBegin,
DateEnd: this.folder.DateEnd, DateEnd: this.folder.DateEnd,
ActionType: this.segment, ActionType: this.folder.ActionType,
} }
console.log(this.folder); console.log(this.folder);
try { /* try {
await this.publication.CreatePublicationFolder(this.folder).toPromise() await this.publicationsService.UpdatePresidentialAction(this.folder).toPromise()
this.close(); this.close();
this.toastService.successMessage('Acção presidencial criada') this.toastService.successMessage('Acção presidencial criada')
} 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')
} */ }
*/
} }
} }
@@ -65,7 +65,7 @@ export class ViewPublicationsPage implements OnInit {
} }
getPublicationDetail() { getPublicationDetail() {
this.publications.PresidentialAction(this.folderId).subscribe(res=>{ this.publications.GetPresidentialAction(this.folderId).subscribe(res=>{
console.log(res); console.log(res);
this.item = res; this.item = res;
}); });