survery-lib 2.1.6 → 2.1.8

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 (48) hide show
  1. package/esm2022/lib/components/question-cascade-template/question-cascade-template.component.mjs +10 -3
  2. package/esm2022/lib/components/question-institutions-template/question-institutions-template.component.mjs +252 -0
  3. package/esm2022/lib/core/states/entites/question.entity.mjs +1 -1
  4. package/esm2022/lib/core/states/survey-store/question-group.selector.mjs +1 -1
  5. package/esm2022/lib/core/states/survey-store/question.selector.mjs +2 -2
  6. package/esm2022/lib/core/states/survey-store/survey.action.mjs +9 -1
  7. package/esm2022/lib/core/states/survey-store/survey.effect.mjs +13 -6
  8. package/esm2022/lib/core/states/survey-store/survey.reducer.mjs +42 -2
  9. package/esm2022/lib/core/states/survey-store/survey.selector.mjs +4 -2
  10. package/esm2022/lib/services/api.service.mjs +21 -2
  11. package/esm2022/lib/services/survey-lib.service.mjs +32 -5
  12. package/esm2022/lib/survery-lib.component.mjs +6 -5
  13. package/esm2022/lib/survery-lib.module.mjs +6 -3
  14. package/esm2022/shared/dtos/base/result.dto.mjs +2 -0
  15. package/esm2022/shared/dtos/institution-branch.dto.mjs +2 -0
  16. package/esm2022/shared/dtos/institution-collage.dto.mjs +2 -0
  17. package/esm2022/shared/dtos/institution-program.dto.mjs +2 -0
  18. package/esm2022/shared/dtos/institution-section.dto.mjs +2 -0
  19. package/esm2022/shared/dtos/institution.dto.mjs +2 -0
  20. package/esm2022/shared/dtos/survey-question.dto.mjs +1 -1
  21. package/esm2022/shared/dtos/survey-sub-question-level-answer.dto.mjs +2 -0
  22. package/esm2022/shared/dtos/survey-sub-question-level.dto.mjs +2 -0
  23. package/esm2022/shared/enums/question-type.enum.mjs +2 -1
  24. package/esm2022/shared/enums/survey-language.enum.mjs +6 -0
  25. package/esm2022/shared/form-interfaces/question-Institutions-template.form-interface.mjs +2 -0
  26. package/fesm2022/survery-lib.mjs +371 -20
  27. package/fesm2022/survery-lib.mjs.map +1 -1
  28. package/lib/components/question-institutions-template/question-institutions-template.component.d.ts +44 -0
  29. package/lib/core/states/entites/question.entity.d.ts +3 -1
  30. package/lib/core/states/survey-store/survey.action.d.ts +27 -0
  31. package/lib/core/states/survey-store/survey.effect.d.ts +6 -1
  32. package/lib/core/states/survey-store/survey.reducer.d.ts +2 -0
  33. package/lib/core/states/survey-store/survey.selector.d.ts +1 -0
  34. package/lib/services/api.service.d.ts +22 -0
  35. package/lib/survery-lib.module.d.ts +10 -9
  36. package/package.json +1 -1
  37. package/shared/dtos/base/result.dto.d.ts +6 -0
  38. package/shared/dtos/institution-branch.dto.d.ts +6 -0
  39. package/shared/dtos/institution-collage.dto.d.ts +6 -0
  40. package/shared/dtos/institution-program.dto.d.ts +5 -0
  41. package/shared/dtos/institution-section.dto.d.ts +6 -0
  42. package/shared/dtos/institution.dto.d.ts +6 -0
  43. package/shared/dtos/survey-question.dto.d.ts +3 -0
  44. package/shared/dtos/survey-sub-question-level-answer.dto.d.ts +20 -0
  45. package/shared/dtos/survey-sub-question-level.dto.d.ts +19 -0
  46. package/shared/enums/question-type.enum.d.ts +2 -1
  47. package/shared/enums/survey-language.enum.d.ts +4 -0
  48. package/shared/form-interfaces/question-Institutions-template.form-interface.d.ts +30 -0
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Directive, HostListener, Pipe, Component, Input, EventEmitter, Output, InjectionToken, Inject, NgModule } from '@angular/core';
2
+ import { Injectable, Directive, HostListener, Pipe, Component, Input, EventEmitter, Output, InjectionToken, Inject, computed, NgModule } from '@angular/core';
3
3
  import { v4 } from 'uuid';
4
4
  import { Subject, of, debounceTime, distinctUntilChanged, map, filter, pairwise, take, withLatestFrom, switchMap } from 'rxjs';
5
5
  import * as i1 from '@angular/forms';
@@ -18,6 +18,7 @@ import * as i5$1 from 'ngx-bootstrap/rating';
18
18
  import { RatingModule } from 'ngx-bootstrap/rating';
19
19
  import * as i6 from 'ngx-bootstrap/pagination';
20
20
  import { PaginationModule } from 'ngx-bootstrap/pagination';
21
+ import { SurveyLanguageEnum } from 'projects/survery-lib/src/shared/enums/survey-language.enum';
21
22
  import * as i1$2 from '@ngrx/effects';
22
23
  import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
23
24
 
@@ -32,6 +33,7 @@ var QuestionTypeEnum;
32
33
  QuestionTypeEnum[QuestionTypeEnum["DropDownMulti"] = 7] = "DropDownMulti";
33
34
  QuestionTypeEnum[QuestionTypeEnum["Cascade"] = 8] = "Cascade";
34
35
  QuestionTypeEnum[QuestionTypeEnum["FeedBack"] = 9] = "FeedBack";
36
+ QuestionTypeEnum[QuestionTypeEnum["Institutions"] = 10] = "Institutions";
35
37
  })(QuestionTypeEnum || (QuestionTypeEnum = {}));
36
38
 
37
39
  var InputTypeEnum;
@@ -83,13 +85,15 @@ const isLastPage = createSelector(showedSurveyPages, selectSurveyData$2, (pageAr
83
85
  return pageArr.findIndex(x => x == state.selectedPageId) == (pageArr.length - 1);
84
86
  });
