{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/js/bijwerkingentool/bijwerkingentool.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","BIJWERKINGENTOOL_URL","Bijwerkingentool","constructor","targetSelector","this","target","document","querySelector","Error","template","htmlTemplate","button","main","data","currentQuestion","salutation","answers","questionData","data_sent","filledInForms","allData","init","fetch","then","response","json","text","populateTemplate","link","createElement","href","rel","type","head","appendChild","sendDataToServer","method","headers","body","JSON","stringify","questions","innerHTML","classList","add","modal","renderQuestion","registerBaseButtonEvent","replaceWith","cloneNode","addEventListener","remove","e","preventDefault","displayCloseConfirmation","reset","registerQuestionButtons","find","obj","id","self","next_button_id","click","push","back_button_id","saveFormData","questionsData","keys","forEach","includes","replace","elem","question","answer","renderInput","replaceChildren","renderQuestionBulletins","footer","undefined","renderFooterButtons","removeRequiredAttributes","disabled","selector","answerValue","prop","doesFormHaveRequiredFields","html","length","firstElementChild","form","FormData","answerData","splitted","split","questionType","description","title","x","questionIndex","answerMultipleTimes","parentList","arguments","elementName","question_id","removeAttribute","isDefined","requiredClass","requiredWhenSelected","required","subQuestions","map","subQuestion","firstChild","eval","checked","textarea","isFormFilledIn","action","bulletins","lastChild","element","bullet","showMessageUnderForm","message","brNode","divNode","createTextNode","inputs","Array","slice","getElementsByTagName","textAreas","filter","tA","window"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAo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AqB,YAAa,GAEpFH,EAAO3D,QAASpG,GAAMA,EAAEwI,gBAAgB,aACxC2B,EAAU/D,QAASiE,GAAOA,EAAG7B,gBAAgB,cAIrD8B,OAAOrI,iBAAmBA,kB","file":"bijwerkingentool/bijwerkingentool.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 9);\n","export const BIJWERKINGENTOOL_URL = `//${HOST_URL}/static/bijwerkingentool/`;\n\nexport default class Bijwerkingentool {\n constructor(targetSelector) {\n this.target = document.querySelector(targetSelector);\n\n if (this.target === null) {\n throw new Error(`Element ${targetSelector} not found`);\n }\n\n this.template = {\n htmlTemplate: null,\n button: null,\n main: null,\n data: null,\n currentQuestion: 0,\n salutation: 'u',\n };\n this.answers = [];\n this.questionData = null;\n this.data_sent = false;\n this.filledInForms = [];\n\n this.allData = {};\n\n this.init();\n }\n\n /**\n * Fetch the default required data.\n */\n init() {\n fetch(`${BIJWERKINGENTOOL_URL}questions.json`, {}).then((response) => response.json()).then((questionData) => {\n this.questionData = questionData;\n fetch(`${BIJWERKINGENTOOL_URL}bijwerkingentool.html`, {}).then((response) => response.text()).then((template) => this.populateTemplate(template));\n });\n\n const link = document.createElement('link');\n link.href = `//${HOST_URL}/static/bijwerkingentool/css/bijwerkingentool.css`;\n link.rel = 'stylesheet';\n link.type = 'text/css';\n document.head.appendChild(link);\n }\n\n /**\n * Send the data of the questions that have been answered to the server.\n */\n sendDataToServer() {\n fetch(`//${HOST_URL}/api/bijwerkingentool/submit`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n questions: this.questionData,\n answers: this.answers,\n allData: this.allData,\n }),\n })\n .then((response) => response.json()).then(() => {\n this.data_sent = true;\n });\n }\n\n /**\n * Add the template of the bijwerkingentool.html to the javascript,\n * this is used to render the template later on.\n */\n populateTemplate(template) {\n this.template.htmlTemplate = document.createElement('div');\n this.template.htmlTemplate.innerHTML = template;\n this.target.innerHTML = this.template.htmlTemplate.innerHTML;\n\n this.target.classList.add('bijwerkingentool');\n\n this.template.modal = this.target.querySelector('.rse-modal-background');\n this.template.button = document.querySelector('.js--meld-bijwerking-button');\n\n // Render first question.\n this.renderQuestion(0);\n\n this.registerBaseButtonEvent();\n }\n\n /**\n * Register the close button events to the buttons.\n */\n registerBaseButtonEvent() {\n this.template.modal.querySelector('.rse-modal-close').replaceWith(this.template.modal.querySelector('.rse-modal-close').cloneNode(true));\n\n this.template.button.addEventListener(\n 'click',\n () => this.template.modal.classList.remove('rse-modal-background--hidden'),\n );\n\n this.template.modal.querySelector('.rse-modal-close').addEventListener(\n 'click',\n (e) => {\n e.preventDefault();\n this.displayCloseConfirmation();\n },\n );\n\n // this.registerQuestionButtons();\n }\n\n reset() {\n this.template.modal.querySelector('.rse-modal-question-bulletins').innerHTML = '';\n this.template.modal.querySelector('.rse-modal-form-container').innerHTML = '';\n this.template.modal.querySelector('.rse-modal-footer').innerHTML = '';\n this.answers = [];\n this.filledInForms = [];\n\n // Render first question.\n this.renderQuestion(0);\n\n this.registerBaseButtonEvent();\n }\n\n /**\n * Register the previous/next button events to the buttons.\n */\n registerQuestionButtons() {\n /* eslint-disable-next-line max-len */\n const currentQuestion = this.questionData.find((obj) => obj.id === this.template.currentQuestion);\n const self = this;\n if (this.template.modal.querySelector('.js--next-question') !== null) {\n this.template.modal.querySelector('.js--template-bijwerkingentool-form').addEventListener(\n 'submit',\n () => {\n this.renderQuestion(currentQuestion ? currentQuestion.next_button_id : 1);\n },\n );\n\n this.template.modal.querySelector('.js--next-question').addEventListener(\n 'click',\n () => {\n self.template.modal.querySelector('.js--form-submit-button').click();\n\n this.filledInForms.push(this.template.currentQuestion - 1);\n // if(answered === false && form.elements.length > 0)\n // alert('Please select one of the following answers');\n },\n );\n }\n\n if (this.template.modal.querySelector('.js--previous-question') !== null\n && !this.data_sent) {\n this.template.modal.querySelector('.js--previous-question').addEventListener(\n 'click',\n () => this.renderQuestion(currentQuestion ? currentQuestion.back_button_id : 1),\n );\n }\n }\n\n /**\n * Render The Questions to the main part of the template.\n */\n renderQuestion(id) {\n this.saveFormData();\n\n if (id === -1) {\n this.template.modal.classList.remove('rse-modal-background--hidden');\n return;\n }\n\n const questionsData = this.questionData.find((obj) => obj.id === id);\n const self = this;\n this.template.currentQuestion = id;\n\n let text = this.template.htmlTemplate.querySelector('.js--template-bijwerkingentool-question-form').innerHTML;\n\n Object.keys(questionsData).forEach((key) => {\n /* This is to replace the different salutations for the texts,\n ** adding a variable-salutation in the json will replace the variable,\n */\n\n /* e.g. when you have {{title}} in the template and title-u in the json,\n ** the title-u will be used if the template.salutation equals everything after the '-'.\n */\n if (key.includes(self.template.salutation)) {\n text = text.replace(`{{${key.replace(`-${self.template.salutation}`, '')}}}`, questionsData[key]);\n }\n else {\n text = text.replace(`{{${key}}}`, questionsData[key]);\n }\n });\n\n const elem = document.createElement('div');\n\n elem.innerHTML = text;\n\n questionsData.questions.forEach((question) => {\n question.answers.forEach((answer) => {\n elem.querySelector('.js--template-bijwerkingentool-form').appendChild(this.renderInput(question, answer));\n });\n });\n\n this.template.modal.querySelector('.rse-modal-form-container').replaceChildren(elem);\n\n this.renderQuestionBulletins();\n\n if (questionsData.footer !== null && questionsData.footer !== undefined) {\n this.renderFooterButtons(questionsData.footer);\n }\n\n this.registerQuestionButtons();\n\n if (this.filledInForms.includes(this.template.currentQuestion)) {\n this.removeRequiredAttributes();\n\n document.querySelector('.js--next-question').disabled = false;\n }\n }\n\n /**\n * Render the buttons to the footer of the file.\n */\n renderFooterButtons(selector) {\n const footer = this.template.htmlTemplate.querySelector(selector);\n\n if (footer === null) {\n throw new Error(`Footer ${selector} not found`);\n }\n\n this.template.modal.querySelector('.rse-modal-footer').innerHTML = footer.innerHTML;\n\n if (this.template.modal.querySelector('.submit-data') !== null) {\n this.template.modal.querySelector('.submit-data').addEventListener('click', () => this.sendDataToServer());\n }\n\n let answerValue = null;\n this.answers.forEach((obj) => {\n Object.keys(obj).forEach((prop) => {\n if (`[${this.template.currentQuestion}][${1}]` === prop) {\n answerValue = obj[prop];\n }\n });\n });\n\n if (answerValue !== null) {\n document.querySelector('.js--next-question').disabled = false;\n }\n else {\n document.querySelector('.js--next-question').disabled = this.doesFormHaveRequiredFields();\n }\n }\n\n displayCloseConfirmation() {\n const html = this.template.htmlTemplate.querySelector('.js--template-close-confirmation').innerHTML;\n\n if (!this.data_sent && this.answers.length > 0) {\n const elem = document.createElement('div');\n elem.innerHTML = html;\n\n // Add click events to remove screen and delete form\n elem.querySelector('.js--ignore').addEventListener('click', (e) => {\n e.preventDefault();\n this.template.modal.querySelector('.js--template-close-confirmation').remove();\n });\n\n elem.querySelector('.js--stop').addEventListener('click', (e) => {\n e.preventDefault();\n this.template.modal.querySelector('.js--template-close-confirmation').remove();\n this.template.modal.classList.add('rse-modal-background--hidden');\n this.reset();\n });\n\n this.template.modal.appendChild(elem.firstElementChild);\n }\n else {\n this.template.modal.classList.add('rse-modal-background--hidden');\n this.reset();\n }\n }\n\n /**\n * Save the form data to the this.answers variable.\n */\n saveFormData() {\n const form = this.template.modal.querySelector('form');\n\n if (form === null) {\n return;\n }\n\n const data = new FormData(form);\n const jsonData = {};\n const answerData = {};\n\n data.forEach((value, key) => {\n if (value) {\n const splitted = key.split('][');\n\n for (let i = 0; i < splitted.length; i++) {\n splitted[i] = splitted[i].replace('[', '');\n splitted[i] = splitted[i].replace(']', '');\n }\n\n const currentQuestion = this.questionData[this.template.currentQuestion];\n const questionType = currentQuestion.questions[0].type;\n\n if (questionType === 'mcq' || questionType === 'checkbox') {\n const {description} = currentQuestion;\n let title = '';\n\n try {\n /* eslint-disable eqeqeq */\n title = currentQuestion.questions[0].answers\n .find((x) => x.id == value)\n .title;\n /* eslint-enable eqeqeq */\n }\n catch {\n title = value;\n }\n\n answerData[description] = title;\n }\n else {\n /* eslint-disable eqeqeq */\n const {title} = currentQuestion.questions[0].answers.find(\n (x) => x.id == splitted[2],\n );\n /* eslint-enable eqeqeq */\n const answer = value;\n\n answerData[title] = answer;\n }\n }\n });\n\n /* eslint-disable-next-line max-len */\n const questionData = this.questionData.find((obj) => obj.id === this.template.currentQuestion);\n /* eslint-enable-next-line max-len */\n\n // The index of the json_data.\n const questionIndex = questionData.title;\n\n // If the json_data is not in allData yet.\n if (this.allData[questionIndex] === undefined) {\n if (questionData.answerMultipleTimes) {\n this.allData[questionIndex] = [answerData];\n }\n else {\n this.allData[questionIndex] = answerData;\n }\n // If the json_data is already in allData.\n }\n else if (questionData.answerMultipleTimes) {\n this.allData[questionIndex][this.allData[questionIndex].length] = answerData;\n }\n else {\n // Replace it.\n this.allData[questionIndex] = answerData;\n }\n this.answers.push(jsonData);\n }\n\n /**\n * Render the different input types to the template.\n */\n renderInput(question, answer, parentList = '') {\n let elementName = `${parentList}[${question.id}]${question.question_id ? `[${question.question_id}]` : ''}`;\n\n let answerValue = null;\n const self = this;\n this.answers.forEach((obj) => {\n Object.keys(obj).forEach((prop) => {\n if (elementName === prop || parentList === prop) {\n if (question.type === 'mcq' || question.type === 'checkbox') {\n if (answer.id === obj[prop]) {\n answerValue = obj[prop];\n }\n }\n else {\n answerValue = obj[prop];\n }\n }\n });\n });\n\n if (answerValue !== null) {\n document.querySelector('.js--next-question').removeAttribute('disabled');\n }\n\n const isDefined = (value) => (value !== null && value !== undefined);\n const requiredClass = (value) => (value ? 'form-label--required' : '');\n\n let {title, description} = answer;\n\n Object.keys(answer).forEach((key) => {\n /* This replaces the default title/description for each question\n ** with with a custom one, based on the salutation.\n */\n if (key.includes(`title-${self.template.salutation}`)) {\n title = answer[key];\n }\n else if (key.includes(`description-${self.template.salutation}`)) {\n description = answer[key];\n }\n });\n\n if (question.type === 'mcq') {\n const elem = document.createElement('div');\n elem.innerHTML = `\n `;\n\n if (elem.querySelector('.js--child-list') !== null) {\n answer.subQuestions.map(((subQuestion) => elem.querySelector('.js--child-list').appendChild(this.renderInput(answer, subQuestion, elementName))));\n }\n\n if (answer.click) {\n elem.firstChild.addEventListener('click', () => {\n // eslint-disable-next-line no-eval\n eval(answer.click)();\n });\n }\n\n elem.firstChild.addEventListener('click', () => {\n document.querySelector('.js--next-question').disabled = false;\n });\n\n return elem.firstChild;\n }\n\n if (question.type === 'checkbox') {\n const elem = document.createElement('div');\n elem.innerHTML = `\n `;\n\n elementName = `${parentList}[${question.question_id}][${question.id}][${answer.id}]`;\n\n if (elem.querySelector('.js--child-list') !== null) {\n answer.subQuestions.map(((subQuestion) => elem.querySelector('.js--child-list').appendChild(this.renderInput(answer, subQuestion, elementName))));\n }\n\n if (answer.click) {\n elem.firstChild.addEventListener('click', () => {\n // eslint-disable-next-line no-eval\n eval(answer.click)();\n });\n }\n\n elem.firstChild.addEventListener('click', (e) => {\n if (e.target.checked) {\n document.querySelector('.js--next-question').disabled = false;\n }\n else {\n document.querySelector('.js--next-question').disabled = true;\n }\n });\n\n return elem.firstChild;\n }\n\n if (question.type === 'open') {\n if (answer.textarea === true) {\n const elem = document.createElement('div');\n elem.innerHTML = ``;\n\n if (answer.click) {\n elem.firstChild.addEventListener('click', () => {\n // eslint-disable-next-line no-eval\n eval(answer.click)();\n });\n }\n\n elem.firstChild.addEventListener('input', () => {\n // If the form has already been filled in once, or this form is filled in.\n if (this.filledInForms.includes(this.template.currentQuestion)\n || this.isFormFilledIn()) {\n document.querySelector('.js--next-question').disabled = false;\n }\n else {\n document.querySelector('.js--next-question').disabled = true;\n }\n\n // This checks if all fields has been filled to make the button clickable\n if (this.filledInForms.includes(this.template.currentQuestion)\n && this.isFormFilledIn()) {\n document.querySelector('.js--add-medicine').disabled = false;\n }\n else {\n document.querySelector('.js--add-medicine').disabled = true;\n }\n });\n return elem.firstChild;\n }\n\n const elem = document.createElement('div');\n elem.innerHTML = ``;\n\n if (answer.click) {\n elem.firstChild.addEventListener('click', () => {\n // eslint-disable-next-line no-eval\n eval(answer.click)();\n });\n }\n\n elem.firstChild.addEventListener('input', () => {\n // If the form has already been filled in once, or this form is filled in.\n if (this.filledInForms.includes(this.template.currentQuestion)\n || this.isFormFilledIn()) {\n document.querySelector('.js--next-question').disabled = false;\n document.querySelector('.js--add-medicine').disabled = false;\n }\n else {\n document.querySelector('.js--next-question').disabled = true;\n document.querySelector('.js--add-medicine').disabled = true;\n }\n });\n\n return elem.firstChild;\n }\n\n if (question.type === 'actionButton') {\n const elem = document.createElement('div');\n elem.innerHTML = `
\n \n
\n
`;\n\n elem.firstChild.addEventListener('click', () => {\n // eslint-disable-next-line no-eval\n eval(question.action)();\n\n this.filledInForms.push(this.template.currentQuestion - 1);\n\n document.querySelector('.js--next-question').disabled = false;\n\n this.removeRequiredAttributes();\n });\n\n return elem.firstChild;\n }\n return false;\n }\n\n /**\n * Render the question bulletins at the top of the template.\n */\n renderQuestionBulletins() {\n const bulletins = this.template.modal.querySelector('.rse-modal-question-bulletins');\n\n // Empty bullet list.\n while (bulletins.firstChild) {\n bulletins.lastChild.remove();\n }\n\n this.questionData.forEach((element) => {\n const bullet = document.createElement('li');\n\n if (element.id < this.template.currentQuestion) {\n bullet.classList.add('completed');\n }\n else if (element.id === this.template.currentQuestion) {\n bullet.classList.add('active');\n }\n\n bulletins.appendChild(bullet);\n });\n }\n\n showMessageUnderForm(message) {\n const form = this.template.modal.querySelector('form');\n\n const brNode = document.createElement('br');\n\n const divNode = document.createElement('div');\n divNode.appendChild(document.createTextNode(message));\n\n form.appendChild(brNode);\n form.appendChild(divNode);\n }\n\n /*\n Checks if the required fields on the form are filled in.\n\n Returns:\n True if the required fields on the form are filled in, false otherwise.\n */\n isFormFilledIn() {\n const form = this.template.modal.querySelector('form');\n\n let inputs = Array.prototype.slice.call(form.getElementsByTagName('input'), 0);\n let textAreas = Array.prototype.slice.call(form.getElementsByTagName('textarea'), 0);\n\n inputs = inputs.filter((i) => i.required && !i.value);\n textAreas = textAreas.filter((tA) => tA.required && !tA.value);\n\n return inputs.length === 0 && textAreas.length === 0;\n }\n\n /*\n Checks if the form has any required fields.\n\n Returns:\n True if the form has any required fields, false otherwise.\n */\n doesFormHaveRequiredFields() {\n const form = this.template.modal.querySelector('form');\n\n let inputs = Array.prototype.slice.call(form.getElementsByTagName('input'), 0);\n let textAreas = Array.prototype.slice.call(form.getElementsByTagName('textarea'), 0);\n\n inputs = inputs.filter((i) => i.required);\n textAreas = textAreas.filter((tA) => tA.required);\n\n return inputs.length > 0 || textAreas.length > 0;\n }\n\n removeRequiredAttributes() {\n const form = this.template.modal.querySelector('form');\n\n const inputs = Array.prototype.slice.call(form.getElementsByTagName('input'), 0);\n const textAreas = Array.prototype.slice.call(form.getElementsByTagName('textarea'), 0);\n\n inputs.forEach((i) => i.removeAttribute('required'));\n textAreas.forEach((tA) => tA.removeAttribute('required'));\n }\n}\n\nwindow.Bijwerkingentool = Bijwerkingentool;\n"],"sourceRoot":""}