diff --git a/package-lock.json b/package-lock.json index 6701c27c..7d43066d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@caliorg/a2jviewer", - "version": "8.1.7-11", + "version": "8.1.7-13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@caliorg/a2jviewer", - "version": "8.1.7-11", + "version": "8.1.7-13", "license": "GNU AGPL v3.0", "dependencies": { "@caliorg/a2jdeps": "^7.1.7", diff --git a/package.json b/package.json index b63066a5..d06e49c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@caliorg/a2jviewer", - "version": "8.1.7-11", + "version": "8.1.7-13", "description": "A2J Viewer standalone and preview app.", "main": "a2jviewer/app", "scripts": { diff --git a/src/footer/footerVersion.js b/src/footer/footerVersion.js index 8121ebc2..35484c3a 100644 --- a/src/footer/footerVersion.js +++ b/src/footer/footerVersion.js @@ -1,7 +1,7 @@ const version = { - number: '8.1.7-11', - date: '2024-09-13' + number: '8.1.7-13', + date: '2024-09-14' } export default version diff --git a/src/mobile/pages/pages-vm.js b/src/mobile/pages/pages-vm.js index 041e8fac..011314b6 100644 --- a/src/mobile/pages/pages-vm.js +++ b/src/mobile/pages/pages-vm.js @@ -219,7 +219,7 @@ export default DefineMap.extend('PagesVM', { * check is date is valid */ function isValidDate (date) { - console.log("date: " + date) + console.log('date: ' + date) let dmy = date.split('/') // js wants mdy or ymd // while a2j dates are d/m/yyyy @@ -251,18 +251,18 @@ export default DefineMap.extend('PagesVM', { validator.set('Date', isValidDate) validator.set('Number', isValidNumber) - - if (validator.has(answer.type)){ + + if (validator.has(answer.type)) { for (let i = 1; i < answer.values.length; i++) { if (!validator.get(answer.type)(answer.values[i])) { - //delete answer.values[i] + // delete answer.values[i] answer.values[i] = null - Object.defineProperty(answer, "invalid", "true") + Object.defineProperty(answer, 'invalid', 'true') } } } - //answer.values[0] = answer.values.length + // answer.values[0] = answer.values.length return answer } @@ -270,7 +270,7 @@ export default DefineMap.extend('PagesVM', { Object.keys(answers).forEach(function filter (name) { let sanitizedAnswer = sanitizeAnswerValues(answers[name]) if (sanitizedAnswer.values.length === 1) { - //delete answers[name] + // delete answers[name] answers[name] = null } else { answers[name] = sanitizedAnswer @@ -280,7 +280,7 @@ export default DefineMap.extend('PagesVM', { return answers }, - /** + /** * @property {String} pages.ViewModel.prototype.answersString answersString * @parent pages.ViewModel * @@ -289,18 +289,17 @@ export default DefineMap.extend('PagesVM', { * This is POSTed to `setDataURL` when user finishes the interview, * and populated when a user loads saved answers. */ - answersValidated: { - get () { - //console.log(this.answers.serialize()) - //console.log(this.validatedAnswers(this.answers.serialize())) + answersValidated: { + get () { + // console.log(this.answers.serialize()) + // console.log(this.validatedAnswers(this.answers.serialize())) // const parsed = Parser.parseANX(this.answers.serialize()) - const parsed = this.validatedAnswers(this.answers.serialize()) - return parsed - } -}, - + const parsed = this.validatedAnswers(this.answers.serialize()) + return parsed + } + }, - /** + /** * @property {String} pages.ViewModel.prototype.answersString answersString * @parent pages.ViewModel * @@ -309,22 +308,21 @@ export default DefineMap.extend('PagesVM', { * This is POSTed to `setDataURL` when user finishes the interview, * and populated when a user loads saved answers. */ - invalidAnswers: { - get () { - //console.log(this.answers.serialize()) - //console.log(this.validatedAnswers(this.answers.serialize())) + invalidAnswers: { + get () { + // console.log(this.answers.serialize()) + // console.log(this.validatedAnswers(this.answers.serialize())) // const parsed = Parser.parseANX(this.answers.serialize()) - let answers = this.answersValidated - Object.keys(answers).forEach(function filter (name) { - if (!answers[name].invalid) { - delete answers[name] - } - - }) + let answers = this.answersValidated + Object.keys(answers).forEach(function filter (name) { + if (!answers[name].invalid) { + delete answers[name] + } + }) - return answers - } -}, + return answers + } + }, /** * @property {String} pages.ViewModel.prototype.answersString answersString @@ -337,8 +335,8 @@ export default DefineMap.extend('PagesVM', { */ answersANX: { get () { - //console.log(this.answers.serialize()) - //console.log(this.validatedAnswers(this.answers.serialize())) + // console.log(this.answers.serialize()) + // console.log(this.validatedAnswers(this.answers.serialize())) // const parsed = Parser.parseANX(this.answers.serialize()) const parsed = Parser.parseANX(this.validatedAnswers(this.answers.serialize())) return parsed diff --git a/src/mobile/pages/pages.js b/src/mobile/pages/pages.js index 0f992b8f..18b5afc8 100644 --- a/src/mobile/pages/pages.js +++ b/src/mobile/pages/pages.js @@ -10,7 +10,6 @@ import stache from 'can-stache' import '~/src/mobile/util/helpers' import constants from '~/src/models/constants' - stache.registerPartial('assemble-form', assembleFormTpl) stache.registerPartial('save-answers-form', saveAnswersFormTpl) @@ -113,10 +112,9 @@ export default Component.extend({ }, 'button.save-answers click': function (el, ev) { - ev.preventDefault() - const button = new DefineMap({ next: constants.qIDSUCCESS }) + const button = new Map({ next: constants.qIDSUCCESS }) const vm = this.viewModel let postBody = { @@ -129,19 +127,17 @@ export default Component.extend({ /*** * !!! Change this in pproduction to prod server!!! */ - fetch("https://staging.a2jauthor.org/a2jauthor/bad-answer-alert.php", { - method: "POST", - body: JSON.stringify(postBody), - headers: { - "Content-type": "application/json; charset=UTF-8" - } + // fetch('https://staging.a2jauthor.org/a2jauthor/bad-answer-alert.php', { + $.ajax({ + url: 'https://staging.a2jauthor.org/a2jauthor/bad-answer-alert.php', + type: 'POST', + data: JSON.stringify(postBody), + dataType: 'json' }) .then((response) => response.json()) - .then((json) => console.log(json)); - + .then((json) => console.log(json)) vm.navigate(button, el, ev) - }, // This event is fired when the Exit, Success, or AssembleSuccess button is clicked,