survery-lib 2.1.27 → 2.1.29

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.
@@ -12,6 +12,7 @@ import { CommonModule } from '@angular/common';
12
12
  import { SubSink } from 'subsink';
13
13
  import * as i5 from '@ng-select/ng-select';
14
14
  import { NgSelectModule } from '@ng-select/ng-select';
15
+ import { InputTypeEnum as InputTypeEnum$1 } from 'projects/survery-lib/src/shared/enums/input-type.enum';
15
16
  import * as i1$1 from '@angular/common/http';
16
17
  import { HttpHeaders, HttpClientModule } from '@angular/common/http';
17
18
  import * as i5$1 from 'ngx-bootstrap/rating';
@@ -1123,12 +1124,13 @@ class QuestionDropdownTemplateComponent {
1123
1124
  this._Store.dispatch(surveyActions.updateQuestionAnswer({
1124
1125
  questionId: formValue.id,
1125
1126
  answer: value,
1126
- isValid: this.fCtrls.answer.valid
1127
+ isValid: this.fCtrls.answer.valid,
1127
1128
  }));
1128
1129
  this.emitter.emit({
1129
1130
  QuestionId: formValue.id,
1130
1131
  IsValid: this.fCtrls.answer.valid,
1131
- Answer: value
1132
+ Answer: value,
1133
+ SurveyAnswerId: this.fCtrls.answer.value
1132
1134
  });
1133
1135
  });
1134
1136
  this.subs.sink = this._Store.select(questionSelectors.pageQuestions).pipe(map(arr => arr.find(x => x.questionId == this.fCtrls.id.value)))