85
87
  const ruleArr = createSelector(selectSurveyData$2, (state) => ruleAdapter.getSelectors().selectAll(state.ruleArr));
88
+ const institutionArr = createSelector(selectSurveyData$2, (state) => state.InstitutionArr);
86
89
  const surveySelectors = {
87
90
  selectedPageId,
88
91
  selectedPageIndex,
89
92
  showedSurveyPages,
90
93
  isFirstPage,
91
94
  isLastPage,
92
- ruleArr
95
+ ruleArr,
96
+ institutionArr
93
97
  };
94
98
 
95
99
  function selectQuestionGroupId(a) {
@@ -110,7 +114,7 @@ const { selectAll: selectAll$1, selectIds: selectIds$1 } = questionAdapter.getSe
110
114
  const selectSurveyData = createFeatureSelector('survey-lib');
111
115
  const allQuestions = createSelector(selectSurveyData, (state) => selectAll$1(state.questionArr));
112
116
  const pageQuestions = createSelector(selectSurveyData, (state) => selectAll$1(state.questionArr).filter(x => x.surveyPageId == state.selectedPageId));
113
- const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(state.questionArr).filter(x => x.isMatrixGroup != true).map(x => {
117
+ const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(state.questionArr).filter(x => x.isQuestionGroup != true).map(x => {
114
118
  return {
115
119
  SurveyPageIndex: x.surveyPageId,
116
120
  QuestionId: x.questionId,
@@ -129,18 +133,26 @@ const questionSelectors = {
129
133
  const loadSurvey = createAction('[Survey library] Load Survey', props());
130
134
  const addQuestion = createAction('[Survey library] Add Question', props());
131
135
  const updateQuestionAnswer = createAction('[Survey library] Update Question Answer', props());
136
+ const updateInstitutionQuestionAnswer = createAction('[Survey library] Update Institution Question Answer', props());
132
137
  const updateQuestionShow = createAction('[Survey library] Update Question Show', props());
133
138
  const updateQuestionDisable = createAction('[Survey library] Update Question Disable', props());
139
+ const updateQuestionRequired = createAction('[Survey library] Update Question Required', props());
134
140
  const removeQuestion = createAction('[Survey library] Remove Question', props());
135
141
  const updatePageId = createAction('[Survey library] Update Page Id', props());
142
+ const loadInstitutionArr = createAction('[Survey library] Load Institution Arr');
143
+ const loadInstitutionArrSuccess = createAction('[Survey library] Load Institution Arr Success', props());
136
144
  const surveyActions = {
137
145
  loadSurvey,
138
146
  addQuestion,
139
147
  updateQuestionAnswer,
148
+ updateInstitutionQuestionAnswer,
140
149
  updateQuestionShow,
141
150
  updateQuestionDisable,
151
+ updateQuestionRequired,
142
152
  removeQuestion,
143
153
  updatePageId,
154
+ loadInstitutionArr,
155
+ loadInstitutionArrSuccess
144
156
  };
145
157
 
146
158
  var EvaluationTypeEnum;
@@ -219,7 +231,7 @@ class SurveyLibService {
219
231
  questionId: question.questionId,
220
232
  questionType: question.questionTypeId,
221
233
  inputTypeId: question.surveyAnswers[0].inputTypeId,
222
- isMatrixGroup: question.questionTypeId == QuestionTypeEnum.Matrix,
234
+ isQuestionGroup: question.questionTypeId == QuestionTypeEnum.Matrix || question.questionTypeId == QuestionTypeEnum.Institutions,
223
235
  answerId: null,
224
236
  answerIdArr: null,
225
237
  answerText: null,
@@ -231,7 +243,8 @@ class SurveyLibService {
231
243
  isShow_default: question.isVisable,
232
244
  questionGroupId: questionGroupId,
233
245
  parentQuestionId: null,
234
- questionAllInfo: question
246
+ maxLevelValue: null,
247
+ questionAllInfo: question,
235
248
  };
236
249
  if (question.questionTypeId == QuestionTypeEnum.FeedBack) {
237
250
  if (question.surveyAnswers[0].evaluationTypeId == EvaluationTypeEnum.Stars) {
@@ -249,7 +262,7 @@ class SurveyLibService {
249
262
  questionId: subQuestion.questionId,
250
263
  questionType: question.questionTypeId,
251
264
  inputTypeId: question.surveyAnswers[0].inputTypeId,
252
- isMatrixGroup: false,
265
+ isQuestionGroup: false,
253
266
  answerId: null,
254
267
  answerIdArr: null,
255
268
  answerText: null,
@@ -261,7 +274,33 @@ class SurveyLibService {
261
274
  isShow_default: question.isVisable,
262
275
  parentQuestionId: question.questionId,
263
276
  questionGroupId: questionGroupId,
264
- questionAllInfo: question
277
+ questionAllInfo: question,
278
+ maxLevelValue: null
279
+ });
280
+ });
281
+ }
282
+ if (question.questionTypeId == QuestionTypeEnum.Institutions) {
283
+ questionNgrxModel.maxLevelValue = question.maxLevelValue;
284
+ question.surveySubQuestionLevels.forEach(subQuestion => {
285
+ questionArr.push({
286
+ surveyPageId: pageIndex,
287
+ questionId: subQuestion.questionId,
288
+ questionType: question.questionTypeId,
289
+ inputTypeId: question.surveyAnswers[0].inputTypeId,
290
+ isQuestionGroup: false,
291
+ answerId: null,
292
+ answerIdArr: null,
293
+ answerText: null,
294
+ isRequired: subQuestion.level == 1 ? question.isRequired : false,
295
+ isValid: null,
296
+ isDisabled: question.isReadOnly,
297
+ isShow: question.isVisable,
298
+ isDisabled_default: question.isReadOnly,
299
+ isShow_default: question.isVisable,
300
+ parentQuestionId: question.questionId,
301
+ questionGroupId: questionGroupId,
302
+ questionAllInfo: question,
303
+ maxLevelValue: null
265
304
  });
266
305
  });
267
306
  }
@@ -1429,7 +1468,26 @@ class ApiService {
1429
1468
  }
1430
1469
  getNextQuestion(filter) {
1431
1470
  var queryString = $.param(filter);
1432
- return this._HttpClient.get(`${this.url}/GetNextQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1471
+ return this._HttpClient.get(`${this.url}/Survey/GetNextQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1472
+ }
1473
+ getAllInstitutions() {
1474
+ return this._HttpClient.get(`${this.url}/Institutions/GetAllInstitutions`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1475
+ }
1476
+ getAllBranches(filter) {
1477
+ var queryString = $.param(filter);
1478
+ return this._HttpClient.get(`${this.url}/Institutions/GetBranches?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1479
+ }
1480
+ getAllCollages(filter) {
1481
+ var queryString = $.param(filter);
1482
+ return this._HttpClient.get(`${this.url}/Institutions/GetCollages?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1483
+ }
1484
+ getAllSections(filter) {
1485
+ var queryString = $.param(filter);
1486
+ return this._HttpClient.get(`${this.url}/Institutions/GetSections?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1487
+ }
1488
+ getAllPrograms(filter) {
1489
+ var queryString = $.param(filter);
1490
+ return this._HttpClient.get(`${this.url}/Institutions/Programs?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1433
1491
  }
1434
1492
  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 }); }
1435
1493
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: ApiService, providedIn: 'root' }); }
@@ -1474,7 +1532,14 @@ class QuestionCascadeTemplateComponent {
1474
1532
  set setQuestion(value) {
1475
1533
  if (this.surveyQuestionArr?.length == 0) {
1476
1534
  this.setQuestions(value.questionAllInfo);
1477
- console.log(value.questionAllInfo);
1535
+ var childQuestion1 = this.pageQuestions$().find(x => x.parentQuestionId == value.questionId);
1536
+ if (childQuestion1) {
1537
+ this.setQuestions(childQuestion1.questionAllInfo);
1538
+ var childQuestion2 = this.pageQuestions$().find(x => x.parentQuestionId == childQuestion1.questionId);
1539
+ if (childQuestion2) {
1540
+ this.setQuestions(childQuestion2.questionAllInfo);
1541
+ }
1542
+ }
1478
1543
  }
1479
1544
  }
1480
1545
  constructor(_formBuilder, _surveyLibService, _ApiService, _Store) {
@@ -1527,7 +1592,7 @@ class QuestionCascadeTemplateComponent {
1527
1592
  questionId: res.questionId,
1528
1593
  questionType: res.questionTypeId,
1529
1594
  inputTypeId: res.surveyAnswers[0].inputTypeId,
1530
- isMatrixGroup: false,
1595
+ isQuestionGroup: false,
1531
1596
  answerId: null,
1532
1597
  answerIdArr: null,
1533
1598
  answerText: null,
@@ -1705,6 +1770,244 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
1705
1770
  type: Input
1706
1771
  }] } });
1707
1772
 
1773
+ class QuestionInstitutionsTemplateComponent {
1774
+ get fCtrls() {
1775
+ return this.rForm.controls;
1776
+ }
1777
+ get questionTypeEnum() {
1778
+ return QuestionTypeEnum;
1779
+ }
1780
+ get questionFormArray() {
1781
+ return this.fCtrls.questionArr;
1782
+ }
1783
+ set setQuestion(value) {
1784
+ if (this.institutionsQuestion == null) {
1785
+ this.institutionsQuestion = value.questionAllInfo;
1786
+ this.rForm.patchValue({
1787
+ id: value.questionId,
1788
+ title: value.questionAllInfo.questionTitle,
1789
+ maxLevelValue: value.questionAllInfo.maxLevelValue,
1790
+ isRequired: value.isRequired,
1791
+ isDisabled: value.isDisabled,
1792
+ isShow: value.isShow
1793
+ });
1794
+ value.questionAllInfo.surveySubQuestionLevels.forEach(surveySubQuestionLevel => {
1795
+ var question = this.pageQuestions$().find(x => x.questionId == value.questionId);
1796
+ this.setQuestionFormGroup(surveySubQuestionLevel, question?.isRequired, question?.answerId);
1797
+ });
1798
+ }
1799
+ }
1800
+ constructor(_Store, _formBuilder, _ApiService) {
1801
+ this._Store = _Store;
1802
+ this._formBuilder = _formBuilder;
1803
+ this._ApiService = _ApiService;
1804
+ this.institutionsQuestion = null;
1805
+ this.pageQuestions$ = this._Store.selectSignal(questionSelectors.pageQuestions);
1806
+ this.institutionsArr$ = this._Store.selectSignal(surveySelectors.institutionArr);
1807
+ this.institutionsQuestionArr = computed(() => {
1808
+ return this.institutionsArr$().map(x => {
1809
+ return {
1810
+ id: x.submissionId,
1811
+ name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.institutionNameArabic : x.institutionNameEnglish
1812
+ };
1813
+ });
1814
+ });
1815
+ this.pageId = null;
1816
+ this.questionGroupId = null;
1817
+ this.isPre = false;
1818
+ this.surveyLanguageId = null;
1819
+ this.applicantKey = null;
1820
+ this.rForm = this._formBuilder.group({
1821
+ id: new FormControl(null),
1822
+ title: new FormControl(null),
1823
+ maxLevelValue: new FormControl(null),
1824
+ isDisabled: new FormControl(false),
1825
+ isShow: new FormControl(false),
1826
+ isRequired: new FormControl(null),
1827
+ institutionId: new FormControl(null),
1828
+ branchId: new FormControl(null),
1829
+ collageId: new FormControl(null),
1830
+ sectionId: new FormControl(null),
1831
+ questionArr: this._formBuilder.array([])
1832
+ });
1833
+ }
1834
+ ngOnInit() {
1835
+ this._Store.dispatch(surveyActions.loadInstitutionArr());
1836
+ }
1837
+ onUpdateAnswer(model, groupIndex) {
1838
+ var group = this.fCtrls.questionArr.at(groupIndex);
1839
+ group.patchValue({
1840
+ answerId: model.id,
1841
+ answerValue: model.name
1842
+ });
1843
+ this._Store.dispatch(surveyActions.updateInstitutionQuestionAnswer({
1844
+ questionId: group.value.id,
1845
+ answerId: group.value.answerId,
1846
+ answer: group.value.answers,
1847
+ isValid: group.controls.answerId.valid,
1848
+ levelAnswerId: group.value.levelAnswerId,
1849
+ }));
1850
+ }
1851
+ identify(index, item) {
1852
+ return item.value.id;
1853
+ }
1854
+ setQuestionFormGroup(value, isRquired, answerId) {
1855
+ var group = this._formBuilder.group({
1856
+ id: new FormControl(value.questionId),
1857
+ typeId: new FormControl(value.questionTypeId),
1858
+ name: new FormControl(value.questionName),
1859
+ description: new FormControl(value.questionDescription),
1860
+ title: new FormControl(value.questionTitle),
1861
+ level: new FormControl(value.level),
1862
+ levelAnswerId: new FormControl(value.levelAnswer.answerId),
1863
+ answerId: new FormControl(null),
1864
+ answerValue: new FormControl(null),
1865
+ answers: new FormControl([]),
1866
+ });
1867
+ if (isRquired == true) {
1868
+ group.controls.answerId.addValidators([Validators.required]);
1869
+ group.controls.answerId.updateValueAndValidity();
1870
+ group.controls.answerValue.addValidators([Validators.required]);
1871
+ group.controls.answerValue.updateValueAndValidity();
1872
+ }
1873
+ group.controls.answerId.valueChanges.pipe(distinctUntilChanged()).subscribe(answerId => {
1874
+ if (answerId) {
1875
+ if (value.level == 1) {
1876
+ this.rForm.patchValue({
1877
+ institutionId: answerId,
1878
+ branchId: null,
1879
+ collageId: null,
1880
+ sectionId: null
1881
+ }, { emitEvent: false });
1882
+ }
1883
+ else if (value.level == 2) {
1884
+ this.rForm.patchValue({
1885
+ branchId: answerId,
1886
+ collageId: null,
1887
+ sectionId: null
1888
+ }, { emitEvent: false });
1889
+ }
1890
+ else if (value.level == 3) {
1891
+ this.rForm.patchValue({
1892
+ collageId: answerId,
1893
+ sectionId: null
1894
+ }, { emitEvent: false });
1895
+ }
1896
+ else if (value.level == 4) {
1897
+ this.rForm.patchValue({
1898
+ sectionId: answerId
1899
+ }, { emitEvent: false });
1900
+ }
1901
+ const level = group.value.level;
1902
+ this.resetAnswersOfFormGroupinHigherLevel(level);
1903
+ var nextGroupIndex = this.fCtrls.questionArr.controls.findIndex(x => x.value.level == level + 1);
1904
+ if (nextGroupIndex) {
1905
+ this.fillQuestionAnswers(nextGroupIndex);
1906
+ }
1907
+ }
1908
+ });
1909
+ group.controls.answers.valueChanges.pipe(distinctUntilChanged()).subscribe(value => {
1910
+ const groupIndex = this.fCtrls.questionArr.controls.findIndex(x => x.value.level == group.value.level);
1911
+ var questionGroup = this.fCtrls.questionArr.at(groupIndex);
1912
+ if (questionGroup) {
1913
+ if (value.length > 0) {
1914
+ if (this.fCtrls.isRequired.value == true) {
1915
+ questionGroup.controls.answerId.addValidators([Validators.required]);
1916
+ questionGroup.controls.answerValue.addValidators([Validators.required]);
1917
+ this._Store.dispatch(surveyActions.updateQuestionRequired({ questionId: group.value.id, isRequired: true }));
1918
+ }
1919
+ }
1920
+ else {
1921
+ questionGroup.controls.answerId.clearValidators();
1922
+ questionGroup.controls.answerValue.clearValidators();
1923
+ this._Store.dispatch(surveyActions.updateQuestionRequired({ questionId: group.value.id, isRequired: false }));
1924
+ }
1925
+ questionGroup.controls.answerId.updateValueAndValidity();
1926
+ questionGroup.controls.answerValue.updateValueAndValidity();
1927
+ }
1928
+ });
1929
+ if (answerId) {
1930
+ group.controls.answerId.setValue(answerId);
1931
+ }
1932
+ this.fCtrls.questionArr.push(group);
1933
+ }
1934
+ fillQuestionAnswers(nextGroupIndex) {
1935
+ const formValue = this.rForm.value;
1936
+ var group = this.fCtrls.questionArr.at(nextGroupIndex);
1937
+ if (group) {
1938
+ if (group.value.level == 2) {
1939
+ this._ApiService.getAllBranches({ submissionId: formValue.institutionId }).pipe(take(1)).subscribe(res => {
1940
+ group.controls.answers.setValue(res.responseDetails.map(x => {
1941
+ return {
1942
+ id: x.branchSubmissionId,
1943
+ name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.branchNameInArabic : x.branchNameInEnglish
1944
+ };
1945
+ }));
1946
+ });
1947
+ }
1948
+ else if (group.value.level == 3) {
1949
+ this._ApiService.getAllCollages({ submissionId: formValue.branchId, branchSubmissionId: formValue.branchId }).pipe(take(1)).subscribe(res => {
1950
+ group.controls.answers.setValue(res.responseDetails.map(x => {
1951
+ return {
1952
+ id: x.collageSubmissionId,
1953
+ name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.collageNameInArabic : x.collageNameInEnglish
1954
+ };
1955
+ }));
1956
+ });
1957
+ }
1958
+ else if (group.value.level == 4) {
1959
+ this._ApiService.getAllSections({ submissionId: formValue.collageId, collageSubmissionId: formValue.collageId }).pipe(take(1)).subscribe(res => {
1960
+ group.controls.answers.setValue(res.responseDetails.map(x => {
1961
+ return {
1962
+ id: x.sectionSubmissionId,
1963
+ name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.sectionNameInArabic : x.sectionNameInEnglish
1964
+ };
1965
+ }));
1966
+ });
1967
+ }
1968
+ else if (group.value.level == 5) {
1969
+ this._ApiService.getAllPrograms({ submissionId: formValue.sectionId, sectionGeneratedKey: formValue.sectionId }).pipe(take(1)).subscribe(res => {
1970
+ group.controls.answers.setValue(res.responseDetails.map(x => {
1971
+ return {
1972
+ id: x.generatedId,
1973
+ name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.programNameArabic : x.programNameEnglish
1974
+ };
1975
+ }));
1976
+ });
1977
+ }
1978
+ }
1979
+ }
1980
+ resetAnswersOfFormGroupinHigherLevel(level) {
1981
+ this.fCtrls.questionArr.controls.forEach((group) => {
1982
+ if (group.value.level > level) {
1983
+ group.patchValue({
1984
+ answerId: null,
1985
+ answerValue: null,
1986
+ answers: []
1987
+ }, { emitEvent: false });
1988
+ }
1989
+ });
1990
+ }
1991
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionInstitutionsTemplateComponent, deps: [{ token: i3.Store }, { token: i1.FormBuilder }, { token: ApiService }], target: i0.ɵɵFactoryTarget.Component }); }
1992
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionInstitutionsTemplateComponent, selector: "lib-question-institutions-template", inputs: { pageId: "pageId", questionGroupId: "questionGroupId", isPre: "isPre", surveyLanguageId: "surveyLanguageId", applicantKey: "applicantKey", setQuestion: "setQuestion" }, ngImport: i0, template: "<div class=\"quastion\">\n <h3 class=\"quastion-title mb-2\">\n <span [innerHTML]=\"fCtrls.title.value\"></span>\n </h3>\n <ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\n <div class=\"quastion\" [attr.id]=\"'question_'+item.value.id\"\n *ngIf=\"item.value.level == 1 || ( item.value.level > 1 && item.value.answers.length > 0 )\"\n [ngClass]=\"{'invalid-question': item.controls.answerId.invalid , 'd-none':fCtrls.isShow.value != true}\">\n <h3 class=\"quastion-title \">\n <span [innerHTML]=\"item.value.title\"></span>\n <span style=\"color: red;\" *ngIf=\"fCtrls.isRequired\">*</span>\n </h3>\n <div class=\"text-quastion text-quastion__dropdown\">\n <ng-select [items]=\"item.value.level ==1 ? institutionsQuestionArr() : item.value.answers\" bindValue=\"id\" bindLabel=\"name\" class=\"form-control\"\n [formControl]=\"item.controls.answerId\" [virtualScroll]=\"true\" [disabled]=\"fCtrls.isDisabled.value\" (change)=\"onUpdateAnswer($event,i)\"\n [multiple]=\"false\">\n </ng-select>\n </div>\n </div>\n\n </ng-container>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.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"] }] }); }
1993
+ }
1994
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionInstitutionsTemplateComponent, decorators: [{
1995
+ type: Component,
1996
+ args: [{ selector: 'lib-question-institutions-template', template: "<div class=\"quastion\">\n <h3 class=\"quastion-title mb-2\">\n <span [innerHTML]=\"fCtrls.title.value\"></span>\n </h3>\n <ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\n <div class=\"quastion\" [attr.id]=\"'question_'+item.value.id\"\n *ngIf=\"item.value.level == 1 || ( item.value.level > 1 && item.value.answers.length > 0 )\"\n [ngClass]=\"{'invalid-question': item.controls.answerId.invalid , 'd-none':fCtrls.isShow.value != true}\">\n <h3 class=\"quastion-title \">\n <span [innerHTML]=\"item.value.title\"></span>\n <span style=\"color: red;\" *ngIf=\"fCtrls.isRequired\">*</span>\n </h3>\n <div class=\"text-quastion text-quastion__dropdown\">\n <ng-select [items]=\"item.value.level ==1 ? institutionsQuestionArr() : item.value.answers\" bindValue=\"id\" bindLabel=\"name\" class=\"form-control\"\n [formControl]=\"item.controls.answerId\" [virtualScroll]=\"true\" [disabled]=\"fCtrls.isDisabled.value\" (change)=\"onUpdateAnswer($event,i)\"\n [multiple]=\"false\">\n </ng-select>\n </div>\n </div>\n\n </ng-container>\n</div>\n\n" }]
1997
+ }], ctorParameters: function () { return [{ type: i3.Store }, { type: i1.FormBuilder }, { type: ApiService }]; }, propDecorators: { pageId: [{
1998
+ type: Input
1999
+ }], questionGroupId: [{
2000
+ type: Input
2001
+ }], isPre: [{
2002
+ type: Input
2003
+ }], surveyLanguageId: [{
2004
+ type: Input
2005
+ }], applicantKey: [{
2006
+ type: Input
2007
+ }], setQuestion: [{
2008
+ type: Input
2009
+ }] } });
2010
+
1708
2011
  class FilterQuestionPipe {
1709
2012
  transform(arr, questionGroupId) {
1710
2013
  return arr.filter(x => x.questionGroupId == questionGroupId && x.parentQuestionId == null);
@@ -1813,7 +2116,7 @@ class SurveryLibComponent {
1813
2116
  var invalidRecords = [];
1814
2117
  var arr = questionArr.filter(x => x.isDisabled == false && x.isShow == true);
1815
2118
  arr.map(x => {
1816
- if (x.isRequired == true && x.isValid != true && x.isMatrixGroup != true) {
2119
+ if (x.isRequired == true && x.isValid != true && x.isQuestionGroup != true) {
1817
2120
  invalidRecords.push(x);
1818
2121
  }
1819
2122
  else {
@@ -1851,11 +2154,11 @@ class SurveryLibComponent {
1851
2154
  return null;
1852
2155
  }
1853
2156
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, deps: [{ token: SurveyLibService }, { token: i3.Store }, { token: i1.FormBuilder }, { token: CheckRuleExpsUsecase }], target: i0.ɵɵFactoryTarget.Component }); }
1854
- 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", isArabicLang: "isArabicLang" }, outputs: { surveyResultEmit: "surveyResultEmit", selectLanguageEmit: "selectLanguageEmit" }, ngImport: i0, template: "<div id=\"survery-card-{{surveryLibraryDivId}}\" class=\"survay-card\">\r\n <div [attr.id]=\"'survey-page_'+fCtrls.currentPageId.value\">\r\n <ng-container *ngFor=\"let item of pageQuestionGroups$(); trackBy:questionGroupIdentify\">\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\" [innerHTML]=\"item.questionGroupName\">\r\n </h2>\r\n <span class=\"group-sub-title \" [innerHTML]=\"item.questionGroupDescription\">\r\n </span>\r\n </div>\r\n <ng-container\r\n *ngFor=\"let question of (pageQuestions$() |filterQuestion : item.questionGroupId); trackBy:questionIdentify\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Boolean\">\r\n </lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.TextInput\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-text-template>\r\n\r\n <lib-question-feedback-template #questionFeedTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.FeedBack\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-feedback-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.RadioButton\">\r\n </lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n\r\n <lib-question-dropdown-multi-template [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDownMulti\">\r\n </lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.CheckBox\">\r\n </lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Matrix\">\r\n </lib-question-matrix-template>\r\n\r\n <lib-question-cascade-template #questionCascadeTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Cascade\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\"\r\n [pageId]=\"question.surveyPageId\" [questionGroupId]=\"question.questionGroupId\"></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=\"fCtrls.showedSurveyPages.value.length > 0\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\">\r\n <span>{{ curruntShowedSurveyPages$ | async}}</span>\r\n <span class=\"ms-2 me-2\">{{isArabicLang ? '\u0645\u0646' : 'of'}} </span>\r\n <span>{{fCtrls.showedSurveyPages.value.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: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: ["isArabicLang", "setQuestion", "isDisabled"] }, { kind: "component", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionDropdownMultiTemplateComponent, selector: "lib-question-dropdown-multi-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: ["pageId", "questionGroupId", "isPre", "surveyLanguageId", "applicantKey", "setQuestion"] }, { kind: "component", type: QuestionFeedbackTemplateComponent, selector: "lib-question-feedback-template", inputs: ["isArabicLang", "setQuestion", "isDisabled"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
2157
+ 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", isArabicLang: "isArabicLang" }, outputs: { surveyResultEmit: "surveyResultEmit", selectLanguageEmit: "selectLanguageEmit" }, ngImport: i0, template: "<div id=\"survery-card-{{surveryLibraryDivId}}\" class=\"survay-card\">\r\n <div [attr.id]=\"'survey-page_'+fCtrls.currentPageId.value\">\r\n <ng-container *ngFor=\"let item of pageQuestionGroups$(); trackBy:questionGroupIdentify\">\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\" [innerHTML]=\"item.questionGroupName\">\r\n </h2>\r\n <span class=\"group-sub-title \" [innerHTML]=\"item.questionGroupDescription\">\r\n </span>\r\n </div>\r\n <ng-container\r\n *ngFor=\"let question of (pageQuestions$() |filterQuestion : item.questionGroupId); trackBy:questionIdentify\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Boolean\">\r\n </lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.TextInput\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-text-template>\r\n\r\n <lib-question-feedback-template #questionFeedTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.FeedBack\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-feedback-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.RadioButton\">\r\n </lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n\r\n <lib-question-dropdown-multi-template [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDownMulti\">\r\n </lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.CheckBox\">\r\n </lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Matrix\">\r\n </lib-question-matrix-template>\r\n\r\n <lib-question-cascade-template #questionCascadeTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Cascade\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\"\r\n [pageId]=\"question.surveyPageId\" [questionGroupId]=\"question.questionGroupId\"></lib-question-cascade-template>\r\n\r\n <lib-question-institutions-template #questionInstitutionsTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Institutions\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\"\r\n [pageId]=\"question.surveyPageId\" [questionGroupId]=\"question.questionGroupId\" ></lib-question-institutions-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=\"fCtrls.showedSurveyPages.value.length > 0\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\">\r\n <span>{{ curruntShowedSurveyPages$ | async}}</span>\r\n <span class=\"ms-2 me-2\">{{isArabicLang ? '\u0645\u0646' : 'of'}} </span>\r\n <span>{{fCtrls.showedSurveyPages.value.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: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: QuestionTextTemplateComponent, selector: "lib-question-text-template", inputs: ["isArabicLang", "setQuestion", "isDisabled"] }, { kind: "component", type: QuestionRadioButtonTemplateComponent, selector: "lib-question-radio-button-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionCheckBoxTemplateComponent, selector: "lib-question-check-box-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "component", type: QuestionMatrixTemplateComponent, selector: "lib-question-matrix-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionBooleanTemplateComponent, selector: "lib-question-boolean-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionDropdownMultiTemplateComponent, selector: "lib-question-dropdown-multi-template", inputs: ["setQuestion"] }, { kind: "component", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: ["pageId", "questionGroupId", "isPre", "surveyLanguageId", "applicantKey", "setQuestion"] }, { kind: "component", type: QuestionFeedbackTemplateComponent, selector: "lib-question-feedback-template", inputs: ["isArabicLang", "setQuestion", "isDisabled"] }, { kind: "component", type: QuestionInstitutionsTemplateComponent, selector: "lib-question-institutions-template", inputs: ["pageId", "questionGroupId", "isPre", "surveyLanguageId", "applicantKey", "setQuestion"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
1855
2158
  }
1856
2159
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
1857
2160
  type: Component,
1858
- args: [{ selector: 'lib-survery-lib', template: "<div id=\"survery-card-{{surveryLibraryDivId}}\" class=\"survay-card\">\r\n <div [attr.id]=\"'survey-page_'+fCtrls.currentPageId.value\">\r\n <ng-container *ngFor=\"let item of pageQuestionGroups$(); trackBy:questionGroupIdentify\">\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\" [innerHTML]=\"item.questionGroupName\">\r\n </h2>\r\n <span class=\"group-sub-title \" [innerHTML]=\"item.questionGroupDescription\">\r\n </span>\r\n </div>\r\n <ng-container\r\n *ngFor=\"let question of (pageQuestions$() |filterQuestion : item.questionGroupId); trackBy:questionIdentify\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Boolean\">\r\n </lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.TextInput\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-text-template>\r\n\r\n <lib-question-feedback-template #questionFeedTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.FeedBack\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-feedback-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.RadioButton\">\r\n </lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n\r\n <lib-question-dropdown-multi-template [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDownMulti\">\r\n </lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.CheckBox\">\r\n </lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Matrix\">\r\n </lib-question-matrix-template>\r\n\r\n <lib-question-cascade-template #questionCascadeTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Cascade\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\"\r\n [pageId]=\"question.surveyPageId\" [questionGroupId]=\"question.questionGroupId\"></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=\"fCtrls.showedSurveyPages.value.length > 0\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\">\r\n <span>{{ curruntShowedSurveyPages$ | async}}</span>\r\n <span class=\"ms-2 me-2\">{{isArabicLang ? '\u0645\u0646' : 'of'}} </span>\r\n <span>{{fCtrls.showedSurveyPages.value.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"] }]
2161
+ args: [{ selector: 'lib-survery-lib', template: "<div id=\"survery-card-{{surveryLibraryDivId}}\" class=\"survay-card\">\r\n <div [attr.id]=\"'survey-page_'+fCtrls.currentPageId.value\">\r\n <ng-container *ngFor=\"let item of pageQuestionGroups$(); trackBy:questionGroupIdentify\">\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\" [innerHTML]=\"item.questionGroupName\">\r\n </h2>\r\n <span class=\"group-sub-title \" [innerHTML]=\"item.questionGroupDescription\">\r\n </span>\r\n </div>\r\n <ng-container\r\n *ngFor=\"let question of (pageQuestions$() |filterQuestion : item.questionGroupId); trackBy:questionIdentify\">\r\n <lib-question-boolean-template #questionBooleanTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Boolean\">\r\n </lib-question-boolean-template>\r\n\r\n <lib-question-text-template #questionTextTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.TextInput\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-text-template>\r\n\r\n <lib-question-feedback-template #questionFeedTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.FeedBack\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-feedback-template>\r\n\r\n <lib-question-radio-button-template #questionRadioButtonTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.RadioButton\">\r\n </lib-question-radio-button-template>\r\n\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDown\"></lib-question-dropdown-template>\r\n\r\n <lib-question-dropdown-multi-template [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.DropDownMulti\">\r\n </lib-question-dropdown-multi-template>\r\n\r\n <lib-question-check-box-template #questionCheckBoxTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.CheckBox\">\r\n </lib-question-check-box-template>\r\n\r\n <lib-question-matrix-template #questionMatrixTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Matrix\">\r\n </lib-question-matrix-template>\r\n\r\n <lib-question-cascade-template #questionCascadeTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Cascade\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\"\r\n [pageId]=\"question.surveyPageId\" [questionGroupId]=\"question.questionGroupId\"></lib-question-cascade-template>\r\n\r\n <lib-question-institutions-template #questionInstitutionsTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Institutions\"\r\n [applicantKey]=\"applicantKey\" [isPre]=\"isPre\" [surveyLanguageId]=\"surveyLanguageId\"\r\n [pageId]=\"question.surveyPageId\" [questionGroupId]=\"question.questionGroupId\" ></lib-question-institutions-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=\"fCtrls.showedSurveyPages.value.length > 0\">\r\n <div class=\"container\" style=\" justify-content: start;\">\r\n <div class=\"survay-pagination fw-bold\">\r\n <span>{{ curruntShowedSurveyPages$ | async}}</span>\r\n <span class=\"ms-2 me-2\">{{isArabicLang ? '\u0645\u0646' : 'of'}} </span>\r\n <span>{{fCtrls.showedSurveyPages.value.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"] }]
1859
2162
  }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i3.Store }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { isPre: [{
1860
2163
  type: Input
1861
2164
  }], surveyLanguageId: [{
@@ -1909,7 +2212,8 @@ const initialSurveyState = {
1909
2212
  selectedPageId: null,
1910
2213
  questionGroupArr: questionGroupAdapter.getInitialState(),
1911
2214
  questionArr: questionAdapter.getInitialState(),
1912
- ruleArr: ruleAdapter.getInitialState()
2215
+ ruleArr: ruleAdapter.getInitialState(),
2216
+ InstitutionArr: []
1913
2217
  };
1914
2218
  const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSurvey, (state, props) => {
1915
2219
  return {
@@ -1964,6 +2268,29 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
1964
2268
  return {
1965
2269
  ...state
1966
2270
  };
2271
+ }), on(surveyActions.updateInstitutionQuestionAnswer, (state, props) => {
2272
+ const question = selectAll(state.questionArr).find(x => x.questionId == props.questionId);
2273
+ if (question) {
2274
+ var updateModel;
2275
+ if (question.questionType == QuestionTypeEnum.Institutions) {
2276
+ updateModel = {
2277
+ id: props.questionId,
2278
+ changes: {
2279
+ answerId: props.answerId,
2280
+ answerText: props.answer,
2281
+ levelAnswerId: props.levelAnswerId,
2282
+ isValid: props.isValid
2283
+ }
2284
+ };
2285
+ return {
2286
+ ...state,
2287
+ questionArr: questionAdapter.updateOne(updateModel, state.questionArr)
2288
+ };
2289
+ }
2290
+ }
2291
+ return {
2292
+ ...state
2293
+ };
1967
2294
  }), on(surveyActions.updateQuestionShow, (state, props) => {
1968
2295
  return {
1969
2296
  ...state,
@@ -1985,6 +2312,17 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
1985
2312
  }
1986
2313
  }, state.questionArr)
1987
2314
  };
2315
+ }), on(surveyActions.updateQuestionRequired, (state, props) => {
2316
+ const question = selectAll(state.questionArr).find(x => x.questionId == props.questionId);
2317
+ return {
2318
+ ...state,
2319
+ questionArr: questionAdapter.updateOne({
2320
+ id: props.questionId,
2321
+ changes: {
2322
+ isRequired: props.isRequired
2323
+ }
2324
+ }, state.questionArr)
2325
+ };
1988
2326
  }), on(surveyActions.removeQuestion, (state, props) => {
1989
2327
  return {
1990
2328
  ...state,
@@ -1995,6 +2333,11 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
1995
2333
  ...state,
1996
2334
  selectedPageId: props.pageId
1997
2335
  };
2336
+ }), on(surveyActions.loadInstitutionArrSuccess, (state, props) => {
2337
+ return {
2338
+ ...state,
2339
+ InstitutionArr: props.institutionArr
2340
+ };
1998
2341
  }));
