survery-lib 0.1.31 → 0.1.33

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.
Files changed (29) hide show
  1. package/esm2022/lib/components/question-cascade-template/question-cascade-template.component.mjs +107 -0
  2. package/esm2022/lib/components/question-dropdown-template/question-dropdown-template.component.mjs +15 -13
  3. package/esm2022/lib/services/api.service.mjs +27 -0
  4. package/esm2022/lib/services/lib-config.service.mjs +3 -0
  5. package/esm2022/lib/services/survey-lib.service.mjs +29 -1
  6. package/esm2022/lib/survery-lib.component.mjs +98 -74
  7. package/esm2022/lib/survery-lib.module.mjs +12 -5
  8. package/esm2022/shared/dtos/base/dto.base.mjs +2 -0
  9. package/esm2022/shared/dtos/base/error.dto.mjs +2 -0
  10. package/esm2022/shared/enums/question-type.enum.mjs +2 -1
  11. package/esm2022/shared/form-interfaces/question-cascade.form-interface.mjs +2 -0
  12. package/esm2022/shared/form-interfaces/question-dropdown-template.form-interface.mjs +1 -1
  13. package/esm2022/shared/results/api.result.mjs +2 -0
  14. package/fesm2022/survery-lib.mjs +272 -89
  15. package/fesm2022/survery-lib.mjs.map +1 -1
  16. package/lib/components/question-cascade-template/question-cascade-template.component.d.ts +33 -0
  17. package/lib/components/question-dropdown-template/question-dropdown-template.component.d.ts +3 -3
  18. package/lib/services/api.service.d.ts +19 -0
  19. package/lib/services/lib-config.service.d.ts +5 -0
  20. package/lib/services/survey-lib.service.d.ts +24 -0
  21. package/lib/survery-lib.component.d.ts +4 -2
  22. package/lib/survery-lib.module.d.ts +9 -7
  23. package/package.json +1 -1
  24. package/shared/dtos/base/dto.base.d.ts +5 -0
  25. package/shared/dtos/base/error.dto.d.ts +6 -0
  26. package/shared/enums/question-type.enum.d.ts +2 -1
  27. package/shared/form-interfaces/question-cascade.form-interface.d.ts +9 -0
  28. package/shared/form-interfaces/question-dropdown-template.form-interface.d.ts +2 -0
  29. package/shared/results/api.result.d.ts +4 -0
@@ -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,6 +10,7 @@ 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 * as i1$1 from '@angular/common/http';
13
14
  import { HttpClientModule } from '@angular/common/http';
14
15
 
