File
Implements
Index
Properties
|
|
Methods
|
|
Inputs
|
|
Outputs
|
|
enableQuestionReadOut
|
Type : boolean
|
|
imageLocalCopyId
|
Type : string
|
|
Outputs
nextCallBack
|
Type : EventEmitter
|
|
previousCallBack
|
Type : EventEmitter
|
|
Methods
checkForValidation
|
checkForValidation()
|
|
|
color
|
Type : string
|
Default value : 'light'
|
|
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>
Legend
Html element with directive