File

src/app/manage-learn/shared/components/slider-type-input/slider-type-input.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(utils: UtilsService)
Parameters :
Name Type Optional
utils UtilsService No

Inputs

data
Type : any
enableQuestionReadOut
Type : boolean
evidenceId
Type : string
generalQuestion
Type : boolean
hideButton
Type : boolean
imageLocalCopyId
Type : string
inputIndex
Type : any
isFirst
Type : boolean
isLast
Type : boolean
schoolId
Type : string
submissionId
Type : any

Outputs

nextCallBack
Type : EventEmitter
previousCallBack
Type : EventEmitter

Methods

checkForValidation
checkForValidation()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

color
Type : string
Default value : 'light'
isComplete
Type : boolean
import { Component, Input, EventEmitter, Output, OnInit } from '@angular/core';
import { UtilsService } from '@app/app/manage-learn/core';

@Component({
  selector: 'app-slider-type-input',
  templateUrl: './slider-type-input.component.html',
  styleUrls: ['./slider-type-input.component.scss'],
})
export class SliderTypeInputComponent implements OnInit {


  @Input() data: any;
  @Input() isLast: boolean;
  @Input() isFirst: boolean;
  @Output() nextCallBack = new EventEmitter();
  @Output() previousCallBack = new EventEmitter()
  @Input() evidenceId: string;
  @Input() hideButton: boolean;
  @Input() schoolId: string;
  @Input() imageLocalCopyId: string;
  @Input() generalQuestion: boolean;
  @Input() submissionId: any;
  @Input() inputIndex;
  @Input() enableQuestionReadOut: boolean;
  color: string = 'light';
  isComplete: boolean;

  constructor(private utils: UtilsService) {
  }

  ngOnInit() {
    this.data.startTime = this.data.startTime ? this.data.startTime : Date.now();
    this.data.value = this.data.value !== "" ? this.data.value : this.data.validation.min;
    if (!this.data.validation.required) {
      this.data.isCompleted = true;
    }
    this.checkForValidation();
  }

  checkForValidation(): void {
    this.data.isCompleted = this.utils.isQuestionComplete(this.data);
    this.data.endTime = this.data.isCompleted ? Date.now() : "";
  }


}
<ion-card class="_cardBg ion-padding">
  <ion-col class="_flex-box _justify-content-center _flex-direction-column">
    <h4 [ngClass]="{'_validQuestion': data?.value}" class="flexbox">
      <app-question-heading [inputIndex]="inputIndex" [data]="data" [enableQuestionReadOut]="enableQuestionReadOut">
      </app-question-heading>
    </h4>
  </ion-col>
  <div class="_tip _flex-box">{{data?.tip}}</div>
  <div class="_flex-box _justify-content-center _full-width ion-margin-top">
    <span class="valueBox _flex-box _justify-content-center">{{data?.value}}</span>
  </div>
  <div class="ion-margin-top">
    <ion-item>
      <ion-range [(ngModel)]="data.value" pin="true" step="1" (ngModelChange)="checkForValidation()" snaps="true"
        [min]="data?.validation.min" [max]="data?.validation.max"
        [disabled]="data.isEditable!=undefined && !data.isEditable">
        <ion-label range-left>{{data?.validation.min}}</ion-label>
        <ion-label range-right>{{data?.validation.max}}</ion-label>
      </ion-range>
    </ion-item>

    <app-remarks *ngIf="data?.showRemarks" [data]="data"></app-remarks>
    <app-image-upload [data]="data" [generalQuestion]="generalQuestion" [imageLocalCopyId]="imageLocalCopyId"
      [evidenceId]="evidenceId" [submissionId]="submissionId"></app-image-upload>
  </div>
</ion-card>

./slider-type-input.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""