survery-lib 2.1.7 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/components/question-cascade-template/question-cascade-template.component.mjs +2 -2
- package/esm2022/lib/components/question-institutions-template/question-institutions-template.component.mjs +252 -0
- package/esm2022/lib/core/states/entites/question.entity.mjs +1 -1
- package/esm2022/lib/core/states/survey-store/question-group.selector.mjs +1 -1
- package/esm2022/lib/core/states/survey-store/question.selector.mjs +2 -2
- package/esm2022/lib/core/states/survey-store/survey.action.mjs +9 -1
- package/esm2022/lib/core/states/survey-store/survey.effect.mjs +13 -6
- package/esm2022/lib/core/states/survey-store/survey.reducer.mjs +42 -2
- package/esm2022/lib/core/states/survey-store/survey.selector.mjs +4 -2
- package/esm2022/lib/services/api.service.mjs +21 -2
- package/esm2022/lib/services/survey-lib.service.mjs +32 -5
- package/esm2022/lib/survery-lib.component.mjs +6 -5
- package/esm2022/lib/survery-lib.module.mjs +6 -3
- package/esm2022/shared/dtos/base/result.dto.mjs +2 -0
- package/esm2022/shared/dtos/institution-branch.dto.mjs +2 -0
- package/esm2022/shared/dtos/institution-collage.dto.mjs +2 -0
- package/esm2022/shared/dtos/institution-program.dto.mjs +2 -0
- package/esm2022/shared/dtos/institution-section.dto.mjs +2 -0
- package/esm2022/shared/dtos/institution.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-question.dto.mjs +1 -1
- package/esm2022/shared/dtos/survey-sub-question-level-answer.dto.mjs +2 -0
- package/esm2022/shared/dtos/survey-sub-question-level.dto.mjs +2 -0
- package/esm2022/shared/enums/question-type.enum.mjs +2 -1
- package/esm2022/shared/enums/survey-language.enum.mjs +6 -0
- package/esm2022/shared/form-interfaces/question-Institutions-template.form-interface.mjs +2 -0
- package/fesm2022/survery-lib.mjs +368 -19
- package/fesm2022/survery-lib.mjs.map +1 -1
- package/lib/components/question-institutions-template/question-institutions-template.component.d.ts +44 -0
- package/lib/core/states/entites/question.entity.d.ts +3 -1
- package/lib/core/states/survey-store/survey.action.d.ts +27 -0
- package/lib/core/states/survey-store/survey.effect.d.ts +6 -1
- package/lib/core/states/survey-store/survey.reducer.d.ts +2 -0
- package/lib/core/states/survey-store/survey.selector.d.ts +1 -0
- package/lib/services/api.service.d.ts +22 -0
- package/lib/survery-lib.module.d.ts +10 -9
- package/package.json +1 -1
- package/shared/dtos/base/result.dto.d.ts +6 -0
- package/shared/dtos/institution-branch.dto.d.ts +6 -0
- package/shared/dtos/institution-collage.dto.d.ts +6 -0
- package/shared/dtos/institution-program.dto.d.ts +5 -0
- package/shared/dtos/institution-section.dto.d.ts +6 -0
- package/shared/dtos/institution.dto.d.ts +6 -0
- package/shared/dtos/survey-question.dto.d.ts +3 -0
- package/shared/dtos/survey-sub-question-level-answer.dto.d.ts +20 -0
- package/shared/dtos/survey-sub-question-level.dto.d.ts +19 -0
- package/shared/enums/question-type.enum.d.ts +2 -1
- package/shared/enums/survey-language.enum.d.ts +4 -0
- package/shared/form-interfaces/question-Institutions-template.form-interface.d.ts +30 -0
package/fesm2022/survery-lib.mjs
CHANGED
|
@@ -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';
|
|
@@ -32,6 +32,7 @@ var QuestionTypeEnum;
|
|
|
32
32
|
QuestionTypeEnum[QuestionTypeEnum["DropDownMulti"] = 7] = "DropDownMulti";
|
|
33
33
|
QuestionTypeEnum[QuestionTypeEnum["Cascade"] = 8] = "Cascade";
|
|
34
34
|
QuestionTypeEnum[QuestionTypeEnum["FeedBack"] = 9] = "FeedBack";
|
|
35
|
+
QuestionTypeEnum[QuestionTypeEnum["Institutions"] = 10] = "Institutions";
|
|
35
36
|
})(QuestionTypeEnum || (QuestionTypeEnum = {}));
|
|
36
37
|
|
|
37
38
|
var InputTypeEnum;
|
|
@@ -83,13 +84,15 @@ const isLastPage = createSelector(showedSurveyPages, selectSurveyData$2, (pageAr
|
|
|
83
84
|
return pageArr.findIndex(x => x == state.selectedPageId) == (pageArr.length - 1);
|
|
84
85
|
});
|
|
85
86
|
const ruleArr = createSelector(selectSurveyData$2, (state) => ruleAdapter.getSelectors().selectAll(state.ruleArr));
|
|
87
|
+
const institutionArr = createSelector(selectSurveyData$2, (state) => state.InstitutionArr);
|
|
86
88
|
const surveySelectors = {
|
|
87
89
|
selectedPageId,
|
|
88
90
|
selectedPageIndex,
|
|
89
91
|
showedSurveyPages,
|
|
90
92
|
isFirstPage,
|
|
91
93
|
isLastPage,
|
|
92
|
-
ruleArr
|
|
94
|
+
ruleArr,
|
|
95
|
+
institutionArr
|
|
93
96
|
};
|
|
94
97
|
|
|
95
98
|
function selectQuestionGroupId(a) {
|
|
@@ -110,7 +113,7 @@ const { selectAll: selectAll$1, selectIds: selectIds$1 } = questionAdapter.getSe
|
|
|
110
113
|
const selectSurveyData = createFeatureSelector('survey-lib');
|
|
111
114
|
const allQuestions = createSelector(selectSurveyData, (state) => selectAll$1(state.questionArr));
|
|
112
115
|
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.
|
|
116
|
+
const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(state.questionArr).filter(x => x.isQuestionGroup != true).map(x => {
|
|
114
117
|
return {
|
|
115
118
|
SurveyPageIndex: x.surveyPageId,
|
|
116
119
|
QuestionId: x.questionId,
|
|
@@ -129,18 +132,26 @@ const questionSelectors = {
|
|
|
129
132
|
const loadSurvey = createAction('[Survey library] Load Survey', props());
|
|
130
133
|
const addQuestion = createAction('[Survey library] Add Question', props());
|
|
131
134
|
const updateQuestionAnswer = createAction('[Survey library] Update Question Answer', props());
|
|
135
|
+
const updateInstitutionQuestionAnswer = createAction('[Survey library] Update Institution Question Answer', props());
|
|
132
136
|
const updateQuestionShow = createAction('[Survey library] Update Question Show', props());
|
|
133
137
|
const updateQuestionDisable = createAction('[Survey library] Update Question Disable', props());
|
|
138
|
+
const updateQuestionRequired = createAction('[Survey library] Update Question Required', props());
|
|
134
139
|
const removeQuestion = createAction('[Survey library] Remove Question', props());
|
|
135
140
|
const updatePageId = createAction('[Survey library] Update Page Id', props());
|
|
141
|
+
const loadInstitutionArr = createAction('[Survey library] Load Institution Arr');
|
|
142
|
+
const loadInstitutionArrSuccess = createAction('[Survey library] Load Institution Arr Success', props());
|
|
136
143
|
const surveyActions = {
|
|
137
144
|
loadSurvey,
|
|
138
145
|
addQuestion,
|
|
139
146
|
updateQuestionAnswer,
|
|
147
|
+
updateInstitutionQuestionAnswer,
|
|
140
148
|
updateQuestionShow,
|
|
141
149
|
updateQuestionDisable,
|
|
150
|
+
updateQuestionRequired,
|
|
142
151
|
removeQuestion,
|
|
143
152
|
updatePageId,
|
|
153
|
+
loadInstitutionArr,
|
|
154
|
+
loadInstitutionArrSuccess
|
|
144
155
|
};
|
|
145
156
|
|
|
146
157
|
var EvaluationTypeEnum;
|
|
@@ -219,7 +230,7 @@ class SurveyLibService {
|
|
|
219
230
|
questionId: question.questionId,
|
|
220
231
|
questionType: question.questionTypeId,
|
|
221
232
|
inputTypeId: question.surveyAnswers[0].inputTypeId,
|
|
222
|
-
|
|
233
|
+
isQuestionGroup: question.questionTypeId == QuestionTypeEnum.Matrix || question.questionTypeId == QuestionTypeEnum.Institutions,
|
|
223
234
|
answerId: null,
|
|
224
235
|
answerIdArr: null,
|
|
225
236
|
answerText: null,
|
|
@@ -231,7 +242,8 @@ class SurveyLibService {
|
|
|
231
242
|
isShow_default: question.isVisable,
|
|
232
243
|
questionGroupId: questionGroupId,
|
|
233
244
|
parentQuestionId: null,
|
|
234
|
-
|
|
245
|
+
maxLevelValue: null,
|
|
246
|
+
questionAllInfo: question,
|
|
235
247
|
};
|
|
236
248
|
if (question.questionTypeId == QuestionTypeEnum.FeedBack) {
|
|
237
249
|
if (question.surveyAnswers[0].evaluationTypeId == EvaluationTypeEnum.Stars) {
|
|
@@ -249,7 +261,7 @@ class SurveyLibService {
|
|
|
249
261
|
questionId: subQuestion.questionId,
|
|
250
262
|
questionType: question.questionTypeId,
|
|
251
263
|
inputTypeId: question.surveyAnswers[0].inputTypeId,
|
|
252
|
-
|
|
264
|
+
isQuestionGroup: false,
|
|
253
265
|
answerId: null,
|
|
254
266
|
answerIdArr: null,
|
|
255
267
|
answerText: null,
|
|
@@ -261,7 +273,33 @@ class SurveyLibService {
|
|
|
261
273
|
isShow_default: question.isVisable,
|
|
262
274
|
parentQuestionId: question.questionId,
|
|
263
275
|
questionGroupId: questionGroupId,
|
|
264
|
-
questionAllInfo: question
|
|
276
|
+
questionAllInfo: question,
|
|
277
|
+
maxLevelValue: null
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if (question.questionTypeId == QuestionTypeEnum.Institutions) {
|
|
282
|
+
questionNgrxModel.maxLevelValue = question.maxLevelValue;
|
|
283
|
+
question.surveySubQuestionLevels.forEach(subQuestion => {
|
|
284
|
+
questionArr.push({
|
|
285
|
+
surveyPageId: pageIndex,
|
|
286
|
+
questionId: subQuestion.questionId,
|
|
287
|
+
questionType: question.questionTypeId,
|
|
288
|
+
inputTypeId: question.surveyAnswers[0].inputTypeId,
|
|
289
|
+
isQuestionGroup: false,
|
|
290
|
+
answerId: null,
|
|
291
|
+
answerIdArr: null,
|
|
292
|
+
answerText: null,
|
|
293
|
+
isRequired: subQuestion.level == 1 ? question.isRequired : false,
|
|
294
|
+
isValid: null,
|
|
295
|
+
isDisabled: question.isReadOnly,
|
|
296
|
+
isShow: question.isVisable,
|
|
297
|
+
isDisabled_default: question.isReadOnly,
|
|
298
|
+
isShow_default: question.isVisable,
|
|
299
|
+
parentQuestionId: question.questionId,
|
|
300
|
+
questionGroupId: questionGroupId,
|
|
301
|
+
questionAllInfo: question,
|
|
302
|
+
maxLevelValue: null
|
|
265
303
|
});
|
|
266
304
|
});
|
|
267
305
|
}
|
|
@@ -1429,7 +1467,26 @@ class ApiService {
|
|
|
1429
1467
|
}
|
|
1430
1468
|
getNextQuestion(filter) {
|
|
1431
1469
|
var queryString = $.param(filter);
|
|
1432
|
-
return this._HttpClient.get(`${this.url}/GetNextQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
1470
|
+
return this._HttpClient.get(`${this.url}/Survey/GetNextQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
1471
|
+
}
|
|
1472
|
+
getAllInstitutions() {
|
|
1473
|
+
return this._HttpClient.get(`${this.url}/Institutions/GetAllInstitutions`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
1474
|
+
}
|
|
1475
|
+
getAllBranches(filter) {
|
|
1476
|
+
var queryString = $.param(filter);
|
|
1477
|
+
return this._HttpClient.get(`${this.url}/Institutions/GetBranches?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
1478
|
+
}
|
|
1479
|
+
getAllCollages(filter) {
|
|
1480
|
+
var queryString = $.param(filter);
|
|
1481
|
+
return this._HttpClient.get(`${this.url}/Institutions/GetCollages?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
1482
|
+
}
|
|
1483
|
+
getAllSections(filter) {
|
|
1484
|
+
var queryString = $.param(filter);
|
|
1485
|
+
return this._HttpClient.get(`${this.url}/Institutions/GetSections?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
1486
|
+
}
|
|
1487
|
+
getAllPrograms(filter) {
|
|
1488
|
+
var queryString = $.param(filter);
|
|
1489
|
+
return this._HttpClient.get(`${this.url}/Institutions/Programs?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
|
|
1433
1490
|
}
|
|
1434
1491
|
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
1492
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: ApiService, providedIn: 'root' }); }
|
|
@@ -1534,7 +1591,7 @@ class QuestionCascadeTemplateComponent {
|
|
|
1534
1591
|
questionId: res.questionId,
|
|
1535
1592
|
questionType: res.questionTypeId,
|
|
1536
1593
|
inputTypeId: res.surveyAnswers[0].inputTypeId,
|
|
1537
|
-
|
|
1594
|
+
isQuestionGroup: false,
|
|
1538
1595
|
answerId: null,
|
|
1539
1596
|
answerIdArr: null,
|
|
1540
1597
|
answerText: null,
|
|
@@ -1712,6 +1769,250 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
1712
1769
|
type: Input
|
|
1713
1770
|
}] } });
|
|
1714
1771
|
|
|
1772
|
+
var SurveyLanguageEnum;
|
|
1773
|
+
(function (SurveyLanguageEnum) {
|
|
1774
|
+
SurveyLanguageEnum[SurveyLanguageEnum["Arabic"] = 0] = "Arabic";
|
|
1775
|
+
SurveyLanguageEnum[SurveyLanguageEnum["English"] = 1] = "English";
|
|
1776
|
+
})(SurveyLanguageEnum || (SurveyLanguageEnum = {}));
|
|
1777
|
+
|
|
1778
|
+
class QuestionInstitutionsTemplateComponent {
|
|
1779
|
+
get fCtrls() {
|
|
1780
|
+
return this.rForm.controls;
|
|
1781
|
+
}
|
|
1782
|
+
get questionTypeEnum() {
|
|
1783
|
+
return QuestionTypeEnum;
|
|
1784
|
+
}
|
|
1785
|
+
get questionFormArray() {
|
|
1786
|
+
return this.fCtrls.questionArr;
|
|
1787
|
+
}
|
|
1788
|
+
set setQuestion(value) {
|
|
1789
|
+
if (this.institutionsQuestion == null) {
|
|
1790
|
+
this.institutionsQuestion = value.questionAllInfo;
|
|
1791
|
+
this.rForm.patchValue({
|
|
1792
|
+
id: value.questionId,
|
|
1793
|
+
title: value.questionAllInfo.questionTitle,
|
|
1794
|
+
maxLevelValue: value.questionAllInfo.maxLevelValue,
|
|
1795
|
+
isRequired: value.isRequired,
|
|
1796
|
+
isDisabled: value.isDisabled,
|
|
1797
|
+
isShow: value.isShow
|
|
1798
|
+
});
|
|
1799
|
+
value.questionAllInfo.surveySubQuestionLevels.forEach(surveySubQuestionLevel => {
|
|
1800
|
+
var question = this.pageQuestions$().find(x => x.questionId == value.questionId);
|
|
1801
|
+
this.setQuestionFormGroup(surveySubQuestionLevel, question?.isRequired, question?.answerId);
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
constructor(_Store, _formBuilder, _ApiService) {
|
|
1806
|
+
this._Store = _Store;
|
|
1807
|
+
this._formBuilder = _formBuilder;
|
|
1808
|
+
this._ApiService = _ApiService;
|
|
1809
|
+
this.institutionsQuestion = null;
|
|
1810
|
+
this.pageQuestions$ = this._Store.selectSignal(questionSelectors.pageQuestions);
|
|
1811
|
+
this.institutionsArr$ = this._Store.selectSignal(surveySelectors.institutionArr);
|
|
1812
|
+
this.institutionsQuestionArr = computed(() => {
|
|
1813
|
+
return this.institutionsArr$().map(x => {
|
|
1814
|
+
return {
|
|
1815
|
+
id: x.submissionId,
|
|
1816
|
+
name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.institutionNameArabic : x.institutionNameEnglish
|
|
1817
|
+
};
|
|
1818
|
+
});
|
|
1819
|
+
});
|
|
1820
|
+
this.pageId = null;
|
|
1821
|
+
this.questionGroupId = null;
|
|
1822
|
+
this.isPre = false;
|
|
1823
|
+
this.surveyLanguageId = null;
|
|
1824
|
+
this.applicantKey = null;
|
|
1825
|
+
this.rForm = this._formBuilder.group({
|
|
1826
|
+
id: new FormControl(null),
|
|
1827
|
+
title: new FormControl(null),
|
|
1828
|
+
maxLevelValue: new FormControl(null),
|
|
1829
|
+
isDisabled: new FormControl(false),
|
|
1830
|
+
isShow: new FormControl(false),
|
|
1831
|
+
isRequired: new FormControl(null),
|
|
1832
|
+
institutionId: new FormControl(null),
|
|
1833
|
+
branchId: new FormControl(null),
|
|
1834
|
+
collageId: new FormControl(null),
|
|
1835
|
+
sectionId: new FormControl(null),
|
|
1836
|
+
questionArr: this._formBuilder.array([])
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
ngOnInit() {
|
|
1840
|
+
this._Store.dispatch(surveyActions.loadInstitutionArr());
|
|
1841
|
+
}
|
|
1842
|
+
onUpdateAnswer(model, groupIndex) {
|
|
1843
|
+
var group = this.fCtrls.questionArr.at(groupIndex);
|
|
1844
|
+
group.patchValue({
|
|
1845
|
+
answerId: model.id,
|
|
1846
|
+
answerValue: model.name
|
|
1847
|
+
});
|
|
1848
|
+
this._Store.dispatch(surveyActions.updateInstitutionQuestionAnswer({
|
|
1849
|
+
questionId: group.value.id,
|
|
1850
|
+
answerId: group.value.answerId,
|
|
1851
|
+
answer: group.value.answers,
|
|
1852
|
+
isValid: group.controls.answerId.valid,
|
|
1853
|
+
levelAnswerId: group.value.levelAnswerId,
|
|
1854
|
+
}));
|
|
1855
|
+
}
|
|
1856
|
+
identify(index, item) {
|
|
1857
|
+
return item.value.id;
|
|
1858
|
+
}
|
|
1859
|
+
setQuestionFormGroup(value, isRquired, answerId) {
|
|
1860
|
+
var group = this._formBuilder.group({
|
|
1861
|
+
id: new FormControl(value.questionId),
|
|
1862
|
+
typeId: new FormControl(value.questionTypeId),
|
|
1863
|
+
name: new FormControl(value.questionName),
|
|
1864
|
+
description: new FormControl(value.questionDescription),
|
|
1865
|
+
title: new FormControl(value.questionTitle),
|
|
1866
|
+
level: new FormControl(value.level),
|
|
1867
|
+
levelAnswerId: new FormControl(value.levelAnswer.answerId),
|
|
1868
|
+
answerId: new FormControl(null),
|
|
1869
|
+
answerValue: new FormControl(null),
|
|
1870
|
+
answers: new FormControl([]),
|
|
1871
|
+
});
|
|
1872
|
+
if (isRquired == true) {
|
|
1873
|
+
group.controls.answerId.addValidators([Validators.required]);
|
|
1874
|
+
group.controls.answerId.updateValueAndValidity();
|
|
1875
|
+
group.controls.answerValue.addValidators([Validators.required]);
|
|
1876
|
+
group.controls.answerValue.updateValueAndValidity();
|
|
1877
|
+
}
|
|
1878
|
+
group.controls.answerId.valueChanges.pipe(distinctUntilChanged()).subscribe(answerId => {
|
|
1879
|
+
if (answerId) {
|
|
1880
|
+
if (value.level == 1) {
|
|
1881
|
+
this.rForm.patchValue({
|
|
1882
|
+
institutionId: answerId,
|
|
1883
|
+
branchId: null,
|
|
1884
|
+
collageId: null,
|
|
1885
|
+
sectionId: null
|
|
1886
|
+
}, { emitEvent: false });
|
|
1887
|
+
}
|
|
1888
|
+
else if (value.level == 2) {
|
|
1889
|
+
this.rForm.patchValue({
|
|
1890
|
+
branchId: answerId,
|
|
1891
|
+
collageId: null,
|
|
1892
|
+
sectionId: null
|
|
1893
|
+
}, { emitEvent: false });
|
|
1894
|
+
}
|
|
1895
|
+
else if (value.level == 3) {
|
|
1896
|
+
this.rForm.patchValue({
|
|
1897
|
+
collageId: answerId,
|
|
1898
|
+
sectionId: null
|
|
1899
|
+
}, { emitEvent: false });
|
|
1900
|
+
}
|
|
1901
|
+
else if (value.level == 4) {
|
|
1902
|
+
this.rForm.patchValue({
|
|
1903
|
+
sectionId: answerId
|
|
1904
|
+
}, { emitEvent: false });
|
|
1905
|
+
}
|
|
1906
|
+
const level = group.value.level;
|
|
1907
|
+
this.resetAnswersOfFormGroupinHigherLevel(level);
|
|
1908
|
+
var nextGroupIndex = this.fCtrls.questionArr.controls.findIndex(x => x.value.level == level + 1);
|
|
1909
|
+
if (nextGroupIndex) {
|
|
1910
|
+
this.fillQuestionAnswers(nextGroupIndex);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
});
|
|
1914
|
+
group.controls.answers.valueChanges.pipe(distinctUntilChanged()).subscribe(value => {
|
|
1915
|
+
const groupIndex = this.fCtrls.questionArr.controls.findIndex(x => x.value.level == group.value.level);
|
|
1916
|
+
var questionGroup = this.fCtrls.questionArr.at(groupIndex);
|
|
1917
|
+
if (questionGroup) {
|
|
1918
|
+
if (value.length > 0) {
|
|
1919
|
+
if (this.fCtrls.isRequired.value == true) {
|
|
1920
|
+
questionGroup.controls.answerId.addValidators([Validators.required]);
|
|
1921
|
+
questionGroup.controls.answerValue.addValidators([Validators.required]);
|
|
1922
|
+
this._Store.dispatch(surveyActions.updateQuestionRequired({ questionId: group.value.id, isRequired: true }));
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
else {
|
|
1926
|
+
questionGroup.controls.answerId.clearValidators();
|
|
1927
|
+
questionGroup.controls.answerValue.clearValidators();
|
|
1928
|
+
this._Store.dispatch(surveyActions.updateQuestionRequired({ questionId: group.value.id, isRequired: false }));
|
|
1929
|
+
}
|
|
1930
|
+
questionGroup.controls.answerId.updateValueAndValidity();
|
|
1931
|
+
questionGroup.controls.answerValue.updateValueAndValidity();
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1934
|
+
if (answerId) {
|
|
1935
|
+
group.controls.answerId.setValue(answerId);
|
|
1936
|
+
}
|
|
1937
|
+
this.fCtrls.questionArr.push(group);
|
|
1938
|
+
}
|
|
1939
|
+
fillQuestionAnswers(nextGroupIndex) {
|
|
1940
|
+
const formValue = this.rForm.value;
|
|
1941
|
+
var group = this.fCtrls.questionArr.at(nextGroupIndex);
|
|
1942
|
+
if (group) {
|
|
1943
|
+
if (group.value.level == 2) {
|
|
1944
|
+
this._ApiService.getAllBranches({ submissionId: formValue.institutionId }).pipe(take(1)).subscribe(res => {
|
|
1945
|
+
group.controls.answers.setValue(res.responseDetails.map(x => {
|
|
1946
|
+
return {
|
|
1947
|
+
id: x.branchSubmissionId,
|
|
1948
|
+
name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.branchNameInArabic : x.branchNameInEnglish
|
|
1949
|
+
};
|
|
1950
|
+
}));
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
else if (group.value.level == 3) {
|
|
1954
|
+
this._ApiService.getAllCollages({ submissionId: formValue.branchId, branchSubmissionId: formValue.branchId }).pipe(take(1)).subscribe(res => {
|
|
1955
|
+
group.controls.answers.setValue(res.responseDetails.map(x => {
|
|
1956
|
+
return {
|
|
1957
|
+
id: x.collageSubmissionId,
|
|
1958
|
+
name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.collageNameInArabic : x.collageNameInEnglish
|
|
1959
|
+
};
|
|
1960
|
+
}));
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
else if (group.value.level == 4) {
|
|
1964
|
+
this._ApiService.getAllSections({ submissionId: formValue.collageId, collageSubmissionId: formValue.collageId }).pipe(take(1)).subscribe(res => {
|
|
1965
|
+
group.controls.answers.setValue(res.responseDetails.map(x => {
|
|
1966
|
+
return {
|
|
1967
|
+
id: x.sectionSubmissionId,
|
|
1968
|
+
name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.sectionNameInArabic : x.sectionNameInEnglish
|
|
1969
|
+
};
|
|
1970
|
+
}));
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
else if (group.value.level == 5) {
|
|
1974
|
+
this._ApiService.getAllPrograms({ submissionId: formValue.sectionId, sectionGeneratedKey: formValue.sectionId }).pipe(take(1)).subscribe(res => {
|
|
1975
|
+
group.controls.answers.setValue(res.responseDetails.map(x => {
|
|
1976
|
+
return {
|
|
1977
|
+
id: x.generatedId,
|
|
1978
|
+
name: this.surveyLanguageId == SurveyLanguageEnum.Arabic ? x.programNameArabic : x.programNameEnglish
|
|
1979
|
+
};
|
|
1980
|
+
}));
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
resetAnswersOfFormGroupinHigherLevel(level) {
|
|
1986
|
+
this.fCtrls.questionArr.controls.forEach((group) => {
|
|
1987
|
+
if (group.value.level > level) {
|
|
1988
|
+
group.patchValue({
|
|
1989
|
+
answerId: null,
|
|
1990
|
+
answerValue: null,
|
|
1991
|
+
answers: []
|
|
1992
|
+
}, { emitEvent: false });
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
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 }); }
|
|
1997
|
+
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"] }] }); }
|
|
1998
|
+
}
|
|
1999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionInstitutionsTemplateComponent, decorators: [{
|
|
2000
|
+
type: Component,
|
|
2001
|
+
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" }]
|
|
2002
|
+
}], ctorParameters: function () { return [{ type: i3.Store }, { type: i1.FormBuilder }, { type: ApiService }]; }, propDecorators: { pageId: [{
|
|
2003
|
+
type: Input
|
|
2004
|
+
}], questionGroupId: [{
|
|
2005
|
+
type: Input
|
|
2006
|
+
}], isPre: [{
|
|
2007
|
+
type: Input
|
|
2008
|
+
}], surveyLanguageId: [{
|
|
2009
|
+
type: Input
|
|
2010
|
+
}], applicantKey: [{
|
|
2011
|
+
type: Input
|
|
2012
|
+
}], setQuestion: [{
|
|
2013
|
+
type: Input
|
|
2014
|
+
}] } });
|
|
2015
|
+
|
|
1715
2016
|
class FilterQuestionPipe {
|
|
1716
2017
|
transform(arr, questionGroupId) {
|
|
1717
2018
|
return arr.filter(x => x.questionGroupId == questionGroupId && x.parentQuestionId == null);
|
|
@@ -1820,7 +2121,7 @@ class SurveryLibComponent {
|
|
|
1820
2121
|
var invalidRecords = [];
|
|
1821
2122
|
var arr = questionArr.filter(x => x.isDisabled == false && x.isShow == true);
|
|
1822
2123
|
arr.map(x => {
|
|
1823
|
-
if (x.isRequired == true && x.isValid != true && x.
|
|
2124
|
+
if (x.isRequired == true && x.isValid != true && x.isQuestionGroup != true) {
|
|
1824
2125
|
invalidRecords.push(x);
|
|
1825
2126
|
}
|
|
1826
2127
|
else {
|
|
@@ -1858,11 +2159,11 @@ class SurveryLibComponent {
|
|
|
1858
2159
|
return null;
|
|
1859
2160
|
}
|
|
1860
2161
|
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 }); }
|
|
1861
|
-
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" }] }); }
|
|
2162
|
+
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" }] }); }
|
|
1862
2163
|
}
|
|
1863
2164
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
|
|
1864
2165
|
type: Component,
|
|
1865
|
-
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"] }]
|
|
2166
|
+
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"] }]
|
|
1866
2167
|
}], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i3.Store }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { isPre: [{
|
|
1867
2168
|
type: Input
|
|
1868
2169
|
}], surveyLanguageId: [{
|
|
@@ -1916,7 +2217,8 @@ const initialSurveyState = {
|
|
|
1916
2217
|
selectedPageId: null,
|
|
1917
2218
|
questionGroupArr: questionGroupAdapter.getInitialState(),
|
|
1918
2219
|
questionArr: questionAdapter.getInitialState(),
|
|
1919
|
-
ruleArr: ruleAdapter.getInitialState()
|
|
2220
|
+
ruleArr: ruleAdapter.getInitialState(),
|
|
2221
|
+
InstitutionArr: []
|
|
1920
2222
|
};
|
|
1921
2223
|
const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSurvey, (state, props) => {
|
|
1922
2224
|
return {
|
|
@@ -1971,6 +2273,29 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
|
|
|
1971
2273
|
return {
|
|
1972
2274
|
...state
|
|
1973
2275
|
};
|
|
2276
|
+
}), on(surveyActions.updateInstitutionQuestionAnswer, (state, props) => {
|
|
2277
|
+
const question = selectAll(state.questionArr).find(x => x.questionId == props.questionId);
|
|
2278
|
+
if (question) {
|
|
2279
|
+
var updateModel;
|
|
2280
|
+
if (question.questionType == QuestionTypeEnum.Institutions) {
|
|
2281
|
+
updateModel = {
|
|
2282
|
+
id: props.questionId,
|
|
2283
|
+
changes: {
|
|
2284
|
+
answerId: props.answerId,
|
|
2285
|
+
answerText: props.answer,
|
|
2286
|
+
levelAnswerId: props.levelAnswerId,
|
|
2287
|
+
isValid: props.isValid
|
|
2288
|
+
}
|
|
2289
|
+
};
|
|
2290
|
+
return {
|
|
2291
|
+
...state,
|
|
2292
|
+
questionArr: questionAdapter.updateOne(updateModel, state.questionArr)
|
|
2293
|
+
};
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
return {
|
|
2297
|
+
...state
|
|
2298
|
+
};
|
|
1974
2299
|
}), on(surveyActions.updateQuestionShow, (state, props) => {
|
|
1975
2300
|
return {
|
|
1976
2301
|
...state,
|
|
@@ -1992,6 +2317,17 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
|
|
|
1992
2317
|
}
|
|
1993
2318
|
}, state.questionArr)
|
|
1994
2319
|
};
|
|
2320
|
+
}), on(surveyActions.updateQuestionRequired, (state, props) => {
|
|
2321
|
+
const question = selectAll(state.questionArr).find(x => x.questionId == props.questionId);
|
|
2322
|
+
return {
|
|
2323
|
+
...state,
|
|
2324
|
+
questionArr: questionAdapter.updateOne({
|
|
2325
|
+
id: props.questionId,
|
|
2326
|
+
changes: {
|
|
2327
|
+
isRequired: props.isRequired
|
|
2328
|
+
}
|
|
2329
|
+
}, state.questionArr)
|
|
2330
|
+
};
|
|
1995
2331
|
}), on(surveyActions.removeQuestion, (state, props) => {
|
|
1996
2332
|
return {
|
|
1997
2333
|
...state,
|
|
@@ -2002,6 +2338,11 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
|
|
|
2002
2338
|
...state,
|
|
2003
2339
|
selectedPageId: props.pageId
|
|
2004
2340
|
};
|
|
2341
|
+
}), on(surveyActions.loadInstitutionArrSuccess, (state, props) => {
|
|
2342
|
+
return {
|
|
2343
|
+
...state,
|
|
2344
|
+
InstitutionArr: props.institutionArr
|
|
2345
|
+
};
|
|
2005
2346
|
}));
|
|
2006
2347
|
function surveyReducer(state, action) {
|
|
2007
2348
|
return _surveyReducer(state, action);
|
|
@@ -2017,10 +2358,11 @@ var LogicActionEnum;
|
|
|
2017
2358
|
})(LogicActionEnum || (LogicActionEnum = {}));
|
|
2018
2359
|
|
|
2019
2360
|
class SurveyEffects {
|
|
2020
|
-
constructor(_actions, _store, _checkRuleExpsUsecase) {
|
|
2361
|
+
constructor(_actions, _store, _checkRuleExpsUsecase, _apiService) {
|
|
2021
2362
|
this._actions = _actions;
|
|
2022
2363
|
this._store = _store;
|
|
2023
2364
|
this._checkRuleExpsUsecase = _checkRuleExpsUsecase;
|
|
2365
|
+
this._apiService = _apiService;
|
|
2024
2366
|
this.updateQuestionAnswer$ = createEffect(() => this._actions.pipe(ofType(surveyActions.updateQuestionAnswer), withLatestFrom(this._store.select(surveySelectors.ruleArr), this._store.select(questionSelectors.allQuestions)), switchMap(([action, ruleArr, questionArr]) => {
|
|
2025
2367
|
var formatedRuleArr = [];
|
|
2026
2368
|
ruleArr.forEach(rule => {
|
|
@@ -2069,7 +2411,7 @@ class SurveyEffects {
|
|
|
2069
2411
|
}
|
|
2070
2412
|
const question = questionArr.find(x => x.questionId == resultQuestion.questionId);
|
|
2071
2413
|
//update matrix sub questions
|
|
2072
|
-
if (question.questionType == QuestionTypeEnum.Matrix && question.
|
|
2414
|
+
if (question.questionType == QuestionTypeEnum.Matrix && question.isQuestionGroup == true) {
|
|
2073
2415
|
var subQuestions = questionArr.filter(x => x.parentQuestionId == question.questionId);
|
|
2074
2416
|
subQuestions.forEach(subQuestion => {
|
|
2075
2417
|
if (rule.logicActionId == LogicActionEnum.Show) {
|
|
@@ -2117,13 +2459,18 @@ class SurveyEffects {
|
|
|
2117
2459
|
});
|
|
2118
2460
|
return of([]);
|
|
2119
2461
|
})), { dispatch: false });
|
|
2462
|
+
this.loadInstitutionArr$ = createEffect(() => this._actions.pipe(ofType(surveyActions.loadInstitutionArr), withLatestFrom(this._store.select(surveySelectors.institutionArr)), filter(([action, institutionArr]) => institutionArr.length == 0), switchMap(() => {
|
|
2463
|
+
return this._apiService.getAllInstitutions().pipe(map((res) => {
|
|
2464
|
+
return surveyActions.loadInstitutionArrSuccess({ institutionArr: res.responseDetails });
|
|
2465
|
+
}));
|
|
2466
|
+
})));
|
|
2120
2467
|
}
|
|
2121
|
-
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 }); }
|
|
2468
|
+
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 }); }
|
|
2122
2469
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyEffects }); }
|
|
2123
2470
|
}
|
|
2124
2471
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveyEffects, decorators: [{
|
|
2125
2472
|
type: Injectable
|
|
2126
|
-
}], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i3.Store }, { type: CheckRuleExpsUsecase }]; } });
|
|
2473
|
+
}], ctorParameters: function () { return [{ type: i1$2.Actions }, { type: i3.Store }, { type: CheckRuleExpsUsecase }, { type: ApiService }]; } });
|
|
2127
2474
|
|
|
2128
2475
|
class SurveryLibModule {
|
|
2129
2476
|
static forRoot(config) {
|
|
@@ -2156,7 +2503,8 @@ class SurveryLibModule {
|
|
|
2156
2503
|
MaskedForMinMaxDirective,
|
|
2157
2504
|
FindQuestionPipe,
|
|
2158
2505
|
QuestionFeedbackTemplateComponent,
|
|
2159
|
-
MaskedForMaxLengthDirective
|
|
2506
|
+
MaskedForMaxLengthDirective,
|
|
2507
|
+
QuestionInstitutionsTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule, i3.StoreFeatureModule, i1$2.EffectsFeatureModule, RatingModule, PaginationModule], exports: [SurveryLibComponent,
|
|
2160
2508
|
StoreModule] }); }
|
|
2161
2509
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,
|
|
2162
2510
|
StoreModule.forFeature('survey-lib', surveyReducer),
|
|
@@ -2182,7 +2530,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
2182
2530
|
MaskedForMinMaxDirective,
|
|
2183
2531
|
FindQuestionPipe,
|
|
2184
2532
|
QuestionFeedbackTemplateComponent,
|
|
2185
|
-
MaskedForMaxLengthDirective
|
|
2533
|
+
MaskedForMaxLengthDirective,
|
|
2534
|
+
QuestionInstitutionsTemplateComponent
|
|
2186
2535
|
],
|
|
2187
2536
|
imports: [
|
|
2188
2537
|
CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,
|