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,GAC7B4H,EAAsBA,EAAoBhG,QAAQ,cAAe9B,EAAQiI,MAAMnG,QAAQ,YAAc+F,EAAc,IAAW,MAC9HK,MAAMJ,IAENI,MAAMlI,EAAQiI,KAAO,wCAA2CJ,EAAc,IAAW,MAE7F5J,EAAEuD,OAAO2G,MAAQ,GAEzB,IAGJ,IAAIC,EAA4BxK,EAAES,MAAMK,KAAK,oCACzC2J,EAA8BzK,EAAES,MAAMK,KAAK,sCAC3C4J,EAAcrK,EAAEuD,OAAOuG,MAAM7H,OAOjC,GALAtC,EAAES,MAAMC,QAAQ,uBACXS,KAAK,2BACLE,YAAY,aACZI,KAAKzB,EAAES,MAAMK,KAAK,qBAEnB4J,EAAc,IAAMF,EAA0BlI,OAAS,GAAKmI,EAA4BnI,OAAS,GAAI,CAErG,IAAIqI,EAAsBH,EAA0BtG,QAAQ,MAAOwG,GAE/DA,EAAc,IACdC,EAAsBF,EAA4BvG,QAAQ,MAAOwG,IAGrE1K,EAAES,MAAMC,QAAQ,uBACXS,KAAK,2BACLyB,SAAS,aACTnB,KAAKkJ,EACd,CACJ,GACJ,IAKA/F,SAASgG,iBAAiB,gCAAgC,SAAUC,GAChE7K,EAAE6K,EAAMC,OAAOC,iBAAiB5J,KAAK,oCAAoCqC,MAAK,SAAUrB,EAAOC,GACvFpC,EAAEoC,GAASjB,KAAK,uBAAyF,SAAhEnB,EAAEoC,GAASjB,KAAK,sBAAsBL,KAAK,mBAC/Ed,EAAEoC,GAASjB,KAAK,yBAAyBF,SAAS,eACnDjB,EAAEoC,GAASQ,SAAS,wBAEpBoI,YAAW,WACPhL,EAAEoC,GAASf,YAAY,uBAC3B,GAAG,KAEHS,OAAOmJ,qBAAqBC,UAAW,GAGnD,GACJ,G","sources":["webpack://sage/./resources/scripts/growtype-form-render.js","webpack://sage/./resources/scripts/partials/actions/repeater.js","webpack://sage/./resources/scripts/partials/actions/conditions.js"],"sourcesContent":["$ = jQuery;\n\n/**\n * Group Repeater\n */\nimport {repeater} from \"./partials/actions/repeater\";\n\nrepeater();\n\n/**\n * Conditions\n */\nimport {conditions} from \"./partials/actions/conditions\";\n\nconditions();\n\n/**\n * General\n */\n$('document').ready(function () {\n\n /**\n * Image uploader\n */\n setupImageUploader();\n\n /**\n * Set date\n */\n if ($(\".datepicker\").length > 0) {\n $(\".datepicker\").each(function (index, element) {\n let options = {\n dateFormat: growtype_form.date.date_format_iso\n };\n\n if ($(element).attr('min-date') !== undefined) {\n options.minDate = $(element).attr('min-date');\n }\n\n $(element).datepicker(options);\n });\n }\n\n /**\n * Set time\n */\n if ($(\".timepicker\").length > 0) {\n $('.timepicker').timepicker();\n }\n\n /**\n * Set date and time pickers\n */\n if ($(\".datetimepicker\").length > 0) {\n const date = new Date();\n let hour = date.getHours();\n let minute = date.getMinutes();\n\n let dateFormat = growtype_form.date.date_format_iso;\n\n function validateValue($this, dateText) {\n let parsedValue = Date.parse(dateText);\n try {\n if (isNaN(parsedValue)) {\n throw null;\n }\n $.datepicker.parseDate(dateFormat, dateText);\n } catch (e) {\n $this.val('')\n }\n }\n\n let startDateMinDate = new Date();\n startDateMinDate.setDate(startDateMinDate.getDate() + 1);\n startDateMinDate.toLocaleDateString();\n\n $('.datetimepicker').datetimepicker({\n language: 'en',\n defaultDate: date,\n dateFormat: dateFormat,\n numberOfMonths: 1,\n hour: hour,\n minute: minute,\n minDate: startDateMinDate,\n onClose: function (dateText, inst) {\n if ($(this).attr('name') === '_auction_dates_from') {\n let endDateMinDate = new Date(dateText);\n endDateMinDate.setDate(endDateMinDate.getDate() + 1);\n endDateMinDate.toLocaleDateString();\n $('.datetimepicker[name=\"_auction_dates_to\"]').datetimepicker(\"option\", \"minDate\", endDateMinDate);\n }\n validateValue($(this), dateText)\n },\n onSelectDate: function (dateText, inst) {\n validateValue($(this), dateText)\n },\n onChangeDateTime: function (dateText, inst) {\n validateValue($(this), dateText)\n }\n });\n }\n\n /**\n * Autonumeric\n */\n if ($(\".autonumeric\").length > 0) {\n $('.autonumeric').autoNumeric('init', {\n unformatOnSubmit: true,\n digitGroupSeparator: growtype_form.currency.digitGroupSeparator,\n decimalCharacter: growtype_form.currency.decimalCharacter,\n currencySymbol: growtype_form.currency.currencySymbol,\n currencySymbolPlacement: growtype_form.currency.currencySymbolPlacement,\n decimalPlacesOverride: growtype_form.currency.decimalPlacesOverride,\n showWarnings: false,\n emptyInputBehavior: 'press',\n minimumValue: 0\n });\n }\n\n /**\n * Img remove\n */\n $('.e-wrapper .btn-img-remove').click(function () {\n let inputType = $(this).attr('data-type');\n let inputId = $(this).attr('data-id');\n let inputClass = $(this).attr('data-class');\n let inputName = $(this).attr('data-name');\n let inputAccept = $(this).attr('data-accept');\n let inputRequired = $(this).attr('data-required');\n let newInput = $('');\n\n newInput.removeClass('has-value');\n\n $(this).closest('.input-file-wrapper').hide();\n $(this).closest('.e-wrapper')\n .append(newInput);\n\n newInput.filestyle({buttonBefore: true})\n });\n\n /**\n * General file input\n */\n $('.growtype-form-wrapper .input-file-wrapper input[type=file]').change(function (e) {\n let maxFileSize = $(this).attr('max-size');\n let maxSizeErrorMessage = $(this).attr('max-size-error-message');\n if (maxFileSize !== undefined) {\n $(e.target.files).each(function (index, element) {\n if (element.size > maxFileSize) {\n if (maxSizeErrorMessage.length > 0) {\n maxSizeErrorMessage = maxSizeErrorMessage.replace(':image_name', element.name).replace(':max_size', (maxFileSize / 1000000) + 'mb')\n alert(maxSizeErrorMessage)\n } else {\n alert(element.name + \" is too big! Max file size allowed - \" + (maxFileSize / 1000000) + 'mb')\n }\n e.target.value = \"\";\n }\n });\n }\n\n let selectedPlaceholderSingle = $(this).attr('data-selected-placeholder-single');\n let selectedPlaceholderMultiple = $(this).attr('data-selected-placeholder-multiple');\n let filesAmount = e.target.files.length;\n\n $(this).closest('.input-file-wrapper')\n .find('.form-label-placeholder')\n .removeClass('is-active')\n .text($(this).attr('data-placeholder'))\n\n if (filesAmount > 0 && (selectedPlaceholderSingle.length > 0 || selectedPlaceholderMultiple.length > 0)) {\n\n let selectedPlaceholder = selectedPlaceholderSingle.replace(':nr', filesAmount)\n\n if (filesAmount > 1) {\n selectedPlaceholder = selectedPlaceholderMultiple.replace(':nr', filesAmount)\n }\n\n $(this).closest('.input-file-wrapper')\n .find('.form-label-placeholder')\n .addClass('is-active')\n .text(selectedPlaceholder)\n }\n });\n});\n\n/**\n * Growtype quiz check if image uploader has files\n */\ndocument.addEventListener('growtypeQuizValidateQuestion', function (event) {\n $(event.detail.currentQuestion).find('.growtype-form-fields .b-wrapper').each(function (index, element) {\n if ($(element).find('div[data-required]') && $(element).find('div[data-required]').attr('data-required') === 'true') {\n if (!$(element).find('.image-uploader-inner').hasClass('has-files')) {\n $(element).addClass('anim-wrong-selection');\n\n setTimeout(function () {\n $(element).removeClass('anim-wrong-selection');\n }, 500);\n\n window.growtype_quiz_global.is_valid = false;\n }\n }\n });\n})\n\n/**\n * Image uploaded setup\n */\nfunction setupImageUploader() {\n /**\n * Image uploader setup\n */\n let defaultGallerySupported = true;\n\n try {\n let dataTransfer = new DataTransfer();\n } catch (err) {\n defaultGallerySupported = false;\n }\n\n let imageUploaderInitial = $('.image-uploader-init');\n\n if (imageUploaderInitial.length === 0) {\n return;\n }\n\n imageUploaderInitial.each(function (index, element) {\n let formInput = $(element);\n let imageUploaderInitialName = formInput.attr('data-name');\n let imageUploaderInitialExtension = formInput.attr('data-extensions') !== undefined ? formInput.attr('data-extensions').split(\",\") : '';\n let imageUploaderInitialMaxSize = formInput.attr('data-max-size');\n let imageUploaderInitialMaxFiles = formInput.attr('data-max-files');\n let imageUploaderPreload = formInput.attr('data-preload');\n let imageUploaderLabel = formInput.attr('data-label') !== undefined ? formInput.attr('data-label') : 'Drag & Drop files here or click to browse';\n let imageCapture = formInput.attr('data-capture') !== undefined ? formInput.attr('data-capture') : '';\n let mimes = formInput.attr('data-mimes') !== undefined ? formInput.attr('data-mimes') : '';\n\n if (defaultGallerySupported) {\n if (typeof $.fn.imageUploader !== 'undefined') {\n formInput.addClass('image-uploader');\n\n let galleryData = typeof (growtype_form_gallery) !== 'undefined' && imageUploaderPreload ? growtype_form_gallery : [];\n let preloaded = [];\n\n if (Object.entries(galleryData).length > 0) {\n let imageUploader = JSON.parse(galleryData['images']);\n\n if (Object.entries(imageUploader).length > 0) {\n preloaded = imageUploader;\n }\n }\n\n let uploaderSettings = {\n preloaded: preloaded,\n imagesInputName: imageUploaderInitialName,\n extensions: imageUploaderInitialExtension,\n maxSize: imageUploaderInitialMaxSize,\n maxFiles: imageUploaderInitialMaxFiles ? imageUploaderInitialMaxFiles : 1,\n label: imageUploaderLabel\n };\n\n if (imageCapture) {\n uploaderSettings.capture = imageCapture;\n }\n\n if (mimes) {\n uploaderSettings.mimes = mimes;\n }\n\n formInput.imageUploader(uploaderSettings);\n\n /**\n * Format label\n */\n formInput.find('.upload-text span:first').html(formInput.find('.upload-text span:first').text())\n }\n } else {\n $('').insertAfter(formInput);\n\n formInput.MultiFile({\n max: 10,\n accept: imageUploaderInitialExtension.join(','),\n max_size: imageUploaderInitialMaxSize,\n });\n }\n });\n}\n","function repeater() {\n /**\n * @param $duplicateBtn\n */\n function cloneReapeaterForm($duplicateBtn) {\n $duplicateBtn.click(function (e) {\n e.preventDefault();\n\n let initialRepeaterForm = $('.repeater-fields[data-form-nr=\"1\"]');\n let repeaterForm = $(this).closest('.repeater-fields');\n let repeaterFormClone = initialRepeaterForm.clone();\n let formNr = repeaterForm.attr('data-form-nr');\n let newFormNr = parseInt(formNr) + 1;\n\n if (repeaterForm.closest('.b-wrapper').hasClass('repeater-fields-folded')) {\n /**\n * Remove closest form group validation\n */\n let blockName = repeaterForm.closest('.b-wrapper').attr('data-group');\n $('.b-wrapper[data-group=\"' + blockName + '\"]')\n .find('.form-check-wrapper[aria-required=\"true\"]')\n .attr('aria-required', 'false')\n .find('input').prop('checked', false);\n\n repeaterForm.closest('.b-wrapper').removeClass('repeater-fields-folded');\n repeaterForm.find('.btn-remove').show();\n repeaterForm.find('.btn-add').hide();\n return false;\n }\n\n /**\n * Hide duplicate btn in previous form\n */\n $(this).closest('.btn-wrapper').hide();\n\n repeaterFormClone.hide();\n repeaterFormClone.insertAfter(repeaterForm)\n repeaterFormClone.find('.btn-remove').show();\n repeaterFormClone.find('.btn-wrapper').show();\n repeaterFormClone.find('.e-counter').text(newFormNr);\n repeaterFormClone.attr('data-form-nr', newFormNr);\n\n /**\n * Reset cloned form\n */\n repeaterFormClone.find('.chosen-container').remove();\n repeaterFormClone.find('label.error').remove();\n repeaterFormClone.find('.error').removeClass('error');\n repeaterFormClone.find('input').val('');\n repeaterFormClone.find('select').val('');\n\n /**\n * Rename cloned form\n */\n renameClonedForm(initialRepeaterForm, repeaterFormClone, newFormNr);\n\n /**\n *\n */\n repeaterFormClone.find('select').chosen(window.selectArgs);\n\n /**\n * Show cloned form\n */\n repeaterFormClone.fadeIn();\n\n /**\n * Reinitiate method\n */\n cloneReapeaterForm(repeaterFormClone.find('a.btn-add'));\n removeRepeaterForm(repeaterFormClone.find('.btn-remove'));\n });\n }\n\n /**\n *\n * @param repeaterFormClone\n * @param newFormNr\n */\n function renameClonedForm(initialRepeaterForm, repeaterFormClone, newFormNr) {\n initialRepeaterForm.find('.e-wrapper').map(function (index, element) {\n let groupName = $(element).attr('data-name');\n if (typeof groupName !== 'undefined' && groupName.length > 0) {\n let newName = '';\n if (groupName.match(/\\[/g) !== null) {\n groupName = groupName.split(\"[\")\n newName = groupName[0] + '_' + newFormNr + '[' + groupName[1];\n } else {\n newName = groupName + '_' + newFormNr;\n }\n\n let field = $(repeaterFormClone.find('div')[index + 1]);\n field.attr('data-name', newName);\n field.find('label').attr('for', newName)\n field.find('.form-control')\n .attr('name', newName)\n .attr('id', newName)\n field.find('select')\n .attr('name', newName)\n .attr('id', newName)\n }\n });\n }\n\n /**\n *\n */\n function removeRepeaterForm(removeBtn) {\n removeBtn.click(function () {\n let repeaterForm = $(this).closest('.repeater-fields');\n\n if (repeaterForm.attr('data-form-nr') === '1') {\n /**\n * Add closest form group validation\n */\n let blockName = repeaterForm.closest('.b-wrapper').attr('data-group');\n $('.b-wrapper[data-group=\"' + blockName + '\"]').find('.form-check-wrapper[aria-required=\"false\"]').attr('aria-required', 'true');\n\n repeaterForm.closest('.b-wrapper').addClass('repeater-fields-folded');\n repeaterForm.find('.btn-add').fadeIn();\n return false;\n }\n\n if (repeaterForm.find('.btn-wrapper:visible').length > 0) {\n repeaterForm.fadeOut().promise().done(function () {\n repeaterForm.prev('.repeater-fields').find('.btn-wrapper').fadeIn();\n $(this).remove();\n })\n } else {\n repeaterForm.fadeOut().promise().done(function () {\n $(this).remove();\n $('.repeater-fields').not('[data-form-nr=\"1\"]').map(function (index, element) {\n let formNr = index + 2;\n $(element).attr('data-form-nr', formNr)\n .find('.e-counter')\n .hide()\n .text(formNr)\n .fadeIn();\n renameClonedForm($('.repeater-fields[data-form-nr=\"1\"]'), $(element), formNr);\n });\n });\n }\n });\n }\n\n $('document').ready(function () {\n cloneReapeaterForm($('.repeater-fields a.btn-add'));\n removeRepeaterForm($('.btn-remove'));\n });\n}\n\nexport {repeater};\n","function conditions() {\n\n /**\n * Collect all conditions from the form\n * @type {*[]}\n */\n window.growtype_form.conditions = [];\n $('.growtype-form .e-wrapper, .growtype-form .b-wrapper').each(function (index, element) {\n if ($(element).attr('data-conditions') && $(element).attr('data-conditions').length > 0) {\n let conditions = JSON.parse($(element).attr('data-conditions'));\n let target = $(element).attr('data-name');\n\n Object.entries(conditions).map(function (element, index) {\n let condition = {\n 'name': element[1]['name'],\n 'condition': element[1]['condition'] ?? '',\n 'value': element[1]['value'],\n 'target': target,\n 'label': element[1]['label'] ?? ''\n };\n\n window.growtype_form.conditions.push(condition)\n })\n }\n });\n\n $(document).ready(function () {\n if (typeof window.growtype_form.conditions === 'object') {\n /**\n * on form load\n */\n $('.form-wrapper').each(function (index, element) {\n updateConditionalValues($(element))\n })\n\n /**\n * On select\n */\n $('.growtype-form select').change(function () {\n let form = $(this).closest('.form-wrapper');\n\n updateConditionalValues(form)\n\n /**\n * Reset conditional checkboxes\n */\n if (form.find('input[type=\"checkbox\"]:checked:hidden').length > 0) {\n form.find('input[type=\"checkbox\"]:checked:hidden').each(function (index, element) {\n $(element).prop('checked', false);\n });\n\n updateConditionalValues(form)\n }\n });\n\n /**\n * On check\n */\n $('.growtype-form input[type=\"checkbox\"]').change(function () {\n let form = $(this).closest('.form-wrapper');\n\n updateConditionalValues(form)\n });\n }\n });\n\n function updateConditionalValues(form) {\n if (window.growtype_form.conditions.length > 0) {\n form.find('[data-conditions]').each(function (index, element) {\n if ($(element).attr('data-conditions').length > 0) {\n $(element).hide();\n }\n })\n\n window.growtype_form.conditions.map(function (element, index) {\n let selectedElement = $('[name=\"' + element['name'] + '\"]');\n let componentValue = selectedElement.val() === null ? '' : selectedElement.val();\n\n /**\n * Check if checkbox is checked\n */\n if (selectedElement.attr('type') === 'checkbox' && selectedElement.is(':checked')) {\n componentValue = 'checked';\n }\n\n let target = form.find('.b-wrapper[data-name=\"' + element['target'] + '\"], .e-wrapper[data-name=\"' + element['target'] + '\"]');\n\n if (componentValue === element['value']) {\n let isRequired = target.find('.form-control').attr('required') !== undefined ? true : false;\n let label = target.find('.form-label');\n let labelText = label.text();\n let labelTextInitial = target.attr('data-initial-label');\n\n if (!window.growtype_form.conditions[index]['initial_label'] && labelTextInitial !== undefined) {\n if (isRequired) {\n labelTextInitial = labelTextInitial.replace(\"*\", '*');\n }\n\n window.growtype_form.conditions[index]['initial_label'] = labelTextInitial;\n }\n\n if (element['condition'] === 'replace') {\n target.attr('data-initial-label', labelText);\n label.html(element['label'] + (isRequired ? '*' : ''));\n } else {\n if (window.growtype_form.conditions[index]['initial_label']) {\n label.html(window.growtype_form.conditions[index]['initial_label']);\n }\n }\n\n target.show();\n }\n })\n }\n }\n}\n\nexport {conditions};\n"],"names":["$","jQuery","cloneReapeaterForm","$duplicateBtn","click","e","preventDefault","initialRepeaterForm","repeaterForm","this","closest","repeaterFormClone","clone","formNr","attr","newFormNr","parseInt","hasClass","blockName","find","prop","removeClass","show","hide","insertAfter","text","remove","val","renameClonedForm","chosen","window","selectArgs","fadeIn","removeRepeaterForm","map","index","element","groupName","length","newName","match","split","field","removeBtn","addClass","fadeOut","promise","done","prev","not","ready","repeater","updateConditionalValues","form","growtype_form","conditions","each","selectedElement","componentValue","is","target","isRequired","undefined","label","labelText","labelTextInitial","replace","html","JSON","parse","Object","entries","_element$1$condition","_element$1$label","condition","push","document","_typeof","change","defaultGallerySupported","DataTransfer","err","imageUploaderInitial","formInput","imageUploaderInitialName","imageUploaderInitialExtension","imageUploaderInitialMaxSize","imageUploaderInitialMaxFiles","imageUploaderPreload","imageUploaderLabel","imageCapture","mimes","fn","imageUploader","galleryData","growtype_form_gallery","preloaded","uploaderSettings","imagesInputName","extensions","maxSize","maxFiles","capture","MultiFile","max","accept","join","max_size","setupImageUploader","options","dateFormat","date","date_format_iso","minDate","datepicker","timepicker","validateValue","$this","dateText","parsedValue","Date","isNaN","parseDate","hour","getHours","minute","getMinutes","startDateMinDate","setDate","getDate","toLocaleDateString","datetimepicker","language","defaultDate","numberOfMonths","onClose","inst","endDateMinDate","onSelectDate","onChangeDateTime","autoNumeric","unformatOnSubmit","digitGroupSeparator","currency","decimalCharacter","currencySymbol","currencySymbolPlacement","decimalPlacesOverride","showWarnings","emptyInputBehavior","minimumValue","inputType","inputId","inputClass","inputName","inputAccept","inputRequired","newInput","append","filestyle","buttonBefore","maxFileSize","maxSizeErrorMessage","files","size","name","alert","value","selectedPlaceholderSingle","selectedPlaceholderMultiple","filesAmount","selectedPlaceholder","addEventListener","event","detail","currentQuestion","setTimeout","growtype_quiz_global","is_valid"],"sourceRoot":""}