@@ -1504,6 +1506,10 @@ class ApiService {
1504
1506
  var queryString = $.param(filter);
1505
1507
  return this._HttpClient.get(`${this.url}/Survey/GetNextQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1506
1508
  }
1509
+ getIsOtherQuestion(filter) {
1510
+ var queryString = $.param(filter);
1511
+ return this._HttpClient.get(`${this.url}/Survey/GetIsOtherQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1512
+ }
1507
1513
  getAllInstitutions() {
1508
1514
  return this._HttpClient.get(`${this.url}/Institutions/GetAllInstitutions`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1509
1515
  }
@@ -1618,35 +1624,117 @@ class QuestionCascadeTemplateComponent {
1618
1624
  }
1619
1625
  }
1620
1626
  if (model.Answer) {
1621
- this._ApiService.getNextQuestion({
1622
- answerId: model.Answer,
1623
- applicantKey: this.applicantKey,
1624
- isPre: this.isPre,
1625
- surveyLanguageId: this.surveyLanguageId
1626
- }).subscribe(res => {
1627
- if (res.errors.filter(x => x.code == 17).length == 0) {
1628
- this._Store.dispatch(surveyActions.addQuestion({ question: {
1629
- surveyPageId: this.pageId,
1627
+ var selectedAnswerObj = this.surveyQuestionArr
1628
+ .find(x => x.questionId == model.QuestionId)?.surveyAnswers.find(x => x.answerId === model.SurveyAnswerId);
1629
+ if (selectedAnswerObj?.isOther == true) {
1630
+ this._ApiService.getIsOtherQuestion({
1631
+ parentQId: model.QuestionId,
1632
+ groupId: this.questionGroupId
1633
+ }).subscribe(res => {
1634
+ if (res.errors.filter(x => x.code == 17).length == 0) {
1635
+ res.questionTypeId = QuestionTypeEnum.TextInput;
1636
+ this._Store.dispatch(surveyActions.addQuestion({
1637
+ question: {
1638
+ surveyPageId: this.pageId,
1639
+ questionId: res.questionId,
1640
+ questionType: res.questionTypeId,
1641
+ inputTypeId: InputTypeEnum$1.Text,
1642
+ isQuestionGroup: false,
1643
+ answerId: null,
1644
+ answerIdArr: null,
1645
+ answerText: null,
1646
+ isRequired: res.isRequired,
1647
+ isValid: null,
1648
+ isDisabled: res.isReadOnly,
1649
+ isShow: res.isVisable,
1650
+ isDisabled_default: res.isReadOnly,
1651
+ isShow_default: res.isVisable,
1652
+ questionGroupId: this.questionGroupId,
1653
+ parentQuestionId: model.QuestionId,
1654
+ questionAllInfo: {
1655
+ questionId: res.questionId,
1656
+ questionTypeId: res.questionTypeId,
1657
+ questionName: res.questionName,
1658
+ questionTitle: res.questionTitle,
1659
+ questionDescription: res.questionDescription,
1660
+ isRequired: res.isRequired,
1661
+ isVisable: res.isVisable,
1662
+ isEditable: res.isEditable,
1663
+ isOTPOption: res.isOtpOption,
1664
+ isAdvanceTextArea: res.isAdvanceTextArea,
1665
+ isReadOnly: res.isReadOnly,
1666
+ isPreDefine: res.isPreDefine,
1667
+ maxLevelValue: res.maxLevelValue,
1668
+ surveyAnswers: [
1669
+ {
1670
+ answerId: res.answerId,
1671
+ inputTypeId: InputTypeEnum$1.Text
1672
+ }
1673
+ ],
1674
+ surveySubQuestions: res.surveySubQuestions,
1675
+ surveySubQuestionLevels: res.surveySubQuestionLevels
1676
+ }
1677
+ }
1678
+ }));
1679
+ this.setQuestions({
1630
1680
  questionId: res.questionId,
1631
- questionType: res.questionTypeId,
1632
- inputTypeId: res.surveyAnswers[0].inputTypeId,
1633
- isQuestionGroup: false,
1634
- answerId: null,
1635
- answerIdArr: null,
1636
- answerText: null,
1681
+ questionTypeId: res.questionTypeId,
1682
+ questionName: res.questionName,
1683
+ questionTitle: res.questionTitle,
1684
+ questionDescription: res.questionDescription,
1637
1685
  isRequired: res.isRequired,
1638
- isValid: null,
1639
- isDisabled: res.isReadOnly,
1640
- isShow: res.isVisable,
1641
- isDisabled_default: res.isReadOnly,
1642
- isShow_default: res.isVisable,
1643
- questionGroupId: this.questionGroupId,
1644
- parentQuestionId: model.QuestionId,
1645
- questionAllInfo: res
1646
- } }));
1647
- this.setQuestions(res);
1648
- }
1649
- });
1686
+ isVisable: res.isVisable,
1687
+ isEditable: res.isEditable,
1688
+ isOTPOption: res.isOtpOption,
1689
+ isAdvanceTextArea: res.isAdvanceTextArea,
1690
+ isReadOnly: res.isReadOnly,
1691
+ isPreDefine: res.isPreDefine,
1692
+ maxLevelValue: res.maxLevelValue,
1693
+ surveyAnswers: [
1694
+ {
1695
+ answerId: res.answerId,
1696
+ inputTypeId: InputTypeEnum$1.Text
1697
+ }
1698
+ ],
1699
+ surveySubQuestions: res.surveySubQuestions,
1700
+ surveySubQuestionLevels: res.surveySubQuestionLevels
1701
+ });
1702
+ }
1703
+ });
1704
+ }
1705
+ else {
1706
+ this._ApiService.getNextQuestion({
1707
+ answerId: model.Answer,
1708
+ applicantKey: this.applicantKey,
1709
+ isPre: this.isPre,
1710
+ surveyLanguageId: this.surveyLanguageId
1711
+ }).subscribe(res => {
1712
+ if (res.errors.filter(x => x.code == 17).length == 0) {
1713
+ this._Store.dispatch(surveyActions.addQuestion({
1714
+ question: {
1715
+ surveyPageId: this.pageId,
1716
+ questionId: res.questionId,
1717
+ questionType: res.questionTypeId,
1718
+ inputTypeId: res.surveyAnswers[0].inputTypeId,
1719
+ isQuestionGroup: false,
1720
+ answerId: null,
1721
+ answerIdArr: null,
1722
+ answerText: null,
1723
+ isRequired: res.isRequired,
1724
+ isValid: null,
1725
+ isDisabled: res.isReadOnly,
1726
+ isShow: res.isVisable,
1727
+ isDisabled_default: res.isReadOnly,
1728
+ isShow_default: res.isVisable,
1729
+ questionGroupId: this.questionGroupId,
1730
+ parentQuestionId: model.QuestionId,
1731
+ questionAllInfo: res
1732
+ }
1733
+ }));
1734
+ this.setQuestions(res);
1735
+ }
1736
+ });
1737
+ }
1650
1738
  }
1651
1739
  }
