survery-lib 2.1.44 → 2.1.46

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.
@@ -33,6 +33,7 @@ var QuestionTypeEnum;
33
33
  QuestionTypeEnum[QuestionTypeEnum["Cascade"] = 8] = "Cascade";
34
34
  QuestionTypeEnum[QuestionTypeEnum["FeedBack"] = 9] = "FeedBack";
35
35
  QuestionTypeEnum[QuestionTypeEnum["Institutions"] = 10] = "Institutions";
36
+ QuestionTypeEnum[QuestionTypeEnum["File"] = 13] = "File";
36
37
  })(QuestionTypeEnum || (QuestionTypeEnum = {}));
37
38
 
38
39
  var InputTypeEnum;
@@ -138,6 +139,10 @@ const allRequiredQuestionsOfCurrentPageDone = createSelector(selectSurveyData, (
138
139
  });
139
140
  const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(state.questionArr)
140
141
  .filter(x => x.isQuestionGroup != true && x.isShow == true).map(x => {
142
+ var answerText = x.answerText;
143
+ if (x.answerText !== null && x.answerText !== undefined) {
144
+ answerText = answerText + "";
145
+ }
141
146
  if (x.questionType == QuestionTypeEnum.Institutions) {
142
147
  return {
143
148
  SurveyPageIndex: x.surveyPageId,
@@ -145,12 +150,26 @@ const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(
145
150
  QuestionName: x.questionAllInfo.questionTitle,
146
151
  QuestionType: x.questionType,
147
152
  AnswerId: x.answerLevelId,
148
- AnswerText: x.answerText,
153
+ AnswerText: answerText,
149
154
  AnswerIdArr: x.answerIdArr,
150
155
  AnswerLevelId: x.answerId,
151
156
  PassedRuleQuestionId: x.passedRuleQuestionId
152
157
  };
153
158
  }
159
+ else if (x.questionType == QuestionTypeEnum.File) {
160
+ return {
161
+ SurveyPageIndex: x.surveyPageId,
162
+ QuestionId: x.questionId,
163
+ QuestionName: x.questionAllInfo.questionTitle,
164
+ QuestionType: x.questionType,
165
+ AnswerId: x.answerId,
166
+ AnswerText: answerText,
167
+ AnswerIdArr: x.answerIdArr,
168
+ AnswerLevelId: x.answerLevelId,
169
+ AnswerFile: x.answerFile,
170
+ PassedRuleQuestionId: x.passedRuleQuestionId
171
+ };
172
+ }
154
173
  else {
155
174
  return {
156
175
  SurveyPageIndex: x.surveyPageId,
@@ -158,27 +177,26 @@ const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(
158
177
  QuestionName: x.questionAllInfo.questionTitle,
159
178
  QuestionType: x.questionType,
160
179
  AnswerId: x.answerId,
161
- AnswerText: x.answerText,
180
+ AnswerText: answerText,
162
181
  AnswerIdArr: x.answerIdArr,
163
182
  AnswerLevelId: x.answerLevelId,
164
183
  PassedRuleQuestionId: x.passedRuleQuestionId
165
184
  };
166
185
  }
167
- })
168
- // .filter(res => {
169
- // if (res.PassedRuleQuestionId !== null && res.PassedRuleQuestionId !== undefined) {
170
- // var passedRuleQuestion = selectAll(state.questionArr).find(x => x.questionId == res.PassedRuleQuestionId);
171
- // if (passedRuleQuestion) {
172
- // const hasAnswerId = res.AnswerId !== null && res.AnswerId !== undefined;
173
- // const hasAnswerText = res.AnswerText !== null && res.AnswerText !== undefined && res.AnswerText !== '';
174
- // const hasAnswerIdArr = Array.isArray(res.AnswerIdArr) && res.AnswerIdArr?.length > 0;
175
- // return hasAnswerId || hasAnswerText || hasAnswerIdArr;
176
- // }
177
- // }
178
- // // Keep the item if at least one of them has a valid value
179
- // return true;
180
- // })
181
- );
186
+ }).filter(res => {
187
+ if (res.PassedRuleQuestionId !== null && res.PassedRuleQuestionId !== undefined) {
188
+ var passedRuleQuestion = selectAll$1(state.questionArr).find(x => x.questionId == res.PassedRuleQuestionId);
189
+ if (passedRuleQuestion) {
190
+ const hasAnswerId = res.AnswerId !== null && res.AnswerId !== undefined;
191
+ const hasAnswerText = res.AnswerText !== null && res.AnswerText !== undefined && res.AnswerText !== '';
192
+ const hasAnswerIdArr = Array.isArray(res.AnswerIdArr) && res.AnswerIdArr?.length > 0;
193
+ const hasAnswerFile = res.AnswerFile !== null && res.AnswerFile !== undefined;
194
+ return hasAnswerId || hasAnswerText || hasAnswerIdArr || hasAnswerFile;
195
+ }
196
+ }
197
+ // Keep the item if at least one of them has a valid value
198
+ return true;
199
+ }));
182
200
  const questionSelectors = {
183
201
  allQuestions,
184
202
  pageQuestions,
@@ -189,6 +207,7 @@ const questionSelectors = {
189
207
  const loadSurvey = createAction('[Survey library] Load Survey', props());
190
208
  const addQuestion = createAction('[Survey library] Add Question', props());
191
209
  const updateQuestionAnswer = createAction('[Survey library] Update Question Answer', props());
210
+ const updateQuestionFileAnswer = createAction('[Survey library] Update Question Answer', props());
192
211
  const updateInstitutionQuestionAnswer = createAction('[Survey library] Update Institution Question Answer', props());
193
212
  const updateQuestionShow = createAction('[Survey library] Update Question Show', props());
194
213
  const updateQuestionsShow = createAction('[Survey library] Update Questions Show', props());
@@ -204,6 +223,7 @@ const surveyActions = {
204
223
  loadSurvey,
205
224
  addQuestion,
206
225
  updateQuestionAnswer,
226
+ updateQuestionFileAnswer,
207
227
  updateInstitutionQuestionAnswer,
208
228
  updateQuestionShow,
209
229
  updateQuestionsShow,
@@ -309,6 +329,7 @@ class SurveyLibService {
309
329
  answerId: null,
310
330
  answerIdArr: null,
311
331
  answerText: null,
332
+ answerFile: null,
312
333
  isRequired: question.isRequired,
313
334
  isValid: null,
314
335
  isDisabled: question.isReadOnly,
@@ -341,6 +362,7 @@ class SurveyLibService {
341
362
  answerId: null,
342
363
  answerIdArr: null,
343
364
  answerText: null,
365
+ answerFile: null,
344
366
  isRequired: question.isRequired,
345
367
  isValid: null,
346
368
  order: question.order,
@@ -367,6 +389,7 @@ class SurveyLibService {
367
389
  answerId: null,
368
390
  answerIdArr: null,
369
391
  answerText: null,
392
+ answerFile: null,
370
393
  isRequired: subQuestion.level == 1 ? question.isRequired : false,
371
394
  isValid: null,
372
395
  isDisabled: question.isReadOnly,
@@ -1749,6 +1772,7 @@ class QuestionCascadeTemplateComponent {
1749
1772
  answerId: null,
1750
1773
  answerIdArr: null,
1751
1774
  answerText: null,
1775
+ answerFile: null,
1752
1776
  isRequired: res.isRequired,
1753
1777
  isValid: null,
1754
1778
  order: res.order,
@@ -1830,6 +1854,7 @@ class QuestionCascadeTemplateComponent {
1830
1854
  answerId: null,
1831
1855
  answerIdArr: null,
1832
1856
  answerText: null,
1857
+ answerFile: null,
1833
1858
  isRequired: res.isRequired,
1834
1859
  order: res.order,
1835
1860
  isValid: null,
@@ -2246,6 +2271,158 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
2246
2271
  type: Input
2247
2272
  }] } });
2248
2273
 
2274
+ class QuestionFileTemplateComponent {
2275
+ get fCtrls() {
2276
+ return this.rForm.controls;
2277
+ }
2278
+ get questionTypeEnum() {
2279
+ return QuestionTypeEnum;
2280
+ }
2281
+ set setQuestion(value) {
2282
+ if (!this.surveyQuestion) {
2283
+ this.surveyQuestion = value.questionAllInfo;
2284
+ this.rForm.patchValue({
2285
+ id: value.questionId,
2286
+ name: value.questionAllInfo.questionName,
2287
+ title: value.questionAllInfo.questionTitle,
2288
+ typeId: value.questionAllInfo.questionTypeId,
2289
+ description: value.questionAllInfo.questionDescription,
2290
+ isDisabled: value.questionAllInfo.isReadOnly,
2291
+ isShow: value.questionAllInfo.isVisable
2292
+ });
2293
+ if (value.isShow == true) {
2294
+ this.fCtrls.isShow.setValue(value.isShow);
2295
+ }
2296
+ if (value.questionAllInfo.surveyAnswers[0]?.answerId != null && value.questionAllInfo.surveyAnswers[0]?.answerId != undefined) {
2297
+ this.fCtrls.surveyAnswerId.setValue(value.questionAllInfo.surveyAnswers[0].answerId);
2298
+ }
2299
+ if (value.isRequired == true) {
2300
+ this.fCtrls.fileName.addValidators([Validators.required]);
2301
+ this.fCtrls.fileName.updateValueAndValidity();
2302
+ }
2303
+ var question = this.questionArr().find(x => x.questionId == value.questionId);
2304
+ if (question?.answerText) {
2305
+ this.rForm.patchValue({
2306
+ fileName: question.answerText,
2307
+ isDisabled: question.isDisabled,
2308
+ isShow: question.isShow
2309
+ }, { emitEvent: false });
2310
+ }
2311
+ this.toggleEnableAnswer(value.questionAllInfo.isReadOnly);
2312
+ }
2313
+ }
2314
+ set isDisabled(value) {
2315
+ this.toggleEnableAnswer(value);
2316
+ }
2317
+ constructor(_formBuilder, _surveyLibService, _Store) {
2318
+ this._formBuilder = _formBuilder;
2319
+ this._surveyLibService = _surveyLibService;
2320
+ this._Store = _Store;
2321
+ this.questionArr = this._Store.selectSignal(questionSelectors.pageQuestions);
2322
+ this.isArabicLang = false;
2323
+ // Define maximum size in bytes (e.g., 5MB = 5 * 1024 * 1024)
2324
+ this.MAX_FILE_SIZE = 10 * 1024 * 1024;
2325
+ this.rForm = this._formBuilder.group({
2326
+ id: new FormControl(null),
2327
+ name: new FormControl(null),
2328
+ title: new FormControl(null),
2329
+ typeId: new FormControl(null),
2330
+ description: new FormControl(null),
2331
+ surveyAnswerId: new FormControl(null),
2332
+ file: new FormControl(null),
2333
+ fileName: new FormControl(null),
2334
+ isDisabled: new FormControl(false),
2335
+ isShow: new FormControl(true),
2336
+ });
2337
+ }
2338
+ ngOnInit() {
2339
+ this.fCtrls.file.valueChanges.pipe().pipe(debounceTime(200), distinctUntilChanged()).subscribe(value => {
2340
+ setTimeout(() => {
2341
+ const formValue = this.rForm.value;
2342
+ this._Store.dispatch(surveyActions.updateQuestionFileAnswer({
2343
+ questionId: formValue.id,
2344
+ fileByteArr: formValue.file,
2345
+ fileName: formValue.fileName,
2346
+ isValid: this.fCtrls.file.valid
2347
+ }));
2348
+ }, 100);
2349
+ });
2350
+ this._Store.select(questionSelectors.pageQuestions).pipe(map(arr => arr.find(x => x.questionId == this.fCtrls.id.value)))
2351
+ .pipe(filter(x => x != null), pairwise()).subscribe(value => {
2352
+ const oldValue = value[0];
2353
+ const newValue = value[1];
2354
+ //updated answer
2355
+ if (oldValue?.answerText != newValue?.answerText && oldValue?.answerText == null) {
2356
+ this.fCtrls.fileName.setValue(newValue?.answerText, { emitEvent: false });
2357
+ }
2358
+ //updated isDisabled
2359
+ if (oldValue?.isDisabled != newValue?.isDisabled) {
2360
+ this.fCtrls.isDisabled.setValue(newValue?.isDisabled);
2361
+ }
2362
+ //updated isShow
2363
+ if (oldValue?.isShow != newValue?.isShow) {
2364
+ this.fCtrls.isShow.setValue(newValue?.isShow);
2365
+ if (newValue?.isShow == false) {
2366
+ this.fCtrls.file.setValue(null);
2367
+ this.fCtrls.fileName.setValue(null);
2368
+ }
2369
+ }
2370
+ });
2371
+ }
2372
+ convertToFormControl(element) {
2373
+ return element;
2374
+ }
2375
+ onFileSelect(event) {
2376
+ const input = event.target;
2377
+ if (input.files && input.files.length > 0) {
2378
+ const file = input.files[0];
2379
+ if (file.size > this.MAX_FILE_SIZE) {
2380
+ // Exceeds max length/size
2381
+ alert('File size exceeds the 10MB limit.');
2382
+ // Reset the form control value
2383
+ this.fCtrls.file.setValue(null);
2384
+ this.fCtrls.fileName.setValue(null);
2385
+ input.value = ''; // Clear native input
2386
+ }
2387
+ else {
2388
+ const reader = new FileReader();
2389
+ // Read the file as a Data URL (Base64)
2390
+ reader.readAsDataURL(file);
2391
+ reader.onload = () => {
2392
+ const base64Result = reader.result;
2393
+ // Strip the Data URL prefix (e.g., "data:image/png;base64,") to leave raw Base64 data
2394
+ const base64Data = base64Result.split(',')[1];
2395
+ this.rForm.patchValue({
2396
+ file: base64Data,
2397
+ fileName: file.name
2398
+ });
2399
+ };
2400
+ }
2401
+ }
2402
+ }
2403
+ toggleEnableAnswer(isReadOnly) {
2404
+ if (isReadOnly == true) {
2405
+ this.fCtrls.file.disable();
2406
+ }
2407
+ else {
2408
+ this.fCtrls.file.enable();
2409
+ }
2410
+ this.fCtrls.file.updateValueAndValidity();
2411
+ }
2412
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionFileTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }, { token: i3.Store }], target: i0.ɵɵFactoryTarget.Component }); }
2413
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionFileTemplateComponent, selector: "lib-question-file-template", inputs: { isArabicLang: "isArabicLang", setQuestion: "setQuestion", isDisabled: "isDisabled" }, ngImport: i0, template: "<div class=\"quastion\" [formGroup]=\"rForm\" [attr.id]=\"'question_'+fCtrls.id.value\"\r\n [ngClass]=\"{'invalid-question': fCtrls.fileName.invalid , 'd-none':fCtrls.isShow.value != true}\">\r\n <h3 class=\"quastion-title \">\r\n <span [innerHTML]=\"surveyQuestion?.questionTitle\"></span>\r\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\r\n </h3>\r\n <div class=\"text-quastion\">\r\n <input class=\"form-control\" [disabled]=\"isDisabled\"\r\n type=\"file\" type=\"file\" (change)=\"onFileSelect($event)\">\r\n </div>", styles: [""], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] }); }
2414
+ }
2415
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionFileTemplateComponent, decorators: [{
2416
+ type: Component,
2417
+ args: [{ selector: 'lib-question-file-template', template: "<div class=\"quastion\" [formGroup]=\"rForm\" [attr.id]=\"'question_'+fCtrls.id.value\"\r\n [ngClass]=\"{'invalid-question': fCtrls.fileName.invalid , 'd-none':fCtrls.isShow.value != true}\">\r\n <h3 class=\"quastion-title \">\r\n <span [innerHTML]=\"surveyQuestion?.questionTitle\"></span>\r\n <span style=\"color: red;\" *ngIf=\"surveyQuestion.isRequired\">*</span>\r\n </h3>\r\n <div class=\"text-quastion\">\r\n <input class=\"form-control\" [disabled]=\"isDisabled\"\r\n type=\"file\" type=\"file\" (change)=\"onFileSelect($event)\">\r\n </div>" }]
2418
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }, { type: i3.Store }]; }, propDecorators: { isArabicLang: [{
2419
+ type: Input
2420
+ }], setQuestion: [{
2421
+ type: Input
2422
+ }], isDisabled: [{
2423
+ type: Input
2424
+ }] } });
2425
+
2249
2426
  class FilterQuestionPipe {
2250
2427
  transform(arr, questionGroupId) {
2251
2428
  return arr.filter(x => x.questionGroupId == questionGroupId && x.parentQuestionId == null)
@@ -2395,11 +2572,11 @@ class SurveryLibComponent {
2395
2572
  return null;
2396
2573
  }
2397
2574
  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 }); }
