2021-06-30 15:01:07 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2021-07-01 11:08:04 +01:00
|
|
|
import { ModalController, NavParams } from '@ionic/angular';
|
2021-06-30 15:48:37 +01:00
|
|
|
import { PublicationsService } from 'src/app/services/publications.service';
|
2021-07-13 17:15:25 +01:00
|
|
|
import { ToastService } from 'src/app/services/toast.service';
|
2021-10-25 15:31:43 +01:00
|
|
|
import { ThemeService } from 'src/app/services/theme.service'
|
2021-06-30 15:01:07 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-actions-options',
|
|
|
|
|
templateUrl: './actions-options.page.html',
|
|
|
|
|
styleUrls: ['./actions-options.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class ActionsOptionsPage implements OnInit {
|
|
|
|
|
|
2021-06-30 15:48:37 +01:00
|
|
|
id:string;
|
|
|
|
|
|
2021-06-30 15:01:07 +01:00
|
|
|
constructor(
|
|
|
|
|
private modalController: ModalController,
|
2021-06-30 15:48:37 +01:00
|
|
|
private navParams: NavParams,
|
|
|
|
|
private publicationsService: PublicationsService,
|
2021-10-25 15:31:43 +01:00
|
|
|
private toastService: ToastService,
|
|
|
|
|
public ThemeService: ThemeService
|
2021-06-30 15:48:37 +01:00
|
|
|
) {
|
|
|
|
|
this.id = this.navParams.get('id');
|
|
|
|
|
}
|
2021-06-30 15:01:07 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
close () {
|
|
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-30 16:12:47 +01:00
|
|
|
editAction(){
|
|
|
|
|
this.modalController.dismiss('edit');
|
|
|
|
|
}
|
2021-06-30 15:01:07 +01:00
|
|
|
|
2021-07-13 17:15:25 +01:00
|
|
|
async deleteAction() {
|
|
|
|
|
|
|
|
|
|
const loader = this.toastService.loading();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await this.publicationsService.DeletePresidentialAction(this.id).toPromise();
|
2021-07-14 08:50:20 +01:00
|
|
|
this.toastService.successMessage()
|
2021-07-13 17:15:25 +01:00
|
|
|
this.modalController.dismiss('delete');
|
2021-07-14 08:50:20 +01:00
|
|
|
|
2021-07-13 17:15:25 +01:00
|
|
|
} catch(e) {
|
|
|
|
|
this.toastService.badRequest()
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
loader.remove()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-06-30 15:01:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|