mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { AnimationController, ModalController } from '@ionic/angular';
|
|
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
|
import { PublicationsService } from 'src/app/services/publications.service';
|
|
import { ToastService } from 'src/app/services/toast.service';
|
|
import { BadRequestPage } from 'src/app/shared/popover/bad-request/bad-request.page';
|
|
import { SuccessMessagePage } from 'src/app/shared/popover/success-message/success-message.page';
|
|
|
|
@Component({
|
|
selector: 'app-new-action',
|
|
templateUrl: './new-action.page.html',
|
|
styleUrls: ['./new-action.page.scss'],
|
|
})
|
|
export class NewActionPage implements OnInit {
|
|
|
|
folder: PublicationFolder;
|
|
segment:string;
|
|
|
|
constructor(
|
|
private modalController: ModalController,
|
|
private publication: PublicationsService,
|
|
private animationController: AnimationController,
|
|
private toastService: ToastService
|
|
|
|
) {
|
|
this.folder = new PublicationFolder();
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.segment = "Viagem";
|
|
}
|
|
|
|
segmentChanged(ev: any) {
|
|
console.log(ev.detail.value);
|
|
}
|
|
|
|
async save(){
|
|
this.folder = {
|
|
ProcessId: null,
|
|
Description: this.folder.Description,
|
|
Detail: this.folder.Detail,
|
|
DateBegin: this.folder.DateBegin,
|
|
DateEnd: this.folder.DateEnd,
|
|
ActionType: this.segment,
|
|
}
|
|
console.log(this.folder);
|
|
|
|
try {
|
|
await this.publication.CreatePublicationFolder(this.folder).toPromise()
|
|
this.toastService.successMessage("Ação presidencial criado")
|
|
this.close();
|
|
} catch (error) {
|
|
this.toastService.badRequest("Ação presidencial não criado")
|
|
}
|
|
|
|
}
|
|
close(){
|
|
this.modalController.dismiss();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|