jQuery(document).ready(function(t){(t=jQuery.noConflict())(".bookingor-required-license").find("textarea").attr("disabled",!0),t(".bookingor-required-license").find("input").attr("disabled",!0),t(".bookingor-required-license").find("select").attr("disabled",!0),t(".bookingor-required-license").find("div").attr("disabled",!0),t(".bookingor-required-license").find("div").css("pointer-events","none"),t(".bookingor-required-license").append('<div class="bookingor-d-flex justify-content-between"> <div>Upgrade to see options</div> <a class="bookingor-btn bookingor-btn-primary btn-sm" href="https://bookingor.com/pricing" target="_blank">Upgrade Now</a></div>');t("#add-sub-category-select2").select2({tags:!0,theme:"classic",dropdownParent:t("#categoryModal"),multiple:!0,placeholder:"Add by Comma eg: Book, New book, ",tokenSeparators:[",","enter"]});var o,e=t("#add-select-category");o=e,e=[],t.each(e,function(e,t){t=new Option(t,t,!1,!1);o.append(t)}),o.val(e),o.trigger("change"),t("<bookingor class='bookingor bookingor-why-backgrop'></bookingor>").appendTo("body"),t(".shw-bkdrp").on("click",function(){}),t("#update-category-select2").select2({tags:!0,theme:"classic",dropdownParent:t("#editModal"),type:"text",allowClear:!0,multiple:!0,language:{noResults:function(){return"Update Subcategory"}},placeholder:"Add by Comma eg: Book, New book, ",tokenSeparators:[","]}),t(".shw-sub-lb").hide(),t("#added-sub-container").hide(),t("#example").on("click",".bp-category-view-update",function(e){e.preventDefault(),e=t(this).attr("data-id"),t.post(TCN_BIND.GET_URL+"?action=bp_get_category",{category_id:e,nonce:TCN_BIND.nonce},function(e){t("#bp-update-category")[0].reset(),t("#category-name-update").val(e[0].category_name),t("#category-update-ids").val(e[0].category_id),t("#category-icon-update-id").val(e[0].icon);e=new wp.media.model.Attachment.get(e[0].icon);e.fetch({success:function(e){_.contains(["png","jpg","gif","jpeg"],e.get("subtype"))&&t("#bkinz-category-icon-update").attr("src",e.attributes.url)}}),""==t("#category-icon-update-id").val()?t("#category-icon-update-id").val(e.id):(t("#does-SubCategory-update").attr("checked",!1),t(".upd").text("No"),t(".shw-sub-lb").hide(),t("#update-category-select2").empty(),t("#update-category-select2").val("").trigger("change"))},"json")}),t("#bp-add-category").on("submit",function(e){e.preventDefault(),e=t(this).serialize(),e=(e+="&action=bp_add_category")+"&nonce="+TCN_BIND.nonce,t.post({url:TCN_BIND.GET_URL,data:e,dataType:"json",success:function(e){"success"===e.status?(t.toast({text:e.message,icon:"success",position:"bottom-right"}),t("#categoryModal").modal("hide"),t("#bp-add-category")[0].reset(),location.replace("./admin.php?page=bookingor-category")):t.toast({text:e.message,icon:"error",position:"bottom-right"})}})}),t("#bp-update-category").on("submit",function(e){e.preventDefault(),e=t(this).serialize(),e=(e+="&action=bp_update_category")+"&nonce="+TCN_BIND.nonce,t.post({url:TCN_BIND.GET_URL,data:e,dataType:"json",success:function(e){t("#editModal").modal("hide"),"success"===e.status?(t.toast({text:e.message,icon:"success",position:"bottom-right"}),location.replace("./admin.php?page=bookingor-category")):t.toast({text:e.message,icon:"error",position:"bottom-right"})}})}),t(".bp-delete-category").on("click",function(e){e.preventDefault(),e="action=bp_delete_category&id="+t(this).attr("data-id"),e+="&nonce="+TCN_BIND.nonce,t.post({url:TCN_BIND.GET_URL,data:e,dataType:"json",success:function(e){"success"===e.status?(t.toast({text:e.message,icon:"success",position:"bottom-right"}),location.replace("./admin.php?page=bookingor-category")):t.toast({text:e.message,icon:"error",position:"bottom-right"})}})}),t(".bkinz-status").on("click",function(){"tcn_category_draft"===t(this).attr("name")?t("input[name='tcn_category_status']").val("0"):t("input[name='tcn_category_status']").val("1")})});