File

src/app/manage-learn/shared/components/submission-actions/submission-actions.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(navParams: NavParams, alertCntrler: AlertController, popover: PopoverController, translateService: TranslateService, modalCtrl: ModalController, datepipe: DatePipe)
Parameters :
Name Type Optional
navParams NavParams No
alertCntrler AlertController No
popover PopoverController No
translateService TranslateService No
modalCtrl ModalController No
datepipe DatePipe No

Methods

ngOnInit
ngOnInit()
Returns : void
Async presentAlert
presentAlert()
Returns : any
Async presentModal
presentModal()
Returns : any

Properties

Public popover
Type : PopoverController
submission
Type : any
text
Type : string
translateObject
Type : any
import { DatePipe } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { AlertController, ModalController, NavParams, PopoverController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { ViewDetailComponent } from '../view-detail/view-detail.component';

@Component({
  selector: 'app-submission-actions',
  templateUrl: './submission-actions.component.html',
  styleUrls: ['./submission-actions.component.scss'],
})
export class SubmissionActionsComponent implements OnInit {
  text: string;
  submission: any;
  translateObject: any;
  constructor(
    private navParams: NavParams,
    private alertCntrler: AlertController,
    // private viewCntrlr: ViewController,
    public popover: PopoverController,
    private translateService: TranslateService,
    private modalCtrl: ModalController,
    private datepipe: DatePipe
  ) {}

  ngOnInit() {
    this.submission = this.navParams.get('submission');
    this.translateService
      .get(['FRMELEMNTS_BTN_UPDATE', 'CANCEL', 'FRMELEMNTS_LBL_INSTANCE_NAME'])
      .subscribe((translations) => {
        this.translateObject = translations;
      });
  }

  async presentAlert() {
    let alert = await this.alertCntrler.create({
      header: this.translateObject['FRMELEMNTS_LBL_INSTANCE_NAME'],
      cssClass:'central-alert',
      inputs: [
        {
          name: 'title',
          placeholder: 'Title',
          value: this.submission.title,
        },
      ],
      buttons: [
        {
          text: this.translateObject['CANCEL'],
          role: 'cancel',
          handler: (data) => {
            console.log('Cancel clicked');
            this.popover.dismiss();
          },
        },
        {
          text: this.translateObject['FRMELEMNTS_BTN_UPDATE'],
          handler: (data) => {
            const payload = {
              action: 'update',
              name: data.title,
            };
            this.popover.dismiss(payload);
          },
        },
      ],
    });
    alert.present();
  }

  async presentModal() {
    this.popover.dismiss();
    const modal = await this.modalCtrl.create({
      component: ViewDetailComponent,
      componentProps: {
        submission: this.submission,
      },
    });
    modal.present();
  }
}
<ion-list class="d-flex flex-ai-center flex-dc">
  <ion-button fill="clear" ion-item (click)="presentAlert()" class="custom-btn-txt-transform-none">
    {{ 'FRMELEMNTS_BTN_EDIT' | translate }}
  </ion-button>
  <ion-button fill="clear" ion-item (click)="popover.dismiss({ action: 'delete' })" class="custom-btn-txt-transform-none">
    {{ 'FRMELEMNTS_BTN_DELETE' | translate }}
  </ion-button>
  <ion-button fill="clear" ion-item (click)="presentModal()" class="custom-btn-txt-transform-none">
    {{ 'FRMELEMNTS_BTN_VIEW_DETAILS' | translate }}
  </ion-button>
</ion-list>

./submission-actions.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""