1999
2342
  function surveyReducer(state, action) {
2000
2343
  return _surveyReducer(state, action);
@@ -2010,10 +2353,11 @@ var LogicActionEnum;
2010
2353
  })(LogicActionEnum || (LogicActionEnum = {}));
2011
2354
 
2012
2355
  class SurveyEffects {
2013
- constructor(_actions, _store, _checkRuleExpsUsecase) {
2356
+ constructor(_actions, _store, _checkRuleExpsUsecase, _apiService) {
2014
2357
  this._actions = _actions;
2015
2358
  this._store = _store;
2016
2359
  this._checkRuleExpsUsecase = _checkRuleExpsUsecase;
2360
+ this._apiService = _apiService;
2017
2361
  this.updateQuestionAnswer$ = createEffect(() => this._actions.pipe(ofType(surveyActions.updateQuestionAnswer), withLatestFrom(this._store.select(surveySelectors.ruleArr), this._store.select(questionSelectors.allQuestions)), switchMap(([action, ruleArr, questionArr]) => {
2018
2362
  var formatedRuleArr = [];
2019
2363
  ruleArr.forEach(rule => {
@@ -2062,7 +2406,7 @@ class SurveyEffects {
2062
2406
  }
2063
2407
  const question = questionArr.find(x => x.questionId == resultQuestion.questionId);
2064
2408
  //update matrix sub questions
2065
- if (question.questionType == QuestionTypeEnum.Matrix && question.isMatrixGroup == true) {
2409
+ if (question.questionType == QuestionTypeEnum.Matrix && question.isQuestionGroup == true) {
2066
2410
  var subQuestions = questionArr.filter(x => x.parentQuestionId == question.questionId);
2067
2411
  subQuestions.forEach(subQuestion => {
2068
2412
  if (rule.logicActionId == LogicActionEnum.Show) {
@@ -2110,13 +2454,18 @@ class SurveyEffects {
2110
2454
  });
2111
2455
  return of([]);
2112
2456
  })), { dispatch: false });
2457
+ this.loadInstitutionArr$ = createEffect(() => this._actions.pipe(ofType(surveyActions.loadInstitutionArr), withLatestFrom(this._store.select(surveySelectors.institutionArr)), filter(([action, institutionArr]) => institutionArr.length == 0), switchMap(() => {
2458
+ return this._apiService.getAllInstitutions().pipe(map((res) => {
2459
+ return surveyActions.loadInstitutionArrSuccess({ institutionArr: res.responseDetails });
2460
+ }));
2461
+ })));
2113
2462
  }
2114
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyEffects, deps: [{ token: i1$2.Actions }, { token: i3.Store }, { token: CheckRuleExpsUsecase }], target: i0.ɵɵFactoryTarget.Injectable }); }
2463
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyEffects, deps: [{ token: i1$2.Actions }, { token: i3.Store }, { token: CheckRuleExpsUsecase }, { token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2115
2464
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyEffects }); }
2116
2465
  }
2117
2466
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyEffects, decorators: [{
2118
2467
  type: Injectable
2119
- }], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i3.Store }, { type: CheckRuleExpsUsecase }]; } });
2468
+ }], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i3.Store }, { type: CheckRuleExpsUsecase }, { type: ApiService }]; } });
2120
2469
 
