survery-lib 2.1.45 → 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;
@@ -155,6 +156,20 @@ const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(
155
156
  PassedRuleQuestionId: x.passedRuleQuestionId
156
157
  };
157
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
+ }
158
173
  else {
159
174
  return {
160
175
  SurveyPageIndex: x.surveyPageId,
@@ -175,7 +190,8 @@ const questionAnswers = createSelector(selectSurveyData, (state) => selectAll$1(
175
190
  const hasAnswerId = res.AnswerId !== null && res.AnswerId !== undefined;
176
191
  const hasAnswerText = res.AnswerText !== null && res.AnswerText !== undefined && res.AnswerText !== '';
177
192
  const hasAnswerIdArr = Array.isArray(res.AnswerIdArr) && res.AnswerIdArr?.length > 0;
178
- return hasAnswerId || hasAnswerText || hasAnswerIdArr;
193
+ const hasAnswerFile = res.AnswerFile !== null && res.AnswerFile !== undefined;
194
+ return hasAnswerId || hasAnswerText || hasAnswerIdArr || hasAnswerFile;
179
195
  }
180
196
  }
181
197
  // Keep the item if at least one of them has a valid value
@@ -191,6 +207,7 @@ const questionSelectors = {
191
207
  const loadSurvey = createAction('[Survey library] Load Survey', props());
192
208
  const addQuestion = createAction('[Survey library] Add Question', props());
193
209
  const updateQuestionAnswer = createAction('[Survey library] Update Question Answer', props());
210
+ const updateQuestionFileAnswer = createAction('[Survey library] Update Question Answer', props());
194
211
  const updateInstitutionQuestionAnswer = createAction('[Survey library] Update Institution Question Answer', props());
195
212
  const updateQuestionShow = createAction('[Survey library] Update Question Show', props());
196
213
  const updateQuestionsShow = createAction('[Survey library] Update Questions Show', props());
@@ -206,6 +223,7 @@ const surveyActions = {
206
223
  loadSurvey,
207
224
  addQuestion,
208
225
  updateQuestionAnswer,
226
+ updateQuestionFileAnswer,
209
227
  updateInstitutionQuestionAnswer,
210
228
  updateQuestionShow,
211
229
  updateQuestionsShow,
@@ -311,6 +329,7 @@ class SurveyLibService {
311
329
  answerId: null,
312
330
  answerIdArr: null,
313
331
  answerText: null,
332
+ answerFile: null,
314
333
  isRequired: question.isRequired,
315
334
  isValid: null,
316
335
  isDisabled: question.isReadOnly,
@@ -343,6 +362,7 @@ class SurveyLibService {
343
362
  answerId: null,
344
363
  answerIdArr: null,
345
364
  answerText: null,
365
+ answerFile: null,
346
366
  isRequired: question.isRequired,
347
367
  isValid: null,
348
368
  order: question.order,
@@ -369,6 +389,7 @@ class SurveyLibService {
369
389
  answerId: null,
370
390
  answerIdArr: null,
371
391
  answerText: null,
392
+ answerFile: null,
372
393
  isRequired: subQuestion.level == 1 ? question.isRequired : false,
373
394
  isValid: null,
374
395
  isDisabled: question.isReadOnly,
@@ -1751,6 +1772,7 @@ class QuestionCascadeTemplateComponent {
1751
1772
  answerId: null,
1752
1773
  answerIdArr: null,
1753
1774
  answerText: null,
1775
+ answerFile: null,
1754
1776
  isRequired: res.isRequired,
1755
1777
  isValid: null,
1756
1778
  order: res.order,
@@ -1832,6 +1854,7 @@ class QuestionCascadeTemplateComponent {
1832
1854
  answerId: null,
1833
1855
  answerIdArr: null,
1834
1856
  answerText: null,
1857
+ answerFile: null,
1835
1858
  isRequired: res.isRequired,
1836
1859
  order: res.order,
1837
1860
  isValid: null,
@@ -2248,6 +2271,158 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
2248
2271
  type: Input
2249
2272
  }] } });
2250
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
+
2251
2426
  class FilterQuestionPipe {
2252
2427
  transform(arr, questionGroupId) {
2253
2428
  return arr.filter(x => x.questionGroupId == questionGroupId && x.parentQuestionId == null)
@@ -2397,11 +2572,11 @@ class SurveryLibComponent {
2397
2572
  return null;
2398
2573
  }
2399
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 }); }
2400
- 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" }] }); }
2401
2576
  }
2402
2577
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibComponent, decorators: [{
2403
2578
  type: Component,
2404
- 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"] }]
2405
2580
  }], ctorParameters: function () { return [{ type: SurveyLibService }, { type: i3.Store }, { type: i1.FormBuilder }, { type: CheckRuleExpsUsecase }]; }, propDecorators: { isPre: [{
2406
2581
  type: Input
2407
2582
  }], surveyLanguageId: [{
@@ -2514,6 +2689,29 @@ const _surveyReducer = createReducer(initialSurveyState, on(surveyActions.loadSu
2514
2689
  return {
2515
2690
  ...state
2516
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
+ };
2517
2715
  }), on(surveyActions.updateInstitutionQuestionAnswer, (state, props) => {
2518
2716
  const question = selectAll(state.questionArr).find(x => x.questionId == props.questionId);
2519
2717
  if (question) {
@@ -2810,7 +3008,8 @@ class SurveryLibModule {
2810
3008
  FindQuestionPipe,
2811
3009
  QuestionFeedbackTemplateComponent,
2812
3010
  MaskedForMaxLengthDirective,
2813
- 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,
2814
3013
  StoreModule] }); }
2815
3014
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: SurveryLibModule, imports: [CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,
2816
3015
  StoreModule.forFeature('survey-lib', surveyReducer),
@@ -2837,7 +3036,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
2837
3036
  FindQuestionPipe,
2838
3037
  QuestionFeedbackTemplateComponent,
2839
3038
  MaskedForMaxLengthDirective,
2840
- QuestionInstitutionsTemplateComponent
3039
+ QuestionInstitutionsTemplateComponent,
3040
+ QuestionFileTemplateComponent
2841
3041
  ],
2842
3042
  imports: [
2843
3043
  CommonModule, HttpClientModule, ReactiveFormsModule, FormsModule, NgSelectModule,