2398
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", inputs: { isPre: "isPre", surveyLanguageId: "surveyLanguageId", surveyKey: "surveyKey", 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\" [applicantKey]=\"applicantKey\" [isPre]=\"isPre\"\r\n [surveyLanguageId]=\"surveyLanguageId\" [pageId]=\"question.surveyPageId\"\r\n [questionGroupId]=\"question.questionGroupId\" [surveyKey]=\"surveyKey\"\r\n [surveyLanguageId]=\"surveyLanguageId\"></lib-question-cascade-template>\r\n\r\n <lib-question-institutions-template #questionInstitutionsTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Institutions\"\r\n [isArabicLang]=\"isArabicLang\"></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", "surveyKey", "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: ["isArabicLang", "setQuestion"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
2575
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: SurveryLibComponent, selector: "lib-survery-lib", inputs: { isPre: "isPre", surveyLanguageId: "surveyLanguageId", surveyKey: "surveyKey", 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\" [applicantKey]=\"applicantKey\" [isPre]=\"isPre\"\r\n [surveyLanguageId]=\"surveyLanguageId\" [pageId]=\"question.surveyPageId\"\r\n [questionGroupId]=\"question.questionGroupId\" [surveyKey]=\"surveyKey\"\r\n [surveyLanguageId]=\"surveyLanguageId\"></lib-question-cascade-template>\r\n\r\n <lib-question-institutions-template #questionInstitutionsTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Institutions\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-institutions-template>\r\n\r\n <lib-question-file-template #questionFileTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.File\">\r\n </lib-question-file-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", "surveyKey", "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: ["isArabicLang", "setQuestion"] }, { kind: "component", type: QuestionFileTemplateComponent, selector: "lib-question-file-template", inputs: ["isArabicLang", "setQuestion", "isDisabled"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: FilterQuestionPipe, name: "filterQuestion" }] }); }
2399
2576
  }
