{"version":3,"file":"formhandler.min.js","sources":["https:\/\/udl.id\/blocks\/edwiserratingreview\/amd\/src\/formhandler.js"],"sourcesContent":["\/* eslint-disable no-alert *\/\n\/* eslint-disable no-console *\/\n\/* eslint-disable no-unused-vars *\/\ndefine([\n 'jquery',\n 'core\/ajax',\n 'core\/templates',\n 'core\/notification',\n 'block_edwiserratingreview\/reviewfilter'\n ], function ($, Ajax, Templates, Notification, Reviewfilter) {\n\n const SELECTORS = {\n FEEDBACKFORM: '.feedbackform',\n FORMCONTAINER: '.feedbackform-container',\n WRITEREVIEWBTN: '.writereviewbtn',\n FEEDBACKFORM_RESPONSE: '.feedbacksubmitresponse',\n RATINGSELECTION: '.ratingselectionalert',\n FEEDBACKFORMDATA: '#feedbackformdata',\n STARINPUT: \".rating-stars-input input[name='rating']\",\n SUBMITREVIEW: '.submitreview',\n CANCELREVIEW: '.cancelreview'\n };\n\n const eventListeners = () => {\n $(document).off().on(\"click\", SELECTORS.SUBMITREVIEW, function (e) {\n e.preventDefault();\n\n var rating = $('input[name=\"rating\"]:checked').val();\n var review = $('[name=\"review\"]').val();\n\n Ajax.call([{\n methodname: 'block_edwiserratingreview_store_userfeedback',\n args: {\n starcount: rating,\n contextid: M.cfg.contextid,\n feedbackreview: review,\n fortype: \"course\"\n },\n done: function () {\n $(SELECTORS.FEEDBACKFORM).remove();\n $(SELECTORS.WRITEREVIEWBTN).show().removeAttr(\"disabled\");\n $(SELECTORS.FORMCONTAINER).empty().append(datasubmittionalert);\n \/\/ Reviewfilter.init(); \/\/ uncomment this to update the reviews area.\n },\n fail: function () {\n console.log(Notification.exception);\n }\n\n }]);\n });\n\n \/\/ eslint-disable-next-line max-len\n var datasubmittionalert = `