(function($) { $.fn.contactUs = async function(options) { const opts = $.extend({}, $.fn.contactUs.defaults, options) this.append(html.call(this, '', opts, '')) loadModule.call(this) }; function html(contactUsList, opts, langJson) { return `` } function getLangText(langJson, key) { if (! langJson) { return key } return langJson[key] } function actContactUsApi($btn) { $($btn).prop('disabled', true) const toMail = $(this).find('.dabory-contact-form .pc5-txt').val() $.fn.dataLinker.api23Js('post-act', { "Page": [ { "Id": 0, "PostTitle": $(this).find('.dabory-contact-form .post-title-txt').val(), "PostContents": $(this).find('.dabory-contact-form .post-contents-textarea').val(), "Pc4": $(this).find('.dabory-contact-form .pc4-txt').val(), "Pc5": toMail, "PostTypeId": 7, "Status": "2", } ] }, function (response) { $($btn).prop('disabled', false) if (response.apiStatus) { return iziToast.error({ title: 'Error', message: 'API Error' }); } $.fn.dataLinker.daboryApp('send-mail', { "Component": "views.emails.contact-us", "Data": "TEST", "ToMail": toMail, "Subject": "CONTACT TEST" }, function () { }) return iziToast.success({ title: 'Success', message: 'Success' }); }) } function loadModule() { const self = this $(document).ready(function () { $(self).find('.dabory-contact-us-popup').draggable() $(self).find('.send-btn').on('click', async function() { actContactUsApi.call(self, this) }); $(self).find('.close-btn').on('click', function() { $(self).find('.dabory-contact-us-popup').hide() $(self).closest('#dabory-widget-list').trigger('hide.widget', 'contact-us') }); }); } $.fn.contactUs.defaults = { top: 0, left: 0, width: 850, langType: 'ko', basePath: '/dabory/widget/contact-us', }; }(jQuery));