Plugin Directory

Changeset 3398571


Ignore:
Timestamp:
11/19/2025 07:14:11 AM (4 weeks ago)
Author:
themefic
Message:

update 2.19.6

Location:
tourfic
Files:
657 added
22 edited

Legend:

Unmodified
Added
Removed
  • tourfic/trunk/assets/admin/js/tourfic-admin-scripts.js

    r3392466 r3398571  
    33803380        }
    33813381
    3382         /*
    3383         * Tour Group Package count
    3384         */
    3385         function tourGroupPackageArr(){
    3386             var optionsArr = [];
    3387             $('.tf-repeater-wrap-group_package_pricing .tf-single-repeater-group_package_pricing').each(function(i){
    3388                 // Get the dynamic index from the tf_repeater_count field
    3389                 let index = $(this).find('[name="tf_repeater_count"]').val();
    3390                 // Extract the option title and type using the dynamic index
    3391                 let optionTitle = $(this).find(`[name="tf_tours_opt[group_package_pricing][${index}][pack_title]"]`).val();
    3392                 if (index !== undefined) {
    3393                     optionsArr[index] = {
    3394                         index: index,
    3395                         title: optionTitle,
    3396                     };
    3397                 }
    3398             })
    3399             return optionsArr;
    3400         }
    34013382
    34023383        $(window).on('load', function () {
    34033384            roomOptionsArr();
    34043385            tourPackageArr();
    3405             tourGroupPackageArr();
    34063386        });
    34073387
     
    40204000                            tour_availability: $('.tour_availability').val(),
    40214001                            option_arr: tourPackageArr(),
    4022                             group_option_arr: tourGroupPackageArr(),
    40234002                        },
    40244003                        beforeSend: function () {
     
    44124391            data.push({name: 'tour_availability', value: tourAvailability.val()});
    44134392            data.push({name: 'options_count', value: tourPackageArr().length});
    4414             data.push({name: 'group_options_count', value: tourGroupPackageArr().length});
    44154393
    44164394            $.ajax({
  • tourfic/trunk/assets/admin/js/tourfic-admin-scripts.min.js

    r3392466 r3398571  
    1 (()=>{var t,e,a;(t=jQuery)(document).ready((function(){const e=new Notyf({ripple:!0,dismissable:!0,duration:3e3,position:{x:"right",y:"bottom"}});t(document).on("click",".tf-del-old-review-fields",(function(a){a.preventDefault(),t(this);var n={action:"tf_delete_old_review_fields",deleteAll:t(this).data("delete-all"),_ajax_nonce:tf_admin_params.tf_nonce};t.ajax({type:"post",url:tf_admin_params.ajax_url,data:n,beforeSend:function(t){e.success(tf_admin_params.deleting_old_review_fields)},success:function(t){e.success(t.data)},error:function(t){e.error(t.data)}})})),t(document).on("click",".remove-order-ids",(function(a){a.preventDefault();var n=t(this),o=t("#post_ID").val(),i={action:"tf_remove_room_order_ids",meta_field:n.closest(".tf-repeater-content-wrap").find(".tf-order_id input").attr("name"),post_id:o,_ajax_nonce:tf_admin_params.tf_nonce};t.ajax({type:"post",url:ajaxurl,data:i,beforeSend:function(t){e.success(tf_admin_params.deleting_room_order_ids)},success:function(t){e.success(t.data.message),location.reload()},error:function(t){e.error(t.data)}})})),t(document).on("click",".post-type-tf_tours #publish, .post-type-tf_tours #save-post",(function(a){if(0===t('input[name="tf_tours_opt[location][address]"]').val().length)return a.preventDefault,a.stopImmediatePropagation(),e.error(tf_admin_params.tour_location_required),!1})),t(document).on("click",".post-type-tf_hotel #publish, .post-type-tf_hotel #save-post",(function(a){if(0===t('input[name="tf_hotels_opt[map][address]"]').val().length)return a.preventDefault,a.stopImmediatePropagation(),e.error(tf_admin_params.hotel_location_required),!1})),t(document).on("click",".post-type-tf_apartment #publish, .post-type-tf_apartment #save-post",(function(a){if(0===t('[name="tf_apartment_opt[map][address]"]').val().length)return a.preventDefault,a.stopImmediatePropagation(),e.error(tf_admin_params.apartment_location_required),!1})),t(document).on("click",".tf-install",(function(e){e.preventDefault();var a=t(this),n=a.attr("data-plugin-slug");a.addClass("updating-message").text(tf_admin_params.installing);var o={action:"tf_ajax_install_plugin",_ajax_nonce:tf_admin_params.tf_nonce,slug:n};jQuery.post(tf_admin_params.ajax_url,o,(function(t){a.removeClass("updating-message"),a.addClass("updated-message").text(tf_admin_params.installed),a.attr("href",t.data.activateUrl)})).fail((function(){a.removeClass("updating-message").text(tf_admin_params.install_failed)})).always((function(){a.removeClass("install-now updated-message").addClass("activate-now button-primary").text(tf_admin_params.activating),a.unbind(e),a[0].trigger("click")}))})),t(document).on("click",".tf-pro",(function(t){t.preventDefault(),window.open("https://tourfic.com/")})),t(window).on("load",(function(){t(".tf-field-disable").find("input, select, textarea, button, div, span").attr("disabled","disabled")})),t(document).on("click",".tf-field-pro",(function(t){t.preventDefault(),window.open("https://tourfic.com/")})),t(document).on("click",".room-repeater > div.csf-fieldset > a.csf-repeater-add",(function(e){var a=t('.room-repeater .csf-repeater-wrapper [data-depend-id="room"]').length-2;t(".room-repeater .unique-id input").each((function(){a++,0===t('.room-repeater [data-depend-id="room"] [data-depend-id="unique_id"]').val().length&&t('.room-repeater [name="tf_hotel[room]['+a+'][unique_id]"]').val((new Date).valueOf()+a)}))})),t(".tf-go-docs").parent().attr("target","_blank"),t(".tf-ticket-status").on("click",(function(){if(t(this).is(":checked")){var e=t(this).val();t("#tf-booking-status-loader").addClass("show"),jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ticket_status_change",_ajax_nonce:tf_admin_params.tf_nonce,status:"check in",order_unique_id:e},success:function(e){t("#tf-booking-status-loader").removeClass("show")}})}else e=t(this).val(),t("#tf-booking-status-loader").addClass("show"),jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ticket_status_change",_ajax_nonce:tf_admin_params.tf_nonce,status:"",order_unique_id:e},success:function(e){t("#tf-booking-status-loader").removeClass("show")}})})),t(document).on("click",".tf-affiliate-active",(function(a){a.preventDefault();var n=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_affiliate_active",nonce:tf_admin_params.tf_nonce},beforeSend:function(t){n.addClass("tf-btn-loading").css({"pointer-events":"none"})},success:function(t){let a=JSON.parse(t);"success"===a.status&&(e.success(a.message),setTimeout((function(){location.reload()}),500)),n.removeClass("tf-btn-loading").css({"pointer-events":"auto"})},error:function(t){n.removeClass("tf-btn-loading").css({"pointer-events":"auto"})},complete:function(t){n.removeClass("tf-btn-loading").css({"pointer-events":"auto"})}})})),t(document).on("click",".tf-affiliate-install",(function(e){e.preventDefault();var a=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_affiliate_install",nonce:tf_admin_params.tf_nonce},beforeSend:function(t){a.addClass("tf-btn-loading").css({"pointer-events":"none"})},success:function(t){"success"===JSON.parse(t).status&&location.reload(),a.removeClass("tf-btn-loading").css({"pointer-events":"auto"})},error:function(t){a.removeClass("tf-btn-loading").css({"pointer-events":"auto"})}})})),t(".tf-post-data-duplicate").on("click",(function(e){e.preventDefault();var a=t(this).data("postid"),n=t(this).data("posttype"),o=t(this).data("nonce");t("#wpcontent").append('<div class="tf-duplicator-loader"></div>'),t.ajax({type:"POST",url:tf_admin_params.ajax_url,data:{action:"tf_duplicate_post_data",postID:a,postType:n,security:o},success:function(t){window.location.reload()},error:function(t){console.error("Error duplicating post:",t)}})}))})),function(t){t(document).ready((function(){const e=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}}),a=function(e){t.confirm({icon:"fa fa-check",theme:"modern",title:"Success!",content:e,type:"green",animat6ionSpeed:300,animation:"scale",closeAnimation:"scale",animateFromElement:!1,typeAnimated:!0,boxWidth:"500px",useBootstrap:!1,closeIcon:!0,buttons:{OK:{btnClass:"btn-blue"}}})},n=function(e){t.confirm({icon:"fa fa-times",theme:"modern",title:"Error!",content:e,type:"red",typeAnimated:!0,animationSpeed:300,animation:"scale",closeAnimation:"scale",animateFromElement:!1,boxWidth:"500px",useBootstrap:!1,closeIcon:!0,buttons:{OK:{btnClass:"btn-red"}}})};t(document).on("change",'[name="tf_hotel_date[from]"], [name="tf_hotel_date[to]"]',(function(a){a.preventDefault();var n=t('[name="tf_hotel_date[from]"]').val(),o=t('[name="tf_hotel_date[to]"]').val();n.length>0&&o.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_available_hotel",_nonce:tf_admin_params.tf_nonce,from:n,to:o},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_available_hotels"]');n.empty(),n.append('<option value="">'+tf_admin_params.select_hotel+"</option>"),t.each(a.data.hotels,(function(t,e){n.append('<option value="'+t+'">'+e+"</option>")})),n.select2(),n.val(n.find("option:eq(1)").val()).trigger("change"),t("#tf-backend-hotel-book-btn").removeAttr("disabled"),t('[name="tf_hotel_rooms_number"]').removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-hotel-book-btn").removeAttr("disabled")}})})),t(document).on("change",'[name="tf_available_hotels"]',(function(a){a.preventDefault();var n=t('[name="tf_available_hotels"]').val(),o=t('[name="tf_hotel_date[from]"]').val(),i=t('[name="tf_hotel_date[to]"]').val();n.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_available_room",_nonce:tf_admin_params.tf_nonce,hotel_id:n,from:o,to:i},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_available_rooms"]'),o=t('[name="tf_hotel_service_type"]');n.removeAttr("disabled"),n.empty(),n.append('<option value="">'+tf_admin_params.select_room+"</option>"),t.each(a.data.rooms,(function(t,e){n.append('<option value="'+t+'">'+e+"</option>")})),n.select2(),n.val(n.find("option:eq(1)").val()).trigger("change"),o.empty(),t.each(a.data.services,(function(t,e){o.append('<option value="'+t+'">'+e+"</option>")})),t("#tf-backend-hotel-book-btn").removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-hotel-book-btn").removeAttr("disabled")}})})),t(document).on("change",'[name="tf_available_rooms"]',(function(a){a.preventDefault();let n=t('[name="tf_available_hotels"]').val(),o=t('[name="tf_available_rooms"]').val();var i=t('[name="tf_hotel_date[from]"]').val(),r=t('[name="tf_hotel_date[to]"]').val();o.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_update_room_fields",_nonce:tf_admin_params.tf_nonce,hotel_id:n,room_id:o,from:i,to:r},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_hotel_rooms_number"]');if(n.empty(),a.data.rooms>0){for(var o=1;o<=a.data.rooms;o++)1===o?n.append('<option value="'+o+'" selected>'+o+" Room</option>"):n.append('<option value="'+o+'">'+o+" Rooms</option>");t("#tf-backend-hotel-book-btn").removeAttr("disabled")}else n.append('<option value="" selected>No Room Available</option>'),n.attr("disabled","disabled");t('[name="tf_hotel_adults_number"]').val(a.data.adults).attr("max",a.data.adults*a.data.rooms),t('[name="tf_hotel_children_number"]').val(a.data.children).attr("max",a.data.children*a.data.rooms)}else e.error(a.data)},error:function(e){console.log(e),t("#tf-backend-hotel-book-btn").removeAttr("disabled")}})})),t(document).on("click","#tf-backend-hotel-book-btn",(function(e){e.preventDefault();let o=t(this),i=o.closest("form.tf-backend-hotel-booking"),r=new FormData(i[0]);r.append("action","tf_backend_hotel_booking");let s=["tf_hotel_booked_by","tf_customer_first_name","tf_customer_email","tf_customer_phone","tf_customer_country","tf_customer_address","tf_customer_city","tf_customer_state","tf_customer_zip","tf_hotel_date[from]","tf_hotel_date[to]","tf_available_hotels","tf_available_rooms","tf_hotel_rooms_number","tf_hotel_adults_number","tf_hotel_children_number"];t.ajax({type:"post",url:tf_admin_params.ajax_url,data:r,processData:!1,contentType:!1,beforeSend:function(t){o.addClass("tf-btn-loading")},success:function(t){const e=JSON.parse(t);if(e.success)a(e.message),a(e.message),i[0].reset(),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else if(e.message)n(e.message),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else for(const t of s){const a=e.fieldErrors[t+"_error"];i.find('[name="'+t+'"]').removeClass("error-input"),"tf_hotel_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").find("small.text-danger").remove():"tf_hotel_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").find("small.text-danger").remove():i.find('[name="'+t+'"]').closest(".tf-fieldset").find("small.text-danger").remove(),a&&(i.find('[name="'+t+'"]').addClass("error-input"),"tf_hotel_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").append('<small class="text-danger">'+a+"</small>"):"tf_hotel_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").append('<small class="text-danger">'+a+"</small>"):i.find('[name="'+t+'"]').closest(".tf-fieldset").append('<small class="text-danger">'+a+"</small>"))}o.removeClass("tf-btn-loading")},error:function(t){console.log(t)},complete:function(t){o.removeClass("tf-btn-loading")}})})),t(document).on("change",'[name="tf_available_tours"]',(function(e){e.preventDefault();var a=t('[name="tf_available_tours"]').val();a&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_tour_date_time_update",_nonce:tf_admin_params.tf_nonce,tour_id:a},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(e){if(e){const a=JSON.parse(e);let n={enableTime:!1,dateFormat:"Y/m/d"};if(a.tour_availability&&(n.minDate="today",n.disableMobile="true",n.enable=Object.entries(a.tour_availability).filter((([t,e])=>"available"===e.status)).map((([t,e])=>{const[a,n]=t.split(" - ").map((t=>t.trim())),o=new Date;return o.getFullYear(),o.getMonth(),o.getDate(),{from:a,to:n}}))),a.tour_packages_array&&function(e){let a=t('[name="tf_tour_packages"]');a.empty(),Object.keys(e).length>0?t.each(e,(function(t,e){a.append(`<option value="${t}">${e}</option>`)})):(a.append('<option value="" selected>No Package Available</option>'),a.attr("disabled","disabled"))}(a.tour_packages_array),n.onChange=function(e,n,o){let i={};const r=e[0].getTime(),s=a.tour_availability;for(const t in s){const e=s[t];if("available"!==e.status)continue;const a=new Date(e.check_in.trim()).getTime(),n=new Date(e.check_out.trim()).getTime();if(r>=a&&r<=n){const t=e.allowed_time?.time||[];Array.isArray(t)?t.forEach((t=>{t&&""!==t.trim()&&(i[t]=t)})):"object"==typeof t&&null!==t&&Object.values(t).forEach((t=>{t&&""!==t.trim()&&(i[t]=t)}));break}}!function(e){let a=t('[name="tf_tour_time"]');a.empty(),Object.keys(e).length>0?t.each(e,(function(t,e){a.append(`<option value="${t}">${e}</option>`)})):(a.append('<option value="" selected>No Time Available</option>'),a.attr("disabled","disabled"))}(i),o.element.value=n.replace(/[a-z]+/g,"-")},t("[name='tf_tour_date']").flatpickr(n),a.tour_extras_array&&Object.keys(a.tour_extras_array).length>0){let e=t('[name="tf_tour_extras[]"]');e.removeAttr("disabled"),e.empty(),t.each(a.tour_extras_array,(function(a,n){e.append(t("<option>",{value:a,html:n}))})),e.select2()}else t('[name="tf_tour_extras[]"]').empty().attr("disabled","disabled");t("#tf-backend-hotel-book-btn").removeAttr("disabled")}}})})),t(document).on("click","#tf-backend-tour-book-btn",(function(o){o.preventDefault();let i=t(this),r=i.closest("form.tf-backend-tour-booking"),s=new FormData(r[0]);s.append("action","tf_backend_tour_booking");let l=["tf_tours_booked_by","tf_customer_first_name","tf_customer_email","tf_customer_phone","tf_customer_country","tf_customer_address","tf_customer_city","tf_customer_state","tf_customer_zip","tf_tour_date","tf_available_tours","tf_tour_adults_number","tf_tour_children_number"];t.ajax({type:"post",url:tf_admin_params.ajax_url,data:s,processData:!1,contentType:!1,beforeSend:function(t){i.addClass("tf-btn-loading")},success:function(t){const o=JSON.parse(t);if(o.success)a(o.message),r[0].reset(),r.find("input").removeClass("error-input"),r.find("select").removeClass("error-input"),r.find("textarea").removeClass("error-input"),r.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else if(n(o.message),o.errors&&o.errors.forEach((function(t){e.error(t)})),r.find("input").removeClass("error-input"),r.find("select").removeClass("error-input"),r.find("textarea").removeClass("error-input"),r.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove(),o.fieldErrors)for(const t of l){const e=o.fieldErrors[t+"_error"];r.find('[name="'+t+'"]').removeClass("error-input"),r.find('[name="'+t+'"]').closest(".tf-fieldset").find("small.text-danger").remove(),e&&(r.find('[name="'+t+'"]').addClass("error-input"),r.find('[name="'+t+'"]').closest(".tf-fieldset").append('<small class="text-danger">'+e+"</small>"))}i.removeClass("tf-btn-loading")}})})),t(document).on("change",'[name="tf_apartment_date[from]"], [name="tf_apartment_date[to]"]',(function(a){a.preventDefault();var n=t('[name="tf_apartment_date[from]"]').val(),o=t('[name="tf_apartment_date[to]"]').val(),i=t('[name="tf_available_apartments"]').val();n.length>0&&o.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_available_apartment",_nonce:tf_admin_params.tf_nonce,from:n,to:o,apartment_id:i},beforeSend:function(){t("#tf-backend-apartment-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_available_apartments"]');n.empty(),n.append('<option value="">Select Apartment</option>'),t.each(a.data.apartments,(function(t,e){n.append('<option value="'+t+'">'+e+"</option>")})),n.val(n.find("option:eq(1)").val()).trigger("change"),t("#tf-backend-apartment-book-btn").removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-apartment-book-btn").removeAttr("disabled")}})})),t(document).on("change",'[name="tf_available_apartments"]',(function(a){a.preventDefault();var n=t('[name="tf_available_apartments"]').val(),o=t('[name="tf_apartment_date[from]"]').val(),i=t('[name="tf_apartment_date[to]"]').val();n.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_apartment_aditional_fees",_nonce:tf_admin_params.tf_nonce,apartment_id:n,from:o,to:i},beforeSend:function(){t("#tf-backend-apartment-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_apartment_additional_fees"]');n.select2({multiple:!0}),n.empty(),a.data.additional_fees.length>0?t.each(a.data.additional_fees,(function(t,e){n.append('<option value="'+t+'">'+e.label+" - "+e.price+"</option>")})):n.append('<option value="1">There are no additional fees</option>'),n.find("option").prop("selected",!0).trigger("change"),t("#tf-backend-apartment-book-btn").removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-apartment-book-btn").removeAttr("disabled")}})})),t(document).on("click","#tf-backend-apartment-book-btn",(function(e){e.preventDefault();let o=t(this),i=o.closest("form.tf-backend-apartment-booking"),r=new FormData(i[0]);r.append("action","tf_backend_apartment_booking");let s=["tf_apartment_booked_by","tf_customer_first_name","tf_customer_email","tf_customer_phone","tf_customer_country","tf_customer_address","tf_customer_city","tf_customer_state","tf_customer_zip","tf_apartment_date[from]","tf_apartment_date[to]","tf_available_apartments","tf_apartment_adults_number","tf_apartment_children_number","tf_apartment_infant_number"];t.ajax({type:"post",url:tf_admin_params.ajax_url,data:r,processData:!1,contentType:!1,beforeSend:function(t){o.addClass("tf-btn-loading")},success:function(t){const e=JSON.parse(t);if(e.success)a(e.message),i[0].reset(),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else if(e.message)n(e.message),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else for(const t of s){const a=e.fieldErrors[t+"_error"];i.find('[name="'+t+'"]').removeClass("error-input"),"tf_apartment_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").find("small.text-danger").remove():"tf_apartment_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").find("small.text-danger").remove():i.find('[name="'+t+'"]').closest(".tf-fieldset").find("small.text-danger").remove(),a&&(i.find('[name="'+t+'"]').addClass("error-input"),"tf_apartment_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").append('<small class="text-danger">'+a+"</small>"):"tf_apartment_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").append('<small class="text-danger">'+a+"</small>"):i.find('[name="'+t+'"]').closest(".tf-fieldset").append('<small class="text-danger">'+a+"</small>"))}o.removeClass("tf-btn-loading")},error:function(t){console.log(t)},complete:function(t){o.removeClass("tf-btn-loading")}})}))}))}(jQuery),(()=>{function t(t){var e=document.getElementById("tf-booking-calendar"),a=window.location.href;t||(t=a.includes("post_type=tf_tours&page=tf_tours_booking")?tf_options.tf_tours_orders:a.includes("post_type=tf_hotel&page=tf_hotel_booking")?tf_options.tf_hotels_orders:a.includes("post_type=tf_apartment&page=tf_apartment_booking")?tf_options.tf_apartments_orders:a.includes("post_type=tf_carrental&page=tf_carrental_booking")?tf_options.tf_cars_orders:[]),new FullCalendar.Calendar(e,{editable:!1,selectable:!0,dayMaxEvents:3,headerToolbar:{left:"prev,next",center:"title",right:"dayGridMonth,timeGridWeek,timeGridDay"},events:t,eventContent:function(t){var e=document.createElement("div");return e.classList.add("tf-booking-single-popup"),e.setAttribute("data-id",t.event.id),e.setAttribute("data-type",t.event.extendedProps.post_type),e.setAttribute("data-page",t.event.extendedProps.page),e.innerHTML=`<span>${t.event.title}</span>`,{domNodes:[e]}}}).render()}!function(e){e(document).ready((function(){const a=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});e(".tf-filter-selection").on("click",(function(){e(this).toggleClass("active")})),e(".tf-filter-selection ul li").on("click",(function(){let t=e(this).closest(".tf-filter-selection"),a=e(this).text();t.find("label span").text(a)})),e(".tf-order-payment-status, .tf-calendar-order-payment-status").length>0&&e(".tf-order-payment-status, .tf-calendar-order-payment-status").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Order Status",allowClear:!0}),e(".tf-filter-bulk-option").length>0&&e(".tf-filter-bulk-option").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Bulk Action"}),e(".tf-filter-bulk-option-enquiry").length>0&&e(".tf-filter-bulk-option-enquiry").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Bulk Action",minimumResultsForSearch:-1}),e(".tf-enquiry-filter-hotel-name").length>0&&e(".tf-enquiry-filter-hotel-name").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Hotel Name",allowClear:!0}),e(".tf-enquiry-filter-apartment-name").length>0&&e(".tf-enquiry-filter-apartment-name").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Apartment Name",allowClear:!0}),e(".tf-enquiry-filter-tour-name ").length>0&&e(".tf-enquiry-filter-tour-name").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Tours Name",allowClear:!0}),e(".tf-filter-mail-option-enquiry").length>0&&e(".tf-filter-mail-option-enquiry").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Filters",allowClear:!0,minimumResultsForSearch:-1}),e(".tf-post-id-filter-options, .tf-booking-post-id-filter-options").length>0&&e(".tf-post-id-filter-options, .tf-booking-post-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Tour Name",allowClear:!0}),e(".tf-hotel-id-filter-options, .tf-booking-hotel-id-filter-options").length>0&&e(".tf-hotel-id-filter-options, .tf-booking-hotel-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Hotel Name",allowClear:!0}),e(".tf-apartment-id-filter-options, .tf-booking-apartment-id-filter-options").length>0&&e(".tf-apartment-id-filter-options, .tf-booking-apartment-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Apartment Name",allowClear:!0}),e(".tf-car-id-filter-options").length>0&&e(".tf-car-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Car Name",allowClear:!0}),e(".tf-tour-checkinout-options, .tf-booking-checkinout-options").length>0&&e(".tf-tour-checkinout-options, .tf-booking-checkinout-options").select2({dropdownCssClass:"tf-booking-checkinout-filter-modal",placeholder:"Checked in status",allowClear:!0}),e(document).on("click",".visitor_edit span",(function(t){t.preventDefault(),e(".visitor-details-edit-form").show()})),e(document).on("click",".visitor-details-edit-popup .tf-booking-times span",(function(t){t.preventDefault(),e(".visitor-details-edit-form").hide()})),e(document).on("submit","form.visitor-details-edit-popup",(function(t){t.preventDefault(),e(this);var a=new FormData(this);a.append("action","tf_visitor_details_edit"),a.append("_ajax_nonce",tf_admin_params.tf_nonce),e.ajax({type:"post",url:tf_admin_params.ajax_url,data:a,processData:!1,contentType:!1,beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(".tf-order-checkinout-status ul li").on("click",(function(){let t=e(this).attr("data-value"),a=e(".tf_single_order_id").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_checkinout_details_edit",order_id:a,checkinout:t,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(".tf-order-ostatus ul li").on("click",(function(){let t=e(this).attr("data-value"),a=e(".tf_single_order_id").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_order_status_edit",order_id:a,status:t,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(".tf-order-email-resend ul li").on("click",(function(){let t=e(this).attr("data-value"),n=e("#tf_email_order_id").val(),o=e(".tf_single_order_id").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_order_status_email_resend",order_id:n,status:t,id:o,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){e(".tf-preloader-box").hide(),a.success("Email Sucessfully Resend!")},error:function(t){console.log(t)}})})),e(document).on("click",".tf-voucher-preview .tf-preview-btn a",(function(t){t.preventDefault(),e(".tf-voucher-quick-view-box").css("display","flex")})),e(document).on("click",".tf-voucher-quick-view-box .tf-quick-view-times span",(function(t){t.preventDefault(),e(".tf-voucher-quick-view-box").hide()})),e("#cb #cb-select-all-1").on("click",(function(){e('input[name="order_id[]"]').each((function(){e(this).prop("checked",!e(this).prop("checked"))}))})),e(".tf-order-status-filter-btn").on("click",(function(){let t=[],a=e(".tf-filter-bulk-option").val();e('.tf_booking_details_wrap input[name="order_id[]"]:checked').each((function(){t.push(e(this).val())})),t.length>0&&""!==a&&e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_order_bulk_action_edit",orders:t,status:a,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(document).on("submit","form.tf-right-search-filter",(function(t){t.preventDefault();let a=e("#tf-searching-key").val();if(""!==a){e(".tf-preloader-box").show();let t=window.location.href,n=t.split("?")[0],o=t.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("post")){i.set("post",a);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}else{let e=t+"&post="+a;window.location.href=e}}})),e(".tf-tour-checkinout-options").change((function(){let t=e(this).val();e(".tf-preloader-box").show();let a=window.location.href,n=a.split("?")[0],o=a.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("checkinout")){i.set("checkinout",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}else{i.set("checkinout",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}if(!i.has("nonce")){i.set("nonce",tf_admin_params.tf_nonce);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}})),e(".tf-post-id-filter-options, .tf-hotel-id-filter-options, .tf-apartment-id-filter-options").change((function(){let t=e(this).val();e(".tf-preloader-box").show();let a=window.location.href,n=a.split("?")[0],o=a.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("post")){i.set("post",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}else{i.set("post",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}if(!i.has("nonce")){i.set("nonce",tf_admin_params.tf_nonce);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}})),e(".tf-order-payment-status").change((function(){let t=e(this).val();e(".tf-preloader-box").show();let a=window.location.href,n=a.split("?")[0],o=a.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("payment")){i.set("payment",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}else{i.set("payment",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}if(!i.has("nonce")){i.set("nonce",tf_admin_params.tf_nonce);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}})),e(".tf_booking_views_button ul li").on("click",(function(){e(".tf_booking_views_button ul li").removeClass("active");let a=e(this),n=a.attr("data-view");a.addClass("active"),"calendar"==n&&(e(".tf-booking-header-filter").hide(),e(".tf-order-table-responsive").hide(),e("#tf-booking-calendar").css("padding","24px"),e(".tf-calendar-booking-header-filter").css("display","flex"),e("#tf-booking-calendar").show(),t()),"list"==n&&(e("#tf-booking-calendar").hide(),e(".tf-calendar-booking-header-filter").hide(),e(".tf-booking-header-filter").css("display","flex"),e(".tf-order-table-responsive").show())})),e(document).on("click",".tf-booking-calendar-popup-box .tf-popup-header .tf-close",(function(t){e(".tf-booking-calendar-popup-box").hide()})),e(document).on("click",".tf-booking-single-popup",(function(t){t.preventDefault();let a=e(this);e(".tf-calendar-popup-box").html(""),e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_booking_details_popup",id:a.attr("data-id"),type:a.attr("data-type"),page:a.attr("data-page"),_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){e(".tf-calendar-popup-box").html(t),e(".tf-preloader-box").hide(),e(".tf-booking-calendar-popup-box").css("display","flex")},error:function(t){console.log(t)}})})),e(document).on("change",".tf-calendar-order-payment-status, .tf-booking-checkinout-options, .tf-filter-by-post",(function(a){a.preventDefault();let n=e(".tf-calendar-order-payment-status").val(),o=e(".tf-booking-checkinout-options").val(),i=e(".tf-filter-by-post").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_booking_calendar_filter",ostatus:n,checkinout:o,post_id:i,post_type:e("#tf_booking_post_type").val(),_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(a){let n=JSON.parse(a);e(".tf-preloader-box").hide(),t(n.events)},error:function(t){console.log(t)}})})),e(".tf-date-picker").each((function(){let t=e(this).data("format")||"Y/m/d";flatpickr(this,{dateFormat:t})}))}))}(jQuery),document.addEventListener("DOMContentLoaded",(function(){var e,a=document.getElementById("tf-booking-calendar");a&&(a.dataset.set?(t(e),a.style.display="none"):t(e))}))})(),function(t){"use strict";t(document).ready((function(){const e=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});t(".tf-enquiry-details-wrap .tf-order-status-filter-btn").on("click",(function(a){a.preventDefault();let n=t(this),o=[],i=n.closest(".tf-enquiry-details-wrap").find(".tf-filter-bulk-option-enquiry").val();n.closest(".tf-enquiry-details-wrap").find(".tf-enquiry-filter-hotel-name").val(),n.closest(".tf-enquiry-details-wrap").find(".tf-checkbox-listing #tf-enquiry-name-checkbox:checked").each((function(){o.push(t(this).val())})),t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_bulk_action",selected_items:o,bulk_action:i,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){n.addClass("loading")},success:function(a){let o=t.parseJSON(a);n.removeClass("loading"),"success"==o.status?e.success(o.msg):"error"==o.status&&e.error(o.msg)}})})),t(".tf-enquiry-filter-hotel-name, .tf-enquiry-filter-tour-name, .tf-enquiry-filter-apartment-name").on("change",(function(){let e=t(this),a=e.val()?e.val():"",n=t(".enquiry-post-type").val(),o=t(".tf-filter-mail-option-enquiry ").val();t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_filter_post",post_id:a,post_type:n,filter:o,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t("#tf-enquiry-status-loader").addClass("show")},success:function(e){t("#tf-enquiry-status-loader").removeClass("show"),"error"==e.status?t(".tf-enquiry-details-wrap").append(e.msg):(t(".tf-enquiry-table").remove(),t(".tf-enquiry-details-wrap").append(e))}})})),t(".tf-order-status-filter-reset-btn").on("click",(function(){t(".tf-filter-bulk-option-enquiry").val("").trigger("change"),t(".tf-filter-hotel-name").val("").trigger("change"),t(".tf-filter-mail-option-enquiry").val("").trigger("change")})),t(".tf-filter-mail-option-enquiry").on("change",(function(){let e=t(this),a=e.val()?e.val():"",n=t(".tf-filter-hotel-name ").val(),o=t(".enquiry-post-type").val();t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_filter_mail",filter:a,post_id:n,post_type:o,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t("#tf-enquiry-status-loader").addClass("show")},success:function(e){t("#tf-enquiry-status-loader").removeClass("show"),"error"==e.status?t(".tf-enquiry-details-wrap").append(e.msg):(t(".tf-enquiry-table").remove(),t(".tf-enquiry-details-wrap").append(e))}})})),t("#tf-single-enquiry-reply-form").on("submit",(function(a){a.preventDefault();let n=t(this),o=n.find(".tf-enquiry-reply-email").val(),i=tinyMCE.activeEditor&&tinyMCE.activeEditor.getContent()?tinyMCE.activeEditor.getContent():t("#tf-enquiry-reply-editor").val(),r=n.find(".tf-enquiry-reply-name").val(),s=n.find(".tf-enquiry-reply-subject").val(),l=n.find(".tf-enquiry-reply-post-id").val(),f=n.find(".tf-enquiry-reply-id").val();t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_reply_email",reply_mail:o,reply_message:i,user_name:r,subject:s,post_id:l,enquiry_id:f,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t("#tf-enquiry-status-loader").addClass("show")},success:function(a){t("#tf-enquiry-status-loader").removeClass("show");let n=JSON.parse(a);"success"==n.status?(e.success(n.msg),window.location.reload()):"error"==n.status&&e.error(n.msg)},error:function(t){console.log(t)}})})),t(document).on("submit","form.tf-enquiry-right-search-filter",(function(a){a.preventDefault();let n=t("#tf-searching-enquiry-key").val(),o=t(".tf-filter-hotel-name option");var i=t.map(o,(function(t){return t.value}));-1!==t.inArray(n,i)?t(".tf-filter-hotel-name").val(n).trigger("change"):e.error(tf_admin_params.no_data_found_with_id)})),t(document).on("click",".tf-single-enquiry-copy-btn",(function(a){let n=t(this).closest(".tf-single-enquiry-details-value").data("enquiry-copy-text"),o=t("<input>"),i=t(this).parent().parent().find(".tf-single-enquiry-log-details-single-value").data("enquiry-copy-text");n=n||i,t("body").append(o),o.val(n).select(),document.execCommand("copy"),o.remove(),e.success("Copied to clipboard")})),t(document).on("click",".tf-single-enquiry-reply-mail-button",(function(e){t(".tf-single-enquiry-reply-wrapper").slideDown(),t(this).hide()})),t(".tf-single-enquiry-reply-another-mail-button").on("click",(function(e){t("#tf-single-enquiry-reply-form").slideDown(),t(this).hide()})),t(".tf-single-enquiry-accordion-item.is-active").children(".tf-single-accordion-body").slideDown(),t(".tf-single-enquiry-accordion-head").on("click",(function(){let e=t(this).parent();e.siblings(".tf-single-enquiry-accordion-item").removeClass("is-active").find(".tf-single-accordion-body").slideUp(),e.toggleClass("is-active").find(".tf-single-accordion-body").slideToggle("ease-out")})),t(".tf-enquiry-single-row").on("click",(function(e){let a=window.location.href,n=t(".tf-enquiry-id",this).val();if("check-column"==t(e.target)[0].className||"tf-enquiry-name-checkbox"==t(e.target)[0].className||"table-name-column"==t(e.target)[0].className)return;let o=a+"&enquiry_id="+n+"&action=preview";window.location.href=o}))}))}(jQuery),(()=>{const{select:t,dispatch:e}=wp.data;function a(){let a=!1;tf_admin_params.error=!1,tf_admin_params.messages=[];let n=Object.assign({},t("core/editor").getCurrentPost(),t("core/editor").getPostEdits());n.hasOwnProperty("categories")&&(n.categories=n.categories.filter((function(t){return 1!==t}))),jQuery.each(tf_admin_params.taxonomies,(function(t,o){n.hasOwnProperty(t)&&0===n[t].length?(e("core/notices").createNotice("error",o.message,{id:"tfNotice_"+t,isDismissible:!1}),tf_admin_params.error=a=!0):e("core/notices").removeNotice("tfNotice_"+t)})),!0===a?e("core/editor").lockPostSaving():e("core/editor").unlockPostSaving()}a(),setInterval(a,500)})(),jQuery((function(t){const e=new Notyf({ripple:!0,dismissable:!0,duration:3e3,position:{x:"right",y:"bottom"}});function a(a){return tf_admin_params.error=!1,t.each(tf_admin_params.taxonomies,(function(a,n){"hierarchical"==n.type?0==t("#taxonomy-"+a+" input:checked").length&&(e.error(n.message),tf_admin_params.error=!0):t("#tagsdiv-"+a+" .tagchecklist").is(":empty")&&(e.error(n.message),tf_admin_params.error=!0)})),!tf_admin_params.error||(a.stopImmediatePropagation(),!1)}if(t("#publish, #save-post").on("click.require-post-category",a),t("#post").on("submit.require-post-category",a),null!=t("#publish")[0]&&null!=t._data(t("#publish")[0],"events")){var n=t._data(t("#publish")[0],"events").click;n&&n.length>1&&n.unshift(n.pop())}if(null!=t("#save-post")[0]&&null!=t._data(t("#save-post")[0],"events")){var o=t._data(t("#save-post")[0],"events").click;o&&o.length>1&&o.unshift(o.pop())}if(null!=t("#post")[0]&&null!=t._data(t("#post")[0],"events")){var i=t._data(t("#post")[0],"events").submit;i&&i.length>1&&i.unshift(i.pop())}})),function(t){t(document).ready((function(){const e=new Notyf({ripple:!0,dismissable:!0,duration:3e3,position:{x:"right",y:"bottom"}});t("body").hasClass("tourfic-settings_page_tf-setup-wizard")&&t("html").css("padding","0"),t(document).on("click",".tf-setup-start-btn",(function(e){e.preventDefault(),t(".tf-welcome-step").hide(),tf_admin_params.is_woo_not_active?t(".tf-setup-step-1").fadeIn(600):t(".tf-setup-step-2").fadeIn(600)})),t(document).on("click",".tf-setup-next-btn, .tf-setup-skip-btn",(function(e){e.preventDefault();let a=t("#tf-setup-wizard-form"),n=a.find('input[name="tf-skip-steps"]').val(),o=t(this).closest(".tf-setup-step-container").data("step"),i=o+1;if(2===o&&t(this).hasClass("tf-setup-next-btn")){if(!t('input[name="tf-services[]"]:checked').length)return alert(tf_admin_params.i18n.no_services_selected),!1;t('input[name="tf-services[]"][value="hotel"]').is(":checked")?(t(".tf-hotel-setup-wizard").show(),t(".tf-add-new-hotel").show()):(t(".tf-hotel-setup-wizard").hide(),t(".tf-add-new-hotel").hide()),t('input[name="tf-services[]"][value="tour"]').is(":checked")?(t(".tf-tour-setup-wizard").show(),t(".tf-add-new-tour").show()):(t(".tf-tour-setup-wizard").hide(),t(".tf-add-new-tour").hide()),t('input[name="tf-services[]"][value="apartment"]').is(":checked")?(t(".tf-apartment-setup-wizard").show(),t(".tf-add-new-apartment").show()):(t(".tf-apartment-setup-wizard").hide(),t(".tf-add-new-apartment").hide()),t('input[name="tf-services[]"][value="carrentals"]').is(":checked")?(t(".tf-car-setup-wizard").show(),t(".tf-add-new-car").show()):(t(".tf-car-setup-wizard").hide(),t(".tf-add-new-car").hide())}t(this).hasClass("tf-setup-skip-btn")&&(n=n?-1===n.indexOf(o)?n+","+o:n:o,a.find('input[name="tf-skip-steps"]').val(n),1===o&&(t(".tf-hotel-setup-wizard").show(),t(".tf-tour-setup-wizard").show())),t(this).hasClass("tf-setup-next-btn")&&-1!==n.indexOf(o)&&(n=n.replace(o,""),a.find('input[name="tf-skip-steps"]').val(n)),t(this).hasClass("tf-setup-submit-btn")||t(".tf-setup-step-"+o).fadeOut(300,(function(){t(".tf-setup-step-"+i).fadeIn(300)}))})),t(document).on("click",".tf-setup-prev-btn",(function(e){e.preventDefault();let a=t(this).closest(".tf-setup-step-container").data("step"),n=a-1;2!==a||tf_admin_params.is_woo_not_active?t(".tf-setup-step-"+a).fadeOut(300,(function(){t(".tf-setup-step-"+n).fadeIn(300)})):t(".tf-setup-step-2").fadeOut(300,(function(){t(".tf-setup-step-0").fadeIn(300)}))})),t(document).on("click",".tf-setup-submit-btn",(function(e){e.preventDefault();let a=t(".tf-setup-submit-btn.tf-quick-setup-btn"),n=t(this).closest("#tf-setup-wizard-form"),o=t(this).closest(".tf-setup-step-container").data("step"),i=n.find('input[name="tf-skip-steps"]').val();t(this).hasClass("tf-quick-setup-btn")&&-1!==i.indexOf(o)&&(i=i.replace(o,""),n.find('input[name="tf-skip-steps"]').val(i));let r=new FormData(n[0]);r.append("action","tf_setup_wizard_submit"),t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:r,processData:!1,contentType:!1,beforeSend:function(){a.addClass("tf-btn-loading")},success:function(e){let n=JSON.parse(e);a.removeClass("tf-btn-loading"),n.success&&(t(".tf-finish-step").show(),t(".tf-setup-step-"+o).hide())},complete:function(){a.removeClass("tf-btn-loading")},error:function(t){a.removeClass("tf-btn-loading"),console.log(t)}})}));let a=tf_admin_params.is_travelfic_toolkit_active;t(document).on("click",".tf-setup-travelfic-theme-btn",(function(e){if(e.preventDefault(),tf_admin_params.current_active_theme&&"travelfic"!=tf_admin_params.current_active_theme&&"ultimate-hotel-booking"!=tf_admin_params.current_active_theme){let e=t('.tf-template-selection input[name="tf_theme_select"]:checked').val();"travelfic"==e&&t(".tf-setup-travelfic-theme-btn").text("Travelfic Installing..."),"ultimate-hotel-booking"==e&&t(".tf-setup-travelfic-theme-btn").text("Hotel Booking Installing..."),t(".tf-setup-travelfic-theme-btn").addClass("tf-btn-loading");var a={action:"tf_theme_installing",_ajax_nonce:tf_admin_params.tf_nonce,slug:e};jQuery.post(tf_admin_params.ajax_url,a,(function(e){t(".tf-setup-travelfic-theme-active").trigger("click")}))}else t(".tf-setup-travelfic-toolkit-btn").trigger("click")})),t(document).on("click",".tf-setup-travelfic-theme-active",(function(e){e.preventDefault();let n=t('.tf-template-selection input[name="tf_theme_select"]:checked').val();"travelfic"==n&&t(".tf-setup-travelfic-theme-btn").text("Travelfic Activate..."),"ultimate-hotel-booking"==n&&t(".tf-setup-travelfic-theme-btn").text("Hotel Booking Activate..."),t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_setup_travelfic_theme_active",_ajax_nonce:tf_admin_params.tf_nonce,slug:n},success:function(e){-1!==t.inArray("travelfic-toolkit",a)?t(".tf-setup-travelfic-toolkit-btn").trigger("click"):window.location.replace(tf_admin_params.toolkit_page_url)},error:function(t){}})})),t(document).on("click",".tf-setup-travelfic-toolkit-btn",(function(e){e.preventDefault();var n=t(this);if(-1!==t.inArray("travelfic-toolkit",a)){let e=t(this).attr("data-install");n.text("Toolkit Activate..."),n.addClass("tf-btn-loading");var o={action:"tf_travelfic_toolkit_installing",_ajax_nonce:tf_admin_params.tf_nonce,slug:e};jQuery.post(tf_admin_params.ajax_url,o,(function(e){t(".tf-setup-travelfic-toolkit-active").trigger("click")}))}else window.location.replace(tf_admin_params.toolkit_page_url)})),t(document).on("click",".tf-setup-travelfic-toolkit-active",(function(e){e.preventDefault();let a=t(this).attr("data-install");t(".tf-setup-travelfic-theme-btn").text("Toolkit Activate..."),t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_travelfic_toolkit_activate",_ajax_nonce:tf_admin_params.tf_nonce,slug:a},success:function(t){window.location.replace(tf_admin_params.toolkit_page_url)},error:function(t){}})})),t(document).on("click",".tf-install-woo-btn",(function(e){e.preventDefault();let a=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ajax_install_woo",_ajax_nonce:tf_admin_params.tf_nonce,slug:"woocommerce"},beforeSend:function(){a.text(tf_admin_params.installing),a.addClass("tf-btn-loading")},success:function(e){a.text(tf_admin_params.activating),t(".tf-active-woo-btn").trigger("click")},error:function(t){console.log(t)}})})),t(document).on("click",".tf-active-woo-btn",(function(a){a.preventDefault();let n=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ajax_activate_woo",_ajax_nonce:tf_admin_params.tf_nonce,slug:"woocommerce"},beforeSend:function(){n.text(tf_admin_params.activating),n.addClass("tf-btn-loading")},success:function(a){e.success(a.data),setTimeout((function(){n.closest(".tf-setup-step-layout").find(".tf-setup-next-btn").trigger("click")}),500),n.removeClass("tf-btn-loading"),t(".tf-install-woo-btn").removeClass("tf-btn-loading")},error:function(t){console.log(t)}})}))}))}(jQuery),function(t){"use strict";t(document).ready((function(){const e=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});function a(e=""){e||(e=window.location.hash);let a=e.replace("#tab=","").split("&")[0];if(a){let e=t('.tf-tablinks[data-tab="'+a+'"]'),n=t("#"+a);e.length&&n.length&&(t(".tf-admin-tab .tf-tablinks").removeClass("active"),t(".tf-tab-wrapper .tf-tab-content").removeClass("active"),e.addClass("active"),n.addClass("active"))}}t(".post-type-tf_tours #post, .post-type-tf_hotel #post, .post-type-tf_room #post, .post-type-tf_apartment #post, .post-type-tf_carrental #post, .post-type-tf_email_templates #post").on("submit",(function(){localStorage.setItem("tf_saved_tab_hash",window.location.hash)}));let n=localStorage.getItem("tf_saved_tab_hash");n?(localStorage.removeItem("tf_saved_tab_hash"),window.location.hash=n,a(n)):a(),t(window).on("hashchange load",(function(){window.location.hash;let e=window.location.search;e.indexOf("dashboard")>-1&&t("#toplevel_page_tf_settings").find(".wp-submenu").find("a").filter((function(t,a){return a.href.indexOf(e)>-1})).parent().addClass("current"),x(),b(),S()})),t(document).on("click",".tf-tablinks",(function(e){e.preventDefault();let a,n=t(this),o=n.closest(".tf-admin-tab-item"),i=o.children(".tf-tablinks").attr("data-tab"),r=t(".tf-tab-content"),s=t(".tf-tablinks");r.hide(),s.removeClass("active");let l=n.attr("data-tab");t("#"+l).css("display","flex"),n.next().hasClass("tf-submenu")&&(a=o.find(".tf-submenu li:first-child .tf-tablinks").data("tab")),a===l?o.find(".tf-submenu li:first-child .tf-tablinks").addClass("active"):n.addClass("active"),window.location.hash="#tab="+l,t(".tf-admin-tab").removeClass("active"),t("#toplevel_page_tf_settings").find(".wp-submenu").find("a").filter((function(t,e){let a=e.hash.replace("#tab=","");return l===a||i===a})).parent().addClass("current").siblings().removeClass("current"),u()})),t(document).on("click",".tf-admin-tab-item",(function(e){e.preventDefault();let a=t(this);a.addClass("open"),a.children("ul").slideDown(),a.siblings(".tf-admin-tab-item").children("ul").slideUp(),a.siblings(".tf-admin-tab-item").removeClass("open"),a.siblings(".tf-admin-tab-item").find("li").removeClass("open"),a.siblings(".tf-admin-tab-item").find("ul").slideUp()}));const o=e=>{t(e).each((function(){let e=t(this),a=e.find("input.flatpickr"),n=a.data("format"),o=a.data("multiple"),i=a.data("min-date");if(2===a.length){let t=e.find(".tf-date-from input.flatpickr").flatpickr({dateFormat:n,minDate:i,altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a.set("minDate",e)}}),a=e.find(".tf-date-to input.flatpickr").flatpickr({dateFormat:n,minDate:i,altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(e,a,n){t.set("maxDate",a)}})}else a.flatpickr({dateFormat:n,minDate:i,altInput:!0,altFormat:tf_options.tf_admin_date_format,mode:o?"multiple":"single"})}))};o(".tf-field-date");const i=e=>{t(e).each((function(){let e=t(this).find("input.flatpickr"),a=e.data("format");e.flatpickr({enableTime:!0,noCalendar:!0,dateFormat:a})}))};i(".tf-field-time");const r=e=>{t(e).each((function(){t(this).find("input.tf-color").wpColorPicker()}))};function s(){t(".tf-tab-content, .tf-taxonomy-metabox").each((function(){var e=t(this);e.find("[data-controller]").each((function(){var a=t(this);if(a.length){var n=t.tf_deps.createRuleset(),o=t.tf_deps.createRuleset(),i=[],r=[];a.each((function(){var a=t(this),o=a.data("controller").split("|"),s=a.data("condition").split("|"),l=a.data("value").toString().split("|"),f=!!a.data("depend-global"),c=n;t.each(o,(function(t,n){var o=l[t]||"",d=s[t]||s[0];(c=c.createRule(e.find('[data-depend-id="'+n+'"]'),d,o)).include(a),f?r.push(n):i.push(n)}))})),i.length&&t.tf_deps.enable(e,n,i),r.length&&t.tf_deps.enable(TF.vars.$body,o,r)}}))}))}r(".tf-field-color"),s(),t(document).on("click",".tf-modal-btn",(function(e){e.preventDefault(),t(this);let a=t("#tf-icon-modal");a.length>0&&a.hasClass("tf-modal-show")?(a.removeClass("tf-modal-show"),t("body").removeClass("tf-modal-open")):(a.addClass("tf-modal-show"),t("body").addClass("tf-modal-open"))})),t(document).on("click",".tf-modal-close",(function(){t(".tf-modal").removeClass("tf-modal-show"),t("body").removeClass("tf-modal-open")})),t(document).on("click",(function(e){t(".tf-map-modal").length||t(e.target).closest(".tf-modal-content,.tf-modal-btn").length||(t("body").removeClass("tf-modal-open"),t(".tf-modal").removeClass("tf-modal-show"))})),t(document).on("click",".tf-icon-tab",(function(e){e.preventDefault();let a=t(this),n=a.data("tab");t(".tf-icon-tab").removeClass("active"),a.addClass("active"),t("#"+n).addClass("active").siblings().removeClass("active");let o=t(".tf-icon-search-input").val();c(),f(o)})),t(document).on("click",".tf-icon-select .tf-admin-btn, .tf-icon-select .tf-icon-preview",(function(e){e.preventDefault();let a=t(this).closest(".tf-icon-select").attr("id");t("#tf-icon-modal").data("icon-field",a)})),t(document).on("click",".tf-icon-list li",(function(e){e.preventDefault();let a=t(this);t(".tf-icon-list li").removeClass("active"),a.addClass("active"),t(".tf-icon-insert").removeClass("disabled")})),t(document).on("click",".tf-icon-insert",(function(e){e.preventDefault(),t(this);let a=t("#tf-icon-modal").data("icon-field"),n=t("#"+a),o=n.find(".tf-icon-preview"),i=t(".tf-icon-list li.active").data("icon");i&&(o.removeClass("tf-hide"),n.find(".tf-icon-preview-wrap i").attr("class",i),n.find(".tf-icon-value").val(i).trigger("change"),t(".tf-modal").removeClass("tf-modal-show"),t("body").removeClass("tf-modal-open"))})),t(document).on("click",".tf-icon-preview .remove-icon",(function(e){e.preventDefault();let a=t(this),n=a.closest(".tf-icon-preview"),o=a.closest(".tf-icon-select"),i=t("#tf-icon-modal").find(".tf-icon-list li");n.addClass("tf-hide"),o.find(".tf-icon-preview-wrap i").attr("class",""),o.find(".tf-icon-value").val("").trigger("change"),i.removeClass("active")}));const l=(t,e)=>{let a;return function(){const n=this,o=arguments;clearTimeout(a),a=setTimeout((()=>t.apply(n,o)),e)}};t(document).on("keyup",".tf-icon-search-input",l((function(e){let a=t(this).val();f(a)}),500));const f=a=>{let n=t(".tf-icon-tab-pane.active").data("type"),o=t(".tf-icon-tab-pane.active .tf-icon-list");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_icon_search",_nonce:tf_admin_params.tf_nonce,search:a,type:n},beforeSend:function(){o.html('<div class="tf-icon-loading">Loading...</div>')},success:function(a){a.success?(o.html(a.data.html),t(".tf-icon-tab-pane.active").attr("data-max",a.data.count)):e.error(a.data)},error:function(t,e,a){console.error(a)}})},c=()=>{var a=!1,n=100;let o=t(".tf-icon-tab-pane.active .tf-icon-list"),i=0,r=t(".tf-icon-search-input").val();o.on("scroll",(function(){let s=t(".tf-icon-tab-pane.active").data("type"),l=t(".tf-icon-tab-pane.active").data("max");i=o[0].scrollHeight-o.height(),o.scrollTop()>=i&&!a&&n<l&&(a=!0,t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_load_more_icons",_nonce:tf_admin_params.tf_nonce,start_index:n,type:s,search:r},beforeSend:function(){t(".tf-icon-list").append('<div class="tf-icon-loading">Loading...</div>')},success:function(o){o.success?(a=!1,t("#tf-icon-tab-"+s+" .tf-icon-list").append(o.data),t(".tf-icon-loading").remove(),n+=100):(t(".tf-icon-loading").remove(),e.error(o.data))},error:function(e,n,o){a=!1,console.error(o),t(".tf-icon-loading").remove()}}))}))};c(),t(document).on("click",".tf-setting-save-btn .tf-submit-btn",(function(e){e.preventDefault(),t(".tf-option-form.tf-ajax-save").submit()})),t(document).on("click",".tf-setting-save-btn .tf-reset-btn",(function(a){t.confirm({icon:"fa fa-warning",title:tf_options.swal_reset_title_text,content:tf_options.swal_reset_other_text,type:"red",typeAnimated:!1,boxWidth:"500px",animationSpeed:500,animation:"scale",closeAnimation:"scale",animateFromElement:!1,useBootstrap:!1,theme:"modern",buttons:{confirm:{text:tf_options.swal_reset_btn_text,btnClass:"btn-blue",action:function(){t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_options_reset",tf_option_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t(".tf-setting-save-btn .tf-reset-btn").addClass("tf-btn-loading")},success:function(a){let n=JSON.parse(a);"success"===n.status?(e.success(n.message),window.location.reload()):e.error(n.message),t(".tf-setting-save-btn .tf-reset-btn").removeClass("tf-btn-loading")},error:function(t,e,a){console.log(a)}}).done((function(){}))}},cancel:{text:tf_options.swal_reset_cancel_btn_text,btnClass:"btn-red"}}})})),t(document).find("#tf-settings-header-search-filed").on("keyup",l((function(){var e=t(this).val().toLowerCase();let a=document.createElement("div");a.classList.add("tf-search-results"),e.length>=3?t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_search_settings_autocomplete",tf_option_nonce:tf_admin_params.tf_nonce,search:e},success:function(n){let o=JSON.parse(n),i=0,r=document.createElement("ul");if("success"===o.status){if(t.each(o.message,(function(n,o){if(-1!=o.field_title.toLowerCase().indexOf(e)){let t=document.createElement("li"),e=document.createElement("div");e.classList.add("tf-search-result-title");let a=document.createElement("a");a.href=`#tab=${o.parent_id}`;let n=document.createElement("i"),i=document.createElement("p"),s=document.createElement("span");i.innerHTML=o.field_title,s.innerHTML=o.path,n.classList.add(...o.icon.split(" ")),r.classList.add("tf-search-result"),t.setAttribute("data-id",o.id),t.setAttribute("data-tab-id",o.tab_id),a.append(n),e.append(i),e.append(s),a.append(e),t.append(a),r.append(t)}else i=1;t(".tf-search-results").length||e<3?t(".tf-search-results").remove():a.append(r)})),1==i){let t=document.createElement("p");t.classList.add("tf-search-not-found"),t.innerHTML=tf_admin_params.setting_search_no_result,r.append(t)}t(".tf-setting-search").append(a)}else console.log("Something went wrong!")}}):t(".tf-search-results").hide()}),700)),t(document).on("click",(function(e){"tf-settings-header-search-filed"!==e.target.id&&t(".tf-search-results").length&&t(".tf-search-results").hide()})),t("#tf-settings-header-search-filed").on("focus",(function(e){t(".tf-search-results").length&&t(".tf-search-results").show()})),t(document).on("click",".tf-search-result li",(function(e){let a=`label[for='tf_settings\\[${t(this).data("id")}\\]']`,n=t(this).closest("li").data("tab-id");n&&t('.tf-tab-item[data-tab-id="'+n+'"]').trigger("click"),t("html, body").animate({scrollTop:t(document).find(a).closest(".tf-field").offset().top},100)})),t(document).on("submit",".tf-option-form.tf-ajax-save",(function(a){a.preventDefault();let n=t(this),o=n.find(".tf-submit-btn"),i=new FormData(this);var r=t(".itinerary-fonts-file").prop("files");if(void 0!==r)for(var s=0;s<r.length;s++)i.append("file[]",r[s]);let l=!1;if(void 0!==i.get("tf_import_option")&&""!=i.get("tf_import_option").trim()){if(!confirm(tf_options.tf_export_import_msg.import_confirm))return;l=!0}i.append("action","tf_options_save"),t.ajax({url:tf_options.ajax_url,type:"POST",data:i,processData:!1,contentType:!1,beforeSend:function(){1==l&&n.find(".tf-import-btn").addClass("tf-btn-loading"),o.addClass("tf-btn-loading"),t(".tf-setting-save-btn .tf-submit-btn").addClass("tf-btn-loading")},success:function(a){let i=JSON.parse(a);"success"===i.status?(e.success(i.message),1==l&&window.location.reload()):e.error(i.message),o.removeClass("tf-btn-loading"),t(".tf-setting-save-btn .tf-submit-btn").removeClass("tf-btn-loading"),1==l&&n.find(".tf-import-btn").removeClass("tf-btn-loading")},error:function(t){o.removeClass("tf-btn-loading"),console.log(t.responseText),t.responseText.includes("max_input_vars")?e.error({message:tf_admin_params.max_input_vars_notice,duration:15e3,dismissible:!0}):e.error({message:t.responseText,duration:6e3})}})}));const d=e=>{let a=e,n=a.attr("id"),o=a.data("placeholder");"yes"===a.data("delete")?t("#"+n).select2({placeholder:o,allowClear:!0,templateResult:p,templateSelection:function(e){if(!e.id)return e.text;var a=t(e.element).data("edit-url");return a?t("<span>"+e.text+' <a target="_blank" href="'+a+'" class="tf-edit-room"><i class="fa-regular fa-pen-to-square"></i></a></span>'):e.text}}):t("#"+n).select2({placeholder:o,allowClear:!0,templateSelection:function(e){if(!e.id)return e.text;var a=t(e.element).data("edit-url");return a?t("<span>"+e.text+' <a target="_blank" href="'+a+'" class="tf-edit-room"><i class="fa-regular fa-pen-to-square"></i></a></span>'):e.text}})};function p(e){return e.id?t('<span style="display: flex; justify-content: space-between;">'+e.text+'<span class="tf-remove-button" data-id="'+e.id+'">Remove</span></span>'):e.text}function u(){var e=[];return t(".tf-repeater-wrap-room-options .tf-single-repeater-room-options").each((function(a){let n=t(this).find('[name="tf_repeater_count"]').val(),o=t(this).find(`[name="tf_room_opt[room-options][${n}][option_pricing_type]"]`).val(),i=t(this).find(`[name="tf_room_opt[room-options][${n}][option_title]"]`).val();void 0!==n&&(e[n]={index:n,title:i,type:o})})),e}function _(){var e=[];return t(".tf-repeater-wrap-package_pricing .tf-single-repeater-package_pricing").each((function(a){let n=t(this).find('[name="tf_repeater_count"]').val(),o=t(this).find(`[name="tf_tours_opt[package_pricing][${n}][pricing_type]"]`).val(),i=t(this).find(`[name="tf_tours_opt[package_pricing][${n}][pack_title]"]`).val();void 0!==i&&(e[n]={index:n,title:i,type:o})})),e}function m(){var e=[];return t(".tf-repeater-wrap-group_package_pricing .tf-single-repeater-group_package_pricing").each((function(a){let n=t(this).find('[name="tf_repeater_count"]').val(),o=t(this).find(`[name="tf_tours_opt[group_package_pricing][${n}][pack_title]"]`).val();void 0!==n&&(e[n]={index:n,title:o})})),e}t("select.tf-select2").each((function(){var e=t(this);d(e)})),t(".tf-backend-booking-card-wrap #tf_available_tours").val(null).trigger("change"),t(document).on("select2:selecting",".tf-select2",(function(e){if("tf-remove-button"===e.params.args.originalEvent.target.className){e.stopPropagation(),e.preventDefault();let n=t(this).closest(".tf-fieldset"),o=n.find("#category_name").val(),i=n.find("#category_select_field_name").val();var a=t(e.params.args.originalEvent.target).data("id");t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_delete_category_data",_nonce:tf_admin_params.tf_nonce,term_id:a,categoryName:o},success:function(e){if(JSON.parse(e).success){let e=t("#"+i);e.find('option[value="'+a+'"]').remove(),e.select2("close")}}})}})),t("select.tf-shortcode-select2").each((function(e){let a=t(this);a.attr("id"),d(a),t(this).on("select2:select",(function(e){var a=t(e.currentTarget).val();a&&a.includes("'all'")&&t(this).val(["'all'"]).trigger("change.select2")}))})),t(window).on("load",(function(){u(),_(),m()}));var h=function(e){var a=this;this.container=e,this.calendar=null,this.roomCalData=null,this.fullCalendar,this.timeOut,this.fullCalendarOptions={initialView:"dayGridMonth",firstDay:1,headerToolbar:{start:"title",center:"",end:"prev,next"},displayEventTime:!0,selectable:!0,select:function({start:t,end:e,startStr:n,endStr:o,allDay:i,jsEvent:r,view:s,resource:l}){if(moment(t).isBefore(moment(),"day")||moment(e).isBefore(moment(),"day"))a.fullCalendar.unselect(),v("","",a.roomCalData);else{var f=moment(t).format("Z");f=f.split(":"),f=parseInt(f[0])+":00",v(moment(t).utcOffset(f).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),moment(e).utcOffset(f).subtract(1,"day").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),a.roomCalData)}},events:function({start:e,end:n,startStr:o,endStr:i,timeZone:r},s,l){t.ajax({url:tf_options.ajax_url,dataType:"json",type:"POST",data:{action:"tf_get_hotel_room_availability",_nonce:tf_admin_params.tf_nonce,new_post:t(a.container).find('[name="new_post"]').val(),room_id:t(a.container).find('[name="room_id"]').val(),avail_date:t(a.container).find(".avail_date").val(),option_arr:u()},beforeSend:function(){t(a.container).css({"pointer-events":"none",opacity:"0.5"}),t(a.calendar).addClass("tf-content-loading")},success:function(e){"object"==typeof e&&s(e?.avail_data),t(".tf-single-options").html(e?.options_html),t(a.container).css({"pointer-events":"auto",opacity:"1"}),t(a.calendar).removeClass("tf-content-loading")},error:function(t){console.log(t)}})},eventContent:function(t){const e=t.event.title,a=document.createElement("div");return a.classList.add("fc-event-title"),a.innerHTML=e,{domNodes:[a]}},eventClick:function({event:e,el:n,jsEvent:o,view:i}){let r,s=moment(e.start,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase());r=e.end?moment(e.end,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()):s,v(s,r,a.roomCalData);let l=t(".tf_room_pricing_by").val();if("1"===l)void 0!==e.extendedProps.price&&t("[name='tf_room_price']",a.roomCalData).val(e.extendedProps.price);else if("2"===l)void 0!==e.extendedProps.adult_price&&t("[name='tf_room_adult_price']",a.roomCalData).val(e.extendedProps.adult_price),void 0!==e.extendedProps.child_price&&t("[name='tf_room_child_price']",a.roomCalData).val(e.extendedProps.child_price);else if(0!=e.extendedProps.options_count)for(var f=0;f<=e.extendedProps.options_count-1;f++)t("[name='tf_room_option_"+f+"']",a.roomCalData).prop("checked",1==e.extendedProps["tf_room_option_"+f]),t("[name='tf_option_room_price_"+f+"']",a.roomCalData).val(e.extendedProps["tf_option_room_price_"+f]),t("[name='tf_option_adult_price_"+f+"']",a.roomCalData).val(e.extendedProps["tf_option_adult_price_"+f]),t("[name='tf_option_child_price_"+f+"']",a.roomCalData).val(e.extendedProps["tf_option_child_price_"+f]);e.extendedProps.status&&t("[name='tf_room_status'] option[value="+e.extendedProps.status+"]",a.roomCalData).prop("selected",!0)}},this.init=function(){a.container=jQuery(e),a.calendar=e.querySelector(".tf-room-cal"),a.roomCalData=t(".tf-room-cal-field",a.container),v("","",a.roomCalData),a.initCalendar()},this.initCalendar=function(){"undefined"!=typeof FullCalendar&&(a.fullCalendar=new FullCalendar.Calendar(a.calendar,a.fullCalendarOptions),a.fullCalendar.render())}};function v(e,a,n){t(".tf_room_check_in",n).val(e),t(".tf_room_check_out",n).val(a)}function g(e){t(".tf_room_check_in",e).val(""),t(".tf_room_check_out",e).val(""),t('[name="tf_room_price"]',e).val(""),t('[name="tf_room_adult_price"]',e).val(""),t('[name="tf_room_child_price"]',e).val(""),t(e).find('[name="tf_room_check_in"]').each((function(){this._flatpickr&&this._flatpickr.destroy()})),t(e).find('[name="tf_room_check_out"]').each((function(){this._flatpickr&&this._flatpickr.destroy()}));let a=t(e).find('[name="tf_room_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n&&n.set("minDate",e)}}),n=t(e).find('[name="tf_room_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a&&a.set("maxDate",e)}})}const b=()=>{t(".tf-room-cal-wrap").each((function(t,e){new h(e).init()}))};b(),t(".tf-room-cal-wrap").each((function(e,a){let n=t(a).find('[name="tf_room_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){o.set("minDate",e)}}),o=t(a).find('[name="tf_room_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n.set("maxDate",e)}})})),t(document).on("click",".tf_room_cal_update",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-room-cal-wrap"),i=n.closest(".tf-room-cal-wrap")[0],r=o.find(".tf-room-cal"),s=t("input, select",o.find(".tf-room-cal-field")).serializeArray(),l=t(".tf_room_pricing_by").val(),f=o.find(".avail_date");s.push({name:"action",value:"tf_add_hotel_room_availability"}),s.push({name:"_nonce",value:tf_admin_params.tf_nonce}),s.push({name:"price_by",value:l}),s.push({name:"avail_date",value:f.val()}),s.push({name:"options_count",value:u().length}),t.ajax({url:tf_options.ajax_url,type:"POST",data:s,beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(t){if("object"==typeof t){if(!0===t.data.status){f.val(t.data.avail_date),e.success(t.data.message),g(o);var a=new h(i);a.init(),a.fullCalendar&&a.fullCalendar.refetchEvents()}else e.error(t.data.message);o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}},error:function(t){console.log(t),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}})})),t(document).on("change",".tf_room_pricing_by",(function(e){let a=t(this).val();"1"===a?(t(".tf-price-by-room").show(),t(".tf-price-by-person").hide(),t(".tf-room-cal-field .tf-single-option").hide()):"2"===a?(t(".tf-price-by-person").show(),t(".tf-price-by-room").hide(),t(".tf-room-cal-field .tf-single-option").hide()):"3"===a&&(t(".tf-price-by-room").hide(),t(".tf-price-by-person").hide(),t(".tf-room-cal-field .tf-single-option").show())})),t(document).on("change",".tf-switch",(function(e){var a=t(this);this.checked?a.val(1):a.val(""),a.hasClass("tf_room_availability_by_date")&&b(),a.hasClass("tf_apartment_availability_by_date")&&x(),a.hasClass("tf_tour_availability_by_date")&&S()}));var y=function(e){var a=this;this.container=e,this.calendar=null,this.apartmentCalData=null,this.fullCalendar,this.timeOut,this.fullCalendarOptions={initialView:"dayGridMonth",firstDay:1,headerToolbar:{start:"title",center:"",end:"prev,next"},displayEventTime:!0,selectable:!0,select:function({start:t,end:e,startStr:n,endStr:o,allDay:i,jsEvent:r,view:s,resource:l}){if(moment(t).isBefore(moment(),"day")||moment(e).isBefore(moment(),"day"))a.fullCalendar.unselect(),k("","",a.apartmentCalData);else{var f=moment(t).format("Z");f=f.split(":"),f=parseInt(f[0])+":00",k(moment(t).utcOffset(f).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),moment(e).utcOffset(f).subtract(1,"day").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),a.apartmentCalData)}},events:function({start:e,end:n,startStr:o,endStr:i,timeZone:r},s,l){t.ajax({url:tf_options.ajax_url,dataType:"json",type:"POST",data:{action:"tf_get_apartment_availability",_nonce:tf_admin_params.tf_nonce,new_post:t('[name="new_post"]').val(),apartment_id:t('[name="apartment_id"]').val(),apt_availability:t(".apt_availability").val()},beforeSend:function(){t(a.container).css({"pointer-events":"none",opacity:"0.5"}),t(a.calendar).addClass("tf-content-loading")},success:function(e){"object"==typeof e&&s(e),t(a.container).css({"pointer-events":"auto",opacity:"1"}),t(a.calendar).removeClass("tf-content-loading")},error:function(t){console.log(t)}})},eventContent:function(t){const e=t.event.title,a=document.createElement("div");return a.classList.add("fc-event-title"),a.innerHTML=e,{domNodes:[a]}},eventClick:function({event:e,el:n,jsEvent:o,view:i}){let r,s=moment(e.start,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase());r=e.end?moment(e.end,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()):s,k(s,r,a.apartmentCalData),"per_night"===t(".tf_apt_pricing_type").val()?void 0!==e.extendedProps.price&&t("[name='tf_apt_price']",a.apartmentCalData).val(e.extendedProps.price):(void 0!==e.extendedProps.adult_price&&t("[name='tf_apt_adult_price']",a.apartmentCalData).val(e.extendedProps.adult_price),void 0!==e.extendedProps.child_price&&t("[name='tf_apt_child_price']",a.apartmentCalData).val(e.extendedProps.child_price),void 0!==e.extendedProps.infant_price&&t("[name='tf_apt_infant_price']",a.apartmentCalData).val(e.extendedProps.infant_price)),e.extendedProps.status&&t("[name='tf_apt_status'] option[value="+e.extendedProps.status+"]",a.apartmentCalData).prop("selected",!0)}},this.init=function(){a.container=jQuery(e),a.calendar=e.querySelector(".tf-apt-cal"),a.apartmentCalData=t(".tf-apt-cal-field",a.container),k("","",a.apartmentCalData),a.initCalendar()},this.initCalendar=function(){"undefined"!=typeof FullCalendar&&(a.fullCalendar=new FullCalendar.Calendar(a.calendar,a.fullCalendarOptions),a.fullCalendar.render())}};function k(e,a,n){t(".tf_apt_check_in",n).val(e),t(".tf_apt_check_out",n).val(a)}function w(e){t(".tf_apt_check_in",e).val(""),t(".tf_apt_check_out",e).val(""),t('[name="tf_apt_price"]',e).val(""),t('[name="tf_apt_adult_price"]',e).val(""),t('[name="tf_apt_child_price"]',e).val(""),t('[name="tf_apt_infant_price"]',e).val(""),t(e).find('[name="tf_apt_check_in"]').each((function(){this._flatpickr&&this._flatpickr.destroy()})),t(e).find('[name="tf_apt_check_out"]').each((function(){this._flatpickr&&this._flatpickr.destroy()}));let a=t(e).find('[name="tf_apt_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n&&n.set("minDate",e)}}),n=t(e).find('[name="tf_apt_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a&&a.set("maxDate",e)}})}const x=()=>{t(".tf-apt-cal-wrap").each((function(e,a){new y(a).init();let n=t(a).find('[name="tf_apt_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){o.set("minDate",e)}}),o=t(a).find('[name="tf_apt_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n.set("maxDate",e)}})}))};x(),t(document).on("click",".tf_apt_cal_update",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-apt-cal-wrap"),i=n.closest(".tf-apt-cal-wrap")[0],r=o.find(".tf-apt-cal"),s=t("input, select",o.find(".tf-apt-cal-field")).serializeArray(),l=t(".tf_apt_pricing_type").val(),f=o.find(".apt_availability");s.push({name:"action",value:"tf_add_apartment_availability"}),s.push({name:"_nonce",value:tf_admin_params.tf_nonce}),s.push({name:"pricing_type",value:l}),s.push({name:"apt_availability",value:f.val()}),t.ajax({url:tf_options.ajax_url,type:"POST",data:s,beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(t){if("object"==typeof t){if(!0===t.data.status){f.val(t.data.apt_availability),e.success(t.data.message),w(o);var a=new y(i);a.init(),a.fullCalendar&&a.fullCalendar.refetchEvents()}else e.error(t.data.message);o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}},error:function(t){console.log(t),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}})})),t(document).on("change",".tf_apt_pricing_type",(function(e){let a=t(this).val();"per_night"===a?(t(".tf-price-by-night").show(),t(".tf-price-by-person").hide()):"2"===a&&(t(".tf-price-by-person").show(),t(".tf-price-by-night").hide())}));var C=function(e){var a=this;this.container=e,this.calendar=null,this.tourCalData=null,this.fullCalendar,this.timeOut,this.fullCalendarOptions={initialView:"dayGridMonth",firstDay:1,headerToolbar:{start:"title",center:"",end:"prev,next"},displayEventTime:!0,selectable:!0,select:function({start:t,end:e,startStr:n,endStr:o,allDay:i,jsEvent:r,view:s,resource:l}){if(j(""),moment(t).isBefore(moment(),"day")||moment(e).isBefore(moment(),"day"))a.fullCalendar.unselect(),D("","",a.tourCalData);else{var f=moment(t).format("Z");f=f.split(":"),f=parseInt(f[0])+":00",D(moment(t).utcOffset(f).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),moment(e).utcOffset(f).subtract(1,"day").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),a.tourCalData)}},events:function({start:e,end:n,startStr:o,endStr:i,timeZone:r},s,l){t.ajax({url:tf_options.ajax_url,dataType:"json",type:"POST",data:{action:"tf_get_tour_availability",_nonce:tf_admin_params.tf_nonce,new_post:t('[name="new_post"]').val(),tour_id:t('[name="tour_id"]').val(),tour_availability:t(".tour_availability").val(),option_arr:_(),group_option_arr:m()},beforeSend:function(){t(a.container).css({"pointer-events":"none",opacity:"0.5"}),t(a.calendar).addClass("tf-content-loading")},success:function(e){"object"==typeof e&&s(e?.avail_data),t(".tf-package-field-repeater").html(e?.options_html),t(a.container).css({"pointer-events":"auto",opacity:"1"}),t(a.calendar).removeClass("tf-content-loading")},error:function(t){console.log(t)}})},eventContent:function(t){const e=t.event.title,a=document.createElement("div");return a.classList.add("fc-event-title"),a.innerHTML=e,{domNodes:[a]}},eventDidMount:function(t){const e=t.event.extendedProps.customClass||"";e&&t.el.classList.add(e)},eventClick:function({event:e,el:n,jsEvent:o,view:i}){let r,s=moment(e.start,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase());r=e.end?moment(e.end,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).subtract(1,"days").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()):s,D(s,r,a.tourCalData);let l=t(".tf_tour_pricing_type").val(),f=t('[name="tf_tours_opt[allow_package_pricing]"]').val();void 0!==e.extendedProps.min_person&&t("[name='tf_tour_min_person']",a.tourCalData).val(e.extendedProps.min_person),void 0!==e.extendedProps.max_person&&t("[name='tf_tour_max_person']",a.tourCalData).val(e.extendedProps.max_person),void 0!==e.extendedProps.max_capacity&&t("[name='tf_tour_max_capacity']",a.tourCalData).val(e.extendedProps.max_capacity);let c="";if(void 0!==e.extendedProps.allowed_time){const t=e.extendedProps.allowed_time,a=Array.isArray(t.time)?t.time:"object"==typeof t.time&&null!==t.time?Object.values(t.time):[],n=Array.isArray(t.cont_max_capacity)?t.cont_max_capacity:"object"==typeof t.cont_max_capacity&&null!==t.cont_max_capacity?Object.values(t.cont_max_capacity):[],o=document.querySelector(".tf_tour_allowed_times");if(!o)return void console.error("Container element not found!");for(;o.firstChild;)o.removeChild(o.firstChild);a.length>0&&a.forEach(((t,e)=>{if(!t)return;const a=n[e]||"";c+=`\n                                <div class="tf-single-repeater tf-single-repeater-allowed_time">\n                                    <input type="hidden" name="tf_parent_field" value="">\n                                    <input type="hidden" name="tf_repeater_count" value="${e+1}">\n                                    <input type="hidden" name="tf_current_field" value="allowed_time">\n                                    <div class="tf-repeater-content-wrap">\n                                        <div class="tf-field tf-field-time" style="width: calc(50% - 6px);">\n                                            <div class="tf-fieldset">\n                                                <input type="text" name="allowed_time[time][]" placeholder="Select Time" value="${t}" class="flatpickr flatpickr-input" data-format="h:i K" readonly="readonly">\n                                                <i class="fa-regular fa-clock"></i>\n                                            </div>\n                                        </div>\n                                        <div class="tf-field tf-field-number" style="width: calc(50% - 6px);">\n                                            <div class="tf-fieldset">\n                                                <input type="number" name="allowed_time[cont_max_capacity][]" id="allowed_time[cont_max_capacity]" value="${a}" placeholder="Maximum Capacity">\n                                            </div>\n                                        </div>\n                                        <span class="tf-repeater-icon tf-repeater-icon-delete">\n                                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                <path d="M15 5L5 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                                <path d="M5 5L15 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                            </svg>\n                                        </span>\n                                    </div>\n                                </div>\n                            `}))}if("package"!=l&&c&&(t(".tf_tour_saved_allowed_times").append(c),t(".tf_tour_allowed_times .flatpickr-input").flatpickr({enableTime:!0,noCalendar:!0,dateFormat:"h:i K"})),"group"===l&&1!=f)void 0!==e.extendedProps.price&&t("[name='tf_tour_price']",a.tourCalData).val(e.extendedProps.price);else if("person"===l)void 0!==e.extendedProps.adult_price&&t("[name='tf_tour_adult_price']",a.tourCalData).val(e.extendedProps.adult_price),void 0!==e.extendedProps.child_price&&t("[name='tf_tour_child_price']",a.tourCalData).val(e.extendedProps.child_price),void 0!==e.extendedProps.infant_price&&t("[name='tf_tour_infant_price']",a.tourCalData).val(e.extendedProps.infant_price);else{if(0!=e.extendedProps.options_count)for(var d=0;d<=e.extendedProps.options_count-1;d++){t("[name='tf_option_min_person_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_min_person_"+d]),t("[name='tf_option_max_person_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_max_person_"+d]),t("[name='tf_option_group_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_group_price_"+d]),t("[name='tf_option_adult_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_adult_price_"+d]),t("[name='tf_option_child_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_child_price_"+d]),t("[name='tf_option_infant_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_infant_price_"+d]);const n=e.extendedProps["tf_option_group_discount_"+d];let o="";n&&Array.isArray(n.min_person)&&n.min_person.forEach(((t,e)=>{if(!t)return;const a=n.max_person[e]||"",i=n.price[e]||"";o+=`\n                                            <div class="tf-single-repeater tf-single-repeater-group_discount_package">\n                                                <input type="hidden" name="tf_parent_field" value="[group_tabs]">\n                                                <input type="hidden" name="tf_repeater_count" value="${e+1}">\n                                                <input type="hidden" name="tf_current_field" value="group_discount_package">\n                                                \n                                                <div class="tf-repeater-content-wrap">\n                                                    <div class="tf-field tf-field-number" style="width:calc(66% - 10px);">\n                                                        <div class="tf-fieldset">\n                                                            <div class="tf-number-range">\n                                                                <div class="tf-number-field-box">\n                                                                    <i class="fa-regular fa-user"></i>\n                                                                    <input type="number" name="tf_option_${d}_group_discount[min_person][]" value="${t}" min="0" placeholder="Min Person">\n                                                                </div>\n                                                                <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                                    <path d="M15.5 6.66797L18.8333 10.0013L15.5 13.3346" stroke="#95A3B2" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                                    <path d="M2.1665 10H18.8332" stroke="#95A3B2" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                                </svg>\n                                                                <div class="tf-number-field-box">\n                                                                    <i class="fa-regular fa-user"></i>\n                                                                    <input type="number" name="tf_option_${d}_group_discount[max_person][]" value="${a}" min="0" placeholder="Max Person">\n                                                                </div>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                    <div class="tf-field tf-field-number" style="width:calc(33% - 10px);">\n                                                        <div class="tf-fieldset">\n                                                            <input type="number" name="tf_option_${d}_group_discount[price][]" value="${i}" min="0" placeholder="Price">\n                                                        </div>\n                                                    </div>\n\n                                                    <span class="tf-repeater-icon tf-repeater-icon-delete">\n                                                        <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                            <path d="M15 5L5 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                            <path d="M5 5L15 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                        </svg>\n                                                    </span>\n                                                </div>\n                                            </div>\n                                        `})),o&&t(".tf-group-discount-package_"+d).append(o);const i=e.extendedProps["tf_option_times_"+d];let r="";i&&Array.isArray(i.time)&&i.time.forEach(((t,e)=>{if(!t)return;const a=i.cont_max_capacity[e]||"";r+=`\n                                            <div class="tf-single-repeater tf-single-repeater-allowed_time">\n                                                <input type="hidden" name="tf_parent_field" value="">\n                                                <input type="hidden" name="tf_repeater_count" value="${e+1}">\n                                                <input type="hidden" name="tf_current_field" value="allowed_time">\n                                                <div class="tf-repeater-content-wrap">\n                                                    <div class="tf-field tf-field-time" style="width: calc(50% - 6px);">\n                                                        <div class="tf-fieldset">\n                                                            <input type="text" name="tf_option_${d}_allowed_time[time][]" placeholder="Select Time" value="${t}" class="flatpickr flatpickr-input" data-format="h:i K" readonly="readonly">\n                                                            <i class="fa-regular fa-clock"></i>\n                                                        </div>\n                                                    </div>\n                                                    <div class="tf-field tf-field-number" style="width: calc(50% - 6px);">\n                                                        <div class="tf-fieldset">\n                                                            <input type="number" name="tf_option_${d}_allowed_time[cont_max_capacity][]" value="${a}" placeholder="Maximum Capacity">\n                                                        </div>\n                                                    </div>\n                                                    <span class="tf-repeater-icon tf-repeater-icon-delete">\n                                                        <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                            <path d="M15 5L5 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                                            <path d="M5 5L15 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                                        </svg>\n                                                    </span>\n                                                </div>\n                                            </div>\n                                        `})),r&&(t(".tf-tour-package-allowed-time_"+d).html(r),t(".tf_tour_allowed_times .flatpickr-input").flatpickr({enableTime:!0,noCalendar:!0,dateFormat:"h:i K"}))}void 0===e.extendedProps.options_count&&(t(".tf_option_pricing_type_person input").val(""),t(".tf_option_pricing_type_group input").val(""))}e.extendedProps.status&&t("[name='tf_tour_status'] option[value="+e.extendedProps.status+"]",a.tourCalData).prop("selected",!0)}},this.init=function(){a.container=jQuery(e),a.calendar=e.querySelector(".tf-tour-cal"),a.tourCalData=t(".tf-tour-cal-field",a.container),D("","",a.tourCalData),a.initCalendar()},this.initCalendar=function(){"undefined"!=typeof FullCalendar&&(a.fullCalendar=new FullCalendar.Calendar(a.calendar,a.fullCalendarOptions),a.fullCalendar.render())}};function D(e,a,n){t(".tf_tour_check_in",n).val(e),t(".tf_tour_check_out",n).val(a)}function j(e){if(t(".tf_tour_check_in",e).val(""),t(".tf_tour_check_out",e).val(""),t('[name="tf_tour_price"]',e).val(""),t('[name="tf_tour_adult_price"]',e).val(""),t('[name="tf_tour_child_price"]',e).val(""),t('[name="tf_tour_infant_price"]',e).val(""),t('[name="tf_tour_min_person"]',e).val(""),t('[name="tf_tour_max_person"]',e).val(""),t('[name="tf_tour_max_capacity"]',e).val(""),t('[name="tf_tour_repeat_day[]"], [name="tf_tour_repeat_month[]"], [name="tf_tour_repeat_year[]"], [name="tf_tour_repeat_week[]"]').prop("checked",!1),t(".bulk-popup-content-box #adult_tabs input, .bulk-popup-content-box #child_tabs input, .bulk-popup-content-box #infant_tabs input, .bulk-popup-content-box #group_tabs input").val(""),t(".tf-tour-cal-field .tf_tour_allowed_times").html(""),t(".tf_tour_allowed_times").length>0){const t=document.querySelector(".tf_tour_allowed_times");for(;t.firstChild;)t.removeChild(t.firstChild)}t(e).find('[name="tf_tour_check_in"]').each((function(){this._flatpickr&&this._flatpickr.destroy()})),t(e).find('[name="tf_tour_check_out"]').each((function(){this._flatpickr&&this._flatpickr.destroy()}));let a=t(e).find('[name="tf_tour_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n&&n.set("minDate",e)}}),n=t(e).find('[name="tf_tour_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a&&a.set("maxDate",e)}})}const S=()=>{t(".tf-tour-cal-wrap").each((function(e,a){new C(a).init();let n=t(a).find('[name="tf_tour_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){o.set("minDate",e)}}),o=t(a).find('[name="tf_tour_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n.set("maxDate",e)}})}))};function Y(t){wp.editor.initialize(t,{tinymce:{wpautop:!0,plugins:"charmap colorpicker hr lists paste tabfocus textcolor fullscreen wordpress wpautoresize wpeditimage wpemoji wpgallery wplink wptextpattern",toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,spellchecker,fullscreen,wp_adv,listbuttons",toolbar2:"styleselect,strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help"},quicktags:{buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,more,close"},mediaButtons:!1})}function P(){t(".tf-repeater-wrap .tf-single-repeater-book-confirm-field").length>0&&t(".tf-repeater-wrap .tf-single-repeater-book-confirm-field").each((function(){let e=t(this),a=e.find('input[name="tf_repeater_count"]').val();0!=a&&1!=a&&2!=a||(e.find(".tf_hidden_fields").hide(),e.find(".tf-repeater-icon-clone").hide(),e.find(".tf-repeater-icon-delete").hide())})),t(".tf-repeater-wrap .tf-single-repeater-hotel-book-confirm-field").length>0&&t(".tf-repeater-wrap .tf-single-repeater-hotel-book-confirm-field").each((function(){let e=t(this),a=e.find('input[name="tf_repeater_count"]').val();0!=a&&1!=a&&2!=a||(e.find(".tf_hidden_fields").hide(),e.find(".tf-repeater-icon-clone").hide(),e.find(".tf-repeater-icon-delete").hide())})),t(".tf-repeater-wrap .tf-single-repeater-car-book-confirm-field").length>0&&t(".tf-repeater-wrap .tf-single-repeater-car-book-confirm-field").each((function(){let e=t(this),a=e.find('input[name="tf_repeater_count"]').val();0!=a&&1!=a&&2!=a||(e.find(".tf_hidden_fields").hide(),e.find(".tf-repeater-icon-clone").hide(),e.find(".tf-repeater-icon-delete").hide())}))}S(),t(document).on("click",".tf_tour_cal_update",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-tour-cal-wrap"),i=n.closest(".tf-tour-cal-wrap")[0],r=o.find(".tf-tour-cal"),s=t("input, select",o.find(".tf-tour-cal-field")).serializeArray(),l=t(".tf_tour_pricing_type").val(),f=o.find(".tour_availability");s.push({name:"action",value:"tf_add_tour_availability"}),s.push({name:"_nonce",value:tf_admin_params.tf_nonce}),s.push({name:"pricing_type",value:l}),s.push({name:"tour_availability",value:f.val()}),s.push({name:"options_count",value:_().length}),s.push({name:"group_options_count",value:m().length}),t.ajax({url:tf_options.ajax_url,type:"POST",data:s,beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if("object"==typeof a){if(!0===a.data.status){f.val(a.data.tour_availability),e.success(a.data.message),j(o);var s=new C(i);s.init(),s.fullCalendar&&s.fullCalendar.refetchEvents()}else e.error(a.data.message);o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}t(".tf-check-dates").show(),t(".tf_tour_cal_reset").show(),t(".tf_tour_cal_bulk_edit").show(),t(".tf-tour-cal-field").removeClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").hide(),t(".tf-bulk-edit-header").hide(),t(".tf-field-group-box .tf-tab-switch-box .tf-tab-field-content").hide()},error:function(t){console.log(t),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading"),t(".tf-check-dates").show(),t(".tf_tour_cal_reset").show(),t(".tf_tour_cal_bulk_edit").show(),t(".tf-tour-cal-field").removeClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").hide(),t(".tf-bulk-edit-header").hide(),t(".tf-field-group-box .tf-tab-switch-box .tf-tab-field-content").hide()}})})),t(document).on("click",".tf_tour_cal_refresh",(function(t){t.preventDefault(),S()})),t(document).on("click",".tf_tour_cal_reset, .tf_room_cal_reset, .tf_apt_cal_reset",(function(e){e.preventDefault(),t(".tf-reset-confirmation-box").css("display","flex")})),t(document).on("click",".tf-tour-cal-field .tf-reset-confirmation-box .tf-confirmed-btn",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-tour-cal-wrap"),i=n.closest(".tf-tour-cal-wrap")[0],r=o.find(".tf-tour-cal"),s=o.find(".tour_availability");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_reset_tour_availability",_nonce:tf_admin_params.tf_nonce,tour_id:t("#post_ID").val()},beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if(!0===a.data.status){s.val(a.data.tour_availability),e.success(a.data.message),j(o);var l=new C(i);l.init(),l.fullCalendar&&l.fullCalendar.refetchEvents()}else e.error(a.data.message);t(".tf-reset-confirmation-box").hide(),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},error:function(t){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading"),t(".tf-tour-cal-field").removeClass("tf-bulk-popup")}})})),t(document).on("click",".tf-room-cal-field .tf-reset-confirmation-box .tf-confirmed-btn",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-room-cal-wrap"),i=n.closest(".tf-room-cal-wrap")[0],r=o.find(".tf-room-cal"),s=o.find("avail_date");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_reset_room_availability",_nonce:tf_admin_params.tf_nonce,room_id:t("#post_ID").val()},beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if(!0===a.data.status){s.val(a.data.avail_date),e.success(a.data.message),g(o);var l=new h(i);l.init(),l.fullCalendar&&l.fullCalendar.refetchEvents()}else e.error(a.data.message);t(".tf-reset-confirmation-box").hide(),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},error:function(t){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}})})),t(document).on("click",".tf-apt-cal-field .tf-reset-confirmation-box .tf-confirmed-btn",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-apt-cal-wrap"),i=n.closest(".tf-apt-cal-wrap")[0],r=o.find(".tf-apt-cal"),s=o.find(".apt_availability");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_reset_apt_availability",_nonce:tf_admin_params.tf_nonce,apartment_id:t("#post_ID").val()},beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if(!0===a.data.status){s.val(a.data.apt_availability),e.success(a.data.message),w(o);var l=new y(i);l.init(),l.fullCalendar&&l.fullCalendar.refetchEvents()}else e.error(a.data.message);t(".tf-reset-confirmation-box").hide(),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},error:function(t){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading"),t(".tf-tour-cal-field").removeClass("tf-bulk-popup")}})})),t(document).on("click",".tf-reset-confirmation-box .tf-cancel-btn, .tf-reset-confirmation-box .tf_reset_confirmation_close svg",(function(e){e.preventDefault(),t(".tf-reset-confirmation-box").hide()})),t(document).on("click",".tf-reset-confirmation-box",(function(e){t(e.target).closest(".tf-confirmation-content").length||t(this).hide()})),t(document).on("click",".tf_tour_package_save",(function(a){a.preventDefault();var n=t(this).closest(".tf-single-repeater-package_pricing"),o=null;if(n.find('[name^="tf_tours_opt[package_pricing]"]').each((function(){var e=t(this).attr("name").match(/tf_tours_opt\[package_pricing\]\[(\d+)\]/);if(e&&e[1])return o=e[1],!1})),null!==o){var i={pack_status:"",pack_title:"",pricing_type:"person",desc:"",adult_tabs:[{},{},{},{}],child_tabs:[{},{},{},{}],infant_tabs:[{},{},{},{}],group_tabs:[{},{},{},{},{},{}]};n.find("input, select, textarea").each((function(){var e=t(this),a=e.attr("name");if("tf_parent_field"!==a&&"tf_repeater_count"!==a&&"tf_current_field"!==a)for(var n=a.replace(/^tf_tours_opt\[package_pricing\]\[\d+\]/,"").replace(/^\[|\]$/g,"").split("]["),o=i,r=0;r<n.length;r++){var s=n[r];!isNaN(s)&&r>0&&(s=parseInt(s)),r===n.length-1?"checkbox"===e.attr("type")?o[s]=e.is(":checked")?e.val()||"1":"":o[s]=e.val():(void 0===o[s]&&(o[s]=isNaN(n[r+1])?{}:[]),o=o[s])}}));var r=[];n.find(".tf-single-repeater-group_discount_package").each((function(){var e=t(this),a={},n=!1;e.find('input[type="number"]').each((function(){var e=t(this).attr("name").match(/\[group_discount_package\]\[(\d+)\]\[([^\]]+)\]/);if(e&&e[1]&&e[2]){var o=t(this).val();a[e[2]]=o,"discount_price"===e[2]&&o&&parseFloat(o)>0&&(n=!0)}})),n&&Object.keys(a).length>0&&r.push(a)})),r.length>0?i.group_tabs[5]={group_discount_package:r}:i.group_tabs[5]=[];var s={action:"save_tour_package_pricing",post_id:t("#post_ID").val(),pricing_type:t(".tf_tour_pricing_type").val(),package_index:o,package_data:i,nonce:tf_admin_params.tf_nonce},l=t(this);l.text("Saving...").prop("disabled",!0),t.post(tf_options.ajax_url,s,(function(t){t.success?(i.pack_title?n.find(" > .tf-repeater-header .tf-repeater-title").html(i.pack_title):n.find(" > .tf-repeater-header .tf-repeater-title").html("Create your Tour Packages"),n.find(".tf-repeater-content-wrap").hide(),n.find(".tf-repeater-header").removeClass("active-repeater"),n.find(".tf-repeater-header .package-action-hide").addClass("show"),e.success("Package saved successfully!")):e.error("There is an error!"),l.text("Save").prop("disabled",!1)})).fail((function(t,a,n){e.error("There is an error!"),l.text("Save").prop("disabled",!1)}))}else alert("Could not determine package index")})),t(".group_discount_switcher").each((function(){let e=t(this),a=e.find('input[type="checkbox"]');e.next(".group_discount_package_box").toggle(a.is(":checked"))})),t(document).on("change",".group_discount_switcher input[type='checkbox']",(function(){t(this).closest(".group_discount_switcher").next(".group_discount_package_box").toggle(t(this).is(":checked"))})),t(document).on("change","#tf_tours_opt .tf_tour_pricing_type",(function(e){let a=t(this).val();"person"==a?(t(".tf-show-for-group").hide(),t(".tf-show-for-package").hide(),t(".tf-show-for-person").show()):"group"==a?(t(".tf-show-for-package").hide(),t(".tf-show-for-person").hide(),t(".tf-show-for-group").show()):"package"==a&&(t(".tf-show-for-person").hide(),t(".tf-show-for-group").hide(),t(".tf-show-for-package").show());var n={action:"save_tour_pricing_type",post_id:t("#post_ID").val(),pricing_type:a,nonce:tf_admin_params.tf_nonce};t.post(tf_options.ajax_url,n,(function(t){t.success})).fail((function(t,e,a){}))})),t(document).on("change",".tf_tour_pricing_type",(function(e){let a=t(this).val();"per_night"===a?(t(".tf-price-by-night").show(),t(".tf-price-by-person").hide()):"2"===a&&(t(".tf-price-by-person").show(),t(".tf-price-by-night").hide())})),t(document).on("click","#tf_tours_opt .tf-tablinks",(function(e){"availability"==t(this).attr("data-tab")&&S()})),t(document).on("click",".tf_tour_cal_bulk_edit",(function(e){j(""),t(".tf-tour-cal-field").addClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").show(),t(".tf-check-dates").hide(),t(".tf_tour_cal_bulk_edit").hide(),t(".tf_tour_cal_reset").hide(),t(".bulk-popup-content .tf-repeater-wrap-group_discount_package").html(""),t(".bulk-popup-content .tf_tour_allowed_times").html(""),t(".tf-bulk-edit-header").css("display","flex"),t(".tf_bulk_edit_option").val("1")})),t(document).on("click",".tf_tour_bulk_close",(function(e){t(".tf-tour-cal-field").removeClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").hide(),t(".tf-check-dates").show(),t(".tf_tour_cal_reset").show(),t(".bulk-popup-content .tf-repeater-wrap-group_discount_package").html(""),t(".bulk-popup-content .tf_tour_allowed_times").html(""),t(".tf_tour_cal_bulk_edit").show(),t(".tf-bulk-edit-header").hide(),t(".tf_bulk_edit_option").val("")})),t("textarea.wp_editor, textarea.tf_wp_editor").each((function(){let e=t(this).attr("id");setTimeout((function(){Y(e)}),1e3)})),P(),t(document).on("click",".tf-repeater-icon-add",(function(){var e=t(this).parent().parent(),a=t(this).attr("data-repeater-id"),n=t(this).attr("data-repeater-max"),l=e.find(".tf-single-repeater-clone-"+a+" .tf-single-repeater-"+a).clone(),f=e.find(".tf-repeater-wrap-"+a+" .tf-single-repeater-"+a).length,c=l.find(':input[name="tf_parent_field"]').val(),p=l.find(':input[name="tf_current_field"]').val(),u=parseInt(t(this).closest(".tf-repeater").attr("data-max-index"))+1;if(t(this).closest(".tf-repeater").attr("data-max-index",u),e.find(".tf-repeater-wrap .tf-field-notice-inner").remove(),!tf_admin_params.is_pro&&""!=n&&f>=n)return e.find(".tf-repeater-wrap").append('<div class="tf-field-notice-inner tf-notice-danger" style="display: block;">You have reached limit in free version. Please subscribe to Pro for unlimited access</div>'),!1;l.find(':input[name="tf_repeater_count"]').val(u);let _=l.find(".tf-field-date");_.length>0&&(_.find("input").each((function(){""!=t(this).attr("name")&&void 0!==t(this).attr("name")||t(this).remove()})),o(_));let m=l.find(".tf-field-time");m.length>0&&i(m);let h=l.find(".tf-field-color");if(h.length>0&&(h.find("input.tf-color").each((function(){var e=t(this).clone();t(this).closest("li").length>0?t(this).closest("li").append(e):t(this).closest(".tf-fieldset").append(e),t(this).closest(".wp-picker-container").remove()})),r(h)),""==c){if(l.find(":input").each((function(){this.name=this.name.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]"),this.id=this.id.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]")})),void 0!==(v=l.find('.tf-repeater input[name="tf_parent_field"]').val()))var v=v.replace("["+p+"][00]","["+p+"]["+u+"]");l.find('.tf-repeater input[name="tf_parent_field"]').val(v)}else v=l.find(':input[name="tf_parent_field"]').val(),l.find(":input").each((function(){this.name=this.name.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]"),this.id=this.id.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]")}));l.find("label").each((function(){var e=t(this).attr("for");void 0!==e&&(e=e.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]"),t(this).attr("for",e))})),l.find(".tf-icon-select").each((function(e){var a=t(this).attr("id");void 0!==a&&(a=a+e+u,t(this).attr("id",a))})),l.find("[data-depend-id]").each((function(){var e=t(this).attr("data-depend-id");void 0!==e&&(e=e.replace("["+p+"][00]","["+p+"]["+u+"]"),t(this).attr("data-depend-id",e))})),l.find("[data-controller]").each((function(){var e=t(this).attr("data-controller");void 0!==e&&(e=e.replace("["+p+"][00]","["+p+"]["+u+"]"),t(this).attr("data-controller",e))})),l.find(".wp-editor-wrap").each((function(){var e=t(this).find(".tf_wp_editor").show(),a=t("#"+e.attr("id")).val();if(a&&void 0!==a)var n=tinymce.get(e.attr("id")).getContent();else n="";e.val(n),t(this).closest(".tf-field-textarea").append(e),t(this).remove()}));var g=e.find(".tf-repeater-wrap-"+a);l.appendTo(g).show(),l.find("textarea.parent_wp_editor").each((function(){var e=Math.random().toString(36).substring(3,9)+1;t(this).attr("id",p+e),t(this).attr("data-count-id",e),Y(t(this).attr("id"))})),l.find("select.tf-select2-parent").each((function(){this.id=this.id.replace(p+"__00",p+"__"+u),t(this).attr("id");var e=t(this);d(e)})),s(),P()})),t(document).on("click",".tf-repeater-icon-delete",(function(){t(this).attr("data-repeater-max");var e=t(this).closest(".tf-repeater-wrap");return e.find(".tf-single-repeater").length,confirm("Are you sure to delete this item?")&&(e.find(".tf-field-notice-inner").remove(),t(this).closest(".tf-single-repeater").remove()),!1})),t(document).on("click",".tf-repeater-icon-clone",(function(){var a=t(this).closest(".tf-repeater-wrap");let n=t(this).closest(".tf-single-repeater").clone();var l=t(this).attr("data-repeater-max"),f=n.find('input[name="tf_parent_field"]').val(),c=n.find('input[name="tf_current_field"]').val(),p=n.find('input[name="tf_repeater_count"]').val(),u=a.find(".tf-single-repeater-"+c).length,_=parseInt(t(this).closest(".tf-repeater").attr("data-max-index"))+1;if(t(this).closest(".tf-repeater").attr("data-max-index",_),a.find(".tf-field-notice-inner").remove(),!tf_admin_params.is_pro&&""!=l&&u>=l)return a.append('<div class="tf-field-notice-inner tf-notice-danger" style="display: block;">You have reached limit in free version. Please subscribe to Pro for unlimited access</div>'),!1;let m=n.find(".tf-field-date");m.length>0&&(m.find("input").each((function(){""!=t(this).attr("name")&&void 0!==t(this).attr("name")||t(this).remove()})),o(m));let h=n.find(".tf-field-time");h.length>0&&i(h);let v=n.find(".tf-field-color");if(v.length>0&&(v.find("input.tf-color").each((function(){var e=t(this).clone();t(this).closest("li").length>0?t(this).closest("li").append(e):t(this).closest(".tf-fieldset").append(e),t(this).closest(".wp-picker-container").remove()})),r(v)),""==f){if(n.find(":input").each((function(){0==t(this).closest(".tf-single-repeater-clone").length&&(this.name=this.name.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),this.id=this.id.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"))})),void 0!==(g=n.find('.tf-repeater input[name="tf_parent_field"]').val()))var g=g.replace("["+c+"]["+p+"]","["+c+"]["+_+"]");n.find('.tf-repeater input[name="tf_parent_field"]').val(g)}else n.find(":input").each((function(){0==t(this).closest(".tf-single-repeater-clone").length&&(this.name=this.name.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),this.id=this.id.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"))}));n.find("label").each((function(){if(void 0!==(e=t(this).attr("for"))){e=e.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]");var e=t(this).attr("for",e)}})),n.find(".tf-icon-select").each((function(e){var a=t(this).attr("id");void 0!==a&&(a=a+e+_,t(this).attr("id",a))})),n.find("[data-depend-id]").each((function(){var e=t(this).attr("data-depend-id");void 0!==e&&(e=e.replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),t(this).attr("data-depend-id",e))})),n.find("[data-controller]").each((function(){var e=t(this).attr("data-controller");void 0!==e&&(e=e.replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),t(this).attr("data-controller",e))})),n.find('input[name="tf_repeater_count"]').val(_),n.find(".wp-editor-wrap").each((function(){var e=t(this).find(".tf_wp_editor").show(),a=(t("#"+e.attr("id")).val(),e.attr("id"));if(""!=a&&void 0!==a)var n=tinymce.editors[a].getContent();else n="";e.val(n),t(this).closest(".tf-field-textarea").append(e),t(this).remove()})),n.find(".tf-field-select2").each((function(){var e=t(this).find("select.tf-select-two").select2("val");t(this).find("select.tf-select-two").removeAttr("data-select2-id aria-hidden tabindex"),t(this).find("select.tf-select-two option").removeAttr("data-select2-id"),t(this).find("select.tf-select-two").removeClass("select2-hidden-accessible");var a=t(this).find("select.tf-select-two").show();a.val(e),t(this).find(".tf-fieldset").append(a),t(this).find("span.select2-container").remove()})),t(this).closest(".tf-repeater-wrap").append(n).show(),n.find("textarea.parent_wp_editor, textarea.wp_editor").each((function(){var e=Math.random().toString(36).substring(3,9)+1;t(this).attr("id",c+e),t(this).attr("data-count-id",e),Y(t(this).attr("id"))})),n.find("select.tf-select2-parent, select.tf-select2").each((function(){this.id=this.id.replace(c+"__"+p,c+"__"+_);var e=t(this);d(e)})),s(),e.success("Duplicated Successfully")})),t(document).on("click",".tf-repeater-icon-collapse, .tf-repeater-title",(function(){var e=t(this).closest(".tf-single-repeater").find("input[name=tf_current_field]").val();t(this).closest(".tf-single-repeater").find(".tf-repeater-header").toggleClass("active-repeater"),t(this).closest(".tf-single-repeater").find(".tf-tab-switch-box").toggleClass("active-repeater"),t(this).closest(".tf-single-repeater-"+e).find(".tf-repeater-content-wrap").slideToggle(),t(this).closest(".tf-single-repeater-"+e).children(".tf-repeater-content-wrap").toggleClass("hide"),1==t(this).closest(".tf-single-repeater-"+e).children(".tf-repeater-content-wrap").hasClass("hide")?t(this).closest(".tf-single-repeater-"+e+" .tf-repeater-header").children(".tf-repeater-icon-collapse").html('<i class="fa-solid fa-angle-down"></i>'):t(this).closest(".tf-single-repeater-"+e+" .tf-repeater-header").children(".tf-repeater-icon-collapse").html('<i class="fa-solid fa-angle-up"></i>')})),t(".tf-repeater-wrap").sortable({handle:".tf-repeater-icon-move",start:function(e,a){t(a.item).find(".tf_wp_editor").attr("id")},stop:function(e,a){t(a.item).find(".tf_wp_editor").each((function(){var e=t(this).attr("id");tinyMCE.execCommand("mceRemoveEditor",!1,e),tinyMCE.execCommand("mceAddEditor",!1,e)}))}}),t(".tf-switch-group-wrap").sortable({placeholder:"tf-switch-drag-highlight"}),t(document).on("click",".tf-repeater-add-group_discount_package",(function(e){e.preventDefault(),t(this).closest(".tf-repeater").find(".tf-repeater-wrap-group_discount_package .tf-single-repeater .tf-repeater-content-wrap").show()})),t(document).on("click",".tf-package-add-allowed-time",(function(e){e.preventDefault(),t(this).closest(".tf-repeater").find(".tf_tour_allowed_times .tf-single-repeater .tf-repeater-content-wrap").show()})),t(document).on("click",".tf-field-accordion .tf-tab-field-header .tf-field-collapas",(function(){t(this).toggleClass("rotated"),t(this).closest(".tf-tab-switch-box").toggleClass("active-repeater"),t(this).closest(".tf-tab-switch-box").find(".tf-tab-field-content").slideToggle(200,(function(){t(this).is(":visible")&&t(this).css("display","flex")}))})),t(document).on("click",".tf-action-button-group .tf_tour_package_cancel",(function(){t(this).closest(".tf-repeater-content-wrap").hide(),t(this).closest(".tf-single-repeater").find(".tf-repeater-header").removeClass("active-repeater")})),t(document).on("click",".tf-action-button-group .tf_tour_package_deleted",(function(){t(this).closest(".tf-single-repeater").empty()})),t(document).on("click",".tf-avail-repeater-collapse, .tf-avail-repeater-title",(function(){t(this).closest(".tf-single-repeater").find(".tf-repeater-content-wrap").first().slideToggle(200)})),t(document).on("click",".tf-tab-item",(function(){var e=t(this),a=e.data("tab-id");1==e.parent().parent().find(".tf-tab-item-content").hasClass("show")&&e.parent().parent().find(".tf-tab-item-content").removeClass("show"),e.parent().find(".tf-tab-item").removeClass("show"),e.addClass("show"),e.parent().parent().find(".tf-tab-item-content[data-tab-id = "+a+"]").addClass("show"),b(),x(),S()})),t(document).on("click",".tf-add-category span",(function(e){e.preventDefault(),t(this).closest(".tf-fieldset").children(".tf-popup-box").css("display","flex")})),t(document).on("click",".tf-add-category-box-close",(function(e){e.preventDefault(),t(".tf-popup-box").hide()})),t(document).on("click",".tf-category-button",(function(e){e.preventDefault();var a=t(this).closest(".tf-add-category-box");let n=a.find("#category_name").val(),o=a.find("#category_title").val(),i=a.find("#parent_category").val(),r=a.find("#category_select_field_name").val();t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_insert_category_data",_nonce:tf_admin_params.tf_nonce,categoryName:n,categoryTitle:o,parentCategory:i},success:function(e){var n=JSON.parse(e);if(n.insert_category){var o=new Option(n.insert_category.title,n.insert_category.id,!0,!0);t("#"+r).append(o).trigger("change");var i=new Option(n.insert_category.title,n.insert_category.id,!1,!1);a.find("#parent_category").append(i).trigger("change")}t(".tf-popup-box").hide(),a.find("#category_title").val(""),a.find("#parent_category").val("")}})})),t(document).on("click",".tf-add-new-post-button",(function(a){a.preventDefault();var n=t(this),o=n.closest(".tf-add-category-box");let i=o.find(".post_type").val(),r=o.find(".post_title").val(),s=o.find(".post_select_field_name").val(),l=o.find(".field_id").val(),f=o.find(".post_id").val();r?t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_insert_post_data",_nonce:tf_admin_params.tf_nonce,postType:i,postTitle:r,fieldId:l,postId:f},beforeSend:function(){n.addClass("tf-btn-loading")},success:function(e){var a=JSON.parse(e);if(a.insert_post){var i=new Option(a.insert_post.title,a.insert_post.id,!0,!0);"tf_rooms"==l&&t(i).attr("data-edit-url",a.insert_post.edit_url),t("#"+s).append(i).trigger("change")}n.removeClass("tf-btn-loading"),t(".tf-popup-box").hide(),o.find(".post_title").val("")}}):e.error("Please enter title")}))}))}(jQuery),function(t){t(document).on("click",".tf-image-close",(function(e){e.preventDefault(),$this=t(this),t(this).attr("tf-field-name").replace(/[.[\]_-]/g,"_"),$this.parent().parent().find("input").val(""),$this.parent().html("")})),t(document).on("click",".tf-gallery-remove",(function(e){e.preventDefault(),$this=t(this),t(this).attr("tf-field-name").replace(/[.[\]_-]/g,"_"),$this.parent().parent().find("input").val(""),$this.parent().parent().find(".tf-fieldset-gallery-preview").html(""),t("a.tf-gallery-edit, a.tf-gallery-remove").css("display","none")})),t(document).ready((function(){t("body").on("click",".tf-media-upload",(function(a){var n=t(this),o=t(this).attr("tf-field-name");return o.replace(/[.[\]_-]/g,"_"),(e=wp.media({title:"Select Image",button:{text:"Insert Image"},multiple:!1})).on("select",(function(){var t=e.state().get("selection").first().toJSON();n.parent().parent().find("input").val(t.url),n.parent().parent().find(".tf-fieldset-media-preview").html(`<div class="tf-image-close" tf-field-name='${o}'>✖</div><img src='${t.url}' />`)})),e.open(),!1})),t("body").on("click",".tf-gallery-upload, .tf-gallery-edit",(function(e){var n=t(this);return t(this).attr("tf-field-name").replace(/[.[\]_-]/g,"_"),(a=wp.media({title:"Select Gallery",button:{text:"Insert Gallery"},multiple:"add"})).on("open",(function(){var t=a.state().get("selection"),e=n.parent().parent().find("input").val();e.length>0&&e.split(",").forEach((function(e){attachment=wp.media.attachment(e),attachment.fetch(),t.add(attachment?[attachment]:[])}))})),a.on("select",(function(){var t=[],e=[],o=a.state().get("selection").toJSON();for(i in n.parent().parent().find(".tf-fieldset-gallery-preview").html(""),o){var r=o[i];t.push(r.id),e.push(r.url),n.parent().parent().find(".tf-fieldset-gallery-preview").append(`<img src='${r.url}' />`)}n.parent().parent().find("input").val(t.join(",")),n.parent().find("a.tf-gallery-edit, a.tf-gallery-remove").css("display","inline-block")})),a.open(),!1})),t("#addtag > .submit #submit").on("click",(function(){t(".tf-fieldset-media-preview").html("")})),"googlemap"!=tf_options.gmaps&&t(".tf-field-map").each((function(){var e=t(this),a=e.find(".tf--map-osm"),n=e.find(".tf--map-search input"),o=e.find(".tf--latitude"),i=e.find(".tf--longitude"),r=e.find(".tf--zoom"),s=a.data("map"),l=L.map(a.get(0),s);L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(l);var f=L.marker(s.center,{draggable:!0}).addTo(l),c=function(t){o.val(t.lat),i.val(t.lng),r.val(l.getZoom())};function d(e,a){var o="https://nominatim.openstreetmap.org/reverse?format=json&lat="+e+"&lon="+a;t.ajax({url:o,dataType:"json",success:function(t){n.val(t.display_name)},error:function(t,e,a){console.error("Error:",e,a)}})}o.on("change",(function(){})),l.on("click",(function(t){f.setLatLng(t.latlng),c(t.latlng),d(t.latlng.lat,t.latlng.lng)})),l.on("zoom",(function(){c(f.getLatLng())})),f.on("drag",(function(){c(f.getLatLng())})),f.on("dragend",(function(t){let e=t.target._latlng.lng;d(t.target._latlng.lat,e)})),n.length||(n=t('[data-depend-id="'+e.find(".tf--address-field").data("address-field")+'"]'));var p={};n.autocomplete({source:function(e,a){var n=e.term;n in p?a(p[n]):t.get("https://nominatim.openstreetmap.org/search",{format:"json",q:n},(function(t){var e;e=t.length?t.map((function(t){return{value:t.display_name,label:t.display_name,lat:t.lat,lon:t.lon}}),"json"):[{value:"no-data",label:"No Results."}],p[n]=e,a(e)}))},select:function(t,e){if("no-data"===e.item.value)return!1;var a=L.latLng(e.item.lat,e.item.lon);l.panTo(a),f.setLatLng(a),c(a)},create:function(e,a){t(this).autocomplete("widget").addClass("tf-map-ui-autocomplate")}});var u=function(){var t=L.latLng(o.val(),i.val());l.panTo(t),f.setLatLng(t)};o.on("change",u),i.on("change",u),setInterval((function(){l.invalidateSize()}),100)})),t(".tf-mobile-tabs").on("click",(function(e){e.preventDefault(),t(".tf-admin-tab").toggleClass("active")})),t(".tf-faq-title").on("click",(function(){var e=t(this);e.hasClass("active")||(t(".tf-faq-desc").slideUp(400),t(".tf-faq-title").removeClass("active")),e.toggleClass("active"),e.next().slideToggle()}))}))}(jQuery),function(t){"use strict";function e(t,e,a){this.init(t,e,a)}function a(){this.rules=[]}t.extend(e.prototype,{init:function(t,e,a){this.controller=t,this.condition=e,this.value=a,this.rules=[],this.controls=[]},evalCondition:function(e,a,n,o,i){if("=="==n)return this.checkBoolean(o)==this.checkBoolean(i);if("!="==n)return this.checkBoolean(o)!=this.checkBoolean(i);if(">="==n)return Number(i)>=Number(o);if("<="==n)return Number(i)<=Number(o);if(">"==n)return Number(i)>Number(o);if("<"==n)return Number(i)<Number(o);if("()"==n)return window[o](e,a,i);if("any"==n){if(t.isArray(i)){for(var r=i.length-1;r>=0;r--)if(-1!==t.inArray(i[r],o.split(",")))return!0}else if(-1!==t.inArray(i,o.split(",")))return!0}else if("not-any"==n)if(t.isArray(i)){for(r=i.length-1;r>=0;r--)if(-1==t.inArray(i[r],o.split(",")))return!0}else if(-1==t.inArray(i,o.split(",")))return!0;return!1},checkBoolean:function(t){switch(t){case!0:case"true":case 1:case"1":t=!0;break;case null:case!1:case"false":case 0:case"0":t=!1}return t},checkCondition:function(t){if(!this.condition)return!0;var e=t.find(this.controller),a=this.getControlValue(t,e);return void 0!==a&&(a=this.normalizeValue(e,this.value,a),this.evalCondition(t,e,this.condition,this.value,a))},normalizeValue:function(t,e,a){return"number"==typeof e?parseFloat(a):a},getControlValue:function(t,e){return e.length>1&&("radio"==e.attr("type")||"checkbox"==e.attr("type"))?e.filter(":checked").map((function(){return this.value})).get():"checkbox"==e.attr("type")||"radio"==e.attr("type")?e.is(":checked"):e.val()},createRule:function(t,a,n){var o=new e(t,a,n);return this.rules.push(o),o},include:function(t){this.controls.push(t)},applyRule:function(e,a){var n;n=void 0===a?this.checkCondition(e):a;var o=t.map(this.controls,(function(t,a){return e.find(t)}));n?(t(o).each((function(){t(this).removeClass("tf-depend-on")})),t(this.rules).each((function(){this.applyRule(e)}))):(t(o).each((function(){t(this).addClass("tf-depend-on")})),t(this.rules).each((function(){this.applyRule(e,!1)})))}}),t.extend(a.prototype,{createRule:function(t,a,n){var o=new e(t,a,n);return this.rules.push(o),o},applyRules:function(e){t(this.rules).each((function(){this.applyRule(e)}))}}),t.tf_deps={createRuleset:function(){return new a},enable:function(t,e,a){return t.on("change keyup",(function(n){var o=n.target.getAttribute("data-depend-id")||n.target.getAttribute("data-sub-depend-id");-1!==a.indexOf(o)&&e.applyRules(t)})),e.applyRules(t),!0}}}(jQuery),function(t){t(document).ready((function(){1==tf_options.tf_chart_enable&&(document.getElementById("tf_months"),document.getElementById("tf_months").getContext("2d"),t("#tf_months"),new Chart("tf_months",{type:"line",data:{labels:["January","February","March","April","May","June","July","August","September","October","November","December"],datasets:[{label:"Completed Booking",borderColor:"#003C79",tension:.1,data:tf_options.tf_complete_order,fill:!1},{label:"Cancelled Booking",borderColor:"red",tension:.1,data:tf_options.tf_cancel_orders,fill:!1}]},options:{layout:{padding:10},legend:{display:!0},title:{display:!0,text:""}}})),t(document).on("change","#tf-month-report",(function(){var e=t(this).val();if(0!=e){t("#tf-report-loader").addClass("show"),t(".tf-order-report").find("iframe").remove();var a=t("#tf-year-report").val();jQuery.ajax({type:"post",url:tf_options.ajax_url,data:{action:"tf_month_reports",_nonce:tf_admin_params.tf_nonce,month:e,year:a},success:function(e){if(e.success){var a=JSON.parse(e);document.getElementById("tf_months"),document.getElementById("tf_months").getContext("2d"),t("#tf_months"),new Chart("tf_months",{type:"line",data:{labels:a.months_day_number,datasets:[{label:"Completed Booking",borderColor:"#003C79",tension:.1,data:a.tf_complete_orders,fill:!1},{label:"Cancelled Booking",borderColor:"red",tension:.1,data:a.tf_cancel_orders,fill:!1}]},options:{layout:{padding:10},legend:{display:!0},title:{display:!0,text:a.tf_search_month}}}),t("#tf-report-loader").removeClass("show")}else t("#tf-report-loader").removeClass("show"),notyf.error(e.data)}})}})),t(document).on("change","#tf-year-report",(function(){var e=t(this).val(),a=t("#tf-month-report").val();0!=e&&0!=a&&(t("#tf-report-loader").addClass("show"),t(".tf-order-report").find("iframe").remove(),jQuery.ajax({type:"post",url:tf_options.ajax_url,data:{action:"tf_month_reports",_nonce:tf_admin_params.tf_nonce,month:a,year:e},success:function(e){var a=JSON.parse(e);document.getElementById("tf_months"),document.getElementById("tf_months").getContext("2d"),t("#tf_months"),new Chart("tf_months",{type:"line",data:{labels:a.months_day_number,datasets:[{label:"Completed Booking",borderColor:"#003C79",tension:.1,data:a.tf_complete_orders,fill:!1},{label:"Cancelled Booking",borderColor:"red",tension:.1,data:a.tf_cancel_orders,fill:!1}]},options:{layout:{padding:10},legend:{display:!0},title:{display:!0,text:a.tf_search_month}}}),t("#tf-report-loader").removeClass("show")}}))}))}))}(jQuery),function(t){t(document).on("click",".tf-generate-tour .tf-btn",(function(e){e.preventDefault();var a=[];t(this).parents(".tf-shortcode-generator-single").find(".tf-sg-field-wrap").each((function(){var e=t(this),n=e.find(".tf-setting-field").val(),o=e.find(".tf-setting-field").attr("data-term"),i=e.find(".post-count").attr("data-count"),r=e.find(".tf-shortcode-title-field ").attr("data-title"),s=e.find(".tf-shortcode-subtitle-field ").attr("data-subtitle"),l=e.find(".tf-shortcode-tour-tab-title-field ").attr("data-tour-tab-title"),f=e.find(".tf-shortcode-hotel-tab-title-field ").attr("data-hotel-tab-title"),c=e.find(".tf-shortcode-apartment-tab-title-field ").attr("data-apartment-tab-title"),d=e.find(".tf-shortcode-car-tab-title-field ").attr("data-car-tab-title");null!=o&&""!=o&&(n=o+"="+(n.length?n:'""')),null!=i&&""!=i&&(n=i+"="+(n.length?n:'""')),null!=r&&""!=r&&n.length&&(n=r+"="+(n.length?`"${n}"`:'""')),null!=s&&""!=s&&n.length&&(n=s+"="+(n.length?`"${n}"`:'""')),null!=l&&""!=l&&n.length&&(n=l+"="+(n.length?`"${n}"`:'""')),null!=f&&""!=f&&n.length&&(n=f+"="+(n.length?`"${n}"`:'""')),null!=c&&""!=c&&n.length&&(n=c+"="+(n.length?`"${n}"`:'""')),null!=d&&""!=d&&n.length&&(n=d+"="+(n.length?`"${n}"`:'""')),a.push(n)}));var n="["+a.filter(Boolean).join(" ")+"]";t(this).parents(".tf-shortcode-generator-single").find(".tf-shortcode-value").val(n),t(this).parents(".tf-shortcode-generator-single").find(".tf-copy-item").slideDown()})),t(document).on("click",".tf-sg-close",(function(e){t(this).parents(".tf-shortcode-generators").find(".tf-sg-form-wrapper").fadeOut()})),t(document).on("click",".tf-shortcode-btn",(function(e){var a=t(this);a.parents(".tf-shortcode-generator-single").find(".tf-sg-form-wrapper").fadeIn(),a.parents(".tf-shortcode-generator-single").on("mouseup",(function(e){var a=t(this).find(".tf-shortcode-generator-form"),n=a.parent(".tf-sg-form-wrapper");a.is(e.target)||0!==a.has(e.target).length||n.fadeOut()}))})),t(document).on("click",".tf-copy-btn",(function(){var e=t(this).parent(".tf-shortcode-field").find("#tf-shortcode");e&&(e.select(),document.execCommand("copy")),t(this).parents(".tf-copy-item").append('<div><span class="tf-copied-msg">Copied<span></div>'),t("span.tf-copied-msg").animate({opacity:0},1e3,(function(){t(this).slideUp("slow",(function(){t(this).remove()}))}))})),t(document).ready((function(){t(document).on("click",".tf-import-btn",(function(e){if(e.preventDefault(),""==t('textarea[name="tf_import_option"]').val().trim()){alert(tf_options.tf_export_import_msg.import_empty);let e=t('textarea[name="tf_import_option"]');return e.focus(),void e.css("border","1px solid red")}t(".tf-option-form").submit()})),t(document).on("click",".tf-export-btn",(function(e){e.preventDefault(),t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_export_data",_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t(".tf-export-btn").html("Exporting..."),t(".tf-export-btn").attr("disabled","disabled")},success:function(e){let a=JSON.parse(e);if("success"===a.status){var n=new Blob([a.data],{type:"text/plain"}),o=window.URL.createObjectURL(n),i=document.createElement("a");i.href=o,i.download="tf-settings-export.json",i.click(),window.URL.revokeObjectURL(o)}else notyf.error(a.message);t(".tf-export-btn").html("Export"),t(".tf-export-btn").removeAttr("disabled")},error:function(e){console.log(e),t(".tf-export-btn").html("Export"),t(".tf-export-btn").removeAttr("disabled")}})})),t(document).on("click",".tf-add-category i",(function(e){e.preventDefault(),$this=t(this),parentDiv=$this.closest(".tf-fieldset"),parentDiv.children("#tf-popup-box").css("display","flex")})),t(document).on("click",".tf-add-category-box-close",(function(e){e.preventDefault(),t("#tf-popup-box").hide()}))})),jQuery(document).ready((function(t){const e={d1:{brand:{default:"#0E3DD8",dark:"#0A2B99",lite:"#C9D4F7"},text:{heading:"#1C2130",paragraph:"#494D59",lite:"#F3F5FD"},border:{default:"#16275F",lite:"#D1D7EE"},filling:{background:"#ffffff",foreground:"#F5F7FF"}},d2:{brand:{default:"#B58E53",dark:"#917242",lite:"#FAEEDC"},text:{heading:"#30281C",paragraph:"#595349",lite:"#FDF9F3"},border:{default:"#5F4216",lite:"#EEE2D1"},filling:{background:"#ffffff",foreground:"#FDF9F3"}},d3:{brand:{default:"#F97415",dark:"#C75605",lite:"#FDDCC3"},text:{heading:"#30241C",paragraph:"#595049",lite:"#FDF7F3"},border:{default:"#5F3416",lite:"#EEDDD1"},filling:{background:"#ffffff",foreground:"#FFF9F5"}},d4:{brand:{default:"#003061",dark:"#002952",lite:"#C2E0FF"},text:{heading:"#1C2630",paragraph:"#495159",lite:"#F3F8FD"},border:{default:"#163A5F",lite:"#D1DFEE"},filling:{background:"#ffffff",foreground:"#F5FAFF"}}};t('input[name^="tf_settings[tf-d"]').wpColorPicker({change:function(a,n){let o=t(a.target),i=o.val(),r=n.color.toString();if(function(e){if(!e)return;const a={"design-1":"tf-d1","design-2":"tf-d2","design-3":"tf-d3","design-4":"tf-d4"}[e];a&&["brand","text","border","filling"].forEach((e=>{t(`input[name^="tf_settings[${a}-${e}]"]`).each((function(){let a=t(this).attr("name").split("[")[2].replace("]",""),n=t(this).val(),o=t(`input[name="tf_settings[tf-custom-${e}][${a}]"]`);o.length&&o.val(n).trigger("change")}))}))}(t('input[name="tf_settings\\[color-palette-template\\]"]:checked').val()),r!==i){t("#tf_settings\\[color-palette-template\\]\\[custom\\]").prop("checked",!0),t(".tf-field.tf-field-color.tf-depend-hidden").addClass("tf-depend-on"),t('.tf-field.tf-field-color.tf-depend-hidden[data-value="custom"]').removeClass("tf-depend-on");let a=o.attr("name").match(/\[tf-(d\d+)-(brand|text|border|filling)]\[(.*?)\]/);if(!a)return;let n=a[1],i=a[2],s=a[3],l=t(`input[name="tf_settings[tf-custom-${i}][${s}]"]`);if(l.length){let a=t(`input[name="tf_settings[tf-${n}-${i}][${s}]"]`).val();t(`input[name="tf_settings[tf-custom-${i}][${s}]"]`).val(a).trigger("change"),t(`input[name="tf_settings[tf-${n}-${i}][${s}]"]`).val(e[n][i][s]).trigger("change"),l.val(r).trigger("change")}}}})})),jQuery(document).ready((function(t){t(".tf-plugin-button").not(".pro").on("click",(function(e){e.preventDefault();let a=t(this),n=a.data("action"),o=a.data("plugin"),i=a.data("plugin_filename");if(!n||!o)return;let r=a.find(".loader"),s=a.clone().children().remove().end().text().trim();"install"===n?a.contents().first().replaceWith("Installing.."):"activate"===n&&a.contents().first().replaceWith("Activating.."),a.addClass("loading").prop("disabled",!0),r.show(),t.ajax({url:ajaxurl,type:"POST",data:{action:"themefic_manage_plugin",security:tf_admin_params.tf_nonce,plugin_slug:o,plugin_filename:i,plugin_action:n},success:function(t){a.removeClass("loading").prop("disabled",!1),r.hide(),t.success?"install"===n?(a.contents().first().replaceWith("Activate"),a.data("action","activate").removeClass("install").addClass("activate")):"activate"===n&&a.replaceWith('<span class="tf-plugin-button tf-plugin-status active">Activated</span>'):(a.contents().first().replaceWith(s),alert("Error: "+t.data))},error:function(){a.contents().first().replaceWith(s).removeClass("loading").prop("disabled",!1),r.hide(),alert("An error occurred. Please try again.")}})}))}))}(jQuery)})();
     1(()=>{var t,e,a;(t=jQuery)(document).ready((function(){const e=new Notyf({ripple:!0,dismissable:!0,duration:3e3,position:{x:"right",y:"bottom"}});t(document).on("click",".tf-del-old-review-fields",(function(a){a.preventDefault(),t(this);var n={action:"tf_delete_old_review_fields",deleteAll:t(this).data("delete-all"),_ajax_nonce:tf_admin_params.tf_nonce};t.ajax({type:"post",url:tf_admin_params.ajax_url,data:n,beforeSend:function(t){e.success(tf_admin_params.deleting_old_review_fields)},success:function(t){e.success(t.data)},error:function(t){e.error(t.data)}})})),t(document).on("click",".remove-order-ids",(function(a){a.preventDefault();var n=t(this),o=t("#post_ID").val(),i={action:"tf_remove_room_order_ids",meta_field:n.closest(".tf-repeater-content-wrap").find(".tf-order_id input").attr("name"),post_id:o,_ajax_nonce:tf_admin_params.tf_nonce};t.ajax({type:"post",url:ajaxurl,data:i,beforeSend:function(t){e.success(tf_admin_params.deleting_room_order_ids)},success:function(t){e.success(t.data.message),location.reload()},error:function(t){e.error(t.data)}})})),t(document).on("click",".post-type-tf_tours #publish, .post-type-tf_tours #save-post",(function(a){if(0===t('input[name="tf_tours_opt[location][address]"]').val().length)return a.preventDefault,a.stopImmediatePropagation(),e.error(tf_admin_params.tour_location_required),!1})),t(document).on("click",".post-type-tf_hotel #publish, .post-type-tf_hotel #save-post",(function(a){if(0===t('input[name="tf_hotels_opt[map][address]"]').val().length)return a.preventDefault,a.stopImmediatePropagation(),e.error(tf_admin_params.hotel_location_required),!1})),t(document).on("click",".post-type-tf_apartment #publish, .post-type-tf_apartment #save-post",(function(a){if(0===t('[name="tf_apartment_opt[map][address]"]').val().length)return a.preventDefault,a.stopImmediatePropagation(),e.error(tf_admin_params.apartment_location_required),!1})),t(document).on("click",".tf-install",(function(e){e.preventDefault();var a=t(this),n=a.attr("data-plugin-slug");a.addClass("updating-message").text(tf_admin_params.installing);var o={action:"tf_ajax_install_plugin",_ajax_nonce:tf_admin_params.tf_nonce,slug:n};jQuery.post(tf_admin_params.ajax_url,o,(function(t){a.removeClass("updating-message"),a.addClass("updated-message").text(tf_admin_params.installed),a.attr("href",t.data.activateUrl)})).fail((function(){a.removeClass("updating-message").text(tf_admin_params.install_failed)})).always((function(){a.removeClass("install-now updated-message").addClass("activate-now button-primary").text(tf_admin_params.activating),a.unbind(e),a[0].trigger("click")}))})),t(document).on("click",".tf-pro",(function(t){t.preventDefault(),window.open("https://tourfic.com/")})),t(window).on("load",(function(){t(".tf-field-disable").find("input, select, textarea, button, div, span").attr("disabled","disabled")})),t(document).on("click",".tf-field-pro",(function(t){t.preventDefault(),window.open("https://tourfic.com/")})),t(document).on("click",".room-repeater > div.csf-fieldset > a.csf-repeater-add",(function(e){var a=t('.room-repeater .csf-repeater-wrapper [data-depend-id="room"]').length-2;t(".room-repeater .unique-id input").each((function(){a++,0===t('.room-repeater [data-depend-id="room"] [data-depend-id="unique_id"]').val().length&&t('.room-repeater [name="tf_hotel[room]['+a+'][unique_id]"]').val((new Date).valueOf()+a)}))})),t(".tf-go-docs").parent().attr("target","_blank"),t(".tf-ticket-status").on("click",(function(){if(t(this).is(":checked")){var e=t(this).val();t("#tf-booking-status-loader").addClass("show"),jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ticket_status_change",_ajax_nonce:tf_admin_params.tf_nonce,status:"check in",order_unique_id:e},success:function(e){t("#tf-booking-status-loader").removeClass("show")}})}else e=t(this).val(),t("#tf-booking-status-loader").addClass("show"),jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ticket_status_change",_ajax_nonce:tf_admin_params.tf_nonce,status:"",order_unique_id:e},success:function(e){t("#tf-booking-status-loader").removeClass("show")}})})),t(document).on("click",".tf-affiliate-active",(function(a){a.preventDefault();var n=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_affiliate_active",nonce:tf_admin_params.tf_nonce},beforeSend:function(t){n.addClass("tf-btn-loading").css({"pointer-events":"none"})},success:function(t){let a=JSON.parse(t);"success"===a.status&&(e.success(a.message),setTimeout((function(){location.reload()}),500)),n.removeClass("tf-btn-loading").css({"pointer-events":"auto"})},error:function(t){n.removeClass("tf-btn-loading").css({"pointer-events":"auto"})},complete:function(t){n.removeClass("tf-btn-loading").css({"pointer-events":"auto"})}})})),t(document).on("click",".tf-affiliate-install",(function(e){e.preventDefault();var a=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_affiliate_install",nonce:tf_admin_params.tf_nonce},beforeSend:function(t){a.addClass("tf-btn-loading").css({"pointer-events":"none"})},success:function(t){"success"===JSON.parse(t).status&&location.reload(),a.removeClass("tf-btn-loading").css({"pointer-events":"auto"})},error:function(t){a.removeClass("tf-btn-loading").css({"pointer-events":"auto"})}})})),t(".tf-post-data-duplicate").on("click",(function(e){e.preventDefault();var a=t(this).data("postid"),n=t(this).data("posttype"),o=t(this).data("nonce");t("#wpcontent").append('<div class="tf-duplicator-loader"></div>'),t.ajax({type:"POST",url:tf_admin_params.ajax_url,data:{action:"tf_duplicate_post_data",postID:a,postType:n,security:o},success:function(t){window.location.reload()},error:function(t){console.error("Error duplicating post:",t)}})}))})),function(t){t(document).ready((function(){const e=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}}),a=function(e){t.confirm({icon:"fa fa-check",theme:"modern",title:"Success!",content:e,type:"green",animat6ionSpeed:300,animation:"scale",closeAnimation:"scale",animateFromElement:!1,typeAnimated:!0,boxWidth:"500px",useBootstrap:!1,closeIcon:!0,buttons:{OK:{btnClass:"btn-blue"}}})},n=function(e){t.confirm({icon:"fa fa-times",theme:"modern",title:"Error!",content:e,type:"red",typeAnimated:!0,animationSpeed:300,animation:"scale",closeAnimation:"scale",animateFromElement:!1,boxWidth:"500px",useBootstrap:!1,closeIcon:!0,buttons:{OK:{btnClass:"btn-red"}}})};t(document).on("change",'[name="tf_hotel_date[from]"], [name="tf_hotel_date[to]"]',(function(a){a.preventDefault();var n=t('[name="tf_hotel_date[from]"]').val(),o=t('[name="tf_hotel_date[to]"]').val();n.length>0&&o.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_available_hotel",_nonce:tf_admin_params.tf_nonce,from:n,to:o},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_available_hotels"]');n.empty(),n.append('<option value="">'+tf_admin_params.select_hotel+"</option>"),t.each(a.data.hotels,(function(t,e){n.append('<option value="'+t+'">'+e+"</option>")})),n.select2(),n.val(n.find("option:eq(1)").val()).trigger("change"),t("#tf-backend-hotel-book-btn").removeAttr("disabled"),t('[name="tf_hotel_rooms_number"]').removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-hotel-book-btn").removeAttr("disabled")}})})),t(document).on("change",'[name="tf_available_hotels"]',(function(a){a.preventDefault();var n=t('[name="tf_available_hotels"]').val(),o=t('[name="tf_hotel_date[from]"]').val(),i=t('[name="tf_hotel_date[to]"]').val();n.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_available_room",_nonce:tf_admin_params.tf_nonce,hotel_id:n,from:o,to:i},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_available_rooms"]'),o=t('[name="tf_hotel_service_type"]');n.removeAttr("disabled"),n.empty(),n.append('<option value="">'+tf_admin_params.select_room+"</option>"),t.each(a.data.rooms,(function(t,e){n.append('<option value="'+t+'">'+e+"</option>")})),n.select2(),n.val(n.find("option:eq(1)").val()).trigger("change"),o.empty(),t.each(a.data.services,(function(t,e){o.append('<option value="'+t+'">'+e+"</option>")})),t("#tf-backend-hotel-book-btn").removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-hotel-book-btn").removeAttr("disabled")}})})),t(document).on("change",'[name="tf_available_rooms"]',(function(a){a.preventDefault();let n=t('[name="tf_available_hotels"]').val(),o=t('[name="tf_available_rooms"]').val();var i=t('[name="tf_hotel_date[from]"]').val(),r=t('[name="tf_hotel_date[to]"]').val();o.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_update_room_fields",_nonce:tf_admin_params.tf_nonce,hotel_id:n,room_id:o,from:i,to:r},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_hotel_rooms_number"]');if(n.empty(),a.data.rooms>0){for(var o=1;o<=a.data.rooms;o++)1===o?n.append('<option value="'+o+'" selected>'+o+" Room</option>"):n.append('<option value="'+o+'">'+o+" Rooms</option>");t("#tf-backend-hotel-book-btn").removeAttr("disabled")}else n.append('<option value="" selected>No Room Available</option>'),n.attr("disabled","disabled");t('[name="tf_hotel_adults_number"]').val(a.data.adults).attr("max",a.data.adults*a.data.rooms),t('[name="tf_hotel_children_number"]').val(a.data.children).attr("max",a.data.children*a.data.rooms)}else e.error(a.data)},error:function(e){console.log(e),t("#tf-backend-hotel-book-btn").removeAttr("disabled")}})})),t(document).on("click","#tf-backend-hotel-book-btn",(function(e){e.preventDefault();let o=t(this),i=o.closest("form.tf-backend-hotel-booking"),r=new FormData(i[0]);r.append("action","tf_backend_hotel_booking");let s=["tf_hotel_booked_by","tf_customer_first_name","tf_customer_email","tf_customer_phone","tf_customer_country","tf_customer_address","tf_customer_city","tf_customer_state","tf_customer_zip","tf_hotel_date[from]","tf_hotel_date[to]","tf_available_hotels","tf_available_rooms","tf_hotel_rooms_number","tf_hotel_adults_number","tf_hotel_children_number"];t.ajax({type:"post",url:tf_admin_params.ajax_url,data:r,processData:!1,contentType:!1,beforeSend:function(t){o.addClass("tf-btn-loading")},success:function(t){const e=JSON.parse(t);if(e.success)a(e.message),a(e.message),i[0].reset(),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else if(e.message)n(e.message),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else for(const t of s){const a=e.fieldErrors[t+"_error"];i.find('[name="'+t+'"]').removeClass("error-input"),"tf_hotel_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").find("small.text-danger").remove():"tf_hotel_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").find("small.text-danger").remove():i.find('[name="'+t+'"]').closest(".tf-fieldset").find("small.text-danger").remove(),a&&(i.find('[name="'+t+'"]').addClass("error-input"),"tf_hotel_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").append('<small class="text-danger">'+a+"</small>"):"tf_hotel_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").append('<small class="text-danger">'+a+"</small>"):i.find('[name="'+t+'"]').closest(".tf-fieldset").append('<small class="text-danger">'+a+"</small>"))}o.removeClass("tf-btn-loading")},error:function(t){console.log(t)},complete:function(t){o.removeClass("tf-btn-loading")}})})),t(document).on("change",'[name="tf_available_tours"]',(function(e){e.preventDefault();var a=t('[name="tf_available_tours"]').val();a&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_tour_date_time_update",_nonce:tf_admin_params.tf_nonce,tour_id:a},beforeSend:function(){t("#tf-backend-hotel-book-btn").attr("disabled","disabled")},success:function(e){if(e){const a=JSON.parse(e);let n={enableTime:!1,dateFormat:"Y/m/d"};if(a.tour_availability&&(n.minDate="today",n.disableMobile="true",n.enable=Object.entries(a.tour_availability).filter((([t,e])=>"available"===e.status)).map((([t,e])=>{const[a,n]=t.split(" - ").map((t=>t.trim())),o=new Date;return o.getFullYear(),o.getMonth(),o.getDate(),{from:a,to:n}}))),a.tour_packages_array&&function(e){let a=t('[name="tf_tour_packages"]');a.empty(),Object.keys(e).length>0?t.each(e,(function(t,e){a.append(`<option value="${t}">${e}</option>`)})):(a.append('<option value="" selected>No Package Available</option>'),a.attr("disabled","disabled"))}(a.tour_packages_array),n.onChange=function(e,n,o){let i={};const r=e[0].getTime(),s=a.tour_availability;for(const t in s){const e=s[t];if("available"!==e.status)continue;const a=new Date(e.check_in.trim()).getTime(),n=new Date(e.check_out.trim()).getTime();if(r>=a&&r<=n){const t=e.allowed_time?.time||[];Array.isArray(t)?t.forEach((t=>{t&&""!==t.trim()&&(i[t]=t)})):"object"==typeof t&&null!==t&&Object.values(t).forEach((t=>{t&&""!==t.trim()&&(i[t]=t)}));break}}!function(e){let a=t('[name="tf_tour_time"]');a.empty(),Object.keys(e).length>0?t.each(e,(function(t,e){a.append(`<option value="${t}">${e}</option>`)})):(a.append('<option value="" selected>No Time Available</option>'),a.attr("disabled","disabled"))}(i),o.element.value=n.replace(/[a-z]+/g,"-")},t("[name='tf_tour_date']").flatpickr(n),a.tour_extras_array&&Object.keys(a.tour_extras_array).length>0){let e=t('[name="tf_tour_extras[]"]');e.removeAttr("disabled"),e.empty(),t.each(a.tour_extras_array,(function(a,n){e.append(t("<option>",{value:a,html:n}))})),e.select2()}else t('[name="tf_tour_extras[]"]').empty().attr("disabled","disabled");t("#tf-backend-hotel-book-btn").removeAttr("disabled")}}})})),t(document).on("click","#tf-backend-tour-book-btn",(function(o){o.preventDefault();let i=t(this),r=i.closest("form.tf-backend-tour-booking"),s=new FormData(r[0]);s.append("action","tf_backend_tour_booking");let l=["tf_tours_booked_by","tf_customer_first_name","tf_customer_email","tf_customer_phone","tf_customer_country","tf_customer_address","tf_customer_city","tf_customer_state","tf_customer_zip","tf_tour_date","tf_available_tours","tf_tour_adults_number","tf_tour_children_number"];t.ajax({type:"post",url:tf_admin_params.ajax_url,data:s,processData:!1,contentType:!1,beforeSend:function(t){i.addClass("tf-btn-loading")},success:function(t){const o=JSON.parse(t);if(o.success)a(o.message),r[0].reset(),r.find("input").removeClass("error-input"),r.find("select").removeClass("error-input"),r.find("textarea").removeClass("error-input"),r.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else if(n(o.message),o.errors&&o.errors.forEach((function(t){e.error(t)})),r.find("input").removeClass("error-input"),r.find("select").removeClass("error-input"),r.find("textarea").removeClass("error-input"),r.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),r.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove(),o.fieldErrors)for(const t of l){const e=o.fieldErrors[t+"_error"];r.find('[name="'+t+'"]').removeClass("error-input"),r.find('[name="'+t+'"]').closest(".tf-fieldset").find("small.text-danger").remove(),e&&(r.find('[name="'+t+'"]').addClass("error-input"),r.find('[name="'+t+'"]').closest(".tf-fieldset").append('<small class="text-danger">'+e+"</small>"))}i.removeClass("tf-btn-loading")}})})),t(document).on("change",'[name="tf_apartment_date[from]"], [name="tf_apartment_date[to]"]',(function(a){a.preventDefault();var n=t('[name="tf_apartment_date[from]"]').val(),o=t('[name="tf_apartment_date[to]"]').val(),i=t('[name="tf_available_apartments"]').val();n.length>0&&o.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_available_apartment",_nonce:tf_admin_params.tf_nonce,from:n,to:o,apartment_id:i},beforeSend:function(){t("#tf-backend-apartment-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_available_apartments"]');n.empty(),n.append('<option value="">Select Apartment</option>'),t.each(a.data.apartments,(function(t,e){n.append('<option value="'+t+'">'+e+"</option>")})),n.val(n.find("option:eq(1)").val()).trigger("change"),t("#tf-backend-apartment-book-btn").removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-apartment-book-btn").removeAttr("disabled")}})})),t(document).on("change",'[name="tf_available_apartments"]',(function(a){a.preventDefault();var n=t('[name="tf_available_apartments"]').val(),o=t('[name="tf_apartment_date[from]"]').val(),i=t('[name="tf_apartment_date[to]"]').val();n.length>0&&jQuery.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_check_apartment_aditional_fees",_nonce:tf_admin_params.tf_nonce,apartment_id:n,from:o,to:i},beforeSend:function(){t("#tf-backend-apartment-book-btn").attr("disabled","disabled")},success:function(a){if(a.success){var n=t('[name="tf_apartment_additional_fees"]');n.select2({multiple:!0}),n.empty(),a.data.additional_fees.length>0?t.each(a.data.additional_fees,(function(t,e){n.append('<option value="'+t+'">'+e.label+" - "+e.price+"</option>")})):n.append('<option value="1">There are no additional fees</option>'),n.find("option").prop("selected",!0).trigger("change"),t("#tf-backend-apartment-book-btn").removeAttr("disabled")}else e.error(a.data)},error:function(t){console.log(t)},complete:function(e){t("#tf-backend-apartment-book-btn").removeAttr("disabled")}})})),t(document).on("click","#tf-backend-apartment-book-btn",(function(e){e.preventDefault();let o=t(this),i=o.closest("form.tf-backend-apartment-booking"),r=new FormData(i[0]);r.append("action","tf_backend_apartment_booking");let s=["tf_apartment_booked_by","tf_customer_first_name","tf_customer_email","tf_customer_phone","tf_customer_country","tf_customer_address","tf_customer_city","tf_customer_state","tf_customer_zip","tf_apartment_date[from]","tf_apartment_date[to]","tf_available_apartments","tf_apartment_adults_number","tf_apartment_children_number","tf_apartment_infant_number"];t.ajax({type:"post",url:tf_admin_params.ajax_url,data:r,processData:!1,contentType:!1,beforeSend:function(t){o.addClass("tf-btn-loading")},success:function(t){const e=JSON.parse(t);if(e.success)a(e.message),i[0].reset(),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else if(e.message)n(e.message),i.find("input").removeClass("error-input"),i.find("select").removeClass("error-input"),i.find("textarea").removeClass("error-input"),i.find("input").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("select").closest(".tf-fieldset").find("small.text-danger").remove(),i.find("textarea").closest(".tf-fieldset").find("small.text-danger").remove();else for(const t of s){const a=e.fieldErrors[t+"_error"];i.find('[name="'+t+'"]').removeClass("error-input"),"tf_apartment_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").find("small.text-danger").remove():"tf_apartment_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").find("small.text-danger").remove():i.find('[name="'+t+'"]').closest(".tf-fieldset").find("small.text-danger").remove(),a&&(i.find('[name="'+t+'"]').addClass("error-input"),"tf_apartment_date[from]"===t?i.find('[name="'+t+'"]').closest(".tf-date-from").append('<small class="text-danger">'+a+"</small>"):"tf_apartment_date[to]"===t?i.find('[name="'+t+'"]').closest(".tf-date-to").append('<small class="text-danger">'+a+"</small>"):i.find('[name="'+t+'"]').closest(".tf-fieldset").append('<small class="text-danger">'+a+"</small>"))}o.removeClass("tf-btn-loading")},error:function(t){console.log(t)},complete:function(t){o.removeClass("tf-btn-loading")}})}))}))}(jQuery),(()=>{function t(t){var e=document.getElementById("tf-booking-calendar"),a=window.location.href;t||(t=a.includes("post_type=tf_tours&page=tf_tours_booking")?tf_options.tf_tours_orders:a.includes("post_type=tf_hotel&page=tf_hotel_booking")?tf_options.tf_hotels_orders:a.includes("post_type=tf_apartment&page=tf_apartment_booking")?tf_options.tf_apartments_orders:a.includes("post_type=tf_carrental&page=tf_carrental_booking")?tf_options.tf_cars_orders:[]),new FullCalendar.Calendar(e,{editable:!1,selectable:!0,dayMaxEvents:3,headerToolbar:{left:"prev,next",center:"title",right:"dayGridMonth,timeGridWeek,timeGridDay"},events:t,eventContent:function(t){var e=document.createElement("div");return e.classList.add("tf-booking-single-popup"),e.setAttribute("data-id",t.event.id),e.setAttribute("data-type",t.event.extendedProps.post_type),e.setAttribute("data-page",t.event.extendedProps.page),e.innerHTML=`<span>${t.event.title}</span>`,{domNodes:[e]}}}).render()}!function(e){e(document).ready((function(){const a=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});e(".tf-filter-selection").on("click",(function(){e(this).toggleClass("active")})),e(".tf-filter-selection ul li").on("click",(function(){let t=e(this).closest(".tf-filter-selection"),a=e(this).text();t.find("label span").text(a)})),e(".tf-order-payment-status, .tf-calendar-order-payment-status").length>0&&e(".tf-order-payment-status, .tf-calendar-order-payment-status").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Order Status",allowClear:!0}),e(".tf-filter-bulk-option").length>0&&e(".tf-filter-bulk-option").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Bulk Action"}),e(".tf-filter-bulk-option-enquiry").length>0&&e(".tf-filter-bulk-option-enquiry").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Bulk Action",minimumResultsForSearch:-1}),e(".tf-enquiry-filter-hotel-name").length>0&&e(".tf-enquiry-filter-hotel-name").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Hotel Name",allowClear:!0}),e(".tf-enquiry-filter-apartment-name").length>0&&e(".tf-enquiry-filter-apartment-name").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Apartment Name",allowClear:!0}),e(".tf-enquiry-filter-tour-name ").length>0&&e(".tf-enquiry-filter-tour-name").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Tours Name",allowClear:!0}),e(".tf-filter-mail-option-enquiry").length>0&&e(".tf-filter-mail-option-enquiry").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Filters",allowClear:!0,minimumResultsForSearch:-1}),e(".tf-post-id-filter-options, .tf-booking-post-id-filter-options").length>0&&e(".tf-post-id-filter-options, .tf-booking-post-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Tour Name",allowClear:!0}),e(".tf-hotel-id-filter-options, .tf-booking-hotel-id-filter-options").length>0&&e(".tf-hotel-id-filter-options, .tf-booking-hotel-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Hotel Name",allowClear:!0}),e(".tf-apartment-id-filter-options, .tf-booking-apartment-id-filter-options").length>0&&e(".tf-apartment-id-filter-options, .tf-booking-apartment-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Apartment Name",allowClear:!0}),e(".tf-car-id-filter-options").length>0&&e(".tf-car-id-filter-options").select2({dropdownCssClass:"tf-booking-filter-modal",placeholder:"Car Name",allowClear:!0}),e(".tf-tour-checkinout-options, .tf-booking-checkinout-options").length>0&&e(".tf-tour-checkinout-options, .tf-booking-checkinout-options").select2({dropdownCssClass:"tf-booking-checkinout-filter-modal",placeholder:"Checked in status",allowClear:!0}),e(document).on("click",".visitor_edit span",(function(t){t.preventDefault(),e(".visitor-details-edit-form").show()})),e(document).on("click",".visitor-details-edit-popup .tf-booking-times span",(function(t){t.preventDefault(),e(".visitor-details-edit-form").hide()})),e(document).on("submit","form.visitor-details-edit-popup",(function(t){t.preventDefault(),e(this);var a=new FormData(this);a.append("action","tf_visitor_details_edit"),a.append("_ajax_nonce",tf_admin_params.tf_nonce),e.ajax({type:"post",url:tf_admin_params.ajax_url,data:a,processData:!1,contentType:!1,beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(".tf-order-checkinout-status ul li").on("click",(function(){let t=e(this).attr("data-value"),a=e(".tf_single_order_id").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_checkinout_details_edit",order_id:a,checkinout:t,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(".tf-order-ostatus ul li").on("click",(function(){let t=e(this).attr("data-value"),a=e(".tf_single_order_id").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_order_status_edit",order_id:a,status:t,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(".tf-order-email-resend ul li").on("click",(function(){let t=e(this).attr("data-value"),n=e("#tf_email_order_id").val(),o=e(".tf_single_order_id").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_order_status_email_resend",order_id:n,status:t,id:o,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){e(".tf-preloader-box").hide(),a.success("Email Sucessfully Resend!")},error:function(t){console.log(t)}})})),e(document).on("click",".tf-voucher-preview .tf-preview-btn a",(function(t){t.preventDefault(),e(".tf-voucher-quick-view-box").css("display","flex")})),e(document).on("click",".tf-voucher-quick-view-box .tf-quick-view-times span",(function(t){t.preventDefault(),e(".tf-voucher-quick-view-box").hide()})),e("#cb #cb-select-all-1").on("click",(function(){e('input[name="order_id[]"]').each((function(){e(this).prop("checked",!e(this).prop("checked"))}))})),e(".tf-order-status-filter-btn").on("click",(function(){let t=[],a=e(".tf-filter-bulk-option").val();e('.tf_booking_details_wrap input[name="order_id[]"]:checked').each((function(){t.push(e(this).val())})),t.length>0&&""!==a&&e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_order_bulk_action_edit",orders:t,status:a,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){location.reload()},error:function(t){console.log(t)}})})),e(document).on("submit","form.tf-right-search-filter",(function(t){t.preventDefault();let a=e("#tf-searching-key").val();if(""!==a){e(".tf-preloader-box").show();let t=window.location.href,n=t.split("?")[0],o=t.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("post")){i.set("post",a);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}else{let e=t+"&post="+a;window.location.href=e}}})),e(".tf-tour-checkinout-options").change((function(){let t=e(this).val();e(".tf-preloader-box").show();let a=window.location.href,n=a.split("?")[0],o=a.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("checkinout")){i.set("checkinout",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}else{i.set("checkinout",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}if(!i.has("nonce")){i.set("nonce",tf_admin_params.tf_nonce);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}})),e(".tf-post-id-filter-options, .tf-hotel-id-filter-options, .tf-apartment-id-filter-options").change((function(){let t=e(this).val();e(".tf-preloader-box").show();let a=window.location.href,n=a.split("?")[0],o=a.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("post")){i.set("post",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}else{i.set("post",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}if(!i.has("nonce")){i.set("nonce",tf_admin_params.tf_nonce);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}})),e(".tf-order-payment-status").change((function(){let t=e(this).val();e(".tf-preloader-box").show();let a=window.location.href,n=a.split("?")[0],o=a.split("?")[1],i=new URLSearchParams(o);if(i.delete("paged"),i.has("payment")){i.set("payment",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}else{i.set("payment",t);let e=n.split("?")[0]+"?"+i.toString();window.location.href=e}if(!i.has("nonce")){i.set("nonce",tf_admin_params.tf_nonce);let t=n.split("?")[0]+"?"+i.toString();window.location.href=t}})),e(".tf_booking_views_button ul li").on("click",(function(){e(".tf_booking_views_button ul li").removeClass("active");let a=e(this),n=a.attr("data-view");a.addClass("active"),"calendar"==n&&(e(".tf-booking-header-filter").hide(),e(".tf-order-table-responsive").hide(),e("#tf-booking-calendar").css("padding","24px"),e(".tf-calendar-booking-header-filter").css("display","flex"),e("#tf-booking-calendar").show(),t()),"list"==n&&(e("#tf-booking-calendar").hide(),e(".tf-calendar-booking-header-filter").hide(),e(".tf-booking-header-filter").css("display","flex"),e(".tf-order-table-responsive").show())})),e(document).on("click",".tf-booking-calendar-popup-box .tf-popup-header .tf-close",(function(t){e(".tf-booking-calendar-popup-box").hide()})),e(document).on("click",".tf-booking-single-popup",(function(t){t.preventDefault();let a=e(this);e(".tf-calendar-popup-box").html(""),e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_booking_details_popup",id:a.attr("data-id"),type:a.attr("data-type"),page:a.attr("data-page"),_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(t){e(".tf-calendar-popup-box").html(t),e(".tf-preloader-box").hide(),e(".tf-booking-calendar-popup-box").css("display","flex")},error:function(t){console.log(t)}})})),e(document).on("change",".tf-calendar-order-payment-status, .tf-booking-checkinout-options, .tf-filter-by-post",(function(a){a.preventDefault();let n=e(".tf-calendar-order-payment-status").val(),o=e(".tf-booking-checkinout-options").val(),i=e(".tf-filter-by-post").val();e.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_booking_calendar_filter",ostatus:n,checkinout:o,post_id:i,post_type:e("#tf_booking_post_type").val(),_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(t){e(".tf-preloader-box").show()},complete:function(t){},success:function(a){let n=JSON.parse(a);e(".tf-preloader-box").hide(),t(n.events)},error:function(t){console.log(t)}})})),e(".tf-date-picker").each((function(){let t=e(this).data("format")||"Y/m/d";flatpickr(this,{dateFormat:t})}))}))}(jQuery),document.addEventListener("DOMContentLoaded",(function(){var e,a=document.getElementById("tf-booking-calendar");a&&(a.dataset.set?(t(e),a.style.display="none"):t(e))}))})(),function(t){"use strict";t(document).ready((function(){const e=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});t(".tf-enquiry-details-wrap .tf-order-status-filter-btn").on("click",(function(a){a.preventDefault();let n=t(this),o=[],i=n.closest(".tf-enquiry-details-wrap").find(".tf-filter-bulk-option-enquiry").val();n.closest(".tf-enquiry-details-wrap").find(".tf-enquiry-filter-hotel-name").val(),n.closest(".tf-enquiry-details-wrap").find(".tf-checkbox-listing #tf-enquiry-name-checkbox:checked").each((function(){o.push(t(this).val())})),t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_bulk_action",selected_items:o,bulk_action:i,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){n.addClass("loading")},success:function(a){let o=t.parseJSON(a);n.removeClass("loading"),"success"==o.status?e.success(o.msg):"error"==o.status&&e.error(o.msg)}})})),t(".tf-enquiry-filter-hotel-name, .tf-enquiry-filter-tour-name, .tf-enquiry-filter-apartment-name").on("change",(function(){let e=t(this),a=e.val()?e.val():"",n=t(".enquiry-post-type").val(),o=t(".tf-filter-mail-option-enquiry ").val();t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_filter_post",post_id:a,post_type:n,filter:o,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t("#tf-enquiry-status-loader").addClass("show")},success:function(e){t("#tf-enquiry-status-loader").removeClass("show"),"error"==e.status?t(".tf-enquiry-details-wrap").append(e.msg):(t(".tf-enquiry-table").remove(),t(".tf-enquiry-details-wrap").append(e))}})})),t(".tf-order-status-filter-reset-btn").on("click",(function(){t(".tf-filter-bulk-option-enquiry").val("").trigger("change"),t(".tf-filter-hotel-name").val("").trigger("change"),t(".tf-filter-mail-option-enquiry").val("").trigger("change")})),t(".tf-filter-mail-option-enquiry").on("change",(function(){let e=t(this),a=e.val()?e.val():"",n=t(".tf-filter-hotel-name ").val(),o=t(".enquiry-post-type").val();t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_filter_mail",filter:a,post_id:n,post_type:o,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t("#tf-enquiry-status-loader").addClass("show")},success:function(e){t("#tf-enquiry-status-loader").removeClass("show"),"error"==e.status?t(".tf-enquiry-details-wrap").append(e.msg):(t(".tf-enquiry-table").remove(),t(".tf-enquiry-details-wrap").append(e))}})})),t("#tf-single-enquiry-reply-form").on("submit",(function(a){a.preventDefault();let n=t(this),o=n.find(".tf-enquiry-reply-email").val(),i=tinyMCE.activeEditor&&tinyMCE.activeEditor.getContent()?tinyMCE.activeEditor.getContent():t("#tf-enquiry-reply-editor").val(),r=n.find(".tf-enquiry-reply-name").val(),s=n.find(".tf-enquiry-reply-subject").val(),l=n.find(".tf-enquiry-reply-post-id").val(),f=n.find(".tf-enquiry-reply-id").val();t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:{action:"tf_enquiry_reply_email",reply_mail:o,reply_message:i,user_name:r,subject:s,post_id:l,enquiry_id:f,_ajax_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t("#tf-enquiry-status-loader").addClass("show")},success:function(a){t("#tf-enquiry-status-loader").removeClass("show");let n=JSON.parse(a);"success"==n.status?(e.success(n.msg),window.location.reload()):"error"==n.status&&e.error(n.msg)},error:function(t){console.log(t)}})})),t(document).on("submit","form.tf-enquiry-right-search-filter",(function(a){a.preventDefault();let n=t("#tf-searching-enquiry-key").val(),o=t(".tf-filter-hotel-name option");var i=t.map(o,(function(t){return t.value}));-1!==t.inArray(n,i)?t(".tf-filter-hotel-name").val(n).trigger("change"):e.error(tf_admin_params.no_data_found_with_id)})),t(document).on("click",".tf-single-enquiry-copy-btn",(function(a){let n=t(this).closest(".tf-single-enquiry-details-value").data("enquiry-copy-text"),o=t("<input>"),i=t(this).parent().parent().find(".tf-single-enquiry-log-details-single-value").data("enquiry-copy-text");n=n||i,t("body").append(o),o.val(n).select(),document.execCommand("copy"),o.remove(),e.success("Copied to clipboard")})),t(document).on("click",".tf-single-enquiry-reply-mail-button",(function(e){t(".tf-single-enquiry-reply-wrapper").slideDown(),t(this).hide()})),t(".tf-single-enquiry-reply-another-mail-button").on("click",(function(e){t("#tf-single-enquiry-reply-form").slideDown(),t(this).hide()})),t(".tf-single-enquiry-accordion-item.is-active").children(".tf-single-accordion-body").slideDown(),t(".tf-single-enquiry-accordion-head").on("click",(function(){let e=t(this).parent();e.siblings(".tf-single-enquiry-accordion-item").removeClass("is-active").find(".tf-single-accordion-body").slideUp(),e.toggleClass("is-active").find(".tf-single-accordion-body").slideToggle("ease-out")})),t(".tf-enquiry-single-row").on("click",(function(e){let a=window.location.href,n=t(".tf-enquiry-id",this).val();if("check-column"==t(e.target)[0].className||"tf-enquiry-name-checkbox"==t(e.target)[0].className||"table-name-column"==t(e.target)[0].className)return;let o=a+"&enquiry_id="+n+"&action=preview";window.location.href=o}))}))}(jQuery),(()=>{const{select:t,dispatch:e}=wp.data;function a(){let a=!1;tf_admin_params.error=!1,tf_admin_params.messages=[];let n=Object.assign({},t("core/editor").getCurrentPost(),t("core/editor").getPostEdits());n.hasOwnProperty("categories")&&(n.categories=n.categories.filter((function(t){return 1!==t}))),jQuery.each(tf_admin_params.taxonomies,(function(t,o){n.hasOwnProperty(t)&&0===n[t].length?(e("core/notices").createNotice("error",o.message,{id:"tfNotice_"+t,isDismissible:!1}),tf_admin_params.error=a=!0):e("core/notices").removeNotice("tfNotice_"+t)})),!0===a?e("core/editor").lockPostSaving():e("core/editor").unlockPostSaving()}a(),setInterval(a,500)})(),jQuery((function(t){const e=new Notyf({ripple:!0,dismissable:!0,duration:3e3,position:{x:"right",y:"bottom"}});function a(a){return tf_admin_params.error=!1,t.each(tf_admin_params.taxonomies,(function(a,n){"hierarchical"==n.type?0==t("#taxonomy-"+a+" input:checked").length&&(e.error(n.message),tf_admin_params.error=!0):t("#tagsdiv-"+a+" .tagchecklist").is(":empty")&&(e.error(n.message),tf_admin_params.error=!0)})),!tf_admin_params.error||(a.stopImmediatePropagation(),!1)}if(t("#publish, #save-post").on("click.require-post-category",a),t("#post").on("submit.require-post-category",a),null!=t("#publish")[0]&&null!=t._data(t("#publish")[0],"events")){var n=t._data(t("#publish")[0],"events").click;n&&n.length>1&&n.unshift(n.pop())}if(null!=t("#save-post")[0]&&null!=t._data(t("#save-post")[0],"events")){var o=t._data(t("#save-post")[0],"events").click;o&&o.length>1&&o.unshift(o.pop())}if(null!=t("#post")[0]&&null!=t._data(t("#post")[0],"events")){var i=t._data(t("#post")[0],"events").submit;i&&i.length>1&&i.unshift(i.pop())}})),function(t){t(document).ready((function(){const e=new Notyf({ripple:!0,dismissable:!0,duration:3e3,position:{x:"right",y:"bottom"}});t("body").hasClass("tourfic-settings_page_tf-setup-wizard")&&t("html").css("padding","0"),t(document).on("click",".tf-setup-start-btn",(function(e){e.preventDefault(),t(".tf-welcome-step").hide(),tf_admin_params.is_woo_not_active?t(".tf-setup-step-1").fadeIn(600):t(".tf-setup-step-2").fadeIn(600)})),t(document).on("click",".tf-setup-next-btn, .tf-setup-skip-btn",(function(e){e.preventDefault();let a=t("#tf-setup-wizard-form"),n=a.find('input[name="tf-skip-steps"]').val(),o=t(this).closest(".tf-setup-step-container").data("step"),i=o+1;if(2===o&&t(this).hasClass("tf-setup-next-btn")){if(!t('input[name="tf-services[]"]:checked').length)return alert(tf_admin_params.i18n.no_services_selected),!1;t('input[name="tf-services[]"][value="hotel"]').is(":checked")?(t(".tf-hotel-setup-wizard").show(),t(".tf-add-new-hotel").show()):(t(".tf-hotel-setup-wizard").hide(),t(".tf-add-new-hotel").hide()),t('input[name="tf-services[]"][value="tour"]').is(":checked")?(t(".tf-tour-setup-wizard").show(),t(".tf-add-new-tour").show()):(t(".tf-tour-setup-wizard").hide(),t(".tf-add-new-tour").hide()),t('input[name="tf-services[]"][value="apartment"]').is(":checked")?(t(".tf-apartment-setup-wizard").show(),t(".tf-add-new-apartment").show()):(t(".tf-apartment-setup-wizard").hide(),t(".tf-add-new-apartment").hide()),t('input[name="tf-services[]"][value="carrentals"]').is(":checked")?(t(".tf-car-setup-wizard").show(),t(".tf-add-new-car").show()):(t(".tf-car-setup-wizard").hide(),t(".tf-add-new-car").hide())}t(this).hasClass("tf-setup-skip-btn")&&(n=n?-1===n.indexOf(o)?n+","+o:n:o,a.find('input[name="tf-skip-steps"]').val(n),1===o&&(t(".tf-hotel-setup-wizard").show(),t(".tf-tour-setup-wizard").show())),t(this).hasClass("tf-setup-next-btn")&&-1!==n.indexOf(o)&&(n=n.replace(o,""),a.find('input[name="tf-skip-steps"]').val(n)),t(this).hasClass("tf-setup-submit-btn")||t(".tf-setup-step-"+o).fadeOut(300,(function(){t(".tf-setup-step-"+i).fadeIn(300)}))})),t(document).on("click",".tf-setup-prev-btn",(function(e){e.preventDefault();let a=t(this).closest(".tf-setup-step-container").data("step"),n=a-1;2!==a||tf_admin_params.is_woo_not_active?t(".tf-setup-step-"+a).fadeOut(300,(function(){t(".tf-setup-step-"+n).fadeIn(300)})):t(".tf-setup-step-2").fadeOut(300,(function(){t(".tf-setup-step-0").fadeIn(300)}))})),t(document).on("click",".tf-setup-submit-btn",(function(e){e.preventDefault();let a=t(".tf-setup-submit-btn.tf-quick-setup-btn"),n=t(this).closest("#tf-setup-wizard-form"),o=t(this).closest(".tf-setup-step-container").data("step"),i=n.find('input[name="tf-skip-steps"]').val();t(this).hasClass("tf-quick-setup-btn")&&-1!==i.indexOf(o)&&(i=i.replace(o,""),n.find('input[name="tf-skip-steps"]').val(i));let r=new FormData(n[0]);r.append("action","tf_setup_wizard_submit"),t.ajax({url:tf_admin_params.ajax_url,type:"POST",data:r,processData:!1,contentType:!1,beforeSend:function(){a.addClass("tf-btn-loading")},success:function(e){let n=JSON.parse(e);a.removeClass("tf-btn-loading"),n.success&&(t(".tf-finish-step").show(),t(".tf-setup-step-"+o).hide())},complete:function(){a.removeClass("tf-btn-loading")},error:function(t){a.removeClass("tf-btn-loading"),console.log(t)}})}));let a=tf_admin_params.is_travelfic_toolkit_active;t(document).on("click",".tf-setup-travelfic-theme-btn",(function(e){if(e.preventDefault(),tf_admin_params.current_active_theme&&"travelfic"!=tf_admin_params.current_active_theme&&"ultimate-hotel-booking"!=tf_admin_params.current_active_theme){let e=t('.tf-template-selection input[name="tf_theme_select"]:checked').val();"travelfic"==e&&t(".tf-setup-travelfic-theme-btn").text("Travelfic Installing..."),"ultimate-hotel-booking"==e&&t(".tf-setup-travelfic-theme-btn").text("Hotel Booking Installing..."),t(".tf-setup-travelfic-theme-btn").addClass("tf-btn-loading");var a={action:"tf_theme_installing",_ajax_nonce:tf_admin_params.tf_nonce,slug:e};jQuery.post(tf_admin_params.ajax_url,a,(function(e){t(".tf-setup-travelfic-theme-active").trigger("click")}))}else t(".tf-setup-travelfic-toolkit-btn").trigger("click")})),t(document).on("click",".tf-setup-travelfic-theme-active",(function(e){e.preventDefault();let n=t('.tf-template-selection input[name="tf_theme_select"]:checked').val();"travelfic"==n&&t(".tf-setup-travelfic-theme-btn").text("Travelfic Activate..."),"ultimate-hotel-booking"==n&&t(".tf-setup-travelfic-theme-btn").text("Hotel Booking Activate..."),t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_setup_travelfic_theme_active",_ajax_nonce:tf_admin_params.tf_nonce,slug:n},success:function(e){-1!==t.inArray("travelfic-toolkit",a)?t(".tf-setup-travelfic-toolkit-btn").trigger("click"):window.location.replace(tf_admin_params.toolkit_page_url)},error:function(t){}})})),t(document).on("click",".tf-setup-travelfic-toolkit-btn",(function(e){e.preventDefault();var n=t(this);if(-1!==t.inArray("travelfic-toolkit",a)){let e=t(this).attr("data-install");n.text("Toolkit Activate..."),n.addClass("tf-btn-loading");var o={action:"tf_travelfic_toolkit_installing",_ajax_nonce:tf_admin_params.tf_nonce,slug:e};jQuery.post(tf_admin_params.ajax_url,o,(function(e){t(".tf-setup-travelfic-toolkit-active").trigger("click")}))}else window.location.replace(tf_admin_params.toolkit_page_url)})),t(document).on("click",".tf-setup-travelfic-toolkit-active",(function(e){e.preventDefault();let a=t(this).attr("data-install");t(".tf-setup-travelfic-theme-btn").text("Toolkit Activate..."),t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_travelfic_toolkit_activate",_ajax_nonce:tf_admin_params.tf_nonce,slug:a},success:function(t){window.location.replace(tf_admin_params.toolkit_page_url)},error:function(t){}})})),t(document).on("click",".tf-install-woo-btn",(function(e){e.preventDefault();let a=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ajax_install_woo",_ajax_nonce:tf_admin_params.tf_nonce,slug:"woocommerce"},beforeSend:function(){a.text(tf_admin_params.installing),a.addClass("tf-btn-loading")},success:function(e){a.text(tf_admin_params.activating),t(".tf-active-woo-btn").trigger("click")},error:function(t){console.log(t)}})})),t(document).on("click",".tf-active-woo-btn",(function(a){a.preventDefault();let n=t(this);t.ajax({type:"post",url:tf_admin_params.ajax_url,data:{action:"tf_ajax_activate_woo",_ajax_nonce:tf_admin_params.tf_nonce,slug:"woocommerce"},beforeSend:function(){n.text(tf_admin_params.activating),n.addClass("tf-btn-loading")},success:function(a){e.success(a.data),setTimeout((function(){n.closest(".tf-setup-step-layout").find(".tf-setup-next-btn").trigger("click")}),500),n.removeClass("tf-btn-loading"),t(".tf-install-woo-btn").removeClass("tf-btn-loading")},error:function(t){console.log(t)}})}))}))}(jQuery),function(t){"use strict";t(document).ready((function(){const e=new Notyf({ripple:!0,duration:3e3,dismissable:!0,position:{x:"right",y:"bottom"}});function a(e=""){e||(e=window.location.hash);let a=e.replace("#tab=","").split("&")[0];if(a){let e=t('.tf-tablinks[data-tab="'+a+'"]'),n=t("#"+a);e.length&&n.length&&(t(".tf-admin-tab .tf-tablinks").removeClass("active"),t(".tf-tab-wrapper .tf-tab-content").removeClass("active"),e.addClass("active"),n.addClass("active"))}}t(".post-type-tf_tours #post, .post-type-tf_hotel #post, .post-type-tf_room #post, .post-type-tf_apartment #post, .post-type-tf_carrental #post, .post-type-tf_email_templates #post").on("submit",(function(){localStorage.setItem("tf_saved_tab_hash",window.location.hash)}));let n=localStorage.getItem("tf_saved_tab_hash");n?(localStorage.removeItem("tf_saved_tab_hash"),window.location.hash=n,a(n)):a(),t(window).on("hashchange load",(function(){window.location.hash;let e=window.location.search;e.indexOf("dashboard")>-1&&t("#toplevel_page_tf_settings").find(".wp-submenu").find("a").filter((function(t,a){return a.href.indexOf(e)>-1})).parent().addClass("current"),w(),g(),j()})),t(document).on("click",".tf-tablinks",(function(e){e.preventDefault();let a,n=t(this),o=n.closest(".tf-admin-tab-item"),i=o.children(".tf-tablinks").attr("data-tab"),r=t(".tf-tab-content"),s=t(".tf-tablinks");r.hide(),s.removeClass("active");let l=n.attr("data-tab");t("#"+l).css("display","flex"),n.next().hasClass("tf-submenu")&&(a=o.find(".tf-submenu li:first-child .tf-tablinks").data("tab")),a===l?o.find(".tf-submenu li:first-child .tf-tablinks").addClass("active"):n.addClass("active"),window.location.hash="#tab="+l,t(".tf-admin-tab").removeClass("active"),t("#toplevel_page_tf_settings").find(".wp-submenu").find("a").filter((function(t,e){let a=e.hash.replace("#tab=","");return l===a||i===a})).parent().addClass("current").siblings().removeClass("current"),u()})),t(document).on("click",".tf-admin-tab-item",(function(e){e.preventDefault();let a=t(this);a.addClass("open"),a.children("ul").slideDown(),a.siblings(".tf-admin-tab-item").children("ul").slideUp(),a.siblings(".tf-admin-tab-item").removeClass("open"),a.siblings(".tf-admin-tab-item").find("li").removeClass("open"),a.siblings(".tf-admin-tab-item").find("ul").slideUp()}));const o=e=>{t(e).each((function(){let e=t(this),a=e.find("input.flatpickr"),n=a.data("format"),o=a.data("multiple"),i=a.data("min-date");if(2===a.length){let t=e.find(".tf-date-from input.flatpickr").flatpickr({dateFormat:n,minDate:i,altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a.set("minDate",e)}}),a=e.find(".tf-date-to input.flatpickr").flatpickr({dateFormat:n,minDate:i,altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(e,a,n){t.set("maxDate",a)}})}else a.flatpickr({dateFormat:n,minDate:i,altInput:!0,altFormat:tf_options.tf_admin_date_format,mode:o?"multiple":"single"})}))};o(".tf-field-date");const i=e=>{t(e).each((function(){let e=t(this).find("input.flatpickr"),a=e.data("format");e.flatpickr({enableTime:!0,noCalendar:!0,dateFormat:a})}))};i(".tf-field-time");const r=e=>{t(e).each((function(){t(this).find("input.tf-color").wpColorPicker()}))};function s(){t(".tf-tab-content, .tf-taxonomy-metabox").each((function(){var e=t(this);e.find("[data-controller]").each((function(){var a=t(this);if(a.length){var n=t.tf_deps.createRuleset(),o=t.tf_deps.createRuleset(),i=[],r=[];a.each((function(){var a=t(this),o=a.data("controller").split("|"),s=a.data("condition").split("|"),l=a.data("value").toString().split("|"),f=!!a.data("depend-global"),c=n;t.each(o,(function(t,n){var o=l[t]||"",d=s[t]||s[0];(c=c.createRule(e.find('[data-depend-id="'+n+'"]'),d,o)).include(a),f?r.push(n):i.push(n)}))})),i.length&&t.tf_deps.enable(e,n,i),r.length&&t.tf_deps.enable(TF.vars.$body,o,r)}}))}))}r(".tf-field-color"),s(),t(document).on("click",".tf-modal-btn",(function(e){e.preventDefault(),t(this);let a=t("#tf-icon-modal");a.length>0&&a.hasClass("tf-modal-show")?(a.removeClass("tf-modal-show"),t("body").removeClass("tf-modal-open")):(a.addClass("tf-modal-show"),t("body").addClass("tf-modal-open"))})),t(document).on("click",".tf-modal-close",(function(){t(".tf-modal").removeClass("tf-modal-show"),t("body").removeClass("tf-modal-open")})),t(document).on("click",(function(e){t(".tf-map-modal").length||t(e.target).closest(".tf-modal-content,.tf-modal-btn").length||(t("body").removeClass("tf-modal-open"),t(".tf-modal").removeClass("tf-modal-show"))})),t(document).on("click",".tf-icon-tab",(function(e){e.preventDefault();let a=t(this),n=a.data("tab");t(".tf-icon-tab").removeClass("active"),a.addClass("active"),t("#"+n).addClass("active").siblings().removeClass("active");let o=t(".tf-icon-search-input").val();c(),f(o)})),t(document).on("click",".tf-icon-select .tf-admin-btn, .tf-icon-select .tf-icon-preview",(function(e){e.preventDefault();let a=t(this).closest(".tf-icon-select").attr("id");t("#tf-icon-modal").data("icon-field",a)})),t(document).on("click",".tf-icon-list li",(function(e){e.preventDefault();let a=t(this);t(".tf-icon-list li").removeClass("active"),a.addClass("active"),t(".tf-icon-insert").removeClass("disabled")})),t(document).on("click",".tf-icon-insert",(function(e){e.preventDefault(),t(this);let a=t("#tf-icon-modal").data("icon-field"),n=t("#"+a),o=n.find(".tf-icon-preview"),i=t(".tf-icon-list li.active").data("icon");i&&(o.removeClass("tf-hide"),n.find(".tf-icon-preview-wrap i").attr("class",i),n.find(".tf-icon-value").val(i).trigger("change"),t(".tf-modal").removeClass("tf-modal-show"),t("body").removeClass("tf-modal-open"))})),t(document).on("click",".tf-icon-preview .remove-icon",(function(e){e.preventDefault();let a=t(this),n=a.closest(".tf-icon-preview"),o=a.closest(".tf-icon-select"),i=t("#tf-icon-modal").find(".tf-icon-list li");n.addClass("tf-hide"),o.find(".tf-icon-preview-wrap i").attr("class",""),o.find(".tf-icon-value").val("").trigger("change"),i.removeClass("active")}));const l=(t,e)=>{let a;return function(){const n=this,o=arguments;clearTimeout(a),a=setTimeout((()=>t.apply(n,o)),e)}};t(document).on("keyup",".tf-icon-search-input",l((function(e){let a=t(this).val();f(a)}),500));const f=a=>{let n=t(".tf-icon-tab-pane.active").data("type"),o=t(".tf-icon-tab-pane.active .tf-icon-list");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_icon_search",_nonce:tf_admin_params.tf_nonce,search:a,type:n},beforeSend:function(){o.html('<div class="tf-icon-loading">Loading...</div>')},success:function(a){a.success?(o.html(a.data.html),t(".tf-icon-tab-pane.active").attr("data-max",a.data.count)):e.error(a.data)},error:function(t,e,a){console.error(a)}})},c=()=>{var a=!1,n=100;let o=t(".tf-icon-tab-pane.active .tf-icon-list"),i=0,r=t(".tf-icon-search-input").val();o.on("scroll",(function(){let s=t(".tf-icon-tab-pane.active").data("type"),l=t(".tf-icon-tab-pane.active").data("max");i=o[0].scrollHeight-o.height(),o.scrollTop()>=i&&!a&&n<l&&(a=!0,t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_load_more_icons",_nonce:tf_admin_params.tf_nonce,start_index:n,type:s,search:r},beforeSend:function(){t(".tf-icon-list").append('<div class="tf-icon-loading">Loading...</div>')},success:function(o){o.success?(a=!1,t("#tf-icon-tab-"+s+" .tf-icon-list").append(o.data),t(".tf-icon-loading").remove(),n+=100):(t(".tf-icon-loading").remove(),e.error(o.data))},error:function(e,n,o){a=!1,console.error(o),t(".tf-icon-loading").remove()}}))}))};c(),t(document).on("click",".tf-setting-save-btn .tf-submit-btn",(function(e){e.preventDefault(),t(".tf-option-form.tf-ajax-save").submit()})),t(document).on("click",".tf-setting-save-btn .tf-reset-btn",(function(a){t.confirm({icon:"fa fa-warning",title:tf_options.swal_reset_title_text,content:tf_options.swal_reset_other_text,type:"red",typeAnimated:!1,boxWidth:"500px",animationSpeed:500,animation:"scale",closeAnimation:"scale",animateFromElement:!1,useBootstrap:!1,theme:"modern",buttons:{confirm:{text:tf_options.swal_reset_btn_text,btnClass:"btn-blue",action:function(){t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_options_reset",tf_option_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t(".tf-setting-save-btn .tf-reset-btn").addClass("tf-btn-loading")},success:function(a){let n=JSON.parse(a);"success"===n.status?(e.success(n.message),window.location.reload()):e.error(n.message),t(".tf-setting-save-btn .tf-reset-btn").removeClass("tf-btn-loading")},error:function(t,e,a){console.log(a)}}).done((function(){}))}},cancel:{text:tf_options.swal_reset_cancel_btn_text,btnClass:"btn-red"}}})})),t(document).find("#tf-settings-header-search-filed").on("keyup",l((function(){var e=t(this).val().toLowerCase();let a=document.createElement("div");a.classList.add("tf-search-results"),e.length>=3?t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_search_settings_autocomplete",tf_option_nonce:tf_admin_params.tf_nonce,search:e},success:function(n){let o=JSON.parse(n),i=0,r=document.createElement("ul");if("success"===o.status){if(t.each(o.message,(function(n,o){if(-1!=o.field_title.toLowerCase().indexOf(e)){let t=document.createElement("li"),e=document.createElement("div");e.classList.add("tf-search-result-title");let a=document.createElement("a");a.href=`#tab=${o.parent_id}`;let n=document.createElement("i"),i=document.createElement("p"),s=document.createElement("span");i.innerHTML=o.field_title,s.innerHTML=o.path,n.classList.add(...o.icon.split(" ")),r.classList.add("tf-search-result"),t.setAttribute("data-id",o.id),t.setAttribute("data-tab-id",o.tab_id),a.append(n),e.append(i),e.append(s),a.append(e),t.append(a),r.append(t)}else i=1;t(".tf-search-results").length||e<3?t(".tf-search-results").remove():a.append(r)})),1==i){let t=document.createElement("p");t.classList.add("tf-search-not-found"),t.innerHTML=tf_admin_params.setting_search_no_result,r.append(t)}t(".tf-setting-search").append(a)}else console.log("Something went wrong!")}}):t(".tf-search-results").hide()}),700)),t(document).on("click",(function(e){"tf-settings-header-search-filed"!==e.target.id&&t(".tf-search-results").length&&t(".tf-search-results").hide()})),t("#tf-settings-header-search-filed").on("focus",(function(e){t(".tf-search-results").length&&t(".tf-search-results").show()})),t(document).on("click",".tf-search-result li",(function(e){let a=`label[for='tf_settings\\[${t(this).data("id")}\\]']`,n=t(this).closest("li").data("tab-id");n&&t('.tf-tab-item[data-tab-id="'+n+'"]').trigger("click"),t("html, body").animate({scrollTop:t(document).find(a).closest(".tf-field").offset().top},100)})),t(document).on("submit",".tf-option-form.tf-ajax-save",(function(a){a.preventDefault();let n=t(this),o=n.find(".tf-submit-btn"),i=new FormData(this);var r=t(".itinerary-fonts-file").prop("files");if(void 0!==r)for(var s=0;s<r.length;s++)i.append("file[]",r[s]);let l=!1;if(void 0!==i.get("tf_import_option")&&""!=i.get("tf_import_option").trim()){if(!confirm(tf_options.tf_export_import_msg.import_confirm))return;l=!0}i.append("action","tf_options_save"),t.ajax({url:tf_options.ajax_url,type:"POST",data:i,processData:!1,contentType:!1,beforeSend:function(){1==l&&n.find(".tf-import-btn").addClass("tf-btn-loading"),o.addClass("tf-btn-loading"),t(".tf-setting-save-btn .tf-submit-btn").addClass("tf-btn-loading")},success:function(a){let i=JSON.parse(a);"success"===i.status?(e.success(i.message),1==l&&window.location.reload()):e.error(i.message),o.removeClass("tf-btn-loading"),t(".tf-setting-save-btn .tf-submit-btn").removeClass("tf-btn-loading"),1==l&&n.find(".tf-import-btn").removeClass("tf-btn-loading")},error:function(t){o.removeClass("tf-btn-loading"),console.log(t.responseText),t.responseText.includes("max_input_vars")?e.error({message:tf_admin_params.max_input_vars_notice,duration:15e3,dismissible:!0}):e.error({message:t.responseText,duration:6e3})}})}));const d=e=>{let a=e,n=a.attr("id"),o=a.data("placeholder");"yes"===a.data("delete")?t("#"+n).select2({placeholder:o,allowClear:!0,templateResult:p,templateSelection:function(e){if(!e.id)return e.text;var a=t(e.element).data("edit-url");return a?t("<span>"+e.text+' <a target="_blank" href="'+a+'" class="tf-edit-room"><i class="fa-regular fa-pen-to-square"></i></a></span>'):e.text}}):t("#"+n).select2({placeholder:o,allowClear:!0,templateSelection:function(e){if(!e.id)return e.text;var a=t(e.element).data("edit-url");return a?t("<span>"+e.text+' <a target="_blank" href="'+a+'" class="tf-edit-room"><i class="fa-regular fa-pen-to-square"></i></a></span>'):e.text}})};function p(e){return e.id?t('<span style="display: flex; justify-content: space-between;">'+e.text+'<span class="tf-remove-button" data-id="'+e.id+'">Remove</span></span>'):e.text}function u(){var e=[];return t(".tf-repeater-wrap-room-options .tf-single-repeater-room-options").each((function(a){let n=t(this).find('[name="tf_repeater_count"]').val(),o=t(this).find(`[name="tf_room_opt[room-options][${n}][option_pricing_type]"]`).val(),i=t(this).find(`[name="tf_room_opt[room-options][${n}][option_title]"]`).val();void 0!==n&&(e[n]={index:n,title:i,type:o})})),e}function _(){var e=[];return t(".tf-repeater-wrap-package_pricing .tf-single-repeater-package_pricing").each((function(a){let n=t(this).find('[name="tf_repeater_count"]').val(),o=t(this).find(`[name="tf_tours_opt[package_pricing][${n}][pricing_type]"]`).val(),i=t(this).find(`[name="tf_tours_opt[package_pricing][${n}][pack_title]"]`).val();void 0!==i&&(e[n]={index:n,title:i,type:o})})),e}t("select.tf-select2").each((function(){var e=t(this);d(e)})),t(".tf-backend-booking-card-wrap #tf_available_tours").val(null).trigger("change"),t(document).on("select2:selecting",".tf-select2",(function(e){if("tf-remove-button"===e.params.args.originalEvent.target.className){e.stopPropagation(),e.preventDefault();let n=t(this).closest(".tf-fieldset"),o=n.find("#category_name").val(),i=n.find("#category_select_field_name").val();var a=t(e.params.args.originalEvent.target).data("id");t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_delete_category_data",_nonce:tf_admin_params.tf_nonce,term_id:a,categoryName:o},success:function(e){if(JSON.parse(e).success){let e=t("#"+i);e.find('option[value="'+a+'"]').remove(),e.select2("close")}}})}})),t("select.tf-shortcode-select2").each((function(e){let a=t(this);a.attr("id"),d(a),t(this).on("select2:select",(function(e){var a=t(e.currentTarget).val();a&&a.includes("'all'")&&t(this).val(["'all'"]).trigger("change.select2")}))})),t(window).on("load",(function(){u(),_()}));var m=function(e){var a=this;this.container=e,this.calendar=null,this.roomCalData=null,this.fullCalendar,this.timeOut,this.fullCalendarOptions={initialView:"dayGridMonth",firstDay:1,headerToolbar:{start:"title",center:"",end:"prev,next"},displayEventTime:!0,selectable:!0,select:function({start:t,end:e,startStr:n,endStr:o,allDay:i,jsEvent:r,view:s,resource:l}){if(moment(t).isBefore(moment(),"day")||moment(e).isBefore(moment(),"day"))a.fullCalendar.unselect(),h("","",a.roomCalData);else{var f=moment(t).format("Z");f=f.split(":"),f=parseInt(f[0])+":00",h(moment(t).utcOffset(f).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),moment(e).utcOffset(f).subtract(1,"day").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),a.roomCalData)}},events:function({start:e,end:n,startStr:o,endStr:i,timeZone:r},s,l){t.ajax({url:tf_options.ajax_url,dataType:"json",type:"POST",data:{action:"tf_get_hotel_room_availability",_nonce:tf_admin_params.tf_nonce,new_post:t(a.container).find('[name="new_post"]').val(),room_id:t(a.container).find('[name="room_id"]').val(),avail_date:t(a.container).find(".avail_date").val(),option_arr:u()},beforeSend:function(){t(a.container).css({"pointer-events":"none",opacity:"0.5"}),t(a.calendar).addClass("tf-content-loading")},success:function(e){"object"==typeof e&&s(e?.avail_data),t(".tf-single-options").html(e?.options_html),t(a.container).css({"pointer-events":"auto",opacity:"1"}),t(a.calendar).removeClass("tf-content-loading")},error:function(t){console.log(t)}})},eventContent:function(t){const e=t.event.title,a=document.createElement("div");return a.classList.add("fc-event-title"),a.innerHTML=e,{domNodes:[a]}},eventClick:function({event:e,el:n,jsEvent:o,view:i}){let r,s=moment(e.start,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase());r=e.end?moment(e.end,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()):s,h(s,r,a.roomCalData);let l=t(".tf_room_pricing_by").val();if("1"===l)void 0!==e.extendedProps.price&&t("[name='tf_room_price']",a.roomCalData).val(e.extendedProps.price);else if("2"===l)void 0!==e.extendedProps.adult_price&&t("[name='tf_room_adult_price']",a.roomCalData).val(e.extendedProps.adult_price),void 0!==e.extendedProps.child_price&&t("[name='tf_room_child_price']",a.roomCalData).val(e.extendedProps.child_price);else if(0!=e.extendedProps.options_count)for(var f=0;f<=e.extendedProps.options_count-1;f++)t("[name='tf_room_option_"+f+"']",a.roomCalData).prop("checked",1==e.extendedProps["tf_room_option_"+f]),t("[name='tf_option_room_price_"+f+"']",a.roomCalData).val(e.extendedProps["tf_option_room_price_"+f]),t("[name='tf_option_adult_price_"+f+"']",a.roomCalData).val(e.extendedProps["tf_option_adult_price_"+f]),t("[name='tf_option_child_price_"+f+"']",a.roomCalData).val(e.extendedProps["tf_option_child_price_"+f]);e.extendedProps.status&&t("[name='tf_room_status'] option[value="+e.extendedProps.status+"]",a.roomCalData).prop("selected",!0)}},this.init=function(){a.container=jQuery(e),a.calendar=e.querySelector(".tf-room-cal"),a.roomCalData=t(".tf-room-cal-field",a.container),h("","",a.roomCalData),a.initCalendar()},this.initCalendar=function(){"undefined"!=typeof FullCalendar&&(a.fullCalendar=new FullCalendar.Calendar(a.calendar,a.fullCalendarOptions),a.fullCalendar.render())}};function h(e,a,n){t(".tf_room_check_in",n).val(e),t(".tf_room_check_out",n).val(a)}function v(e){t(".tf_room_check_in",e).val(""),t(".tf_room_check_out",e).val(""),t('[name="tf_room_price"]',e).val(""),t('[name="tf_room_adult_price"]',e).val(""),t('[name="tf_room_child_price"]',e).val(""),t(e).find('[name="tf_room_check_in"]').each((function(){this._flatpickr&&this._flatpickr.destroy()})),t(e).find('[name="tf_room_check_out"]').each((function(){this._flatpickr&&this._flatpickr.destroy()}));let a=t(e).find('[name="tf_room_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n&&n.set("minDate",e)}}),n=t(e).find('[name="tf_room_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a&&a.set("maxDate",e)}})}const g=()=>{t(".tf-room-cal-wrap").each((function(t,e){new m(e).init()}))};g(),t(".tf-room-cal-wrap").each((function(e,a){let n=t(a).find('[name="tf_room_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){o.set("minDate",e)}}),o=t(a).find('[name="tf_room_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n.set("maxDate",e)}})})),t(document).on("click",".tf_room_cal_update",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-room-cal-wrap"),i=n.closest(".tf-room-cal-wrap")[0],r=o.find(".tf-room-cal"),s=t("input, select",o.find(".tf-room-cal-field")).serializeArray(),l=t(".tf_room_pricing_by").val(),f=o.find(".avail_date");s.push({name:"action",value:"tf_add_hotel_room_availability"}),s.push({name:"_nonce",value:tf_admin_params.tf_nonce}),s.push({name:"price_by",value:l}),s.push({name:"avail_date",value:f.val()}),s.push({name:"options_count",value:u().length}),t.ajax({url:tf_options.ajax_url,type:"POST",data:s,beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(t){if("object"==typeof t){if(!0===t.data.status){f.val(t.data.avail_date),e.success(t.data.message),v(o);var a=new m(i);a.init(),a.fullCalendar&&a.fullCalendar.refetchEvents()}else e.error(t.data.message);o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}},error:function(t){console.log(t),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}})})),t(document).on("change",".tf_room_pricing_by",(function(e){let a=t(this).val();"1"===a?(t(".tf-price-by-room").show(),t(".tf-price-by-person").hide(),t(".tf-room-cal-field .tf-single-option").hide()):"2"===a?(t(".tf-price-by-person").show(),t(".tf-price-by-room").hide(),t(".tf-room-cal-field .tf-single-option").hide()):"3"===a&&(t(".tf-price-by-room").hide(),t(".tf-price-by-person").hide(),t(".tf-room-cal-field .tf-single-option").show())})),t(document).on("change",".tf-switch",(function(e){var a=t(this);this.checked?a.val(1):a.val(""),a.hasClass("tf_room_availability_by_date")&&g(),a.hasClass("tf_apartment_availability_by_date")&&w(),a.hasClass("tf_tour_availability_by_date")&&j()}));var b=function(e){var a=this;this.container=e,this.calendar=null,this.apartmentCalData=null,this.fullCalendar,this.timeOut,this.fullCalendarOptions={initialView:"dayGridMonth",firstDay:1,headerToolbar:{start:"title",center:"",end:"prev,next"},displayEventTime:!0,selectable:!0,select:function({start:t,end:e,startStr:n,endStr:o,allDay:i,jsEvent:r,view:s,resource:l}){if(moment(t).isBefore(moment(),"day")||moment(e).isBefore(moment(),"day"))a.fullCalendar.unselect(),y("","",a.apartmentCalData);else{var f=moment(t).format("Z");f=f.split(":"),f=parseInt(f[0])+":00",y(moment(t).utcOffset(f).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),moment(e).utcOffset(f).subtract(1,"day").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),a.apartmentCalData)}},events:function({start:e,end:n,startStr:o,endStr:i,timeZone:r},s,l){t.ajax({url:tf_options.ajax_url,dataType:"json",type:"POST",data:{action:"tf_get_apartment_availability",_nonce:tf_admin_params.tf_nonce,new_post:t('[name="new_post"]').val(),apartment_id:t('[name="apartment_id"]').val(),apt_availability:t(".apt_availability").val()},beforeSend:function(){t(a.container).css({"pointer-events":"none",opacity:"0.5"}),t(a.calendar).addClass("tf-content-loading")},success:function(e){"object"==typeof e&&s(e),t(a.container).css({"pointer-events":"auto",opacity:"1"}),t(a.calendar).removeClass("tf-content-loading")},error:function(t){console.log(t)}})},eventContent:function(t){const e=t.event.title,a=document.createElement("div");return a.classList.add("fc-event-title"),a.innerHTML=e,{domNodes:[a]}},eventClick:function({event:e,el:n,jsEvent:o,view:i}){let r,s=moment(e.start,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase());r=e.end?moment(e.end,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()):s,y(s,r,a.apartmentCalData),"per_night"===t(".tf_apt_pricing_type").val()?void 0!==e.extendedProps.price&&t("[name='tf_apt_price']",a.apartmentCalData).val(e.extendedProps.price):(void 0!==e.extendedProps.adult_price&&t("[name='tf_apt_adult_price']",a.apartmentCalData).val(e.extendedProps.adult_price),void 0!==e.extendedProps.child_price&&t("[name='tf_apt_child_price']",a.apartmentCalData).val(e.extendedProps.child_price),void 0!==e.extendedProps.infant_price&&t("[name='tf_apt_infant_price']",a.apartmentCalData).val(e.extendedProps.infant_price)),e.extendedProps.status&&t("[name='tf_apt_status'] option[value="+e.extendedProps.status+"]",a.apartmentCalData).prop("selected",!0)}},this.init=function(){a.container=jQuery(e),a.calendar=e.querySelector(".tf-apt-cal"),a.apartmentCalData=t(".tf-apt-cal-field",a.container),y("","",a.apartmentCalData),a.initCalendar()},this.initCalendar=function(){"undefined"!=typeof FullCalendar&&(a.fullCalendar=new FullCalendar.Calendar(a.calendar,a.fullCalendarOptions),a.fullCalendar.render())}};function y(e,a,n){t(".tf_apt_check_in",n).val(e),t(".tf_apt_check_out",n).val(a)}function k(e){t(".tf_apt_check_in",e).val(""),t(".tf_apt_check_out",e).val(""),t('[name="tf_apt_price"]',e).val(""),t('[name="tf_apt_adult_price"]',e).val(""),t('[name="tf_apt_child_price"]',e).val(""),t('[name="tf_apt_infant_price"]',e).val(""),t(e).find('[name="tf_apt_check_in"]').each((function(){this._flatpickr&&this._flatpickr.destroy()})),t(e).find('[name="tf_apt_check_out"]').each((function(){this._flatpickr&&this._flatpickr.destroy()}));let a=t(e).find('[name="tf_apt_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n&&n.set("minDate",e)}}),n=t(e).find('[name="tf_apt_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a&&a.set("maxDate",e)}})}const w=()=>{t(".tf-apt-cal-wrap").each((function(e,a){new b(a).init();let n=t(a).find('[name="tf_apt_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){o.set("minDate",e)}}),o=t(a).find('[name="tf_apt_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n.set("maxDate",e)}})}))};w(),t(document).on("click",".tf_apt_cal_update",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-apt-cal-wrap"),i=n.closest(".tf-apt-cal-wrap")[0],r=o.find(".tf-apt-cal"),s=t("input, select",o.find(".tf-apt-cal-field")).serializeArray(),l=t(".tf_apt_pricing_type").val(),f=o.find(".apt_availability");s.push({name:"action",value:"tf_add_apartment_availability"}),s.push({name:"_nonce",value:tf_admin_params.tf_nonce}),s.push({name:"pricing_type",value:l}),s.push({name:"apt_availability",value:f.val()}),t.ajax({url:tf_options.ajax_url,type:"POST",data:s,beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(t){if("object"==typeof t){if(!0===t.data.status){f.val(t.data.apt_availability),e.success(t.data.message),k(o);var a=new b(i);a.init(),a.fullCalendar&&a.fullCalendar.refetchEvents()}else e.error(t.data.message);o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}},error:function(t){console.log(t),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}})})),t(document).on("change",".tf_apt_pricing_type",(function(e){let a=t(this).val();"per_night"===a?(t(".tf-price-by-night").show(),t(".tf-price-by-person").hide()):"2"===a&&(t(".tf-price-by-person").show(),t(".tf-price-by-night").hide())}));var x=function(e){var a=this;this.container=e,this.calendar=null,this.tourCalData=null,this.fullCalendar,this.timeOut,this.fullCalendarOptions={initialView:"dayGridMonth",firstDay:1,headerToolbar:{start:"title",center:"",end:"prev,next"},displayEventTime:!0,selectable:!0,select:function({start:t,end:e,startStr:n,endStr:o,allDay:i,jsEvent:r,view:s,resource:l}){if(D(""),moment(t).isBefore(moment(),"day")||moment(e).isBefore(moment(),"day"))a.fullCalendar.unselect(),C("","",a.tourCalData);else{var f=moment(t).format("Z");f=f.split(":"),f=parseInt(f[0])+":00",C(moment(t).utcOffset(f).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),moment(e).utcOffset(f).subtract(1,"day").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()),a.tourCalData)}},events:function({start:e,end:n,startStr:o,endStr:i,timeZone:r},s,l){t.ajax({url:tf_options.ajax_url,dataType:"json",type:"POST",data:{action:"tf_get_tour_availability",_nonce:tf_admin_params.tf_nonce,new_post:t('[name="new_post"]').val(),tour_id:t('[name="tour_id"]').val(),tour_availability:t(".tour_availability").val(),option_arr:_()},beforeSend:function(){t(a.container).css({"pointer-events":"none",opacity:"0.5"}),t(a.calendar).addClass("tf-content-loading")},success:function(e){"object"==typeof e&&s(e?.avail_data),t(".tf-package-field-repeater").html(e?.options_html),t(a.container).css({"pointer-events":"auto",opacity:"1"}),t(a.calendar).removeClass("tf-content-loading")},error:function(t){console.log(t)}})},eventContent:function(t){const e=t.event.title,a=document.createElement("div");return a.classList.add("fc-event-title"),a.innerHTML=e,{domNodes:[a]}},eventDidMount:function(t){const e=t.event.extendedProps.customClass||"";e&&t.el.classList.add(e)},eventClick:function({event:e,el:n,jsEvent:o,view:i}){let r,s=moment(e.start,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase());r=e.end?moment(e.end,String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()).subtract(1,"days").format(String(tf_options.tf_admin_date_format||"MM/DD/YYYY").toUpperCase()):s,C(s,r,a.tourCalData);let l=t(".tf_tour_pricing_type").val(),f=t('[name="tf_tours_opt[allow_package_pricing]"]').val();void 0!==e.extendedProps.min_person&&t("[name='tf_tour_min_person']",a.tourCalData).val(e.extendedProps.min_person),void 0!==e.extendedProps.max_person&&t("[name='tf_tour_max_person']",a.tourCalData).val(e.extendedProps.max_person),void 0!==e.extendedProps.max_capacity&&t("[name='tf_tour_max_capacity']",a.tourCalData).val(e.extendedProps.max_capacity);let c="";if(void 0!==e.extendedProps.allowed_time){const t=e.extendedProps.allowed_time,a=Array.isArray(t.time)?t.time:"object"==typeof t.time&&null!==t.time?Object.values(t.time):[],n=Array.isArray(t.cont_max_capacity)?t.cont_max_capacity:"object"==typeof t.cont_max_capacity&&null!==t.cont_max_capacity?Object.values(t.cont_max_capacity):[],o=document.querySelector(".tf_tour_allowed_times");if(!o)return void console.error("Container element not found!");for(;o.firstChild;)o.removeChild(o.firstChild);a.length>0&&a.forEach(((t,e)=>{if(!t)return;const a=n[e]||"";c+=`\n                                <div class="tf-single-repeater tf-single-repeater-allowed_time">\n                                    <input type="hidden" name="tf_parent_field" value="">\n                                    <input type="hidden" name="tf_repeater_count" value="${e+1}">\n                                    <input type="hidden" name="tf_current_field" value="allowed_time">\n                                    <div class="tf-repeater-content-wrap">\n                                        <div class="tf-field tf-field-time" style="width: calc(50% - 6px);">\n                                            <div class="tf-fieldset">\n                                                <input type="text" name="allowed_time[time][]" placeholder="Select Time" value="${t}" class="flatpickr flatpickr-input" data-format="h:i K" readonly="readonly">\n                                                <i class="fa-regular fa-clock"></i>\n                                            </div>\n                                        </div>\n                                        <div class="tf-field tf-field-number" style="width: calc(50% - 6px);">\n                                            <div class="tf-fieldset">\n                                                <input type="number" name="allowed_time[cont_max_capacity][]" id="allowed_time[cont_max_capacity]" value="${a}" placeholder="Maximum Capacity">\n                                            </div>\n                                        </div>\n                                        <span class="tf-repeater-icon tf-repeater-icon-delete">\n                                            <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                <path d="M15 5L5 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                                <path d="M5 5L15 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                            </svg>\n                                        </span>\n                                    </div>\n                                </div>\n                            `}))}if("package"!=l&&c&&(t(".tf_tour_saved_allowed_times").append(c),t(".tf_tour_allowed_times .flatpickr-input").flatpickr({enableTime:!0,noCalendar:!0,dateFormat:"h:i K"})),"group"===l&&1!=f)void 0!==e.extendedProps.price&&t("[name='tf_tour_price']",a.tourCalData).val(e.extendedProps.price);else if("person"===l)void 0!==e.extendedProps.adult_price&&t("[name='tf_tour_adult_price']",a.tourCalData).val(e.extendedProps.adult_price),void 0!==e.extendedProps.child_price&&t("[name='tf_tour_child_price']",a.tourCalData).val(e.extendedProps.child_price),void 0!==e.extendedProps.infant_price&&t("[name='tf_tour_infant_price']",a.tourCalData).val(e.extendedProps.infant_price);else{if(0!=e.extendedProps.options_count)for(var d=0;d<=e.extendedProps.options_count-1;d++){t("[name='tf_option_min_person_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_min_person_"+d]),t("[name='tf_option_max_person_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_max_person_"+d]),t("[name='tf_option_group_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_group_price_"+d]),t("[name='tf_option_adult_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_adult_price_"+d]),t("[name='tf_option_child_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_child_price_"+d]),t("[name='tf_option_infant_price_"+d+"']",a.roomCalData).val(e.extendedProps["tf_option_infant_price_"+d]);const n=e.extendedProps["tf_option_group_discount_"+d];let o="";n&&Array.isArray(n.min_person)&&n.min_person.forEach(((t,e)=>{if(!t)return;const a=n.max_person[e]||"",i=n.price[e]||"";o+=`\n                                            <div class="tf-single-repeater tf-single-repeater-group_discount_package">\n                                                <input type="hidden" name="tf_parent_field" value="[group_tabs]">\n                                                <input type="hidden" name="tf_repeater_count" value="${e+1}">\n                                                <input type="hidden" name="tf_current_field" value="group_discount_package">\n                                                \n                                                <div class="tf-repeater-content-wrap">\n                                                    <div class="tf-field tf-field-number" style="width:calc(66% - 10px);">\n                                                        <div class="tf-fieldset">\n                                                            <div class="tf-number-range">\n                                                                <div class="tf-number-field-box">\n                                                                    <i class="fa-regular fa-user"></i>\n                                                                    <input type="number" name="tf_option_${d}_group_discount[min_person][]" value="${t}" min="0" placeholder="Min Person">\n                                                                </div>\n                                                                <svg width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                                    <path d="M15.5 6.66797L18.8333 10.0013L15.5 13.3346" stroke="#95A3B2" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                                    <path d="M2.1665 10H18.8332" stroke="#95A3B2" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                                </svg>\n                                                                <div class="tf-number-field-box">\n                                                                    <i class="fa-regular fa-user"></i>\n                                                                    <input type="number" name="tf_option_${d}_group_discount[max_person][]" value="${a}" min="0" placeholder="Max Person">\n                                                                </div>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                    <div class="tf-field tf-field-number" style="width:calc(33% - 10px);">\n                                                        <div class="tf-fieldset">\n                                                            <input type="number" name="tf_option_${d}_group_discount[price][]" value="${i}" min="0" placeholder="Price">\n                                                        </div>\n                                                    </div>\n\n                                                    <span class="tf-repeater-icon tf-repeater-icon-delete">\n                                                        <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                            <path d="M15 5L5 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                            <path d="M5 5L15 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>\n                                                        </svg>\n                                                    </span>\n                                                </div>\n                                            </div>\n                                        `})),o&&t(".tf-group-discount-package_"+d).append(o);const i=e.extendedProps["tf_option_times_"+d];let r="";i&&Array.isArray(i.time)&&i.time.forEach(((t,e)=>{if(!t)return;const a=i.cont_max_capacity[e]||"";r+=`\n                                            <div class="tf-single-repeater tf-single-repeater-allowed_time">\n                                                <input type="hidden" name="tf_parent_field" value="">\n                                                <input type="hidden" name="tf_repeater_count" value="${e+1}">\n                                                <input type="hidden" name="tf_current_field" value="allowed_time">\n                                                <div class="tf-repeater-content-wrap">\n                                                    <div class="tf-field tf-field-time" style="width: calc(50% - 6px);">\n                                                        <div class="tf-fieldset">\n                                                            <input type="text" name="tf_option_${d}_allowed_time[time][]" placeholder="Select Time" value="${t}" class="flatpickr flatpickr-input" data-format="h:i K" readonly="readonly">\n                                                            <i class="fa-regular fa-clock"></i>\n                                                        </div>\n                                                    </div>\n                                                    <div class="tf-field tf-field-number" style="width: calc(50% - 6px);">\n                                                        <div class="tf-fieldset">\n                                                            <input type="number" name="tf_option_${d}_allowed_time[cont_max_capacity][]" value="${a}" placeholder="Maximum Capacity">\n                                                        </div>\n                                                    </div>\n                                                    <span class="tf-repeater-icon tf-repeater-icon-delete">\n                                                        <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n                                                            <path d="M15 5L5 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                                            <path d="M5 5L15 15" stroke="#566676" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>\n                                                        </svg>\n                                                    </span>\n                                                </div>\n                                            </div>\n                                        `})),r&&(t(".tf-tour-package-allowed-time_"+d).html(r),t(".tf_tour_allowed_times .flatpickr-input").flatpickr({enableTime:!0,noCalendar:!0,dateFormat:"h:i K"}))}void 0===e.extendedProps.options_count&&(t(".tf_option_pricing_type_person input").val(""),t(".tf_option_pricing_type_group input").val(""))}e.extendedProps.status&&t("[name='tf_tour_status'] option[value="+e.extendedProps.status+"]",a.tourCalData).prop("selected",!0)}},this.init=function(){a.container=jQuery(e),a.calendar=e.querySelector(".tf-tour-cal"),a.tourCalData=t(".tf-tour-cal-field",a.container),C("","",a.tourCalData),a.initCalendar()},this.initCalendar=function(){"undefined"!=typeof FullCalendar&&(a.fullCalendar=new FullCalendar.Calendar(a.calendar,a.fullCalendarOptions),a.fullCalendar.render())}};function C(e,a,n){t(".tf_tour_check_in",n).val(e),t(".tf_tour_check_out",n).val(a)}function D(e){if(t(".tf_tour_check_in",e).val(""),t(".tf_tour_check_out",e).val(""),t('[name="tf_tour_price"]',e).val(""),t('[name="tf_tour_adult_price"]',e).val(""),t('[name="tf_tour_child_price"]',e).val(""),t('[name="tf_tour_infant_price"]',e).val(""),t('[name="tf_tour_min_person"]',e).val(""),t('[name="tf_tour_max_person"]',e).val(""),t('[name="tf_tour_max_capacity"]',e).val(""),t('[name="tf_tour_repeat_day[]"], [name="tf_tour_repeat_month[]"], [name="tf_tour_repeat_year[]"], [name="tf_tour_repeat_week[]"]').prop("checked",!1),t(".bulk-popup-content-box #adult_tabs input, .bulk-popup-content-box #child_tabs input, .bulk-popup-content-box #infant_tabs input, .bulk-popup-content-box #group_tabs input").val(""),t(".tf-tour-cal-field .tf_tour_allowed_times").html(""),t(".tf_tour_allowed_times").length>0){const t=document.querySelector(".tf_tour_allowed_times");for(;t.firstChild;)t.removeChild(t.firstChild)}t(e).find('[name="tf_tour_check_in"]').each((function(){this._flatpickr&&this._flatpickr.destroy()})),t(e).find('[name="tf_tour_check_out"]').each((function(){this._flatpickr&&this._flatpickr.destroy()}));let a=t(e).find('[name="tf_tour_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n&&n.set("minDate",e)}}),n=t(e).find('[name="tf_tour_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,n){a&&a.set("maxDate",e)}})}const j=()=>{t(".tf-tour-cal-wrap").each((function(e,a){new x(a).init();let n=t(a).find('[name="tf_tour_check_in"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){o.set("minDate",e)}}),o=t(a).find('[name="tf_tour_check_out"]').flatpickr({dateFormat:tf_options.tf_admin_date_format||"MM/DD/YYYY",minDate:"today",altInput:!0,altFormat:tf_options.tf_admin_date_format,onChange:function(t,e,a){n.set("maxDate",e)}})}))};function S(t){wp.editor.initialize(t,{tinymce:{wpautop:!0,plugins:"charmap colorpicker hr lists paste tabfocus textcolor fullscreen wordpress wpautoresize wpeditimage wpemoji wpgallery wplink wptextpattern",toolbar1:"formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,spellchecker,fullscreen,wp_adv,listbuttons",toolbar2:"styleselect,strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help"},quicktags:{buttons:"strong,em,link,block,del,ins,img,ul,ol,li,code,more,close"},mediaButtons:!1})}function Y(){t(".tf-repeater-wrap .tf-single-repeater-book-confirm-field").length>0&&t(".tf-repeater-wrap .tf-single-repeater-book-confirm-field").each((function(){let e=t(this),a=e.find('input[name="tf_repeater_count"]').val();0!=a&&1!=a&&2!=a||(e.find(".tf_hidden_fields").hide(),e.find(".tf-repeater-icon-clone").hide(),e.find(".tf-repeater-icon-delete").hide())})),t(".tf-repeater-wrap .tf-single-repeater-hotel-book-confirm-field").length>0&&t(".tf-repeater-wrap .tf-single-repeater-hotel-book-confirm-field").each((function(){let e=t(this),a=e.find('input[name="tf_repeater_count"]').val();0!=a&&1!=a&&2!=a||(e.find(".tf_hidden_fields").hide(),e.find(".tf-repeater-icon-clone").hide(),e.find(".tf-repeater-icon-delete").hide())})),t(".tf-repeater-wrap .tf-single-repeater-car-book-confirm-field").length>0&&t(".tf-repeater-wrap .tf-single-repeater-car-book-confirm-field").each((function(){let e=t(this),a=e.find('input[name="tf_repeater_count"]').val();0!=a&&1!=a&&2!=a||(e.find(".tf_hidden_fields").hide(),e.find(".tf-repeater-icon-clone").hide(),e.find(".tf-repeater-icon-delete").hide())}))}j(),t(document).on("click",".tf_tour_cal_update",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-tour-cal-wrap"),i=n.closest(".tf-tour-cal-wrap")[0],r=o.find(".tf-tour-cal"),s=t("input, select",o.find(".tf-tour-cal-field")).serializeArray(),l=t(".tf_tour_pricing_type").val(),f=o.find(".tour_availability");s.push({name:"action",value:"tf_add_tour_availability"}),s.push({name:"_nonce",value:tf_admin_params.tf_nonce}),s.push({name:"pricing_type",value:l}),s.push({name:"tour_availability",value:f.val()}),s.push({name:"options_count",value:_().length}),t.ajax({url:tf_options.ajax_url,type:"POST",data:s,beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if("object"==typeof a){if(!0===a.data.status){f.val(a.data.tour_availability),e.success(a.data.message),D(o);var s=new x(i);s.init(),s.fullCalendar&&s.fullCalendar.refetchEvents()}else e.error(a.data.message);o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}t(".tf-check-dates").show(),t(".tf_tour_cal_reset").show(),t(".tf_tour_cal_bulk_edit").show(),t(".tf-tour-cal-field").removeClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").hide(),t(".tf-bulk-edit-header").hide(),t(".tf-field-group-box .tf-tab-switch-box .tf-tab-field-content").hide()},error:function(t){console.log(t),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading"),t(".tf-check-dates").show(),t(".tf_tour_cal_reset").show(),t(".tf_tour_cal_bulk_edit").show(),t(".tf-tour-cal-field").removeClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").hide(),t(".tf-bulk-edit-header").hide(),t(".tf-field-group-box .tf-tab-switch-box .tf-tab-field-content").hide()}})})),t(document).on("click",".tf_tour_cal_refresh",(function(t){t.preventDefault(),j()})),t(document).on("click",".tf_tour_cal_reset, .tf_room_cal_reset, .tf_apt_cal_reset",(function(e){e.preventDefault(),t(".tf-reset-confirmation-box").css("display","flex")})),t(document).on("click",".tf-tour-cal-field .tf-reset-confirmation-box .tf-confirmed-btn",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-tour-cal-wrap"),i=n.closest(".tf-tour-cal-wrap")[0],r=o.find(".tf-tour-cal"),s=o.find(".tour_availability");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_reset_tour_availability",_nonce:tf_admin_params.tf_nonce,tour_id:t("#post_ID").val()},beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if(!0===a.data.status){s.val(a.data.tour_availability),e.success(a.data.message),D(o);var l=new x(i);l.init(),l.fullCalendar&&l.fullCalendar.refetchEvents()}else e.error(a.data.message);t(".tf-reset-confirmation-box").hide(),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},error:function(t){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading"),t(".tf-tour-cal-field").removeClass("tf-bulk-popup")}})})),t(document).on("click",".tf-room-cal-field .tf-reset-confirmation-box .tf-confirmed-btn",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-room-cal-wrap"),i=n.closest(".tf-room-cal-wrap")[0],r=o.find(".tf-room-cal"),s=o.find("avail_date");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_reset_room_availability",_nonce:tf_admin_params.tf_nonce,room_id:t("#post_ID").val()},beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if(!0===a.data.status){s.val(a.data.avail_date),e.success(a.data.message),v(o);var l=new m(i);l.init(),l.fullCalendar&&l.fullCalendar.refetchEvents()}else e.error(a.data.message);t(".tf-reset-confirmation-box").hide(),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},error:function(t){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")}})})),t(document).on("click",".tf-apt-cal-field .tf-reset-confirmation-box .tf-confirmed-btn",(function(a){a.preventDefault();let n=t(this),o=n.closest(".tf-apt-cal-wrap"),i=n.closest(".tf-apt-cal-wrap")[0],r=o.find(".tf-apt-cal"),s=o.find(".apt_availability");t.ajax({url:tf_options.ajax_url,type:"POST",data:{action:"tf_reset_apt_availability",_nonce:tf_admin_params.tf_nonce,apartment_id:t("#post_ID").val()},beforeSend:function(){o.css({"pointer-events":"none",opacity:"0.5"}),r.addClass("tf-content-loading"),n.addClass("tf-btn-loading")},success:function(a){if(!0===a.data.status){s.val(a.data.apt_availability),e.success(a.data.message),k(o);var l=new b(i);l.init(),l.fullCalendar&&l.fullCalendar.refetchEvents()}else e.error(a.data.message);t(".tf-reset-confirmation-box").hide(),o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},error:function(t){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading")},complete:function(){o.css({"pointer-events":"auto",opacity:"1"}),r.removeClass("tf-content-loading"),n.removeClass("tf-btn-loading"),t(".tf-tour-cal-field").removeClass("tf-bulk-popup")}})})),t(document).on("click",".tf-reset-confirmation-box .tf-cancel-btn, .tf-reset-confirmation-box .tf_reset_confirmation_close svg",(function(e){e.preventDefault(),t(".tf-reset-confirmation-box").hide()})),t(document).on("click",".tf-reset-confirmation-box",(function(e){t(e.target).closest(".tf-confirmation-content").length||t(this).hide()})),t(document).on("click",".tf_tour_package_save",(function(a){a.preventDefault();var n=t(this).closest(".tf-single-repeater-package_pricing"),o=null;if(n.find('[name^="tf_tours_opt[package_pricing]"]').each((function(){var e=t(this).attr("name").match(/tf_tours_opt\[package_pricing\]\[(\d+)\]/);if(e&&e[1])return o=e[1],!1})),null!==o){var i={pack_status:"",pack_title:"",pricing_type:"person",desc:"",adult_tabs:[{},{},{},{}],child_tabs:[{},{},{},{}],infant_tabs:[{},{},{},{}],group_tabs:[{},{},{},{},{},{}]};n.find("input, select, textarea").each((function(){var e=t(this),a=e.attr("name");if("tf_parent_field"!==a&&"tf_repeater_count"!==a&&"tf_current_field"!==a)for(var n=a.replace(/^tf_tours_opt\[package_pricing\]\[\d+\]/,"").replace(/^\[|\]$/g,"").split("]["),o=i,r=0;r<n.length;r++){var s=n[r];!isNaN(s)&&r>0&&(s=parseInt(s)),r===n.length-1?"checkbox"===e.attr("type")?o[s]=e.is(":checked")?e.val()||"1":"":o[s]=e.val():(void 0===o[s]&&(o[s]=isNaN(n[r+1])?{}:[]),o=o[s])}}));var r=[];n.find(".tf-single-repeater-group_discount_package").each((function(){var e=t(this),a={},n=!1;e.find('input[type="number"]').each((function(){var e=t(this).attr("name").match(/\[group_discount_package\]\[(\d+)\]\[([^\]]+)\]/);if(e&&e[1]&&e[2]){var o=t(this).val();a[e[2]]=o,"discount_price"===e[2]&&o&&parseFloat(o)>0&&(n=!0)}})),n&&Object.keys(a).length>0&&r.push(a)})),r.length>0?i.group_tabs[5]={group_discount_package:r}:i.group_tabs[5]=[];var s={action:"save_tour_package_pricing",post_id:t("#post_ID").val(),pricing_type:t(".tf_tour_pricing_type").val(),package_index:o,package_data:i,nonce:tf_admin_params.tf_nonce},l=t(this);l.text("Saving...").prop("disabled",!0),t.post(tf_options.ajax_url,s,(function(t){t.success?(i.pack_title?n.find(" > .tf-repeater-header .tf-repeater-title").html(i.pack_title):n.find(" > .tf-repeater-header .tf-repeater-title").html("Create your Tour Packages"),n.find(".tf-repeater-content-wrap").hide(),n.find(".tf-repeater-header").removeClass("active-repeater"),n.find(".tf-repeater-header .package-action-hide").addClass("show"),e.success("Package saved successfully!")):e.error("There is an error!"),l.text("Save").prop("disabled",!1)})).fail((function(t,a,n){e.error("There is an error!"),l.text("Save").prop("disabled",!1)}))}else alert("Could not determine package index")})),t(".group_discount_switcher").each((function(){let e=t(this),a=e.find('input[type="checkbox"]');e.next(".group_discount_package_box").toggle(a.is(":checked"))})),t(document).on("change",".group_discount_switcher input[type='checkbox']",(function(){t(this).closest(".group_discount_switcher").next(".group_discount_package_box").toggle(t(this).is(":checked"))})),t(document).on("change","#tf_tours_opt .tf_tour_pricing_type",(function(e){let a=t(this).val();"person"==a?(t(".tf-show-for-group").hide(),t(".tf-show-for-package").hide(),t(".tf-show-for-person").show()):"group"==a?(t(".tf-show-for-package").hide(),t(".tf-show-for-person").hide(),t(".tf-show-for-group").show()):"package"==a&&(t(".tf-show-for-person").hide(),t(".tf-show-for-group").hide(),t(".tf-show-for-package").show());var n={action:"save_tour_pricing_type",post_id:t("#post_ID").val(),pricing_type:a,nonce:tf_admin_params.tf_nonce};t.post(tf_options.ajax_url,n,(function(t){t.success})).fail((function(t,e,a){}))})),t(document).on("change",".tf_tour_pricing_type",(function(e){let a=t(this).val();"per_night"===a?(t(".tf-price-by-night").show(),t(".tf-price-by-person").hide()):"2"===a&&(t(".tf-price-by-person").show(),t(".tf-price-by-night").hide())})),t(document).on("click","#tf_tours_opt .tf-tablinks",(function(e){"availability"==t(this).attr("data-tab")&&j()})),t(document).on("click",".tf_tour_cal_bulk_edit",(function(e){D(""),t(".tf-tour-cal-field").addClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").show(),t(".tf-check-dates").hide(),t(".tf_tour_cal_bulk_edit").hide(),t(".tf_tour_cal_reset").hide(),t(".bulk-popup-content .tf-repeater-wrap-group_discount_package").html(""),t(".bulk-popup-content .tf_tour_allowed_times").html(""),t(".tf-bulk-edit-header").css("display","flex"),t(".tf_bulk_edit_option").val("1")})),t(document).on("click",".tf_tour_bulk_close",(function(e){t(".tf-tour-cal-field").removeClass("tf-bulk-popup"),t(".tf-bulk-repeater-section").hide(),t(".tf-check-dates").show(),t(".tf_tour_cal_reset").show(),t(".bulk-popup-content .tf-repeater-wrap-group_discount_package").html(""),t(".bulk-popup-content .tf_tour_allowed_times").html(""),t(".tf_tour_cal_bulk_edit").show(),t(".tf-bulk-edit-header").hide(),t(".tf_bulk_edit_option").val("")})),t("textarea.wp_editor, textarea.tf_wp_editor").each((function(){let e=t(this).attr("id");setTimeout((function(){S(e)}),1e3)})),Y(),t(document).on("click",".tf-repeater-icon-add",(function(){var e=t(this).parent().parent(),a=t(this).attr("data-repeater-id"),n=t(this).attr("data-repeater-max"),l=e.find(".tf-single-repeater-clone-"+a+" .tf-single-repeater-"+a).clone(),f=e.find(".tf-repeater-wrap-"+a+" .tf-single-repeater-"+a).length,c=l.find(':input[name="tf_parent_field"]').val(),p=l.find(':input[name="tf_current_field"]').val(),u=parseInt(t(this).closest(".tf-repeater").attr("data-max-index"))+1;if(t(this).closest(".tf-repeater").attr("data-max-index",u),e.find(".tf-repeater-wrap .tf-field-notice-inner").remove(),!tf_admin_params.is_pro&&""!=n&&f>=n)return e.find(".tf-repeater-wrap").append('<div class="tf-field-notice-inner tf-notice-danger" style="display: block;">You have reached limit in free version. Please subscribe to Pro for unlimited access</div>'),!1;l.find(':input[name="tf_repeater_count"]').val(u);let _=l.find(".tf-field-date");_.length>0&&(_.find("input").each((function(){""!=t(this).attr("name")&&void 0!==t(this).attr("name")||t(this).remove()})),o(_));let m=l.find(".tf-field-time");m.length>0&&i(m);let h=l.find(".tf-field-color");if(h.length>0&&(h.find("input.tf-color").each((function(){var e=t(this).clone();t(this).closest("li").length>0?t(this).closest("li").append(e):t(this).closest(".tf-fieldset").append(e),t(this).closest(".wp-picker-container").remove()})),r(h)),""==c){if(l.find(":input").each((function(){this.name=this.name.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]"),this.id=this.id.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]")})),void 0!==(v=l.find('.tf-repeater input[name="tf_parent_field"]').val()))var v=v.replace("["+p+"][00]","["+p+"]["+u+"]");l.find('.tf-repeater input[name="tf_parent_field"]').val(v)}else v=l.find(':input[name="tf_parent_field"]').val(),l.find(":input").each((function(){this.name=this.name.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]"),this.id=this.id.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]")}));l.find("label").each((function(){var e=t(this).attr("for");void 0!==e&&(e=e.replace("_____","").replace("["+p+"][00]","["+p+"]["+u+"]"),t(this).attr("for",e))})),l.find(".tf-icon-select").each((function(e){var a=t(this).attr("id");void 0!==a&&(a=a+e+u,t(this).attr("id",a))})),l.find("[data-depend-id]").each((function(){var e=t(this).attr("data-depend-id");void 0!==e&&(e=e.replace("["+p+"][00]","["+p+"]["+u+"]"),t(this).attr("data-depend-id",e))})),l.find("[data-controller]").each((function(){var e=t(this).attr("data-controller");void 0!==e&&(e=e.replace("["+p+"][00]","["+p+"]["+u+"]"),t(this).attr("data-controller",e))})),l.find(".wp-editor-wrap").each((function(){var e=t(this).find(".tf_wp_editor").show(),a=t("#"+e.attr("id")).val();if(a&&void 0!==a)var n=tinymce.get(e.attr("id")).getContent();else n="";e.val(n),t(this).closest(".tf-field-textarea").append(e),t(this).remove()}));var g=e.find(".tf-repeater-wrap-"+a);l.appendTo(g).show(),l.find("textarea.parent_wp_editor").each((function(){var e=Math.random().toString(36).substring(3,9)+1;t(this).attr("id",p+e),t(this).attr("data-count-id",e),S(t(this).attr("id"))})),l.find("select.tf-select2-parent").each((function(){this.id=this.id.replace(p+"__00",p+"__"+u),t(this).attr("id");var e=t(this);d(e)})),s(),Y()})),t(document).on("click",".tf-repeater-icon-delete",(function(){t(this).attr("data-repeater-max");var e=t(this).closest(".tf-repeater-wrap");return e.find(".tf-single-repeater").length,confirm("Are you sure to delete this item?")&&(e.find(".tf-field-notice-inner").remove(),t(this).closest(".tf-single-repeater").remove()),!1})),t(document).on("click",".tf-repeater-icon-clone",(function(){var a=t(this).closest(".tf-repeater-wrap");let n=t(this).closest(".tf-single-repeater").clone();var l=t(this).attr("data-repeater-max"),f=n.find('input[name="tf_parent_field"]').val(),c=n.find('input[name="tf_current_field"]').val(),p=n.find('input[name="tf_repeater_count"]').val(),u=a.find(".tf-single-repeater-"+c).length,_=parseInt(t(this).closest(".tf-repeater").attr("data-max-index"))+1;if(t(this).closest(".tf-repeater").attr("data-max-index",_),a.find(".tf-field-notice-inner").remove(),!tf_admin_params.is_pro&&""!=l&&u>=l)return a.append('<div class="tf-field-notice-inner tf-notice-danger" style="display: block;">You have reached limit in free version. Please subscribe to Pro for unlimited access</div>'),!1;let m=n.find(".tf-field-date");m.length>0&&(m.find("input").each((function(){""!=t(this).attr("name")&&void 0!==t(this).attr("name")||t(this).remove()})),o(m));let h=n.find(".tf-field-time");h.length>0&&i(h);let v=n.find(".tf-field-color");if(v.length>0&&(v.find("input.tf-color").each((function(){var e=t(this).clone();t(this).closest("li").length>0?t(this).closest("li").append(e):t(this).closest(".tf-fieldset").append(e),t(this).closest(".wp-picker-container").remove()})),r(v)),""==f){if(n.find(":input").each((function(){0==t(this).closest(".tf-single-repeater-clone").length&&(this.name=this.name.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),this.id=this.id.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"))})),void 0!==(g=n.find('.tf-repeater input[name="tf_parent_field"]').val()))var g=g.replace("["+c+"]["+p+"]","["+c+"]["+_+"]");n.find('.tf-repeater input[name="tf_parent_field"]').val(g)}else n.find(":input").each((function(){0==t(this).closest(".tf-single-repeater-clone").length&&(this.name=this.name.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),this.id=this.id.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]"))}));n.find("label").each((function(){if(void 0!==(e=t(this).attr("for"))){e=e.replace("_____","").replace("["+c+"]["+p+"]","["+c+"]["+_+"]");var e=t(this).attr("for",e)}})),n.find(".tf-icon-select").each((function(e){var a=t(this).attr("id");void 0!==a&&(a=a+e+_,t(this).attr("id",a))})),n.find("[data-depend-id]").each((function(){var e=t(this).attr("data-depend-id");void 0!==e&&(e=e.replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),t(this).attr("data-depend-id",e))})),n.find("[data-controller]").each((function(){var e=t(this).attr("data-controller");void 0!==e&&(e=e.replace("["+c+"]["+p+"]","["+c+"]["+_+"]"),t(this).attr("data-controller",e))})),n.find('input[name="tf_repeater_count"]').val(_),n.find(".wp-editor-wrap").each((function(){var e=t(this).find(".tf_wp_editor").show(),a=(t("#"+e.attr("id")).val(),e.attr("id"));if(""!=a&&void 0!==a)var n=tinymce.editors[a].getContent();else n="";e.val(n),t(this).closest(".tf-field-textarea").append(e),t(this).remove()})),n.find(".tf-field-select2").each((function(){var e=t(this).find("select.tf-select-two").select2("val");t(this).find("select.tf-select-two").removeAttr("data-select2-id aria-hidden tabindex"),t(this).find("select.tf-select-two option").removeAttr("data-select2-id"),t(this).find("select.tf-select-two").removeClass("select2-hidden-accessible");var a=t(this).find("select.tf-select-two").show();a.val(e),t(this).find(".tf-fieldset").append(a),t(this).find("span.select2-container").remove()})),t(this).closest(".tf-repeater-wrap").append(n).show(),n.find("textarea.parent_wp_editor, textarea.wp_editor").each((function(){var e=Math.random().toString(36).substring(3,9)+1;t(this).attr("id",c+e),t(this).attr("data-count-id",e),S(t(this).attr("id"))})),n.find("select.tf-select2-parent, select.tf-select2").each((function(){this.id=this.id.replace(c+"__"+p,c+"__"+_);var e=t(this);d(e)})),s(),e.success("Duplicated Successfully")})),t(document).on("click",".tf-repeater-icon-collapse, .tf-repeater-title",(function(){var e=t(this).closest(".tf-single-repeater").find("input[name=tf_current_field]").val();t(this).closest(".tf-single-repeater").find(".tf-repeater-header").toggleClass("active-repeater"),t(this).closest(".tf-single-repeater").find(".tf-tab-switch-box").toggleClass("active-repeater"),t(this).closest(".tf-single-repeater-"+e).find(".tf-repeater-content-wrap").slideToggle(),t(this).closest(".tf-single-repeater-"+e).children(".tf-repeater-content-wrap").toggleClass("hide"),1==t(this).closest(".tf-single-repeater-"+e).children(".tf-repeater-content-wrap").hasClass("hide")?t(this).closest(".tf-single-repeater-"+e+" .tf-repeater-header").children(".tf-repeater-icon-collapse").html('<i class="fa-solid fa-angle-down"></i>'):t(this).closest(".tf-single-repeater-"+e+" .tf-repeater-header").children(".tf-repeater-icon-collapse").html('<i class="fa-solid fa-angle-up"></i>')})),t(".tf-repeater-wrap").sortable({handle:".tf-repeater-icon-move",start:function(e,a){t(a.item).find(".tf_wp_editor").attr("id")},stop:function(e,a){t(a.item).find(".tf_wp_editor").each((function(){var e=t(this).attr("id");tinyMCE.execCommand("mceRemoveEditor",!1,e),tinyMCE.execCommand("mceAddEditor",!1,e)}))}}),t(".tf-switch-group-wrap").sortable({placeholder:"tf-switch-drag-highlight"}),t(document).on("click",".tf-repeater-add-group_discount_package",(function(e){e.preventDefault(),t(this).closest(".tf-repeater").find(".tf-repeater-wrap-group_discount_package .tf-single-repeater .tf-repeater-content-wrap").show()})),t(document).on("click",".tf-package-add-allowed-time",(function(e){e.preventDefault(),t(this).closest(".tf-repeater").find(".tf_tour_allowed_times .tf-single-repeater .tf-repeater-content-wrap").show()})),t(document).on("click",".tf-field-accordion .tf-tab-field-header .tf-field-collapas",(function(){t(this).toggleClass("rotated"),t(this).closest(".tf-tab-switch-box").toggleClass("active-repeater"),t(this).closest(".tf-tab-switch-box").find(".tf-tab-field-content").slideToggle(200,(function(){t(this).is(":visible")&&t(this).css("display","flex")}))})),t(document).on("click",".tf-action-button-group .tf_tour_package_cancel",(function(){t(this).closest(".tf-repeater-content-wrap").hide(),t(this).closest(".tf-single-repeater").find(".tf-repeater-header").removeClass("active-repeater")})),t(document).on("click",".tf-action-button-group .tf_tour_package_deleted",(function(){t(this).closest(".tf-single-repeater").empty()})),t(document).on("click",".tf-avail-repeater-collapse, .tf-avail-repeater-title",(function(){t(this).closest(".tf-single-repeater").find(".tf-repeater-content-wrap").first().slideToggle(200)})),t(document).on("click",".tf-tab-item",(function(){var e=t(this),a=e.data("tab-id");1==e.parent().parent().find(".tf-tab-item-content").hasClass("show")&&e.parent().parent().find(".tf-tab-item-content").removeClass("show"),e.parent().find(".tf-tab-item").removeClass("show"),e.addClass("show"),e.parent().parent().find(".tf-tab-item-content[data-tab-id = "+a+"]").addClass("show"),g(),w(),j()})),t(document).on("click",".tf-add-category span",(function(e){e.preventDefault(),t(this).closest(".tf-fieldset").children(".tf-popup-box").css("display","flex")})),t(document).on("click",".tf-add-category-box-close",(function(e){e.preventDefault(),t(".tf-popup-box").hide()})),t(document).on("click",".tf-category-button",(function(e){e.preventDefault();var a=t(this).closest(".tf-add-category-box");let n=a.find("#category_name").val(),o=a.find("#category_title").val(),i=a.find("#parent_category").val(),r=a.find("#category_select_field_name").val();t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_insert_category_data",_nonce:tf_admin_params.tf_nonce,categoryName:n,categoryTitle:o,parentCategory:i},success:function(e){var n=JSON.parse(e);if(n.insert_category){var o=new Option(n.insert_category.title,n.insert_category.id,!0,!0);t("#"+r).append(o).trigger("change");var i=new Option(n.insert_category.title,n.insert_category.id,!1,!1);a.find("#parent_category").append(i).trigger("change")}t(".tf-popup-box").hide(),a.find("#category_title").val(""),a.find("#parent_category").val("")}})})),t(document).on("click",".tf-add-new-post-button",(function(a){a.preventDefault();var n=t(this),o=n.closest(".tf-add-category-box");let i=o.find(".post_type").val(),r=o.find(".post_title").val(),s=o.find(".post_select_field_name").val(),l=o.find(".field_id").val(),f=o.find(".post_id").val();r?t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_insert_post_data",_nonce:tf_admin_params.tf_nonce,postType:i,postTitle:r,fieldId:l,postId:f},beforeSend:function(){n.addClass("tf-btn-loading")},success:function(e){var a=JSON.parse(e);if(a.insert_post){var i=new Option(a.insert_post.title,a.insert_post.id,!0,!0);"tf_rooms"==l&&t(i).attr("data-edit-url",a.insert_post.edit_url),t("#"+s).append(i).trigger("change")}n.removeClass("tf-btn-loading"),t(".tf-popup-box").hide(),o.find(".post_title").val("")}}):e.error("Please enter title")}))}))}(jQuery),function(t){t(document).on("click",".tf-image-close",(function(e){e.preventDefault(),$this=t(this),t(this).attr("tf-field-name").replace(/[.[\]_-]/g,"_"),$this.parent().parent().find("input").val(""),$this.parent().html("")})),t(document).on("click",".tf-gallery-remove",(function(e){e.preventDefault(),$this=t(this),t(this).attr("tf-field-name").replace(/[.[\]_-]/g,"_"),$this.parent().parent().find("input").val(""),$this.parent().parent().find(".tf-fieldset-gallery-preview").html(""),t("a.tf-gallery-edit, a.tf-gallery-remove").css("display","none")})),t(document).ready((function(){t("body").on("click",".tf-media-upload",(function(a){var n=t(this),o=t(this).attr("tf-field-name");return o.replace(/[.[\]_-]/g,"_"),(e=wp.media({title:"Select Image",button:{text:"Insert Image"},multiple:!1})).on("select",(function(){var t=e.state().get("selection").first().toJSON();n.parent().parent().find("input").val(t.url),n.parent().parent().find(".tf-fieldset-media-preview").html(`<div class="tf-image-close" tf-field-name='${o}'>✖</div><img src='${t.url}' />`)})),e.open(),!1})),t("body").on("click",".tf-gallery-upload, .tf-gallery-edit",(function(e){var n=t(this);return t(this).attr("tf-field-name").replace(/[.[\]_-]/g,"_"),(a=wp.media({title:"Select Gallery",button:{text:"Insert Gallery"},multiple:"add"})).on("open",(function(){var t=a.state().get("selection"),e=n.parent().parent().find("input").val();e.length>0&&e.split(",").forEach((function(e){attachment=wp.media.attachment(e),attachment.fetch(),t.add(attachment?[attachment]:[])}))})),a.on("select",(function(){var t=[],e=[],o=a.state().get("selection").toJSON();for(i in n.parent().parent().find(".tf-fieldset-gallery-preview").html(""),o){var r=o[i];t.push(r.id),e.push(r.url),n.parent().parent().find(".tf-fieldset-gallery-preview").append(`<img src='${r.url}' />`)}n.parent().parent().find("input").val(t.join(",")),n.parent().find("a.tf-gallery-edit, a.tf-gallery-remove").css("display","inline-block")})),a.open(),!1})),t("#addtag > .submit #submit").on("click",(function(){t(".tf-fieldset-media-preview").html("")})),"googlemap"!=tf_options.gmaps&&t(".tf-field-map").each((function(){var e=t(this),a=e.find(".tf--map-osm"),n=e.find(".tf--map-search input"),o=e.find(".tf--latitude"),i=e.find(".tf--longitude"),r=e.find(".tf--zoom"),s=a.data("map"),l=L.map(a.get(0),s);L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(l);var f=L.marker(s.center,{draggable:!0}).addTo(l),c=function(t){o.val(t.lat),i.val(t.lng),r.val(l.getZoom())};function d(e,a){var o="https://nominatim.openstreetmap.org/reverse?format=json&lat="+e+"&lon="+a;t.ajax({url:o,dataType:"json",success:function(t){n.val(t.display_name)},error:function(t,e,a){console.error("Error:",e,a)}})}o.on("change",(function(){})),l.on("click",(function(t){f.setLatLng(t.latlng),c(t.latlng),d(t.latlng.lat,t.latlng.lng)})),l.on("zoom",(function(){c(f.getLatLng())})),f.on("drag",(function(){c(f.getLatLng())})),f.on("dragend",(function(t){let e=t.target._latlng.lng;d(t.target._latlng.lat,e)})),n.length||(n=t('[data-depend-id="'+e.find(".tf--address-field").data("address-field")+'"]'));var p={};n.autocomplete({source:function(e,a){var n=e.term;n in p?a(p[n]):t.get("https://nominatim.openstreetmap.org/search",{format:"json",q:n},(function(t){var e;e=t.length?t.map((function(t){return{value:t.display_name,label:t.display_name,lat:t.lat,lon:t.lon}}),"json"):[{value:"no-data",label:"No Results."}],p[n]=e,a(e)}))},select:function(t,e){if("no-data"===e.item.value)return!1;var a=L.latLng(e.item.lat,e.item.lon);l.panTo(a),f.setLatLng(a),c(a)},create:function(e,a){t(this).autocomplete("widget").addClass("tf-map-ui-autocomplate")}});var u=function(){var t=L.latLng(o.val(),i.val());l.panTo(t),f.setLatLng(t)};o.on("change",u),i.on("change",u),setInterval((function(){l.invalidateSize()}),100)})),t(".tf-mobile-tabs").on("click",(function(e){e.preventDefault(),t(".tf-admin-tab").toggleClass("active")})),t(".tf-faq-title").on("click",(function(){var e=t(this);e.hasClass("active")||(t(".tf-faq-desc").slideUp(400),t(".tf-faq-title").removeClass("active")),e.toggleClass("active"),e.next().slideToggle()}))}))}(jQuery),function(t){"use strict";function e(t,e,a){this.init(t,e,a)}function a(){this.rules=[]}t.extend(e.prototype,{init:function(t,e,a){this.controller=t,this.condition=e,this.value=a,this.rules=[],this.controls=[]},evalCondition:function(e,a,n,o,i){if("=="==n)return this.checkBoolean(o)==this.checkBoolean(i);if("!="==n)return this.checkBoolean(o)!=this.checkBoolean(i);if(">="==n)return Number(i)>=Number(o);if("<="==n)return Number(i)<=Number(o);if(">"==n)return Number(i)>Number(o);if("<"==n)return Number(i)<Number(o);if("()"==n)return window[o](e,a,i);if("any"==n){if(t.isArray(i)){for(var r=i.length-1;r>=0;r--)if(-1!==t.inArray(i[r],o.split(",")))return!0}else if(-1!==t.inArray(i,o.split(",")))return!0}else if("not-any"==n)if(t.isArray(i)){for(r=i.length-1;r>=0;r--)if(-1==t.inArray(i[r],o.split(",")))return!0}else if(-1==t.inArray(i,o.split(",")))return!0;return!1},checkBoolean:function(t){switch(t){case!0:case"true":case 1:case"1":t=!0;break;case null:case!1:case"false":case 0:case"0":t=!1}return t},checkCondition:function(t){if(!this.condition)return!0;var e=t.find(this.controller),a=this.getControlValue(t,e);return void 0!==a&&(a=this.normalizeValue(e,this.value,a),this.evalCondition(t,e,this.condition,this.value,a))},normalizeValue:function(t,e,a){return"number"==typeof e?parseFloat(a):a},getControlValue:function(t,e){return e.length>1&&("radio"==e.attr("type")||"checkbox"==e.attr("type"))?e.filter(":checked").map((function(){return this.value})).get():"checkbox"==e.attr("type")||"radio"==e.attr("type")?e.is(":checked"):e.val()},createRule:function(t,a,n){var o=new e(t,a,n);return this.rules.push(o),o},include:function(t){this.controls.push(t)},applyRule:function(e,a){var n;n=void 0===a?this.checkCondition(e):a;var o=t.map(this.controls,(function(t,a){return e.find(t)}));n?(t(o).each((function(){t(this).removeClass("tf-depend-on")})),t(this.rules).each((function(){this.applyRule(e)}))):(t(o).each((function(){t(this).addClass("tf-depend-on")})),t(this.rules).each((function(){this.applyRule(e,!1)})))}}),t.extend(a.prototype,{createRule:function(t,a,n){var o=new e(t,a,n);return this.rules.push(o),o},applyRules:function(e){t(this.rules).each((function(){this.applyRule(e)}))}}),t.tf_deps={createRuleset:function(){return new a},enable:function(t,e,a){return t.on("change keyup",(function(n){var o=n.target.getAttribute("data-depend-id")||n.target.getAttribute("data-sub-depend-id");-1!==a.indexOf(o)&&e.applyRules(t)})),e.applyRules(t),!0}}}(jQuery),function(t){t(document).ready((function(){1==tf_options.tf_chart_enable&&(document.getElementById("tf_months"),document.getElementById("tf_months").getContext("2d"),t("#tf_months"),new Chart("tf_months",{type:"line",data:{labels:["January","February","March","April","May","June","July","August","September","October","November","December"],datasets:[{label:"Completed Booking",borderColor:"#003C79",tension:.1,data:tf_options.tf_complete_order,fill:!1},{label:"Cancelled Booking",borderColor:"red",tension:.1,data:tf_options.tf_cancel_orders,fill:!1}]},options:{layout:{padding:10},legend:{display:!0},title:{display:!0,text:""}}})),t(document).on("change","#tf-month-report",(function(){var e=t(this).val();if(0!=e){t("#tf-report-loader").addClass("show"),t(".tf-order-report").find("iframe").remove();var a=t("#tf-year-report").val();jQuery.ajax({type:"post",url:tf_options.ajax_url,data:{action:"tf_month_reports",_nonce:tf_admin_params.tf_nonce,month:e,year:a},success:function(e){if(e.success){var a=JSON.parse(e);document.getElementById("tf_months"),document.getElementById("tf_months").getContext("2d"),t("#tf_months"),new Chart("tf_months",{type:"line",data:{labels:a.months_day_number,datasets:[{label:"Completed Booking",borderColor:"#003C79",tension:.1,data:a.tf_complete_orders,fill:!1},{label:"Cancelled Booking",borderColor:"red",tension:.1,data:a.tf_cancel_orders,fill:!1}]},options:{layout:{padding:10},legend:{display:!0},title:{display:!0,text:a.tf_search_month}}}),t("#tf-report-loader").removeClass("show")}else t("#tf-report-loader").removeClass("show"),notyf.error(e.data)}})}})),t(document).on("change","#tf-year-report",(function(){var e=t(this).val(),a=t("#tf-month-report").val();0!=e&&0!=a&&(t("#tf-report-loader").addClass("show"),t(".tf-order-report").find("iframe").remove(),jQuery.ajax({type:"post",url:tf_options.ajax_url,data:{action:"tf_month_reports",_nonce:tf_admin_params.tf_nonce,month:a,year:e},success:function(e){var a=JSON.parse(e);document.getElementById("tf_months"),document.getElementById("tf_months").getContext("2d"),t("#tf_months"),new Chart("tf_months",{type:"line",data:{labels:a.months_day_number,datasets:[{label:"Completed Booking",borderColor:"#003C79",tension:.1,data:a.tf_complete_orders,fill:!1},{label:"Cancelled Booking",borderColor:"red",tension:.1,data:a.tf_cancel_orders,fill:!1}]},options:{layout:{padding:10},legend:{display:!0},title:{display:!0,text:a.tf_search_month}}}),t("#tf-report-loader").removeClass("show")}}))}))}))}(jQuery),function(t){t(document).on("click",".tf-generate-tour .tf-btn",(function(e){e.preventDefault();var a=[];t(this).parents(".tf-shortcode-generator-single").find(".tf-sg-field-wrap").each((function(){var e=t(this),n=e.find(".tf-setting-field").val(),o=e.find(".tf-setting-field").attr("data-term"),i=e.find(".post-count").attr("data-count"),r=e.find(".tf-shortcode-title-field ").attr("data-title"),s=e.find(".tf-shortcode-subtitle-field ").attr("data-subtitle"),l=e.find(".tf-shortcode-tour-tab-title-field ").attr("data-tour-tab-title"),f=e.find(".tf-shortcode-hotel-tab-title-field ").attr("data-hotel-tab-title"),c=e.find(".tf-shortcode-apartment-tab-title-field ").attr("data-apartment-tab-title"),d=e.find(".tf-shortcode-car-tab-title-field ").attr("data-car-tab-title");null!=o&&""!=o&&(n=o+"="+(n.length?n:'""')),null!=i&&""!=i&&(n=i+"="+(n.length?n:'""')),null!=r&&""!=r&&n.length&&(n=r+"="+(n.length?`"${n}"`:'""')),null!=s&&""!=s&&n.length&&(n=s+"="+(n.length?`"${n}"`:'""')),null!=l&&""!=l&&n.length&&(n=l+"="+(n.length?`"${n}"`:'""')),null!=f&&""!=f&&n.length&&(n=f+"="+(n.length?`"${n}"`:'""')),null!=c&&""!=c&&n.length&&(n=c+"="+(n.length?`"${n}"`:'""')),null!=d&&""!=d&&n.length&&(n=d+"="+(n.length?`"${n}"`:'""')),a.push(n)}));var n="["+a.filter(Boolean).join(" ")+"]";t(this).parents(".tf-shortcode-generator-single").find(".tf-shortcode-value").val(n),t(this).parents(".tf-shortcode-generator-single").find(".tf-copy-item").slideDown()})),t(document).on("click",".tf-sg-close",(function(e){t(this).parents(".tf-shortcode-generators").find(".tf-sg-form-wrapper").fadeOut()})),t(document).on("click",".tf-shortcode-btn",(function(e){var a=t(this);a.parents(".tf-shortcode-generator-single").find(".tf-sg-form-wrapper").fadeIn(),a.parents(".tf-shortcode-generator-single").on("mouseup",(function(e){var a=t(this).find(".tf-shortcode-generator-form"),n=a.parent(".tf-sg-form-wrapper");a.is(e.target)||0!==a.has(e.target).length||n.fadeOut()}))})),t(document).on("click",".tf-copy-btn",(function(){var e=t(this).parent(".tf-shortcode-field").find("#tf-shortcode");e&&(e.select(),document.execCommand("copy")),t(this).parents(".tf-copy-item").append('<div><span class="tf-copied-msg">Copied<span></div>'),t("span.tf-copied-msg").animate({opacity:0},1e3,(function(){t(this).slideUp("slow",(function(){t(this).remove()}))}))})),t(document).ready((function(){t(document).on("click",".tf-import-btn",(function(e){if(e.preventDefault(),""==t('textarea[name="tf_import_option"]').val().trim()){alert(tf_options.tf_export_import_msg.import_empty);let e=t('textarea[name="tf_import_option"]');return e.focus(),void e.css("border","1px solid red")}t(".tf-option-form").submit()})),t(document).on("click",".tf-export-btn",(function(e){e.preventDefault(),t.ajax({url:tf_options.ajax_url,method:"POST",data:{action:"tf_export_data",_nonce:tf_admin_params.tf_nonce},beforeSend:function(){t(".tf-export-btn").html("Exporting..."),t(".tf-export-btn").attr("disabled","disabled")},success:function(e){let a=JSON.parse(e);if("success"===a.status){var n=new Blob([a.data],{type:"text/plain"}),o=window.URL.createObjectURL(n),i=document.createElement("a");i.href=o,i.download="tf-settings-export.json",i.click(),window.URL.revokeObjectURL(o)}else notyf.error(a.message);t(".tf-export-btn").html("Export"),t(".tf-export-btn").removeAttr("disabled")},error:function(e){console.log(e),t(".tf-export-btn").html("Export"),t(".tf-export-btn").removeAttr("disabled")}})})),t(document).on("click",".tf-add-category i",(function(e){e.preventDefault(),$this=t(this),parentDiv=$this.closest(".tf-fieldset"),parentDiv.children("#tf-popup-box").css("display","flex")})),t(document).on("click",".tf-add-category-box-close",(function(e){e.preventDefault(),t("#tf-popup-box").hide()}))})),jQuery(document).ready((function(t){const e={d1:{brand:{default:"#0E3DD8",dark:"#0A2B99",lite:"#C9D4F7"},text:{heading:"#1C2130",paragraph:"#494D59",lite:"#F3F5FD"},border:{default:"#16275F",lite:"#D1D7EE"},filling:{background:"#ffffff",foreground:"#F5F7FF"}},d2:{brand:{default:"#B58E53",dark:"#917242",lite:"#FAEEDC"},text:{heading:"#30281C",paragraph:"#595349",lite:"#FDF9F3"},border:{default:"#5F4216",lite:"#EEE2D1"},filling:{background:"#ffffff",foreground:"#FDF9F3"}},d3:{brand:{default:"#F97415",dark:"#C75605",lite:"#FDDCC3"},text:{heading:"#30241C",paragraph:"#595049",lite:"#FDF7F3"},border:{default:"#5F3416",lite:"#EEDDD1"},filling:{background:"#ffffff",foreground:"#FFF9F5"}},d4:{brand:{default:"#003061",dark:"#002952",lite:"#C2E0FF"},text:{heading:"#1C2630",paragraph:"#495159",lite:"#F3F8FD"},border:{default:"#163A5F",lite:"#D1DFEE"},filling:{background:"#ffffff",foreground:"#F5FAFF"}}};t('input[name^="tf_settings[tf-d"]').wpColorPicker({change:function(a,n){let o=t(a.target),i=o.val(),r=n.color.toString();if(function(e){if(!e)return;const a={"design-1":"tf-d1","design-2":"tf-d2","design-3":"tf-d3","design-4":"tf-d4"}[e];a&&["brand","text","border","filling"].forEach((e=>{t(`input[name^="tf_settings[${a}-${e}]"]`).each((function(){let a=t(this).attr("name").split("[")[2].replace("]",""),n=t(this).val(),o=t(`input[name="tf_settings[tf-custom-${e}][${a}]"]`);o.length&&o.val(n).trigger("change")}))}))}(t('input[name="tf_settings\\[color-palette-template\\]"]:checked').val()),r!==i){t("#tf_settings\\[color-palette-template\\]\\[custom\\]").prop("checked",!0),t(".tf-field.tf-field-color.tf-depend-hidden").addClass("tf-depend-on"),t('.tf-field.tf-field-color.tf-depend-hidden[data-value="custom"]').removeClass("tf-depend-on");let a=o.attr("name").match(/\[tf-(d\d+)-(brand|text|border|filling)]\[(.*?)\]/);if(!a)return;let n=a[1],i=a[2],s=a[3],l=t(`input[name="tf_settings[tf-custom-${i}][${s}]"]`);if(l.length){let a=t(`input[name="tf_settings[tf-${n}-${i}][${s}]"]`).val();t(`input[name="tf_settings[tf-custom-${i}][${s}]"]`).val(a).trigger("change"),t(`input[name="tf_settings[tf-${n}-${i}][${s}]"]`).val(e[n][i][s]).trigger("change"),l.val(r).trigger("change")}}}})})),jQuery(document).ready((function(t){t(".tf-plugin-button").not(".pro").on("click",(function(e){e.preventDefault();let a=t(this),n=a.data("action"),o=a.data("plugin"),i=a.data("plugin_filename");if(!n||!o)return;let r=a.find(".loader"),s=a.clone().children().remove().end().text().trim();"install"===n?a.contents().first().replaceWith("Installing.."):"activate"===n&&a.contents().first().replaceWith("Activating.."),a.addClass("loading").prop("disabled",!0),r.show(),t.ajax({url:ajaxurl,type:"POST",data:{action:"themefic_manage_plugin",security:tf_admin_params.tf_nonce,plugin_slug:o,plugin_filename:i,plugin_action:n},success:function(t){a.removeClass("loading").prop("disabled",!1),r.hide(),t.success?"install"===n?(a.contents().first().replaceWith("Activate"),a.data("action","activate").removeClass("install").addClass("activate")):"activate"===n&&a.replaceWith('<span class="tf-plugin-button tf-plugin-status active">Activated</span>'):(a.contents().first().replaceWith(s),alert("Error: "+t.data))},error:function(){a.contents().first().replaceWith(s).removeClass("loading").prop("disabled",!1),r.hide(),alert("An error occurred. Please try again.")}})}))}))}(jQuery)})();
  • tourfic/trunk/inc/Admin/Backend_Booking/TF_Tour_Backend_Booking.php

    r3385153 r3398571  
    389389        $disable_infant_price = ! empty( $meta['disable_infant_price'] ) ? $meta['disable_infant_price'] : false;
    390390
    391         // Group Type Package
    392         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    393         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
    394391        // People number
    395392        $total_people         = $adults + $children + $infant;
     
    640637         *
    641638         */
    642         if ( $tour_type == 'fixed' && $pricing_rule!='package' && ( empty($allow_package_pricing) && empty($group_package_pricing) ) ) {
     639        if ( $tour_type == 'fixed' && $pricing_rule!='package' ) {
    643640
    644641            /* translators: %s minimum people */
     
    658655            }
    659656
    660         } elseif ( $tour_type == 'continuous' && $pricing_rule!='package' && ( empty($allow_package_pricing) && empty($group_package_pricing) ) ) {
     657        } elseif ( $tour_type == 'continuous' && $pricing_rule!='package' ) {
    661658
    662659            // Backend continuous date values
     
    769766        }
    770767
    771         if( $pricing_rule=='group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
     768        if( $pricing_rule=='group' ){
    772769            $max_allowed = 0;
    773770            $matched_price = '';
     
    838835        $infant_price   = ! empty( $matched_availability['infant_price'] ) ? $matched_availability['infant_price'] : $infant_price;
    839836
    840         if( $pricing_rule=='group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
     837        if( $pricing_rule=='group' ){
    841838            $max_allowed = 0;
    842839            $matched_price = '';
  • tourfic/trunk/inc/Admin/TF_Options/TF_Options.php

    r3392466 r3398571  
    788788
    789789        if ( $new_post != 'true' ) {
    790             $apt_availability = json_decode( $apartment_data['apt_availability'], true );
     790            $apt_availability = !empty($apartment_meta['apt_availability']) ? json_decode( $apartment_meta['apt_availability'], true ) : [];
     791
    791792            if ( isset( $apt_availability ) && ! empty( $apt_availability ) ) {
    792793                $apt_availability_data = array_merge( $apt_availability, $apt_availability_data );
    793794            }
    794             $apartment_data['apt_availability'] = wp_json_encode( $apt_availability_data );
    795             update_post_meta( $apartment_id, 'tf_apartment_opt', $apartment_data );
     795            $apartment_meta['apt_availability'] = wp_json_encode( $apt_availability_data );
     796            update_post_meta( $apartment_id, 'tf_apartment_opt', $apartment_meta );
    796797        } else {
    797798            $apt_availability = json_decode( stripslashes( $apt_availability ), true );
     
    799800                $apt_availability_data = array_merge( $apt_availability, $apt_availability_data );
    800801            }
     802            $apartment_meta['apt_availability'] = wp_json_encode( $apt_availability_data );
     803            update_post_meta( $apartment_id, 'tf_apartment_opt', $apartment_meta );
    801804        }
    802805
     
    915918        $tour_availability    = isset( $_POST['tour_availability'] ) && ! empty( $_POST['tour_availability'] ) ? sanitize_text_field( $_POST['tour_availability'] ) : '';
    916919        $options_count       = isset( $_POST['options_count'] ) && ! empty( $_POST['options_count'] ) ? sanitize_text_field( $_POST['options_count'] ) : '';
    917         $group_options_count       = isset( $_POST['group_options_count'] ) && ! empty( $_POST['group_options_count'] ) ? sanitize_text_field( $_POST['group_options_count'] ) : '';
    918920
    919921        $tf_tour_min_person  = isset( $_POST['tf_tour_min_person'] ) && ! empty( $_POST['tf_tour_min_person'] ) ? sanitize_text_field( $_POST['tf_tour_min_person'] ) : '';
     
    953955
    954956        $meta = get_post_meta( $tour_id, 'tf_tours_opt', true );
    955         $group_package_option = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    956         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
     957
    957958        $package_pricing = ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : '';
    958959
     
    13151316                    }
    13161317                }
    1317                 if ( $item['pricing_type'] == 'group' && (empty($group_package_option) || empty($group_package_pricing)) ) {
     1318                if ( $item['pricing_type'] == 'group' ) {
    13181319                    $item['title'] = __( 'Price: ', 'tourfic' ) . wc_price( $item['price'] ) . '<br>'. $time_string;
    13191320                } elseif ( $item['pricing_type'] == 'person' ) {
     
    13411342                        }
    13421343                    }
    1343                 } elseif ( $item['pricing_type'] == 'group' && !empty($group_package_option) && !empty($group_package_pricing) ) {
    1344                     $item['title'] = '';
    1345                     if ( ! empty( $item['options_count'] ) ) {
    1346                         for ( $i = 0; $i <= $item['options_count'] - 1; $i ++ ) {
    1347                             if( !empty($item['tf_option_title_'.$i]) && !empty($item['tf_option_group_price_'.$i]) ){
    1348                                 $item['title'] .= __( 'Title: ', 'tourfic' ) . $item['tf_option_title_'.$i] . '<br>';
    1349                                 $item['title'] .= __( 'Price: ', 'tourfic' ) . wc_price($item['tf_option_group_price_'.$i]). '<br><br>';
    1350                             }
    1351                         }
    1352                     }
    1353                     $item['title'] .=  $time_string;
    13541344                }
    13551345
     
    16891679        $options_html .= ob_get_clean();
    16901680
    1691         if($pricing_by == 'group' && !empty($group_package_option) && !empty($group_package_pricing)){
    1692             foreach ( $group_option_arr as $key => $item ) {
    1693                 ob_start();
    1694                 if(empty($item)){
    1695                     continue;
    1696                 }
    1697                 ?>
    1698                 <div class="tf-single-option tf-single-package">
    1699                     <div class="tf-field-switch">
    1700                         <label for="tf_package_option_<?php echo esc_attr( $item['index'] ); ?>" class="tf-field-label"><?php echo esc_html( $item['title'] ); ?></label>
    1701                     </div>
    1702                     <div class="tf-form-fields">
    1703                         <div class="tf-field-text tf_option_pricing_type_group">
    1704                             <label class="tf-field-label"><?php echo esc_html__( 'Minimum Person', 'tourfic' ); ?></label>
    1705                             <div class="tf-fieldset">
    1706                                 <input type="number" min="0" name="tf_option_min_person_<?php echo esc_attr( $item['index'] ); ?>" />
    1707                             </div>
    1708                         </div>
    1709                         <div class="tf-field-text tf_option_pricing_type_group">
    1710                             <label class="tf-field-label"><?php echo esc_html__( 'Maximum Person', 'tourfic' ); ?></label>
    1711                             <div class="tf-fieldset">
    1712                                 <input type="number" min="0" name="tf_option_max_person_<?php echo esc_attr( $item['index'] ); ?>" />
    1713                             </div>
    1714                         </div>
    1715                         <div class="tf-field-text tf_option_pricing_type_group">
    1716                             <label class="tf-field-label"><?php echo esc_html__( 'Group Price', 'tourfic' ); ?></label>
    1717                             <div class="tf-fieldset">
    1718                                 <input type="number" min="0" name="tf_option_group_price_<?php echo esc_attr( $item['index'] ); ?>" />
    1719                             </div>
    1720                         </div>
    1721                     </div>
    1722                     <input type="hidden" name="tf_option_title_<?php echo esc_attr( $item['index'] ); ?>" value="<?php echo esc_attr($item['title']); ?>"/>
    1723                     <input type="hidden" name="tf_option_pricing_type_<?php echo esc_attr( $item['index'] ); ?>" value="group"/>
    1724                 </div>
    1725 
    1726          
    1727                 <?php
    1728                 $options_html .= ob_get_clean();
    1729             }
    1730         }
    1731 
    17321681        echo wp_json_encode( array(
    17331682            'avail_data'   => $tour_availability_data,
  • tourfic/trunk/inc/Admin/TF_Options/classes/TF_Taxonomy_Metabox.php

    r3354901 r3398571  
    123123
    124124            $tf_taxonomy_value = array();
    125             $taxonomy_request  = array();
    126             if( !empty($_POST[ $this->taxonomy_id ]) ){
    127                 $taxonomy_request = array_map('sanitize_text_field', wp_unslash($_POST[ $this->taxonomy_id ]));
    128             }
     125            $taxonomy_request   = ( ! empty( $_POST[ $this->taxonomy_id ] ) ) ? $_POST[ $this->taxonomy_id ] : array();
    129126
    130127            // var_dump($taxonomy_request); exit;
  • tourfic/trunk/inc/Admin/TF_Options/fields/tourAvailabilityCal/TF_tourAvailabilityCal.php

    r3392466 r3398571  
    2121            $pricing_type = ! empty( $meta['pricing'] ) ? $meta['pricing'] : 'person';
    2222            $tour_package_options = ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : [];
    23             $group_package_option = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    24             $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
     23
    2524            $tour_avail_type = ! empty( $meta['type'] ) ? $meta['type'] : 'continuous';
    2625            if ( Helper::tf_is_woo_active() ) {
  • tourfic/trunk/inc/Admin/TF_Options/metaboxes/tf-hotel-metabox.php

    r3384715 r3398571  
    3434    'title' => sprintf( esc_html__( '%s Settings', 'tourfic' ), $hotel_name ),
    3535    'post_type' => 'tf_hotel',
    36     'sections'  => array(
     36    'sections'  => apply_filters( 'tf_hotels_opt_sections', array(
    3737        'general' => array(
    3838            'title'  => esc_html__( 'General', 'tourfic' ),
     
    692692            ),
    693693        ),
    694     ),
     694    )),
    695695) );
  • tourfic/trunk/inc/Admin/TF_Options/taxonomies/tf-hotel_location.php

    r3105281 r3398571  
    11<?php
    22// don't load directly
    3 defined( 'ABSPATH' ) || exit;
     3defined('ABSPATH') || exit;
    44
    5 TF_Taxonomy_Metabox::taxonomy( 'tf_hotel_location', array(
    6     'title'    => esc_html__( 'Hotel Settings', 'tourfic' ),
     5TF_Taxonomy_Metabox::taxonomy('tf_hotel_location', apply_filters('tf_hotel_location_metabox_args', array(
     6    'title'    => esc_html__('Hotel Settings', 'tourfic'),
    77    'taxonomy' => 'hotel_location',
    88    'fields'   => array(
     
    1010            'id'    => 'image',
    1111            'type'  => 'image',
    12             'title' => esc_html__( 'Upload location photo', 'tourfic' ),
     12            'title' => esc_html__('Upload location photo', 'tourfic'),
    1313        ),
    1414    ),
    15 ) );
     15)));
  • tourfic/trunk/inc/Classes/Helper.php

    r3384715 r3398571  
    280280            'order'      => 'ASC',
    281281        );
    282         $args             = wp_parse_args( $args, $defaults );
     282        $args  = wp_parse_args( $args, $defaults );
     283
     284        $args = apply_filters( 'tf_get_terms_dropdown_args', $args, $taxonomy );
    283285        $args['taxonomy'] = $taxonomy;
    284286
  • tourfic/trunk/inc/Classes/Hotel/Hotel.php

    r3384715 r3398571  
    20512051                        </label>
    20522052                        <div class="tf-search__form__field" id="locationField">
    2053                             <input type="text" name="place-name" <?php echo $hotel_location_field_required != 1 ? '' : 'required'; ?> id="tf-location" class="tf-search__form__input" placeholder="<?php esc_html_e('Where you wanna stay?', 'tourfic'); ?>" value="">
     2053                            <input type="text" name="place-name" <?php echo $hotel_location_field_required != 1 ? '' : 'required'; ?> id="tf-location" class="tf-search__form__input"  placeholder="<?php echo esc_attr( apply_filters( 'tf_location_placeholder', __( 'Where you wanna stay?', 'tourfic' ) ) ); ?>" value="">
    20542054                            <input type="hidden" name="place" id="tf-search-hotel" class="tf-place-input">
    20552055                            <span class="tf-search__form__field__icon icon--location">
  • tourfic/trunk/inc/Classes/Tour/Pricing.php

    r3384715 r3398571  
    108108
    109109        $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    110         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    111         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
     110       
    112111        $package_pricing = function_exists( 'is_tf_pro' ) && is_tf_pro() && ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : '';
    113112
     
    140139                    }
    141140                }
    142 
    143                 // if($pricing_rule == 'group' && $data['pricing_type'] == 'group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
    144                 //  if(!empty($data['options_count'])){
    145                 //      for($i = 0; $i < $data['options_count']; $i++){
    146                 //          if (!empty($data['tf_option_group_price_'.$i])) {
    147                 //              if ($data['tf_option_group_price_'.$i]) {
    148                 //                  $tour_price[] = $data['tf_option_group_price_'.$i];
    149                 //              }
    150                 //          }
    151                 //      }
    152                 //  }else{
    153                 //      if(!empty($group_price)){
    154                 //          $tour_price[] = $group_price;
    155                 //      }
    156                 //  }
    157                 // }
    158141
    159142                if($pricing_rule == 'group' && $data['pricing_type'] == 'group'){
     
    265248        $pricing_rule                     = ! empty( $meta['pricing'] ) ? $meta['pricing'] : '';
    266249        $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    267         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    268         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
     250
    269251        $package_pricing = function_exists( 'is_tf_pro' ) && is_tf_pro() && ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : '';
    270252
     
    487469        $pricing_rule                     = ! empty( $meta['pricing'] ) ? $meta['pricing'] : '';
    488470        $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    489         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    490         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
    491471       
    492472        $min_person = null;
     
    618598
    619599        $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    620         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    621         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
    622600
    623601        $matched_availability = null;
     
    699677                $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    700678
    701                 $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    702                 $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
    703 
    704679                if(!empty($tour_availability_data)){
    705680                    foreach ($tour_availability_data as $data) {
     
    724699                            }
    725700                        }
    726            
    727                         // if($data['pricing_type'] == 'group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
    728                         //  if(!empty($data['options_count'])){
    729                         //      for($i = 0; $i < $data['options_count']; $i++){
    730                         //          if (!empty($data['tf_option_group_price_'.$i])) {
    731                         //              $tftours_min_maxprices[] = $data['tf_option_group_price_'.$i];
    732                         //          }
    733                         //      }
    734                         //  }
    735                         // }
    736701           
    737702                        if($pricing_rule == 'group' && $data['pricing_type'] == 'group' ){
     
    809774
    810775        $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    811         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    812         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
     776
    813777        $package_pricing = function_exists( 'is_tf_pro' ) && is_tf_pro() && ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : '';
    814778
     
    835799                }
    836800
    837                 // if($pricing_rule == 'group' && $data['pricing_type'] == 'group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
    838                 //  if(!empty($data['options_count'])){
    839                 //      for($i = 0; $i < $data['options_count']; $i++){
    840                 //          if (!empty($data['tf_option_group_price_'.$i])) {
    841                 //              if ($data['tf_option_group_price_'.$i]) {
    842                 //                  $tour_price[] = $data['tf_option_group_price_'.$i];
    843                 //              }
    844                 //          }
    845                 //      }
    846                 //  }else{
    847                 //      if(!empty($group_price)){
    848                 //          $tour_price[] = $group_price;
    849                 //      }
    850                 //  }
    851                 // }
    852 
    853801                if($pricing_rule == 'group' && $data['pricing_type'] == 'group' ){
    854802                    // Group Price
  • tourfic/trunk/inc/Classes/Tour/Tour.php

    r3392466 r3398571  
    21222122                                                        <?php } ?>
    21232123                                                    <?php }else{ ?>
     2124                                                        <?php
     2125                                                        if( empty($package_pricing[$key]['group_tabs'][6]['disable_adult_price']) ){
     2126                                                        ?>
    21242127                                                        <div class="tf-single-person">
    21252128                                                            <h3><?php echo esc_html__( "Adult", "tourfic" ); ?></h3>
     
    21302133                                                            </div>
    21312134                                                        </div>
     2135                                                        <?php } if( empty($package_pricing[$key]['group_tabs'][7]['disable_child_price']) ){ ?>
    21322136                                                        <div class="tf-single-person">
    21332137                                                            <h3><?php echo esc_html__( "Child", "tourfic" ); ?></h3>
     
    21382142                                                            </div>
    21392143                                                        </div>
     2144                                                        <?php } if( empty($package_pricing[$key]['group_tabs'][6]['disable_adult_price']) && empty($package_pricing[$key]['group_tabs'][8]['disable_infant_price']) ){ ?>
    21402145                                                        <div class="tf-single-person">
    21412146                                                            <h3><?php echo esc_html__( "Infant", "tourfic" ); ?></h3>
     
    21462151                                                            </div>
    21472152                                                        </div>
     2153                                                        <?php } ?>
    21482154                                                    <?php } ?>
    21492155                                                </div>
     
    28712877                                    //get the lowest price from all available room price
    28722878                                    $tf_tour_min_price      = ! empty( $tour_price ) ? min( $tour_price ) : 0;
    2873                                     $tf_tour_full_price     = ! empty( $tour_price ) ? min( $tour_price ) : 0;
    2874                                     $tf_tour_discount_type  = ! empty( $meta['discount_type'] ) ? $meta['discount_type'] : '';
    2875                                     $tf_tour_discount_price = ! empty( $meta['discount_price'] ) ? $meta['discount_price'] : 0;
    2876                                     if ( ! empty( $tf_tour_discount_type ) && ! empty( $tf_tour_min_price ) && ! empty( $tf_tour_discount_price ) ) {
    2877 
    2878                                         if ( $tf_tour_discount_type == "percent" ) {
    2879                                             $tf_tour_min_discount = ( $tf_tour_min_price * $tf_tour_discount_price ) / 100;
    2880                                             $tf_tour_min_price    = (int) $tf_tour_min_price - $tf_tour_min_discount;
    2881                                         }
    2882                                         if ( $tf_tour_discount_type == "fixed" ) {
    2883                                             $tf_tour_min_discount = $tf_tour_discount_price;
    2884                                             $tf_tour_min_price    = $tf_tour_min_price - $tf_tour_discount_price;
    2885                                         }
    2886                                     }
    28872879                                    $lowest_price = wc_price( $tf_tour_min_price );
    28882880                                    echo esc_html__( "From ", "tourfic" ) . wp_kses_post( $lowest_price ) . " ";
    2889                                     if ( ! empty( $tf_tour_min_discount ) ) {
    2890                                         echo "<del>" . wp_kses_post( wc_price( $tf_tour_full_price ) ) . "</del>";
     2881                                    if ( ! empty( $min_sale_price ) ) {
     2882                                        echo "<del>" . wp_kses_post( wc_price( $min_sale_price ) ) . "</del>";
    28912883                                    }
    28922884                                    ?>
     
    29602952                                //get the lowest price from all available room price
    29612953                                $tf_tour_min_price      = ! empty( $tour_price ) ? min( $tour_price ) : 0;
    2962                                 $tf_tour_full_price     = ! empty( $tour_price ) ? min( $tour_price ) : 0;
    2963                                 $tf_tour_discount_type  = ! empty( $meta['discount_type'] ) ? $meta['discount_type'] : '';
    2964                                 $tf_tour_discount_price = ! empty( $meta['discount_price'] ) ? $meta['discount_price'] : 0;
    2965                                 if ( !empty($allow_discount) && ! empty( $tf_tour_discount_type ) && ! empty( $tf_tour_min_price ) && ! empty( $tf_tour_discount_price ) ) {
    2966 
    2967                                     if ( $tf_tour_discount_type == "percent" ) {
    2968                                         $tf_tour_min_discount = ( $tf_tour_min_price * $tf_tour_discount_price ) / 100;
    2969                                         $tf_tour_min_price    = (int) $tf_tour_min_price - $tf_tour_min_discount;
    2970                                     }
    2971                                     if ( $tf_tour_discount_type == "fixed" ) {
    2972                                         $tf_tour_min_discount = $tf_tour_discount_price;
    2973                                         $tf_tour_min_price    = $tf_tour_min_price - $tf_tour_discount_price;
    2974                                     }
    2975                                 }
    29762954                                $lowest_price = wc_price( $tf_tour_min_price );
    29772955
    2978                                 if ( ! empty( $tf_tour_min_discount ) ) {
    2979                                     echo esc_html__( "From ", "tourfic" ) . " " . "<del>" . wp_kses_post( wp_strip_all_tags( wc_price( $tf_tour_full_price ) ) ) . "</del>" . " " . wp_kses_post( $lowest_price );
     2956                                if ( ! empty( $min_sale_price ) ) {
     2957                                    echo esc_html__( "From ", "tourfic" ) . " " . "<del>" . wp_kses_post( wp_strip_all_tags( wc_price( $min_sale_price ) ) ) . "</del>" . " " . wp_kses_post( $lowest_price );
    29802958                                } else {
    29812959                                    echo esc_html__( "From ", "tourfic" ) . wp_kses_post( $lowest_price ) . " ";
     
    36323610                    for($i = 0; $i <= $options_count; $i++){
    36333611
    3634                         if ( !empty($matched_availability['tf_option_adult_price_'.$i]) && ( is_null($adult_price) || $matched_availability['tf_option_adult_price_'.$i] < $adult_price ) ) {
    3635                             $adult_price = $matched_availability['tf_option_adult_price_'.$i];
    3636                         }
    3637 
    3638                         if ( !empty($matched_availability['tf_option_child_price_'.$i]) && ( is_null($child_price) || $matched_availability['tf_option_child_price_'.$i] < $child_price ) ) {
    3639                             $child_price = $matched_availability['tf_option_child_price_'.$i];
    3640                         }
    3641 
    3642                         if ( !empty($matched_availability['tf_option_infant_price_'.$i]) && ( is_null($infant_price) || $matched_availability['tf_option_infant_price_'.$i] < $infant_price ) ) {
    3643                             $infant_price = $matched_availability['tf_option_infant_price_'.$i];
    3644                         }
    3645 
    3646                         if ( !empty($matched_availability['tf_option_group_price_'.$i]) && ( is_null($price) || $matched_availability['tf_option_group_price_'.$i] < $price ) ) {
    3647                             $price = $matched_availability['tf_option_group_price_'.$i];
    3648                         }
     3612                        if( !empty($matched_availability['tf_option_pricing_type_'.$i]) && $matched_availability['tf_option_pricing_type_'.$i]=='person' ){
     3613                            if ( !empty($matched_availability['tf_option_adult_price_'.$i]) && ( is_null($adult_price) || $matched_availability['tf_option_adult_price_'.$i] < $adult_price ) ) {
     3614                                $adult_price = $matched_availability['tf_option_adult_price_'.$i];
     3615                            }
     3616   
     3617                            if ( !empty($matched_availability['tf_option_child_price_'.$i]) && ( is_null($child_price) || $matched_availability['tf_option_child_price_'.$i] < $child_price ) ) {
     3618                                $child_price = $matched_availability['tf_option_child_price_'.$i];
     3619                            }
     3620   
     3621                            if ( !empty($matched_availability['tf_option_infant_price_'.$i]) && ( is_null($infant_price) || $matched_availability['tf_option_infant_price_'.$i] < $infant_price ) ) {
     3622                                $infant_price = $matched_availability['tf_option_infant_price_'.$i];
     3623                            }
     3624                        }
     3625
     3626                        if( !empty($matched_availability['tf_option_pricing_type_'.$i]) && $matched_availability['tf_option_pricing_type_'.$i]=='group' ){
     3627                            if ( !empty($matched_availability['tf_option_group_price_'.$i]) && ( is_null($price) || $matched_availability['tf_option_group_price_'.$i] < $price ) ) {
     3628                                $price = $matched_availability['tf_option_group_price_'.$i];
     3629                            }
     3630                        }
    36493631
    36503632                    }
     
    37333715            if($pricing_rule == 'group'){
    37343716                $min_price    = ! empty( $price ) ? $price : '';
    3735             }else{
     3717            }elseif($pricing_rule == 'person'){
    37363718                $all_prices = [];
    37373719                if(!empty($adult_price)){
     
    37403722                if(!empty($child_price)){
    37413723                    $all_prices[] = $child_price;
     3724                }
     3725                $min_price = !empty($all_prices) ? min($all_prices) : '';
     3726            }elseif($pricing_rule == 'package'){
     3727                $all_prices = [];
     3728                if(!empty($adult_price)){
     3729                    $all_prices[] = $adult_price;
     3730                }
     3731                if(!empty($child_price)){
     3732                    $all_prices[] = $child_price;
     3733                }
     3734                if(!empty($price)){
     3735                    $all_prices[] = $price;
    37423736                }
    37433737                $min_price = !empty($all_prices) ? min($all_prices) : '';
     
    39543948        $tf_package_pricing = ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : '';
    39553949
    3956         // Group Type Package
    3957         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    3958         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
    3959 
    39603950        /**
    39613951         * If fixed is selected but pro is not activated
     
    41844174         *
    41854175         */
    4186         if ( $tour_type == 'fixed' && $pricing_rule!='package' && ( empty($allow_package_pricing) && empty($group_package_pricing) ) ) {
     4176        if ( $tour_type == 'fixed' && $pricing_rule!='package' ) {
    41874177
    41884178            /* translators: %s: number of people */
     
    42024192            }
    42034193
    4204         } elseif ( $tour_type == 'continuous' && $pricing_rule!='package' && ( empty($allow_package_pricing) && empty($group_package_pricing) ) ) {
     4194        } elseif ( $tour_type == 'continuous' && $pricing_rule!='package' ) {
    42054195
    42064196            // Backend continuous date values
     
    43974387        $children_price = ! empty( $matched_availability['child_price'] ) ? $matched_availability['child_price'] : $children_price;
    43984388        $infant_price   = ! empty( $matched_availability['infant_price'] ) ? $matched_availability['infant_price'] : $infant_price;
    4399 
    4400         // if( $pricing_rule=='group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
    4401         //  $max_allowed = 0;
    4402         //  $matched_price = '';
    4403         //  $found_valid_option = false;
    4404 
    4405         //  for ( $i = 0; $i < (int) $matched_availability['options_count']; $i++ ) {
    4406         //      $min = (int) $matched_availability[ 'tf_option_min_person_' . $i ];
    4407         //      $max = (int) $matched_availability[ 'tf_option_max_person_' . $i ];
    4408         //      $price =  !empty($matched_availability[ 'tf_option_group_price_' . $i ]) ? $matched_availability[ 'tf_option_group_price_' . $i ] : 0;
    4409 
    4410         //      // Keep track of the highest max_person across all options
    4411         //      if ( $max > $max_allowed ) {
    4412         //          $max_allowed = $max;
    4413         //      }
    4414 
    4415         //      // Find a matching price bracket
    4416         //      if ( $total_people_booking >= $min && $total_people_booking <= $max ) {
    4417         //          $found_valid_option = true;
    4418         //          $matched_price = $price;
    4419         //          break;
    4420         //      }
    4421         //  }
    4422 
    4423         //  if ( $total_people_booking > $max_allowed ) {
    4424         //      $response['errors'][] = sprintf( esc_html__( 'Maximum %1$s allowed', 'tourfic' ), $max_allowed );
    4425         //  } elseif ( $found_valid_option ) {
    4426         //      $group_price = $matched_price;
    4427         //  }
    4428         // }
    44294389
    44304390        if ( function_exists( 'is_tf_pro' ) && is_tf_pro() && $tour_type == 'continuous' && !empty($allowed_times_field['time']) ) {
     
    47174677                $response['traveller_info'] .= '</div>
    47184678            </div>';
    4719                 $tour_date_format_for_users = ! empty( Helper::tfopt( "tf-date-format-for-users" ) ) ? Helper::tfopt( "tf-date-format-for-users" ) : "Y/m/d";
    4720             }
     4679            }
     4680            $tour_date_format_for_users = ! empty( Helper::tfopt( "tf-date-format-for-users" ) ) ? Helper::tfopt( "tf-date-format-for-users" ) : "Y/m/d";
    47214681            $response['traveller_summery'] .= '<h6>' . esc_html__("On ", 'tourfic') . self::tf_date_format_user( $tour_date, $tour_date_format_for_users ) . '</h6>';
    47224682            $response['traveller_summery'] .= !empty( $tour_time_title ) ? '<h6>' . esc_html__("At ", 'tourfic') . $tour_time_title . '</h6>' : '';
  • tourfic/trunk/inc/Classes/Tour/Tour_Price.php

    r3384715 r3398571  
    3939
    4040        $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    41         $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    42         $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
     41       
    4342        $package_pricing = function_exists( 'is_tf_pro' ) && is_tf_pro() && ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : '';
    4443
     
    6564                }
    6665
    67                 if($pricing_rule == 'group' && $data['pricing_type'] == 'group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
    68                     if(!empty($data['options_count'])){
    69                         for($i = 0; $i < $data['options_count']; $i++){
    70                             if (!empty($data['tf_option_group_price_'.$i])) {
    71                                 if (is_null($price) || $data['tf_option_group_price_'.$i] < $price) {
    72                                     $price = $data['tf_option_group_price_'.$i];
    73                                 }
    74                             }
    75                         }
    76                     }
    77                 }
    78 
    79                 if($pricing_rule == 'group' && $data['pricing_type'] == 'group' && (empty($allow_package_pricing) || empty($group_package_pricing)) ){
     66                if($pricing_rule == 'group' && $data['pricing_type'] == 'group' ){
    8067                    // Group Price
    8168                    if (is_null($price) || $data['price'] < $price) {
  • tourfic/trunk/inc/functions/woocommerce/wc-tour.php

    r3384715 r3398571  
    4949    $tour_time    = isset( $_POST['check-in-time'] ) ? sanitize_text_field( $_POST['check-in-time'] ) : null;
    5050    $make_deposit = ! empty( $_POST['deposit'] ) ? sanitize_text_field( $_POST['deposit'] ) : false;
    51 
    52     // Group Type Package
    53     $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    54     $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
    5551
    5652    // Tour Package
     
    394390     *
    395391     */
    396     if ( $tour_type == 'fixed' && $pricing_rule!='package' && ( empty($allow_package_pricing) && empty($group_package_pricing) ) ) {
     392    if ( $tour_type == 'fixed' && $pricing_rule!='package' ) {
    397393
    398394        /* translators: %s Min Person  */
     
    411407        }
    412408
    413     } elseif ( $tour_type == 'continuous' && $pricing_rule!='package' && ( empty($allow_package_pricing) && empty($group_package_pricing) ) ) {
     409    } elseif ( $tour_type == 'continuous' && $pricing_rule!='package' ) {
    414410
    415411        // Backend continuous date values
  • tourfic/trunk/readme.txt

    r3396611 r3398571  
    44Requires at least: 5.4
    55Tested up to: 6.8
    6 Stable tag: 2.18.5
     6Stable tag: 2.18.6
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    406406== Changelog ==
    407407
     408= 2.18.6 – November 19, 2025 =
     409
     410- Fixed: Warning notice issue has been resolved.
     411- Fixed: Apartment availability issue has been resolved.
     412- Fixed: Discount calculation issue has been resolved.
     413- Updated: Person selection option in package pricing.
     414
    408415= 2.18.5 – November 16, 2025 =
    409416
     
    411418- Improved: System stability and performance.
    412419
    413 = 2.18.4 – November 09, 2025 =
    414 
    415 - Fixed: Tour deposit issue resolved.
    416 - Fixed: Availability calendar date issue resolved.
    417 - Fixed: Settings reset issue resolved.
    418 - Updated: Information in readme.txt file.
    419 - Improved: System stability and performance.
    420420
    421421**Old Changelog can be found [here](https://community.themefic.com/changelog/)**.
  • tourfic/trunk/templates/hotel/archive-hotels.php

    r3354901 r3398571  
    3131        include TF_TEMPLATE_PATH . 'hotel/archive/design-3.php';
    3232    } else {
    33         include TF_TEMPLATE_PATH . 'hotel/archive/design-legacy.php';
     33        $template = apply_filters( 'tf_hotel_archive_legacy_template', TF_TEMPLATE_PATH . 'hotel/archive/design-legacy.php' );
     34        include $template;
    3435    }
    3536} else {
  • tourfic/trunk/templates/hotel/single-hotel.php

    r3351042 r3398571  
    156156        include TF_TEMPLATE_PART_PATH . 'hotel/design-2.php';
    157157    }else{
    158         include TF_TEMPLATE_PART_PATH . 'hotel/design-legacy.php';
     158        $template = apply_filters(
     159            'tf_hotel_single_legacy_template',
     160            TF_TEMPLATE_PART_PATH . 'hotel/design-legacy.php'
     161        );
     162
     163        include $template;
     164       
    159165    }
    160166endwhile;
  • tourfic/trunk/templates/hotel/taxonomy-hotel_locations.php

    r3363251 r3398571  
    144144    </div>
    145145
    146 <?php } else{ ?>
     146<?php } else{
     147   
     148ob_start();
     149?>
     150
    147151<div class="tf-main-wrapper tf-archive-template__legacy" data-fullwidth="true">
    148     <?php do_action( 'tf_before_container' ); ?>
    149     <div class="tf-container">
    150         <h3><?php echo esc_html( $taxonomy_name ); ?></h3>
    151         <div class="search-result-inner">
     152    <?php do_action( 'tf_before_container' ); ?>
     153    <div class="tf-container">
     154        <h3><?php echo esc_html( $taxonomy_name ); ?></h3>
     155        <div class="search-result-inner">
    152156
    153             <div class="tf-search-left">
    154                 <?php require_once TF_TEMPLATE_PART_PATH . 'archive.php'; ?>
    155             </div>
     157            <div class="tf-search-left">
     158                <?php require_once TF_TEMPLATE_PART_PATH . 'archive.php'; ?>
     159            </div>
    156160
    157             <div class="tf-search-right">
    158                 <?php Helper::tf_archive_sidebar_search_form($post_type, $taxonomy, $taxonomy_name, $taxonomy_slug); ?>
     161            <div class="tf-search-right">
     162                <?php Helper::tf_archive_sidebar_search_form( $post_type, $taxonomy, $taxonomy_name, $taxonomy_slug ); ?>
    159163                <?php if ( is_active_sidebar( 'tf_archive_booking_sidebar' ) ) { ?>
    160164                    <div id="tf__booking_sidebar">
     
    164168            </div>
    165169
    166         </div>
    167     </div>
    168     <?php do_action( 'tf_after_container' ); ?>
     170        </div>
     171    </div>
     172    <?php do_action( 'tf_after_container' ); ?>
    169173</div>
     174
    170175<?php
     176// Get the output and apply filter
     177$template_output = ob_get_clean();
     178echo apply_filters( 'tf_hotel_location_archive_legacy_template', $template_output, $post_type, $taxonomy, $taxonomy_name, $taxonomy_slug );
    171179}
    172180if(wp_is_block_theme()){
  • tourfic/trunk/templates/template-parts/review.php

    r3363251 r3398571  
    339339                            <div class="tf-btn-wrap">
    340340                                <button class="<?php echo esc_attr( $btn_class ); ?> tf-modal-btn" data-target="#tf-rating-modal">
    341                                     <i class="fas fa-plus"></i> <?php esc_html_e( 'Add Review', 'tourfic' ); ?>
     341                                    <i class="fas fa-plus"></i>
     342                                     <?php echo esc_html( apply_filters( 'tourfic_add_review_button_text', __( 'Add Review', 'tourfic' ) ) );?>
    342343                                </button>
    343344                            </div>
     
    349350                            <div class="tf-btn-wrap">
    350351                                <button class="<?php echo esc_attr( $btn_class ); ?> tf-modal-btn" data-target="#tf-rating-modal">
    351                                     <i class="fas fa-plus"></i> <?php esc_html_e( 'Add Review', 'tourfic' ) ?>
     352                                    <i class="fas fa-plus"></i>
     353                                     <?php echo esc_html( apply_filters( 'tourfic_add_review_button_text', __( 'Add Review', 'tourfic' ) ) ); ?>
    352354                                </button>
    353355                            </div>
     
    450452                    <div class="tf-btn-wrap">
    451453                        <button class="<?php echo esc_attr( $btn_class ); ?> tf-modal-btn" data-target="#tf-rating-modal">
    452                             <i class="fas fa-plus"></i> <?php esc_html_e( 'Add Review', 'tourfic' ); ?>
     454                            <i class="fas fa-plus"></i>
     455                             <?php echo esc_html( apply_filters( 'tourfic_add_review_button_text', __( 'Add Review', 'tourfic' ) ) );?>
    453456                        </button>
    454457                    </div>
     
    463466                    <div class="tf-btn-wrap">
    464467                        <button class="<?php echo esc_attr( $btn_class ); ?> tf-modal-btn" data-target="#tf-rating-modal">
    465                             <i class="fas fa-plus"></i> <?php esc_html_e( 'Add Review', 'tourfic' ) ?>
     468                            <i class="fas fa-plus"></i>
     469                             <?php echo esc_html( apply_filters( 'tourfic_add_review_button_text', __( 'Add Review', 'tourfic' ) ) ); ?>
    466470                        </button>
    467471                    </div>
     
    481485            <div class="tf-modal-content">
    482486                <div class="tf-modal-header">
     487                    <?php echo apply_filters( 'tf_rating_modal_header_content', '' );?>
    483488                    <a data-dismiss="modal" class="tf-modal-close">&#10005;</a>
    484489                </div>
  • tourfic/trunk/templates/template-parts/search/design-legacy.php

    r3354901 r3398571  
    2727    </div>
    2828</div>
    29 <?php else: ?>
    30 <div class="tf-main-wrapper search-result-wrapper tf-archive-template__legacy" data-fullwidth="true">
    31     <?php do_action( 'tf_before_container' ); ?>
    32     <div class="tf-container">
    33         <div class="search-result-inner">
    34             <!-- Start Content -->           
    35             <div class="tf-search-left">
    36                 <?php echo do_shortcode("[tf_search_result]"); ?>
    37             </div>
    38             <!-- End Content -->
     29<?php else:
     30    ob_start();
     31    ?>
    3932
    40             <!-- Start Sidebar -->
    41             <div class="tf-search-right">
    42                 <?php Helper::tf_search_result_sidebar_form( 'archive' ); ?>
    43             </div>
    44             <!-- End Sidebar -->
    45         </div>
    46     </div>
    47     <?php do_action( 'tf_after_container' ); ?>
    48 </div>
     33    <div class="tf-main-wrapper search-result-wrapper tf-archive-template__legacy" data-fullwidth="true">
     34        <?php do_action( 'tf_before_container' ); ?>
     35        <div class="tf-container">
     36            <div class="search-result-inner">
     37                <!-- Start Content -->           
     38                <div class="tf-search-left">
     39                    <?php echo do_shortcode("[tf_search_result]"); ?>
     40                </div>
     41                <!-- End Content -->
     42
     43                <!-- Start Sidebar -->
     44                <div class="tf-search-right">
     45                    <?php Helper::tf_search_result_sidebar_form( 'archive' ); ?>
     46                </div>
     47                <!-- End Sidebar -->
     48            </div>
     49        </div>
     50        <?php do_action( 'tf_after_container' ); ?>
     51    </div>
     52<?php echo apply_filters( 'tf_search_result_legacy_template', ob_get_clean() ); ?>
    4953<?php endif; ?>
  • tourfic/trunk/templates/template-parts/tour/design-1/price.php

    r3384715 r3398571  
    2828                   
    2929                $tour_availability_data = isset( $meta['tour_availability'] ) && ! empty( $meta['tour_availability'] ) ? json_decode( $meta['tour_availability'], true ) : [];
    30                 $allow_package_pricing = ! empty( $meta['allow_package_pricing'] ) ? $meta['allow_package_pricing'] : '';
    31                 $group_package_pricing = ! empty( $meta['group_package_pricing'] ) ? $meta['group_package_pricing'] : '';
     30
    3231                $tf_package_pricing = ! empty( $meta['package_pricing'] ) ? $meta['package_pricing'] : '';
    3332
     
    4948                        }
    5049       
    51                         if($data['pricing_type'] == 'group' && !empty($allow_package_pricing) && !empty($group_package_pricing) ){
    52                             if(!empty($data['options_count'])){
    53                                 for($i = 0; $i < $data['options_count']; $i++){
    54                                     if (!empty($data['tf_option_max_person_'.$i])) {
    55                                         $tf_max_people [] = $data['tf_option_max_person_'.$i];
    56                                     }
    57                                 }
    58                             }
    59                         }
    60        
    61                         if($data['pricing_type'] == 'group' && (empty($allow_package_pricing) || empty($group_package_pricing)) ){
     50                        if($data['pricing_type'] == 'group'){
    6251                            if (!empty($data['max_person'])) {
    6352                                $tf_max_people [] = $data['max_person'];
  • tourfic/trunk/tourfic.php

    r3396611 r3398571  
    88 * Text Domain:     tourfic
    99 * Domain Path:     /lang/
    10  * Version:         2.18.5
     10 * Version:         2.18.6
    1111 * Tested up to:    6.8
    1212 * WC tested up to: 10.0
     
    2828     */
    2929
    30     const VERSION = '2.18.5';
     30    const VERSION = '2.18.6';
    3131
    3232    /**
Note: See TracChangeset for help on using the changeset viewer.