import { Component, OnInit } from '@angular/core';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { ModalController } from '@ionic/angular';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';

@Component({
  selector: 'app-more-action-modal',
  templateUrl: './more-action-modal.component.html',
  styleUrls: ['./more-action-modal.component.scss'],
})
export class MoreActionModalComponent implements OnInit {
  actionBtns :any =[];
  radioButtonValue: any;
  constructor( private ts: TranslatorService,private modalCtrl: ModalController, private cs: CommonService){}

  ngOnInit() {
    console.log("modal");
    this.actionBtns = this.cs.sharedService.getSharedData("passActionMore" , false);
    console.log("modal");

  }
  closeModal() {
    this.modalCtrl.dismiss();
  }

  radioSelect(v) {
    this.radioButtonValue = v;
    console.log("radio selected"+v);
  }

  OkBtnModal() {
    if (!this.radioButtonValue) {
      let msg: string = this.ts.trPK("replacementRoll", "msg");
      this.cs.presentAlert(msg);
      return;
    } else {
      let data = this.radioButtonValue;
      this.modalCtrl.dismiss(data);
    }
  }



}
