survery-lib 2.1.27 → 2.1.30

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.
@@ -1123,12 +1123,13 @@ class QuestionDropdownTemplateComponent {
1123
1123
  this._Store.dispatch(surveyActions.updateQuestionAnswer({
1124
1124
  questionId: formValue.id,
1125
1125
  answer: value,
1126
- isValid: this.fCtrls.answer.valid
1126
+ isValid: this.fCtrls.answer.valid,
1127
1127
  }));
1128
1128
  this.emitter.emit({
1129
1129
  QuestionId: formValue.id,
1130
1130
  IsValid: this.fCtrls.answer.valid,
1131
- Answer: value
1131
+ Answer: value,
1132
+ SurveyAnswerId: this.fCtrls.answer.value
1132
1133
  });
1133
1134
  });
1134
1135
  this.subs.sink = this._Store.select(questionSelectors.pageQuestions).pipe(map(arr => arr.find(x => x.questionId == this.fCtrls.id.value)))
@@ -1504,6 +1505,10 @@ class ApiService {
1504
1505
  var queryString = $.param(filter);
1505
1506
  return this._HttpClient.get(`${this.url}/Survey/GetNextQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1506
1507
  }
1508
+ getIsOtherQuestion(filter) {
1509
+ var queryString = $.param(filter);
1510
+ return this._HttpClient.get(`${this.url}/Survey/GetIsOtherQuestion?${queryString}`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1511
+ }
1507
1512
  getAllInstitutions() {
1508
1513
  return this._HttpClient.get(`${this.url}/Institutions/GetAllInstitutions`, { headers: new HttpHeaders({ 'disable-error-alert': 'true' }) });
1509
1514
  }
@@ -1618,35 +1623,117 @@ class QuestionCascadeTemplateComponent {
1618
1623
  }
1619
1624
  }
1620
1625
  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,
1626
+ var selectedAnswerObj = this.surveyQuestionArr
1627
+ .find(x => x.questionId == model.QuestionId)?.surveyAnswers.find(x => x.answerId === model.SurveyAnswerId);
1628
+ if (selectedAnswerObj?.isOther == true) {
1629
+ this._ApiService.getIsOtherQuestion({
1630
+ parentQId: model.QuestionId,
1631
+ groupId: this.questionGroupId
1632
+ }).subscribe(res => {
1633
+ if (res.errors.filter(x => x.code == 17).length == 0) {
1634
+ res.questionTypeId = QuestionTypeEnum.TextInput;
1635
+ this._Store.dispatch(surveyActions.addQuestion({
1636
+ question: {
1637
+ surveyPageId: this.pageId,
1638
+ questionId: res.questionId,
1639
+ questionType: res.questionTypeId,
1640
+ inputTypeId: InputTypeEnum.Text,
1641
+ isQuestionGroup: false,
1642
+ answerId: null,
1643
+ answerIdArr: null,
1644
+ answerText: null,
1645
+ isRequired: res.isRequired,
1646
+ isValid: null,
1647
+ isDisabled: res.isReadOnly,
1648
+ isShow: res.isVisable,
1649
+ isDisabled_default: res.isReadOnly,
1650
+ isShow_default: res.isVisable,
1651
+ questionGroupId: this.questionGroupId,
1652
+ parentQuestionId: model.QuestionId,
1653
+ questionAllInfo: {
1654
+ questionId: res.questionId,
1655
+ questionTypeId: res.questionTypeId,
1656
+ questionName: res.questionName,
1657
+ questionTitle: res.questionTitle,
1658
+ questionDescription: res.questionDescription,
1659
+ isRequired: res.isRequired,
1660
+ isVisable: res.isVisable,
1661
+ isEditable: res.isEditable,
1662
+ isOTPOption: res.isOtpOption,
1663
+ isAdvanceTextArea: res.isAdvanceTextArea,
1664
+ isReadOnly: res.isReadOnly,
1665
+ isPreDefine: res.isPreDefine,
1666
+ maxLevelValue: res.maxLevelValue,
1667
+ surveyAnswers: [
1668
+ {
1669
+ answerId: res.answerId,
1670
+ inputTypeId: InputTypeEnum.Text
1671
+ }
1672
+ ],
1673
+ surveySubQuestions: res.surveySubQuestions,
1674
+ surveySubQuestionLevels: res.surveySubQuestionLevels
1675
+ }
1676
+ }
1677
+ }));
1678
+ this.setQuestions({
1630
1679
  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,
1680
+ questionTypeId: res.questionTypeId,
1681
+ questionName: res.questionName,
1682
+ questionTitle: res.questionTitle,
1683
+ questionDescription: res.questionDescription,
1637
1684
  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
- });
1685
+ isVisable: res.isVisable,
1686
+ isEditable: res.isEditable,
1687
+ isOTPOption: res.isOtpOption,
1688
+ isAdvanceTextArea: res.isAdvanceTextArea,
1689
+ isReadOnly: res.isReadOnly,
1690
+ isPreDefine: res.isPreDefine,
1691
+ maxLevelValue: res.maxLevelValue,
1692
+ surveyAnswers: [
1693
+ {
1694
+ answerId: res.answerId,
1695
+ inputTypeId: InputTypeEnum.Text
1696
+ }
1697
+ ],
1698
+ surveySubQuestions: res.surveySubQuestions,
1699
+ surveySubQuestionLevels: res.surveySubQuestionLevels
1700
+ });
1701
+ }
1702
+ });
1703
+ }
1704
+ else {
1705
+ this._ApiService.getNextQuestion({
1706
+ answerId: model.Answer,
1707
+ applicantKey: this.applicantKey,
1708
+ isPre: this.isPre,
1709
+ surveyLanguageId: this.surveyLanguageId
1710
+ }).subscribe(res => {
1711
+ if (res.errors.filter(x => x.code == 17).length == 0) {
1712
+ this._Store.dispatch(surveyActions.addQuestion({
1713
+ question: {
1714
+ surveyPageId: this.pageId,
1715
+ questionId: res.questionId,
1716
+ questionType: res.questionTypeId,
1717
+ inputTypeId: res.surveyAnswers[0].inputTypeId,
1718
+ isQuestionGroup: false,
1719
+ answerId: null,
1720
+ answerIdArr: null,
1721
+ answerText: null,
1722
+ isRequired: res.isRequired,
1723
+ isValid: null,
1724
+ isDisabled: res.isReadOnly,
1725
+ isShow: res.isVisable,
1726
+ isDisabled_default: res.isReadOnly,
1727
+ isShow_default: res.isVisable,
1728
+ questionGroupId: this.questionGroupId,
1729
+ parentQuestionId: model.QuestionId,
1730
+ questionAllInfo: res
1731
+ }
1732
+ }));
1733
+ this.setQuestions(res);
1734
+ }
1735
+ });
1736
+ }
1650
1737
  }
1651
1738
  }
1652
1739
  identify(index, item) {
@@ -1666,11 +1753,11 @@ class QuestionCascadeTemplateComponent {
1666
1753
  this.fCtrls.questionArr.push(group);
1667
1754
  }
1668
1755
  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" }] }); }
1756
+ 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
1757
  }
1671
1758
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: QuestionCascadeTemplateComponent, decorators: [{
1672
1759
  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>" }]
1760
+ 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
1761
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: SurveyLibService }, { type: ApiService }, { type: i3.Store }]; }, propDecorators: { pageId: [{
1675
1762
  type: Input
1676
1763
  }], questionGroupId: [{