File

src/app/components/popups/sb-generic-form-popover/sb-generic-form-popover.component.ts

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods
Inputs

Constructor

constructor(popoverCtrl: PopoverController, platform: Platform, events: Events)
Parameters :
Name Type Optional
popoverCtrl PopoverController No
platform Platform No
events Events No

Inputs

actionsButtons
Type : any
formItems
Type : any
icon
Type : any
metaInfo
Type : any
sbPopoverContent
Type : any
sbPopoverHeading
Type : any
sbPopoverMainTitle
Type : any
selectedContents
Type : any
showHeader
Type : boolean
Default value : true

Methods

closePopover
closePopover()
Returns : void
ngOnDestroy
ngOnDestroy()
Returns : void
ngOnInit
ngOnInit()
Returns : void
submit
submit(buttonIndex: number)
Parameters :
Name Type Optional Default value
buttonIndex number No 0
Returns : void

Properties

backButtonFunc
Type : Subscription
Public popoverCtrl
Type : PopoverController
selectedVal
Type : string
import { Component, Input, OnInit, OnDestroy } from '@angular/core';
import { Platform, PopoverController } from '@ionic/angular';
import { Events } from '@app/util/events';
import { Subscription } from 'rxjs';

@Component({
  selector: 'app-sb-generic-form-popover',
  templateUrl: './sb-generic-form-popover.component.html'
})
export class SbGenericFormPopoverComponent implements OnInit, OnDestroy {

  @Input() actionsButtons: any;
  @Input() icon: any;
  @Input() metaInfo: any;
  @Input() sbPopoverContent: any;
  @Input() sbPopoverHeading: any;
  @Input() sbPopoverMainTitle: any;
  @Input() selectedContents: any;
  @Input() showHeader = true;
  @Input() formItems: any;
  backButtonFunc: Subscription;
  selectedVal: string;

  constructor(
    public popoverCtrl: PopoverController,
    private platform: Platform,
    private events: Events) { }

  ngOnInit() {
    this.backButtonFunc = this.platform.backButton.subscribeWithPriority(11, () => {
      this.popoverCtrl.dismiss({ isLeftButtonClicked: null });
      this.backButtonFunc.unsubscribe();
    });
  }

  ngOnDestroy(): void {
    this.backButtonFunc.unsubscribe();
  }

  closePopover() {
    this.popoverCtrl.dismiss({ isLeftButtonClicked: null });
  }

  submit(buttonIndex: number = 0) {
    if (this.selectedVal) {
      this.popoverCtrl.dismiss(
        {
          isLeftButtonClicked: !Boolean(buttonIndex),
          selectedVal: this.formItems[parseInt(this.selectedVal, 10)]
        }
      );
    }
  }

}
<ion-header class="sb-popover-header" *ngIf="showHeader">
  <ion-toolbar class="sb-popover-toolbar">
    <ion-title class="sb-popover-title">{{sbPopoverHeading}}
      <ion-icon name="close" class="sb-modal-close" (click)="closePopover()"></ion-icon>
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content class="sb-popover-container ion-no-padding">
  <ion-list lines="none" class="content-share">
    <ion-radio-group [(ngModel)]="selectedVal">

      <ion-item *ngFor="let item of formItems;">
        <ion-label>{{item.title | translate }}</ion-label>
        <ion-radio slot="start" value="{{item.index}}" [disabled]="!item.isEnabled">
        </ion-radio>
      </ion-item>

    </ion-radio-group>
  </ion-list>
</ion-content>

<ion-footer>
  <div class="sb-popover-footer">
    <button class="sb-popover-action-btn " [ngClass]="btn.btnClass"
      *ngFor="let btn of actionsButtons,let btn_index=index" (click)="submit(btn_index)">
      {{btn.btntext }}</button>
  </div>
</ion-footer>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""