!function(e){function t(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,s){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t){jQuery(document).ready(function(e){function t(e){n[e]&&(n[s]&&(n[s].$el.removeClass("current"),n[s].$section.removeClass("current")),n[e].$el.addClass("current"),n[e].$section.addClass("current"),s=e)}var n=[],s="",o=0;if(e("ul.subsubsub a").each(function(){o++;var s=e(this),i=s.data("section");n[i]={$el:s,$section:e("#app-settings-"+i)},s.click(function(e){t(i)})}),o){var i=window.location.hash;i=i?i.substr(1):Object.keys(n)[0],t(i)}})},function(e,t){jQuery(document).ready(function(e){function t(){"yes"==l.val()?c.show():c.hide()}var n,s,o,i=e(".custom_color_row"),r=e(".preset_samples");e('select[name="color_set"]').change(function(){var t=e(this).val();if(0==t)i.show(),r.hide();else{i.hide(),r.show();for(o in app_i10n.classes)if(app_i10n.classes.hasOwnProperty(o)){for(n=[],s=1;s<=3;s++)n[s]=app_i10n.presets[o][s];r.find("a."+o).css("background-color","#"+n[t])}}});var a=e(".colorpicker_input");a.each(function(){var t=this.id;e("#"+t).ColorPicker({onSubmit:function(t,n,s,o){e(o).val(n),e(o).ColorPickerHide()},onBeforeShow:function(){e(this).ColorPickerSetColor(this.value)},onChange:function(n,s,o){var i=e("#"+t);i.val(s),i.parent().find("a.pickcolor").css("background-color","#"+s)}}).bind("keyup",function(){e(this).ColorPickerSetColor(this.value)})}),a.keyup(function(){var t=e(this).val();t=t.replace(/[^a-fA-F0-9]/,""),3!==t.length&&6!==t.length||e(this).parent().find("a.pickcolor").css("background-color","#"+t)});var c=e(".api_detail"),l=e('select[name="login_required"]');t(),l.change(function(){t()}),e('select[name="payment_required"]').change(function(){"yes"==e('select[name="payment_required"]').val()?e(".payment_row").show():e(".payment_row").hide()}),e("#app-settings-section-new-worker form.add-new-service-provider").on("submit",function(){var t=e(this);if(null==e("#services_provided",t).val())return alert(app_i10n.messages.select_service_provider),!1}),e(".appointment-create-page a.button").on("click",function(){var t=e("select",e(this).closest("td")).val(),n={action:"make_an_appointment_page",_wpnonce:e(this).data("nonce"),app_page_type:t};return e.post(ajaxurl,n,function(t){var n='

'+t.data.message+"

";e(".appointments-settings h1").after(n)}),!1}),e(document).on("click","#services-table .delete a",function(){if(window.confirm(app_i10n.messages.services.delete_confirmation)){var t=e("#services-table"),n={action:"delete_service",nonce:e(this).data("nonce"),id:e(this).data("id")};e.post(ajaxurl,n,function(s){s.success&&e("tr#app-tr-service-"+n.id).detach();var o='

'+s.data.message+"

";e(".appointments-settings h1").after(o),0===e("tbody.services tr",t).length&&e("tbody.no",t).removeClass("hidden")})}}),e(document).on("click","#workers-table .delete a",function(){if(window.confirm(app_i10n.messages.workers.delete_confirmation)){var t=e("#workers-table"),n={action:"delete_worker",nonce:e(this).data("nonce"),id:e(this).data("id")};e.post(ajaxurl,n,function(s){s.success&&e("tr#app-tr-worker-"+n.id).detach();var o='

'+s.data.message+"

";e(".appointments-settings h1").after(o),0===e("tbody.services tr",t).length&&e("tbody.no",t).removeClass("hidden")})}})})},function(e,t,n){n(0),e.exports=n(1)}]); //# sourceMappingURL=admin-settings.js.map