1652
1740
  identify(index, item) {
@@ -1666,11 +1754,11 @@ class QuestionCascadeTemplateComponent {
1666
1754
  this.fCtrls.questionArr.push(group);
1667
1755
  }
1668
1756
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCascadeTemplateComponent, deps: [{ token: i1.FormBuilder }, { token: SurveyLibService }, { token: ApiService }, { token: i3.Store }], target: i0.ɵɵFactoryTarget.Component }); }
1669
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: { pageId: "pageId", questionGroupId: "questionGroupId", isPre: "isPre", surveyLanguageId: "surveyLanguageId", applicantKey: "applicantKey", setQuestion: "setQuestion" }, ngImport: i0, template: "<ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \"\r\n (emitter)=\"onUpdateAnswer($event)\" >\r\n </lib-question-dropdown-template> \r\n</ng-container>", styles: [""], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "pipe", type: FindQuestionPipe, name: "findQuestion" }] }); }
1757
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: QuestionCascadeTemplateComponent, selector: "lib-question-cascade-template", inputs: { pageId: "pageId", questionGroupId: "questionGroupId", isPre: "isPre", surveyLanguageId: "surveyLanguageId", applicantKey: "applicantKey", setQuestion: "setQuestion" }, ngImport: i0, template: "<ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n <lib-question-dropdown-template #questionDropdownTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType != questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \" (emitter)=\"onUpdateAnswer($event)\">\r\n </lib-question-dropdown-template>\r\n\r\n <lib-question-text-template #questionTextTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType == questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \"\r\n [isArabicLang]=\"true\"></lib-question-text-template>\r\n\r\n</ng-container>", styles: [""], 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: QuestionDropdownTemplateComponent, selector: "lib-question-dropdown-template", inputs: ["setQuestion"], outputs: ["emitter"] }, { kind: "pipe", type: FindQuestionPipe, name: "findQuestion" }] }); }
1670
1758
  }
1671
1759
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCascadeTemplateComponent, decorators: [{
1672
1760
  type: Component,
1673
- args: [{ selector: 'lib-question-cascade-template', template: "<ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n <lib-question-dropdown-template #questionDropdownTemplate [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \"\r\n (emitter)=\"onUpdateAnswer($event)\" >\r\n </lib-question-dropdown-template> \r\n</ng-container>" }]
1761
+ args: [{ selector: 'lib-question-cascade-template', template: "<ng-container *ngFor=\"let item of questionFormArray.controls; trackBy:identify ; let i = index\">\r\n <lib-question-dropdown-template #questionDropdownTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType != questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \" (emitter)=\"onUpdateAnswer($event)\">\r\n </lib-question-dropdown-template>\r\n\r\n <lib-question-text-template #questionTextTemplate\r\n *ngIf=\"(pageQuestions$() |findQuestion :item.value.id)?.questionType == questionTypeEnum.TextInput\"\r\n [setQuestion]=\"pageQuestions$() |findQuestion :item.value.id \"\r\n [isArabicLang]=\"true\"></lib-question-text-template>\r\n\r\n</ng-container>" }]
1674
1762
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }, { type: ApiService }, { type: i3.Store }]; }, propDecorators: { pageId: [{
1675
1763
  type: Input
1676
1764
  }], questionGroupId: [{