15
16
  var 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: { isShow: "isShow", isDisabled: "isDisabled", 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':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"], 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"] }] }); }
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}`);
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);
@@ -935,7 +1090,10 @@ class SurveryLibComponent {
935
1090
  return QuestionTypeEnum;
936
1091
  }
937
1092
  get isFirstPage() {
938
- return this.showedSurveyPages.findIndex(x => x == this.fCtrls.currentPageIndex.value) == 0;
1093
+ if (this.showedSurveyPages.length > 0) {
1094
+ return this.showedSurveyPages.findIndex(x => x == this.fCtrls.currentPageIndex.value) == 0;
1095
+ }
1096
+ return true;
939
1097
  }
940
1098
  get isLastPage() {
941
1099
  return this.showedSurveyPages.findIndex(x => x == this.fCtrls.currentPageIndex.value) == (this.showedSurveyPages.length - 1);
@@ -976,7 +1134,8 @@ class SurveryLibComponent {
976
1134
  this.surveryLibraryDivId = v4();
977
1135
  this.reloadDefaultAnswerId = v4();
978
1136
  this.isPre = false;
979
- this.arabicLanguageId = null;
1137
+ this.surveyLanguageId = null;
1138
+ this.applicantKey = null;
980
1139
  this.surveyResultEmit = new EventEmitter();
981
1140
  this.selectLanguageEmit = new EventEmitter();
982
1141
  this.rForm = this._formBuilder.group({
@@ -992,11 +1151,19 @@ class SurveryLibComponent {
992
1151
  this.fCtrls.questionArray.clear();
993
1152
  this.fCtrls.ruleQuestionArray.clear();
994
1153
  this.surveyData = null;
1154
+ console.log(survey);
995
1155
  if (survey != null) {
996
1156
  this.surveyData = survey;
997
1157
  this.loadQuestions(survey);
998
1158
  }
999
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
+ });
1000
1167
  }
1001
1168
  onPaggingNext() {
1002
1169
  var isHaveInvalidRecords = this.haveInValidateQuestions();
@@ -1036,79 +1203,31 @@ class SurveryLibComponent {
1036
1203
  }
1037
1204
  onUpdateAnswer(model) {
1038
1205
  const index = this.fCtrls.questionArray.value.findIndex(x => x.questionId == model.QuestionId);
1039
- var questionGroup = this.fCtrls.questionArray.controls[index];
1040
- questionGroup.controls.isValid.setValue(model.IsValid);
1041
- if (questionGroup.value.questionType == this.questionTypeEnum.TextInput) {
1042
- questionGroup.patchValue({
1043
- answerId: model.SurveyAnswerId,
1044
- answerText: model.Answer
1045
- });
1046
- }
1047
- else if (questionGroup.value.questionType == this.questionTypeEnum.CheckBox || questionGroup.value.questionType == this.questionTypeEnum.DropDownMulti) {
1048
- questionGroup.controls.answerIdArr.setValue(model.Answer);
1049
- }
1050
- else {
1051
- questionGroup.controls.answerId.setValue(model.Answer);
1052
- }
1053
- if (this.fCtrls.ruleQuestionArray.value.findIndex(x => x.questionId == model.QuestionId) > -1) {
1054
- this.checkRules();
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
+ }
1055
1224
  }
1056
1225
  }
1057
1226
  loadQuestions(survey) {
1058
1227
  survey.surveyPages.forEach((page, pageIndex) => {
1059
1228
  page.surveyQuestionGroups.forEach(group => {
1060
1229
  group.surveyQuestions.forEach(question => {
1061
- if (question.questionTypeId != 6) {
1062
- this.fCtrls.questionArray.push(this._formBuilder.group({
1063
- surveyPageIndex: pageIndex,
1064
- questionId: [question.questionId],
1065
- questionType: [question.questionTypeId],
1066
- isMatrixGroup: [false],
1067
- answerId: [null],
1068
- answerIdArr: [null],
1069
- answerText: [null],
1070
- isRequired: [question.isRequired],
1071
- isValid: [null],
1072
- isDisabled: [question.isReadOnly],
1073
- isShow: [question.isVisable],
1074
- isDisabled_default: [question.isReadOnly],
1075
- isShow_default: [question.isVisable]
1076
- }));
1077
- }
1078
- else {
1079
- this.fCtrls.questionArray.push(this._formBuilder.group({
1080
- surveyPageIndex: pageIndex,
1081
- questionId: [question.questionId],
1082
- questionType: [question.questionTypeId],
1083
- isMatrixGroup: [true],
1084
- answerId: [null],
1085
- answerIdArr: [null],
1086
- answerText: [null],
1087
- isRequired: [question.isRequired],
1088
- isValid: [null],
1089
- isDisabled: [question.isReadOnly],
1090
- isShow: [question.isVisable],
1091
- isDisabled_default: [question.isReadOnly],
1092
- isShow_default: [question.isVisable],
1093
- }));
1094
- question.surveySubQuestions.forEach(subQuestion => {
1095
- this.fCtrls.questionArray.push(this._formBuilder.group({
1096
- surveyPageIndex: pageIndex,
1097
- questionId: [subQuestion.questionId],
1098
- questionType: [subQuestion.questionTypeId],
1099
- isMatrixGroup: [false],
1100
- answerId: [null],
1101
- answerIdArr: [null],
1102
- answerText: [null],
1103
- isRequired: [question.isRequired],
1104
- isValid: [null],
1105
- isDisabled: [subQuestion.isReadOnly],
1106
- isShow: [subQuestion.isVisable],
1107
- isDisabled_default: [subQuestion.isReadOnly],
1108
- isShow_default: [subQuestion.isVisable]
1109
- }));
1110
- });
1111
- }
1230
+ this.addQuestionGroup(question, pageIndex);
1112
1231
  });
1113
1232
  });
1114
1233
  });
@@ -1146,15 +1265,19 @@ class SurveryLibComponent {
1146
1265
  var questionGroup = this.fCtrls.questionArray.at(index);
1147
1266
  if (rule.logicActionId == LogicActionEnum.Show) {
1148
1267
  questionGroup.controls.isShow.setValue(true);
1268
+ this._surveyLibService.setQuestionIsShow(questionGroup.value.questionId, true);
1149
1269
  }
1150
1270
  else if (rule.logicActionId == LogicActionEnum.Hide) {
1151
1271
  questionGroup.controls.isShow.setValue(false);
1272
+ this._surveyLibService.setQuestionIsShow(questionGroup.value.questionId, false);
1152
1273
  }
1153
1274
  else if (rule.logicActionId == LogicActionEnum.Enable) {
1154
1275
  questionGroup.controls.isDisabled.setValue(false);
1276
+ this._surveyLibService.setQuestionIsDisabled(questionGroup.value.questionId, false);
1155
1277
  }
1156
1278
  else if (rule.logicActionId == LogicActionEnum.Disable) {
1157
1279
  questionGroup.controls.isDisabled.setValue(true);
1280
+ this._surveyLibService.setQuestionIsDisabled(questionGroup.value.questionId, true);
1158
1281
  }
1159
1282
  else if (rule.logicActionId == LogicActionEnum.SetAnswer) {
1160
1283
  }
@@ -1191,15 +1314,70 @@ class SurveryLibComponent {
1191
1314
  }
1192
1315
  return null;
1193
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
+ }
1194
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 }); }
1195
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", inputs: { isPre: "isPre", arabicLanguageId: "arabicLanguageId" }, 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\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></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 </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: ["isShow", "isDisabled", "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: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
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" }] }); }
1196
1372
  }
1197
1373
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
1198
1374
  type: Component,
1199
- 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\"\r\n [isShow]=\" (question|filterQuestion : fCtrls.questionArray.value).isShow\"\r\n [isDisabled]=\"(question|filterQuestion : fCtrls.questionArray.value).isDisabled\"></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 </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"] }]
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"] }]
1200
1376
  }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { isPre: [{
1201
1377
  type: Input
1202
- }], arabicLanguageId: [{
1378
+ }], surveyLanguageId: [{
1379
+ type: Input
1380
+ }], applicantKey: [{
1203
1381
  type: Input
1204
1382
  }], surveyResultEmit: [{
1205
1383
  type: Output
@@ -1242,9 +1420,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
1242
1420
  }] });
1243
1421
 
1244
1422
  class SurveryLibModule {
1245
- static forRoot() {
1423
+ static forRoot(config) {
1246
1424
  return {
1247
- ngModule: SurveryLibModule
1425
+ ngModule: SurveryLibModule,
1426
+ providers: [
1427
+ { provide: LibConfigService, useValue: config }
1428
+ ]
1248
1429
  };
1249
1430
  }
1250
1431
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
@@ -1259,7 +1440,8 @@ class SurveryLibModule {
1259
1440
  FilterQuestionPipe,
1260
1441
  DefaultQuestionAnswerPipe,
1261
1442
  DefaultQuestionAnswersPipe,
1262
- TextBoxTypeAttrPipe], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule, NgSelectModule], exports: [SurveryLibComponent] }); }
1443
+ TextBoxTypeAttrPipe,
1444
+ QuestionCascadeTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule, NgSelectModule], exports: [SurveryLibComponent] }); }
1263
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] }); }
1264
1446
  }
1265
1447
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, decorators: [{
@@ -1277,7 +1459,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
1277
1459
  FilterQuestionPipe,
1278
1460
  DefaultQuestionAnswerPipe,
1279
1461
  DefaultQuestionAnswersPipe,
1280
- TextBoxTypeAttrPipe
1462
+ TextBoxTypeAttrPipe,
1463
+ QuestionCascadeTemplateComponent
1281
1464
  ],
1282
1465
  imports: [
1283
1466
  CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgsFormsModule, NgSelectModule