2121
2470
  class SurveryLibModule {
2122
2471
  static forRoot(config) {
@@ -2149,7 +2498,8 @@ class SurveryLibModule {
2149
2498
  MaskedForMinMaxDirective,
2150
2499
  FindQuestionPipe,
2151
2500
  QuestionFeedbackTemplateComponent,
2152
- MaskedForMaxLengthDirective], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule, i3.StoreFeatureModule, i1$2.EffectsFeatureModule, RatingModule, PaginationModule], exports: [SurveryLibComponent,
2501
+ MaskedForMaxLengthDirective,
2502
+ QuestionInstitutionsTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule, i3.StoreFeatureModule, i1$2.EffectsFeatureModule, RatingModule, PaginationModule], exports: [SurveryLibComponent,
2153
2503
  StoreModule] }); }
2154
2504
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,
2155
2505
  StoreModule.forFeature('survey-lib', surveyReducer),
@@ -2175,7 +2525,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
2175
2525
  MaskedForMinMaxDirective,
2176
2526
  FindQuestionPipe,
2177
2527
  QuestionFeedbackTemplateComponent,
2178
- MaskedForMaxLengthDirective
2528
+ MaskedForMaxLengthDirective,
2529
+ QuestionInstitutionsTemplateComponent
2179
2530
  ],
2180
2531
  imports: [
2181
2532
  CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,