survery-lib 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/question-cascade-template/question-cascade-template.component.mjs +107 -0
- package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +15 -13
- package/esm2022/lib/services/api.service.mjs +28 -0
- package/esm2022/lib/services/lib-config.service.mjs +3 -0
- package/esm2022/lib/services/survey-lib.service.mjs +29 -1
- package/esm2022/lib/survery-lib.component.mjs +94 -73
- package/esm2022/lib/survery-lib.module.mjs +12 -5
- package/esm2022/shared/dtos/base/dto.base.mjs +2 -0
- package/esm2022/shared/dtos/base/error.dto.mjs +2 -0
- package/esm2022/shared/enums/question-type.enum.mjs +2 -1
- package/esm2022/shared/form-interfaces/question-cascade.form-interface.mjs +2 -0
- package/esm2022/shared/form-interfaces/question-dropdown-template.form-interface.mjs +1 -1
- package/esm2022/shared/results/api.result.mjs +2 -0
- package/fesm2022/survery-lib.mjs +269 -89
- package/fesm2022/survery-lib.mjs.map +1 -1
- package/lib/components/question-cascade-template/question-cascade-template.component.d.ts +33 -0
- package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +3 -3
- package/lib/services/api.service.d.ts +19 -0
- package/lib/services/lib-config.service.d.ts +5 -0
- package/lib/services/survey-lib.service.d.ts +24 -0
- package/lib/survery-lib.component.d.ts +4 -2
- package/lib/survery-lib.module.d.ts +9 -7
- package/package.json +1 -1
- package/shared/dtos/base/dto.base.d.ts +5 -0
- package/shared/dtos/base/error.dto.d.ts +6 -0
- package/shared/enums/question-type.enum.d.ts +2 -1
- package/shared/form-interfaces/question-cascade.form-interface.d.ts +9 -0
- package/shared/form-interfaces/question-dropdown-template.form-interface.d.ts +2 -0
- package/shared/results/api.result.d.ts +4 -0
package/fesm2022/survery-lib.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Pipe, EventEmitter, Component, Output, Input, NgModule } from '@angular/core';
|
|
2
|
+
import { Injectable, Pipe, EventEmitter, Component, Output, Input, InjectionToken, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import { v4 } from 'uuid';
|
|
4
4
|
import { Subject, of, debounceTime, map, filter, distinctUntilChanged } from 'rxjs';
|
|
5
5
|
import * as i1 from '@ng-stack/forms';
|
|
@@ -10,7 +10,8 @@ import * as i4 from '@angular/forms';
|
|
|
10
10
|
import { Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
11
11
|
import * as i5 from '@ng-select/ng-select';
|
|
12
12
|
import { NgSelectModule } from '@ng-select/ng-select';
|
|
13
|
-
import
|
|
13
|
+
import * as i1$1 from '@angular/common/http';
|
|
14
|
+
import { HttpHeaders, HttpClientModule } from '@angular/common/http';
|
|
14
15
|
|
|
15
16
|
var QuestionTypeEnum;
|
|
16
17
|
(function (QuestionTypeEnum) {
|
|
@@ -21,6 +22,7 @@ var QuestionTypeEnum;
|
|
|
21
22
|
QuestionTypeEnum[QuestionTypeEnum["TextInput"] = 5] = "TextInput";
|
|
22
23
|
QuestionTypeEnum[QuestionTypeEnum["Matrix"] = 6] = "Matrix";
|
|
23
24
|
QuestionTypeEnum[QuestionTypeEnum["DropDownMulti"] = 7] = "DropDownMulti";
|
|
25
|
+
QuestionTypeEnum[QuestionTypeEnum["Cascade"] = 8] = "Cascade";
|
|
24
26
|
})(QuestionTypeEnum || (QuestionTypeEnum = {}));
|
|
25
27
|
|
|
26
28
|
var LogicActionEnum;
|
|
@@ -42,10 +44,26 @@ class SurveyLibService {
|
|
|
42
44
|
get reloadSurveyObsrv() {
|
|
43
45
|
return this.reloadSurveySubject.asObservable();
|
|
44
46
|
}
|
|
47
|
+
get questionIsShowObsrv() {
|
|
48
|
+
return this.questionIsShowSubject.asObservable();
|
|
49
|
+
}
|
|
50
|
+
get questionIsDisabledObsrv() {
|
|
51
|
+
return this.questionIsDisabledSubject.asObservable();
|
|
52
|
+
}
|
|
53
|
+
get addQuestionObsrv() {
|
|
54
|
+
return this.addQuestionSubject.asObservable();
|
|
55
|
+
}
|
|
56
|
+
get removeQuestionObsrv() {
|
|
57
|
+
return this.removeQuestionSubject.asObservable();
|
|
58
|
+
}
|
|
45
59
|
constructor() {
|
|
46
60
|
this.surveyDataSubject = new Subject();
|
|
47
61
|
this.surveyAnswersSubject = new Subject();
|
|
48
62
|
this.reloadSurveySubject = new Subject();
|
|
63
|
+
this.questionIsShowSubject = new Subject();
|
|
64
|
+
this.questionIsDisabledSubject = new Subject();
|
|
65
|
+
this.addQuestionSubject = new Subject();
|
|
66
|
+
this.removeQuestionSubject = new Subject();
|
|
49
67
|
}
|
|
50
68
|
setSurveyData(survey) {
|
|
51
69
|
this.surveyDataSubject.next(survey);
|
|
@@ -53,9 +71,21 @@ class SurveyLibService {
|
|
|
53
71
|
setsurveyAnswers(model) {
|
|
54
72
|
this.surveyAnswersSubject.next(model);
|
|
55
73
|
}
|
|
74
|
+
setQuestionIsShow(questionId, isShow) {
|
|
75
|
+
this.questionIsShowSubject.next({ questionId, isShow });
|
|
76
|
+
}
|
|
77
|
+
setQuestionIsDisabled(questionId, isDisabled) {
|
|
78
|
+
this.questionIsDisabledSubject.next({ questionId, isDisabled });
|
|
79
|
+
}
|
|
56
80
|
setReloadSurvey() {
|
|
57
81
|
this.reloadSurveySubject.next(v4());
|
|
58
82
|
}
|
|
83
|
+
setAddQuestion(question, pageIndex) {
|
|
84
|
+
this.addQuestionSubject.next({ question, pageIndex });
|
|
85
|
+
}
|
|
86
|
+
setRemoveQuestion(questionId) {
|
|
87
|
+
this.removeQuestionSubject.next({ questionId });
|
|
88
|
+
}
|
|
59
89
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
60
90
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyLibService, providedIn: 'root' }); }
|
|
61
91
|
}
|
|
@@ -588,28 +618,28 @@ class QuestionDropdownTemplateComponent {
|
|
|
588
618
|
name: value.questionName,
|
|
589
619
|
title: value.questionTitle,
|
|
590
620
|
typeId: value.questionTypeId,
|
|
591
|
-
description: value.questionDescription
|
|
621
|
+
description: value.questionDescription,
|
|
622
|
+
isDisabled: value.isReadOnly,
|
|
623
|
+
isShow: value.isVisable
|
|
592
624
|
});
|
|
593
625
|
if (value.isRequired == true) {
|
|
594
626
|
this.fCtrls.answer.addValidators([Validators.required]);
|
|
595
627
|
this.fCtrls.answer.updateValueAndValidity();
|
|
596
628
|
}
|
|
597
|
-
this.isShow = value.isVisable;
|
|
598
|
-
this.isDisabled = value.isReadOnly;
|
|
599
629
|
}
|
|
600
630
|
constructor(_formBuilder, _surveyLibService) {
|
|
601
631
|
this._formBuilder = _formBuilder;
|
|
602
632
|
this._surveyLibService = _surveyLibService;
|
|
603
633
|
this.emitter = new EventEmitter();
|
|
604
|
-
this.isShow = true;
|
|
605
|
-
this.isDisabled = false;
|
|
606
634
|
this.rForm = this._formBuilder.group({
|
|
607
635
|
id: [null],
|
|
608
636
|
name: [null],
|
|
609
637
|
title: [null],
|
|
610
638
|
typeId: [null],
|
|
611
639
|
description: [null],
|
|
612
|
-
answer: [null]
|
|
640
|
+
answer: [null],
|
|
641
|
+
isDisabled: [false],
|
|
642
|
+
isShow: [true]
|
|
613
643
|
});
|
|
614
644
|
}
|
|
615
645
|
ngOnInit() {
|
|
@@ -628,22 +658,24 @@ class QuestionDropdownTemplateComponent {
|
|
|
628
658
|
.subscribe(answer => {
|
|
629
659
|
this.fCtrls.answer.setValue(answer.AnswerId);
|
|
630
660
|
});
|
|
661
|
+
this._surveyLibService.questionIsDisabledObsrv.pipe(filter(x => x.questionId == this.fCtrls.id.value)).subscribe(x => {
|
|
662
|
+
this.fCtrls.isDisabled.setValue(x.isDisabled);
|
|
663
|
+
});
|
|
664
|
+
this._surveyLibService.questionIsShowObsrv.pipe(filter(x => x.questionId == this.fCtrls.id.value)).subscribe(x => {
|
|
665
|
+
this.fCtrls.isShow.setValue(x.isShow);
|
|
666
|
+
});
|
|
631
667
|
}
|
|
632
668
|
convertToFormControl(element) {
|
|
633
669
|
return element;
|
|
634
670
|
}
|
|
635
671
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
636
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: {
|
|
672
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: { setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':fCtrls.isShow.value != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\n </h3>\n <div class=\"text-quastion text-quastion__dropdown\">\n <ng-select [items]=\"surveyQuestion?.surveyAnswers\" bindValue=\"answerId\" bindLabel=\"answerTitle\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"fCtrls.isDisabled.value\" [multiple]=\"false\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i5.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }] }); }
|
|
637
673
|
}
|
|
638
674
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionDropdownTemplateComponent, decorators: [{
|
|
639
675
|
type: Component,
|
|
640
|
-
args: [{ selector: 'lib-question-dropdown-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':isShow != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\n </h3>\n <div class=\"text-quastion text-quastion__dropdown\">\n <ng-select [items]=\"surveyQuestion?.surveyAnswers\" bindValue=\"answerId\" bindLabel=\"answerTitle\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"isDisabled\" [multiple]=\"false\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"] }]
|
|
676
|
+
args: [{ selector: 'lib-question-dropdown-template', template: "<div class=\"quastion\" [attr.id]=\"'question_'+fCtrls.id.value\" [ngClass]=\"{'invalid-question': fCtrls.answer.invalid , 'd-none':fCtrls.isShow.value != true}\">\n <h3 class=\"quastion-title \">\n {{fCtrls.title.value}}\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\n </h3>\n <div class=\"text-quastion text-quastion__dropdown\">\n <ng-select [items]=\"surveyQuestion?.surveyAnswers\" bindValue=\"answerId\" bindLabel=\"answerTitle\" class=\"form-control\"\n [formControl]=\"convertToFormControl(fCtrls.answer)\" [disabled]=\"fCtrls.isDisabled.value\" [multiple]=\"false\">\n </ng-select>\n </div>\n</div>\n", styles: [".text-quastion .form-control{padding:10px}\n"] }]
|
|
641
677
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }]; }, propDecorators: { emitter: [{
|
|
642
678
|
type: Output
|
|
643
|
-
}], isShow: [{
|
|
644
|
-
type: Input
|
|
645
|
-
}], isDisabled: [{
|
|
646
|
-
type: Input
|
|
647
679
|
}], setQuestion: [{
|
|
648
680
|
type: Input
|
|
649
681
|
}] } });
|
|
@@ -913,6 +945,129 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
913
945
|
type: Input
|
|
914
946
|
}] } });
|
|
915
947
|
|
|
948
|
+
const LibConfigService = new InjectionToken('LibConfig');
|
|
949
|
+
|
|
950
|
+
class ApiService {
|
|
951
|
+
constructor(_HttpClient, _LibConfigService) {
|
|
952
|
+
this._HttpClient = _HttpClient;
|
|
953
|
+
this._LibConfigService = _LibConfigService;
|
|
954
|
+
this.url = _LibConfigService.apiUrl;
|
|
955
|
+
}
|
|
956
|
+
getNextQuestion(filter) {
|
|
957
|
+
var queryString = $.param(filter);
|
|
958
|
+
return this._HttpClient.get(`${this.url}/GetNextQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
959
|
+
}
|
|
960
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: ApiService, deps: [{ token: i1$1.HttpClient }, { token: LibConfigService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
961
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: ApiService, providedIn: 'root' }); }
|
|
962
|
+
}
|
|
963
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: ApiService, decorators: [{
|
|
964
|
+
type: Injectable,
|
|
965
|
+
args: [{
|
|
966
|
+
providedIn: 'root'
|
|
967
|
+
}]
|
|
968
|
+
}], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: undefined, decorators: [{
|
|
969
|
+
type: Inject,
|
|
970
|
+
args: [LibConfigService]
|
|
971
|
+
}] }]; } });
|
|
972
|
+
|
|
973
|
+
class QuestionCascadeTemplateComponent {
|
|
974
|
+
get fCtrls() {
|
|
975
|
+
return this.rForm.controls;
|
|
976
|
+
}
|
|
977
|
+
get questionTypeEnum() {
|
|
978
|
+
return QuestionTypeEnum;
|
|
979
|
+
}
|
|
980
|
+
get questionFormArray() {
|
|
981
|
+
return this.fCtrls.questionArr;
|
|
982
|
+
}
|
|
983
|
+
set setQuestion(value) {
|
|
984
|
+
this.setQuestions(value);
|
|
985
|
+
}
|
|
986
|
+
constructor(_formBuilder, _surveyLibService, _ApiService) {
|
|
987
|
+
this._formBuilder = _formBuilder;
|
|
988
|
+
this._surveyLibService = _surveyLibService;
|
|
989
|
+
this._ApiService = _ApiService;
|
|
990
|
+
this.surveyQuestionArr = [];
|
|
991
|
+
this.emitter = new EventEmitter();
|
|
992
|
+
this.pageIndex = null;
|
|
993
|
+
this.isPre = false;
|
|
994
|
+
this.surveyLanguageId = null;
|
|
995
|
+
this.applicantKey = null;
|
|
996
|
+
this.rForm = this._formBuilder.group({
|
|
997
|
+
questionArr: this._formBuilder.array([])
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
ngOnInit() {
|
|
1001
|
+
this.fCtrls.questionArr.statusChanges.subscribe(v => {
|
|
1002
|
+
console.log(v);
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
onUpdateAnswer(model) {
|
|
1006
|
+
if (model.Answer) {
|
|
1007
|
+
this._ApiService.getNextQuestion({
|
|
1008
|
+
answerId: model.Answer,
|
|
1009
|
+
applicantKey: this.applicantKey,
|
|
1010
|
+
isPre: this.isPre,
|
|
1011
|
+
surveyLanguageId: this.surveyLanguageId
|
|
1012
|
+
}).subscribe(res => {
|
|
1013
|
+
if (res.errors.filter(x => x.code == 17).length == 0) {
|
|
1014
|
+
this.setQuestions(res);
|
|
1015
|
+
this._surveyLibService.setAddQuestion(res, this.pageIndex);
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
else {
|
|
1020
|
+
if (this.surveyQuestionArr.length > 1) {
|
|
1021
|
+
const surveyQuestionIndex = this.surveyQuestionArr.findIndex(c => c.questionId == model.QuestionId);
|
|
1022
|
+
var deletedQuestions = [];
|
|
1023
|
+
for (let index = surveyQuestionIndex + 1; index < this.surveyQuestionArr.length; index++) {
|
|
1024
|
+
deletedQuestions.push(index);
|
|
1025
|
+
}
|
|
1026
|
+
var sortDeletedArr = deletedQuestions.sort((a, b) => (a > b ? -1 : 1));
|
|
1027
|
+
for (let index = 0; index < sortDeletedArr.length; index++) {
|
|
1028
|
+
const elementIndex = sortDeletedArr[index];
|
|
1029
|
+
const questionId = this.surveyQuestionArr[elementIndex].questionId;
|
|
1030
|
+
this._surveyLibService.setRemoveQuestion(questionId);
|
|
1031
|
+
this.surveyQuestionArr.slice(elementIndex, 1);
|
|
1032
|
+
this.questionFormArray.removeAt(elementIndex);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
this.emitter.emit(model);
|
|
1037
|
+
}
|
|
1038
|
+
setQuestions(value) {
|
|
1039
|
+
this.surveyQuestionArr.push(value);
|
|
1040
|
+
var group = this._formBuilder.group({
|
|
1041
|
+
id: [value.questionId],
|
|
1042
|
+
typeId: [value.questionTypeId],
|
|
1043
|
+
answer: null
|
|
1044
|
+
});
|
|
1045
|
+
if (value.isRequired == true) {
|
|
1046
|
+
group.controls.answer.addValidators([Validators.required]);
|
|
1047
|
+
group.controls.answer.updateValueAndValidity();
|
|
1048
|
+
}
|
|
1049
|
+
this.fCtrls.questionArr.push(group);
|
|
1050
|
+
}
|
|
1051
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCascadeTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }, { token: ApiService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1052
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: { pageIndex: "pageIndex", isPre: "isPre", surveyLanguageId: "surveyLanguageId", applicantKey: "applicantKey", setQuestion: "setQuestion" }, outputs: { emitter: "emitter" }, ngImport: i0, template: "<ng-container *ngFor=\"let item of questionFormArray.value ; let i = index\">\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"surveyQuestionArr[i]\"\n (emitter)=\"onUpdateAnswer($event)\" >\n </lib-question-dropdown-template>\n</ng-container>", styles: [""], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }] }); }
|
|
1053
|
+
}
|
|
1054
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCascadeTemplateComponent, decorators: [{
|
|
1055
|
+
type: Component,
|
|
1056
|
+
args: [{ selector: 'lib-question-cascade-template', template: "<ng-container *ngFor=\"let item of questionFormArray.value ; let i = index\">\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"surveyQuestionArr[i]\"\n (emitter)=\"onUpdateAnswer($event)\" >\n </lib-question-dropdown-template>\n</ng-container>" }]
|
|
1057
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }, { type: ApiService }]; }, propDecorators: { emitter: [{
|
|
1058
|
+
type: Output
|
|
1059
|
+
}], pageIndex: [{
|
|
1060
|
+
type: Input
|
|
1061
|
+
}], isPre: [{
|
|
1062
|
+
type: Input
|
|
1063
|
+
}], surveyLanguageId: [{
|
|
1064
|
+
type: Input
|
|
1065
|
+
}], applicantKey: [{
|
|
1066
|
+
type: Input
|
|
1067
|
+
}], setQuestion: [{
|
|
1068
|
+
type: Input
|
|
1069
|
+
}] } });
|
|
1070
|
+
|
|
916
1071
|
class FilterQuestionPipe {
|
|
917
1072
|
transform(value, questionArr) {
|
|
918
1073
|
return questionArr.find(x => x.questionId == value.questionId);
|
|
@@ -979,7 +1134,8 @@ class SurveryLibComponent {
|
|
|
979
1134
|
this.surveryLibraryDivId = v4();
|
|
980
1135
|
this.reloadDefaultAnswerId = v4();
|
|
981
1136
|
this.isPre = false;
|
|
982
|
-
this.
|
|
1137
|
+
this.surveyLanguageId = null;
|
|
1138
|
+
this.applicantKey = null;
|
|
983
1139
|
this.surveyResultEmit = new EventEmitter();
|
|
984
1140
|
this.selectLanguageEmit = new EventEmitter();
|
|
985
1141
|
this.rForm = this._formBuilder.group({
|
|
@@ -995,11 +1151,19 @@ class SurveryLibComponent {
|
|
|
995
1151
|
this.fCtrls.questionArray.clear();
|
|
996
1152
|
this.fCtrls.ruleQuestionArray.clear();
|
|
997
1153
|
this.surveyData = null;
|
|
1154
|
+
console.log(survey);
|
|
998
1155
|
if (survey != null) {
|
|
999
1156
|
this.surveyData = survey;
|
|
1000
1157
|
this.loadQuestions(survey);
|
|
1001
1158
|
}
|
|
1002
1159
|
});
|
|
1160
|
+
this._surveyLibService.addQuestionObsrv.subscribe(res => {
|
|
1161
|
+
this.addQuestionGroup(res.question, res.pageIndex);
|
|
1162
|
+
});
|
|
1163
|
+
this._surveyLibService.removeQuestionObsrv.subscribe(res => {
|
|
1164
|
+
const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == res.questionId);
|
|
1165
|
+
this.fCtrls.questionArray.removeAt(index);
|
|
1166
|
+
});
|
|
1003
1167
|
}
|
|
1004
1168
|
onPaggingNext() {
|
|
1005
1169
|
var isHaveInvalidRecords = this.haveInValidateQuestions();
|
|
@@ -1039,79 +1203,31 @@ class SurveryLibComponent {
|
|
|
1039
1203
|
}
|
|
1040
1204
|
onUpdateAnswer(model) {
|
|
1041
1205
|
const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == model.QuestionId);
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
questionGroup.
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
questionGroup.
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
this.
|
|
1206
|
+
if (index > -1) {
|
|
1207
|
+
var questionGroup = this.fCtrls.questionArray.controls[index];
|
|
1208
|
+
questionGroup.controls.isValid.setValue(model.IsValid);
|
|
1209
|
+
if (questionGroup.value.questionType == this.questionTypeEnum.TextInput) {
|
|
1210
|
+
questionGroup.patchValue({
|
|
1211
|
+
answerId: model.SurveyAnswerId,
|
|
1212
|
+
answerText: model.Answer
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
else if (questionGroup.value.questionType == this.questionTypeEnum.CheckBox || questionGroup.value.questionType == this.questionTypeEnum.DropDownMulti) {
|
|
1216
|
+
questionGroup.controls.answerIdArr.setValue(model.Answer);
|
|
1217
|
+
}
|
|
1218
|
+
else {
|
|
1219
|
+
questionGroup.controls.answerId.setValue(model.Answer);
|
|
1220
|
+
}
|
|
1221
|
+
if (this.fCtrls.ruleQuestionArray.value.findIndex(x => x.questionId == model.QuestionId) > -1) {
|
|
1222
|
+
this.checkRules();
|
|
1223
|
+
}
|
|
1058
1224
|
}
|
|
1059
1225
|
}
|
|
1060
1226
|
loadQuestions(survey) {
|
|
1061
1227
|
survey.surveyPages.forEach((page, pageIndex) => {
|
|
1062
1228
|
page.surveyQuestionGroups.forEach(group => {
|
|
1063
1229
|
group.surveyQuestions.forEach(question => {
|
|
1064
|
-
|
|
1065
|
-
this.fCtrls.questionArray.push(this._formBuilder.group({
|
|
1066
|
-
surveyPageIndex: pageIndex,
|
|
1067
|
-
questionId: [question.questionId],
|
|
1068
|
-
questionType: [question.questionTypeId],
|
|
1069
|
-
isMatrixGroup: [false],
|
|
1070
|
-
answerId: [null],
|
|
1071
|
-
answerIdArr: [null],
|
|
1072
|
-
answerText: [null],
|
|
1073
|
-
isRequired: [question.isRequired],
|
|
1074
|
-
isValid: [null],
|
|
1075
|
-
isDisabled: [question.isReadOnly],
|
|
1076
|
-
isShow: [question.isVisable],
|
|
1077
|
-
isDisabled_default: [question.isReadOnly],
|
|
1078
|
-
isShow_default: [question.isVisable]
|
|
1079
|
-
}));
|
|
1080
|
-
}
|
|
1081
|
-
else {
|
|
1082
|
-
this.fCtrls.questionArray.push(this._formBuilder.group({
|
|
1083
|
-
surveyPageIndex: pageIndex,
|
|
1084
|
-
questionId: [question.questionId],
|
|
1085
|
-
questionType: [question.questionTypeId],
|
|
1086
|
-
isMatrixGroup: [true],
|
|
1087
|
-
answerId: [null],
|
|
1088
|
-
answerIdArr: [null],
|
|
1089
|
-
answerText: [null],
|
|
1090
|
-
isRequired: [question.isRequired],
|
|
1091
|
-
isValid: [null],
|
|
1092
|
-
isDisabled: [question.isReadOnly],
|
|
1093
|
-
isShow: [question.isVisable],
|
|
1094
|
-
isDisabled_default: [question.isReadOnly],
|
|
1095
|
-
isShow_default: [question.isVisable],
|
|
1096
|
-
}));
|
|
1097
|
-
question.surveySubQuestions.forEach(subQuestion => {
|
|
1098
|
-
this.fCtrls.questionArray.push(this._formBuilder.group({
|
|
1099
|
-
surveyPageIndex: pageIndex,
|
|
1100
|
-
questionId: [subQuestion.questionId],
|
|
1101
|
-
questionType: [subQuestion.questionTypeId],
|
|
1102
|
-
isMatrixGroup: [false],
|
|
1103
|
-
answerId: [null],
|
|
1104
|
-
answerIdArr: [null],
|
|
1105
|
-
answerText: [null],
|
|
1106
|
-
isRequired: [question.isRequired],
|
|
1107
|
-
isValid: [null],
|
|
1108
|
-
isDisabled: [subQuestion.isReadOnly],
|
|
1109
|
-
isShow: [subQuestion.isVisable],
|
|
1110
|
-
isDisabled_default: [subQuestion.isReadOnly],
|
|
1111
|
-
isShow_default: [subQuestion.isVisable]
|
|
1112
|
-
}));
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1230
|
+
this.addQuestionGroup(question, pageIndex);
|
|
1115
1231
|
});
|
|
1116
1232
|
});
|
|
1117
1233
|
});
|
|
@@ -1149,15 +1265,19 @@ class SurveryLibComponent {
|
|
|
1149
1265
|
var questionGroup = this.fCtrls.questionArray.at(index);
|
|
1150
1266
|
if (rule.logicActionId == LogicActionEnum.Show) {
|
|
1151
1267
|
questionGroup.controls.isShow.setValue(true);
|
|
1268
|
+
this._surveyLibService.setQuestionIsShow(questionGroup.value.questionId, true);
|
|
1152
1269
|
}
|
|
1153
1270
|
else if (rule.logicActionId == LogicActionEnum.Hide) {
|
|
1154
1271
|
questionGroup.controls.isShow.setValue(false);
|
|
1272
|
+
this._surveyLibService.setQuestionIsShow(questionGroup.value.questionId, false);
|
|
1155
1273
|
}
|
|
1156
1274
|
else if (rule.logicActionId == LogicActionEnum.Enable) {
|
|
1157
1275
|
questionGroup.controls.isDisabled.setValue(false);
|
|
1276
|
+
this._surveyLibService.setQuestionIsDisabled(questionGroup.value.questionId, false);
|
|
1158
1277
|
}
|
|
1159
1278
|
else if (rule.logicActionId == LogicActionEnum.Disable) {
|
|
1160
1279
|
questionGroup.controls.isDisabled.setValue(true);
|
|
1280
|
+
this._surveyLibService.setQuestionIsDisabled(questionGroup.value.questionId, true);
|
|
1161
1281
|
}
|
|
1162
1282
|
else if (rule.logicActionId == LogicActionEnum.SetAnswer) {
|
|
1163
1283
|
}
|
|
@@ -1194,15 +1314,70 @@ class SurveryLibComponent {
|
|
|
1194
1314
|
}
|
|
1195
1315
|
return null;
|
|
1196
1316
|
}
|
|
1317
|
+
addQuestionGroup(question, pageIndex) {
|
|
1318
|
+
if (question.questionTypeId != 6) {
|
|
1319
|
+
this.fCtrls.questionArray.push(this._formBuilder.group({
|
|
1320
|
+
surveyPageIndex: pageIndex,
|
|
1321
|
+
questionId: [question.questionId],
|
|
1322
|
+
questionType: [question.questionTypeId],
|
|
1323
|
+
isMatrixGroup: [false],
|
|
1324
|
+
answerId: [null],
|
|
1325
|
+
answerIdArr: [null],
|
|
1326
|
+
answerText: [null],
|
|
1327
|
+
isRequired: [question.isRequired],
|
|
1328
|
+
isValid: [null],
|
|
1329
|
+
isDisabled: [question.isReadOnly],
|
|
1330
|
+
isShow: [question.isVisable],
|
|
1331
|
+
isDisabled_default: [question.isReadOnly],
|
|
1332
|
+
isShow_default: [question.isVisable]
|
|
1333
|
+
}));
|
|
1334
|
+
}
|
|
1335
|
+
else {
|
|
1336
|
+
this.fCtrls.questionArray.push(this._formBuilder.group({
|
|
1337
|
+
surveyPageIndex: pageIndex,
|
|
1338
|
+
questionId: [question.questionId],
|
|
1339
|
+
questionType: [question.questionTypeId],
|
|
1340
|
+
isMatrixGroup: [true],
|
|
1341
|
+
answerId: [null],
|
|
1342
|
+
answerIdArr: [null],
|
|
1343
|
+
answerText: [null],
|
|
1344
|
+
isRequired: [question.isRequired],
|
|
1345
|
+
isValid: [null],
|
|
1346
|
+
isDisabled: [question.isReadOnly],
|
|
1347
|
+
isShow: [question.isVisable],
|
|
1348
|
+
isDisabled_default: [question.isReadOnly],
|
|
1349
|
+
isShow_default: [question.isVisable],
|
|
1350
|
+
}));
|
|
1351
|
+
question.surveySubQuestions.forEach(subQuestion => {
|
|
1352
|
+
this.fCtrls.questionArray.push(this._formBuilder.group({
|
|
1353
|
+
surveyPageIndex: pageIndex,
|
|
1354
|
+
questionId: [subQuestion.questionId],
|
|
1355
|
+
questionType: [subQuestion.questionTypeId],
|
|
1356
|
+
isMatrixGroup: [false],
|
|
1357
|
+
answerId: [null],
|
|
1358
|
+
answerIdArr: [null],
|
|
1359
|
+
answerText: [null],
|
|
1360
|
+
isRequired: [question.isRequired],
|
|
1361
|
+
isValid: [null],
|
|
1362
|
+
isDisabled: [subQuestion.isReadOnly],
|
|
1363
|
+
isShow: [subQuestion.isVisable],
|
|
1364
|
+
isDisabled_default: [subQuestion.isReadOnly],
|
|
1365
|
+
isShow_default: [subQuestion.isVisable]
|
|
1366
|
+
}));
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1197
1370
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, deps: [{ token: SurveyLibService }, { token: i1.FormBuilder }, { token: CheckRuleExpsUsecase }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1198
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", inputs: { isPre: "isPre",
|
|
1371
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", inputs: { isPre: "isPre", surveyLanguageId: "surveyLanguageId", applicantKey: "applicantKey" }, outputs: { surveyResultEmit: "surveyResultEmit", selectLanguageEmit: "selectLanguageEmit" }, ngImport: i0, template: "<div id=\"survery-card-{{surveryLibraryDivId}}\" class=\"survay-card\" >\r\n <div class=\"alert alert-warning text-center\" role=\"alert\" *ngIf=\"isPre == true && surveyData != null\">\r\n <h4 class=\"alert-heading mb-0\">This survey in review phase </h4>\r\n </div>\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\"\r\n [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"\r\n [isTextArea]=\"question.isAdvanceTextArea\"></lib-question-text-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n\r\n <lib-question-dropdown-multi-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDownMulti\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-matrix-template>\r\n\r\n <lib-question-cascade-template #questionCascadeTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.Cascade\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\" \r\n [pageIndex]=\"surveyPageIndex\"></lib-question-cascade-template>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"survay-card-footr\" *ngIf=\"surveyData != null\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\">\r\n <span>{{curruntShowedSurveyPages}}</span>\r\n <span class=\"ms-2 me-2\">of</span>\r\n <span>{{showedSurveyPages?.length}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}.quastion{padding:10px}.quastion .quastion-title{color:var(--dark-100, #363636);text-align:right;font-family:Almarai;font-size:18px;font-style:normal;font-weight:700;line-height:20.6px}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: ["isShow", "isTextArea", "setQuestion", "isDisabled"], outputs: ["emitter"] }, { kind: "component", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionDropdownMultiTemplateComponent, selector: "lib-question-dropdown-multi-template", inputs: ["isShow", "isDisabled", "setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: ["pageIndex", "isPre", "surveyLanguageId", "applicantKey", "setQuestion"], outputs: ["emitter"] }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
|
|
1199
1372
|
}
|
|
1200
1373
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
|
|
1201
1374
|
type: Component,
|
|
1202
|
-
args: [{ selector: 'lib-survery-lib', template: "<div id=\"survery-card-{{surveryLibraryDivId}}\" class=\"survay-card\" >\r\n <div class=\"alert alert-warning text-center\" role=\"alert\" *ngIf=\"isPre == true && surveyData != null\">\r\n <h4 class=\"alert-heading mb-0\">This survey in review phase </h4>\r\n </div>\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\"\r\n [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"\r\n [isTextArea]=\"question.isAdvanceTextArea\"></lib-question-text-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"
|
|
1375
|
+
args: [{ selector: 'lib-survery-lib', template: "<div id=\"survery-card-{{surveryLibraryDivId}}\" class=\"survay-card\" >\r\n <div class=\"alert alert-warning text-center\" role=\"alert\" *ngIf=\"isPre == true && surveyData != null\">\r\n <h4 class=\"alert-heading mb-0\">This survey in review phase </h4>\r\n </div>\r\n <div *ngFor=\"let surveyPage of surveyData?.surveyPages; let surveyPageIndex = index\"\r\n [attr.id]=\"'survey-page_'+surveyPageIndex\"\r\n [ngClass]=\"{'d-none': surveyPageIndex != fCtrls.currentPageIndex.value}\">\r\n <ng-container *ngFor=\"let item of surveyPage.surveyQuestionGroups\">\r\n <div class=\"survay-card\">\r\n <div class=\"survay-card-body\">\r\n <div class=\"survay-group\">\r\n <div class=\"title\">\r\n <h2 class=\"group-title\">\r\n {{item.questionGroupName}}\r\n </h2>\r\n <span class=\"group-sub-title \">\r\n {{item.questionGroupDescription}}\r\n </span>\r\n </div>\r\n <ng-container *ngFor=\"let question of item.surveyQuestions\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.Boolean\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.TextInput\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"\r\n [isTextArea]=\"question.isAdvanceTextArea\"></lib-question-text-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.RadioButton\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n\r\n <lib-question-dropdown-multi-template [setQuestion]=\"question\" (emitter)=\"onUpdateAnswer($event)\"\r\n *ngIf=\"question.questionTypeId == questionTypeEnum.DropDownMulti\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.CheckBox\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.Matrix\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></lib-question-matrix-template>\r\n\r\n <lib-question-cascade-template #questionCascadeTemplate [setQuestion]=\"question\"\r\n (emitter)=\"onUpdateAnswer($event)\" *ngIf=\"question.questionTypeId == questionTypeEnum.Cascade\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\" \r\n [pageIndex]=\"surveyPageIndex\"></lib-question-cascade-template>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n <div class=\"survay-card-footr\" *ngIf=\"surveyData != null\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\">\r\n <span>{{curruntShowedSurveyPages}}</span>\r\n <span class=\"ms-2 me-2\">of</span>\r\n <span>{{showedSurveyPages?.length}}</span>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [".disable__btn{background-color:gray!important;cursor:not-allowed}.quastion{padding:10px}.quastion .quastion-title{color:var(--dark-100, #363636);text-align:right;font-family:Almarai;font-size:18px;font-style:normal;font-weight:700;line-height:20.6px}\n"] }]
|
|
1203
1376
|
}], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { isPre: [{
|
|
1204
1377
|
type: Input
|
|
1205
|
-
}],
|
|
1378
|
+
}], surveyLanguageId: [{
|
|
1379
|
+
type: Input
|
|
1380
|
+
}], applicantKey: [{
|
|
1206
1381
|
type: Input
|
|
1207
1382
|
}], surveyResultEmit: [{
|
|
1208
1383
|
type: Output
|
|
@@ -1245,9 +1420,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
1245
1420
|
}] });
|
|
1246
1421
|
|
|
1247
1422
|
class SurveryLibModule {
|
|
1248
|
-
static forRoot() {
|
|
1423
|
+
static forRoot(config) {
|
|
1249
1424
|
return {
|
|
1250
|
-
ngModule: SurveryLibModule
|
|
1425
|
+
ngModule: SurveryLibModule,
|
|
1426
|
+
providers: [
|
|
1427
|
+
{ provide: LibConfigService, useValue: config }
|
|
1428
|
+
]
|
|
1251
1429
|
};
|
|
1252
1430
|
}
|
|
1253
1431
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -1262,7 +1440,8 @@ class SurveryLibModule {
|
|
|
1262
1440
|
FilterQuestionPipe,
|
|
1263
1441
|
DefaultQuestionAnswerPipe,
|
|
1264
1442
|
DefaultQuestionAnswersPipe,
|
|
1265
|
-
TextBoxTypeAttrPipe
|
|
1443
|
+
TextBoxTypeAttrPipe,
|
|
1444
|
+
QuestionCascadeTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule, NgSelectModule], exports: [SurveryLibComponent] }); }
|
|
1266
1445
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule, NgSelectModule] }); }
|
|
1267
1446
|
}
|
|
1268
1447
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, decorators: [{
|
|
@@ -1280,7 +1459,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
1280
1459
|
FilterQuestionPipe,
|
|
1281
1460
|
DefaultQuestionAnswerPipe,
|
|
1282
1461
|
DefaultQuestionAnswersPipe,
|
|
1283
|
-
TextBoxTypeAttrPipe
|
|
1462
|
+
TextBoxTypeAttrPipe,
|
|
1463
|
+
QuestionCascadeTemplateComponent
|
|
1284
1464
|
],
|
|
1285
1465
|
imports: [
|
|
1286
1466
|
CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule, NgSelectModule
|