diff --git a/main.js b/main.js index 6a8dc9361e..932deea845 100644 --- a/main.js +++ b/main.js @@ -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' } ]; diff --git a/package-lock.json b/package-lock.json index c79bfc3881..d063dab972 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7173,19 +7173,19 @@ "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true }, - "common-form-elements": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/common-form-elements/-/common-form-elements-0.0.4.tgz", - "integrity": "sha512-6dhAHVSFtPNa4mw20ipTl16C5ABbtATu4VUprC+FkhX0ANSJqgOH8A2EyBOV2Ch0r7N3E6SjX3pzniOaAvWF4g==", - "requires": { - "tslib": "^1.9.0" - } - }, "common-consumption-styles": { "version": "0.0.14", "resolved": "https://registry.npmjs.org/common-consumption-styles/-/common-consumption-styles-0.0.14.tgz", "integrity": "sha512-+TLK8+8Bb6hX2a2dp0ZrT1snUCyORfV2295vzKfyl7Gr1xUZfkjcpRKRDSQBejZku9xgwnh/m0TxqZmOLVAxcg==" }, + "common-form-elements": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/common-form-elements/-/common-form-elements-0.0.5.tgz", + "integrity": "sha512-3bIjmKFONfcQGsmeqtC3lk734BwJFzwwCjNjgMXBEgo9pPHQ/gyX+4qSV67e6prQTMpLzBnjRfC766cyWdH+8Q==", + "requires": { + "tslib": "^1.9.0" + } + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", diff --git a/package.json b/package.json index a64b71535a..701a3ffd18 100644 --- a/package.json +++ b/package.json @@ -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", @@ -250,4 +250,4 @@ }, "transformIgnorePatterns": [] } -} +} \ No newline at end of file diff --git a/src/app/faq-report-issue/faq-report-issue.page.ts b/src/app/faq-report-issue/faq-report-issue.page.ts index 1fcd5aafc2..d64261eef1 100644 --- a/src/app/faq-report-issue/faq-report-issue.page.ts +++ b/src/app/faq-report-issue/faq-report-issue.page.ts @@ -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'; @@ -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)) { @@ -368,7 +371,7 @@ 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; } }); @@ -376,7 +379,11 @@ export class FaqReportIssuePage implements OnInit, OnDestroy { 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, '*'); } } @@ -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; } } @@ -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) { @@ -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; } } }); @@ -837,7 +845,6 @@ export class FaqReportIssuePage implements OnInit, OnDestroy { responseSubmitted() { if (this.formContext !== FormConfigSubcategories.CONTENT_AVAILABILITY) { this.location.back(); - this.location.back(); } } } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 67729ea96a..f65013b38d 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -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 ",