2400
2577
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
2401
2578
  type: Component,
2402
- 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\" [applicantKey]=\"applicantKey\" [isPre]=\"isPre\"\r\n [surveyLanguageId]=\"surveyLanguageId\" [pageId]=\"question.surveyPageId\"\r\n [questionGroupId]=\"question.questionGroupId\" [surveyKey]=\"surveyKey\"\r\n [surveyLanguageId]=\"surveyLanguageId\"></lib-question-cascade-template>\r\n\r\n <lib-question-institutions-template #questionInstitutionsTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Institutions\"\r\n [isArabicLang]=\"isArabicLang\"></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"] }]
2579
+ 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\" [applicantKey]=\"applicantKey\" [isPre]=\"isPre\"\r\n [surveyLanguageId]=\"surveyLanguageId\" [pageId]=\"question.surveyPageId\"\r\n [questionGroupId]=\"question.questionGroupId\" [surveyKey]=\"surveyKey\"\r\n [surveyLanguageId]=\"surveyLanguageId\"></lib-question-cascade-template>\r\n\r\n <lib-question-institutions-template #questionInstitutionsTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.Institutions\"\r\n [isArabicLang]=\"isArabicLang\"></lib-question-institutions-template>\r\n\r\n <lib-question-file-template #questionFileTemplate [setQuestion]=\"question\"\r\n *ngIf=\"question.questionType == questionTypeEnum.File\">\r\n </lib-question-file-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"] }]
2403
2580
  }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i3.Store }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { isPre: [{
2404
2581
  type: Input
2405
2582
  }], surveyLanguageId: [{
@@ -2512,6 +2689,29 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
2512
2689
  return {
2513
2690
  ...state
2514
2691
  };
2692
+ }), on(surveyActions.updateQuestionFileAnswer, (state, props) => {
2693
+ const question = selectAll(state.questionArr).find(x => x.questionId == props.questionId);
2694
+ if (question) {
2695
+ var updateModel;
2696
+ if (question.questionType == QuestionTypeEnum.File) {
2697
+ updateModel = {
2698
+ id: props.questionId,
2699
+ changes: {
2700
+ answerId: question.questionAllInfo.surveyAnswers[0].answerId,
2701
+ answerText: props.fileName,
2702
+ answerFile: props.fileByteArr,
2703
+ isValid: props.isValid
2704
+ }
2705
+ };
2706
+ }
2707
+ return {
2708
+ ...state,
2709
+ questionArr: questionAdapter.updateOne(updateModel, state.questionArr)
2710
+ };
2711
+ }
2712
+ return {
2713
+ ...state
2714
+ };
2515
2715
  }), on(surveyActions.updateInstitutionQuestionAnswer, (state, props) => {
2516
2716
  const question = selectAll(state.questionArr).find(x => x.questionId == props.questionId);
2517
2717
  if (question) {
@@ -2808,7 +3008,8 @@ class SurveryLibModule {
2808
3008
  FindQuestionPipe,
2809
3009
  QuestionFeedbackTemplateComponent,
2810
3010
  MaskedForMaxLengthDirective,
2811
- QuestionInstitutionsTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule, i3.StoreFeatureModule, i1$2.EffectsFeatureModule, RatingModule, PaginationModule], exports: [SurveryLibComponent,
3011
+ QuestionInstitutionsTemplateComponent,
3012
+ QuestionFileTemplateComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule, i3.StoreFeatureModule, i1$2.EffectsFeatureModule, RatingModule, PaginationModule], exports: [SurveryLibComponent,
2812
3013
  StoreModule] }); }
2813
3014
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,
2814
3015
  StoreModule.forFeature('survey-lib', surveyReducer),
@@ -2835,7 +3036,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
2835
3036
  FindQuestionPipe,
2836
3037
  QuestionFeedbackTemplateComponent,
2837
3038
  MaskedForMaxLengthDirective,
2838
- QuestionInstitutionsTemplateComponent
3039
+ QuestionInstitutionsTemplateComponent,
3040
+ QuestionFileTemplateComponent
2839
3041
  ],
2840
3042
  imports: [
2841
3043
  CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,