Skip to content

Commit

Permalink
Issue #SB-19244 merge: Merge pull request #1029 from raghav14/release…
Browse files Browse the repository at this point in the history
…-3.0.1

Issue #SB-19244 feat: Other Issue fix, text changes
  • Loading branch information
swayangjit authored Jul 7, 2020
2 parents e0dd02b + c819a19 commit 6d7f3be
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 25 deletions.
10 changes: 10 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ var formRequestArray = [{
'type': 'user',
'subType': 'manageduser',
'action': 'create'
},{
'type': 'dynamicform',
'subType': 'support',
'action': 'get',
'component': 'app'
},{
'type': 'form',
'subType': 'boardContactInfo',
'action': 'get',
'component': 'app'
}
];

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"com.jjdltc.cordova.plugin.zip": "https://github.com/swayangjit/jjdltc-cordova-plugin-zip.git",
"com.telerik.plugins.nativepagetransitions": "^0.6.5",
"common-consumption-styles": "0.0.14",
"common-form-elements": "0.0.4",
"common-form-elements": "0.0.5",
"cordova-android": "^8.1.0",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-plugin-advanced-http": "^2.4.1",
Expand Down Expand Up @@ -250,4 +250,4 @@
},
"transformIgnorePatterns": []
}
}
}
35 changes: 21 additions & 14 deletions src/app/faq-report-issue/faq-report-issue.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { AppVersion } from '@ionic-native/app-version/ngx';
import { map, tap, switchMap, distinctUntilChanged, catchError } from 'rxjs/operators';
import { TranslateService } from '@ngx-translate/core';
import { FormControl } from '@angular/forms';
import { Subscription, defer, of, EMPTY } from 'rxjs';
import { defer, of, EMPTY } from 'rxjs';
import { AppHeaderService, FormAndFrameworkUtilService } from '@app/services';
import { Location } from '@angular/common';
import { FieldConfigOptionsBuilder, FieldConfigOption } from 'common-form-elements';
Expand Down Expand Up @@ -292,9 +292,12 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
}

submit() {
if (!this.isFormValid) {
return false;
}
this.prepareEmailContent(this.formValues);

if (this.formValues && this.formValues.subcategory) {
if (this.formValues) {
if (Object.prototype.hasOwnProperty.call(this.callToAction, this.formValues.subcategory)) {
this.takeAction(this.callToAction[this.formValues.subcategory]);
} else if (Object.prototype.hasOwnProperty.call(this.callToAction, this.formValues.category)) {
Expand Down Expand Up @@ -368,15 +371,19 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
const stateContactList = await this.formAndFrameworkUtilService.getStateContactList();
this.supportEmail = undefined;
stateContactList.forEach(element => {
if (this.formValues.children.subcategory.board.code === element.id) {
if (this.formValues.children.subcategory && this.formValues.children.subcategory.board && this.formValues.children.subcategory.board.code === element.id) {
this.supportEmail = element.contactinfo && element.contactinfo.email ? element.contactinfo.email : undefined;
}
});
if (!this.showSupportContact && this.isFormValid) {
this.value = {};
this.value.action = 'initiate-email-clicked';
this.value.value = {};
this.value.initiateEmailBody = this.formValues.children.subcategory.details;
if (this.formValues.children && this.formValues.children.subcategory && this.formValues.children.subcategory) {
this.value.initiateEmailBody = this.formValues.children.subcategory.details
} else if (this.formValues.children && this.formValues.children.category && this.formValues.children.category) {
this.value.initiateEmailBody = this.formValues.children.category.details;
}
window.parent.postMessage(this.value, '*');
}
}
Expand Down Expand Up @@ -756,16 +763,12 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
switch (type) {
case 'board':
return boardClosure;
break;
case 'medium':
return mediumClosure;
break;
case 'grade':
return gradeClosure;
break;
case 'subject':
return subjectClosure;
break;
}
}

Expand All @@ -779,12 +782,17 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
}
}

prepareEmailContent($event) {
prepareEmailContent(formValue) {
this.bmgsString = null;
this.categories = null;
const bmgskeys = ['board', 'medium', 'grade', 'subject', 'contentname'];
const categorykeys = ['category', 'subcategory'];
const fields = $event.children.subcategory;
let fields = [];
if (formValue.children.subcategory) {
fields = formValue.children.subcategory;
} else if (formValue.children) {
fields = formValue.children;
}
bmgskeys.forEach(element => {
if (Object.prototype.hasOwnProperty.call(fields, element)) {
if (!this.bmgsString) {
Expand All @@ -795,11 +803,11 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
}
});
categorykeys.forEach(element => {
if (Object.prototype.hasOwnProperty.call($event, element)) {
if (Object.prototype.hasOwnProperty.call(formValue, element)) {
if (!this.categories) {
$event[element] ? this.categories = $event[element]: null;
formValue[element] ? this.categories = formValue[element]: null;
} else {
$event[element] ? this.categories += " - " + $event[element]: null;
formValue[element] ? this.categories += " - " + formValue[element]: null;
}
}
});
Expand Down Expand Up @@ -837,7 +845,6 @@ export class FaqReportIssuePage implements OnInit, OnDestroy {
responseSubmitted() {
if (this.formContext !== FormConfigSubcategories.CONTENT_AVAILABILITY) {
this.location.back();
this.location.back();
}
}
}
2 changes: 1 addition & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
"NO_ASSESSMENT": "No assessment available",
"NO_BATCHES_AVAILABLE": "No batches available",
"NO_BOOKS_AVAILABLE": "Board is adding books",
"NO_BOOKS_DEFINITION": "Your board is yet to add more books. Tap the button to see more books and content on {{%s}}",
"NO_BOOKS_DEFINITION": "Your board is yet to add more books. Tap the button below to request for content on {{%s}}",
"NO_CONTENTS": "No {{%s}} ",
"NO_CONTENTS_FOUND": "Could not find content",
"NO_CONTENTS_MESSAGE": "Select another content type ",
Expand Down

0 comments on commit 6d7f3be

Please sign in to comment.