Last active
June 24, 2022 17:41
-
-
Save kartikparmar/5c936018ef3940df3680cab27535f770 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function bkap_load_defaults(){ | |
| ?> | |
| <script> | |
| jQuery( document ).ready( function ( $ ) { | |
| if ( jQuery('#bkap-booking-type' ).length > 0 ) { | |
| // Enable Booking. | |
| jQuery( '#booking_enable_date' ).prop( 'checked', true ); | |
| // Enabling Inline Calendar | |
| jQuery( '#enable_inline_calendar' ).prop( 'checked', true ); | |
| // Hide Inline Calendar. | |
| jQuery( '#enable_inline_calendar_section' ).hide(); | |
| jQuery( '#booking_minimum_number_days_row' ).hide(); | |
| // Hide Special Price Column. | |
| jQuery( '.weekdays_flex_child_4' ).hide(); | |
| // Hide Max bookings/No. of Years field and its data. | |
| jQuery( '.bkap_lockout_column_data_1, .bkap_lockout_column_data_2, .bkap_lockout_column_data_3, .bkap_lockout_column_data_4, #specific_heading_max_booking_no_of_year' ).hide(); | |
| // Hide Price, Global, Note Columns and its data | |
| jQuery( '#weekdaydatetime_heading_price, #weekdaydatetime_heading_global, #weekdaydatetime_heading_note, .bkap_price_time_td, .bkap_global_time_td, .bkap_note_time_td' ).hide(); | |
| // Hide Make all data block unavailable. | |
| jQuery( '.bkap_all_data_block_unavailable_section' ).hide(); | |
| } | |
| }); | |
| </script> | |
| <?php | |
| } | |
| function bkap_booking_default_settings() { | |
| if ( is_admin() ) { | |
| $path = untrailingslashit( WP_CONTENT_DIR . '/plugins/woocommerce-booking/' ); | |
| include_once( $path . '/includes/vendors/vendors-common.php' ); | |
| $vendor_id = get_current_user_id(); | |
| $is_vendor = BKAP_Vendors::bkap_is_vendor( $vendor_id ); | |
| if ( ! $is_vendor ) { | |
| bkap_load_defaults(); | |
| } | |
| } else { | |
| bkap_load_defaults(); | |
| } | |
| } | |
| add_action( 'wp_enqueue_scripts', 'bkap_booking_default_settings' ); | |
| add_action( 'admin_footer', 'bkap_booking_default_settings' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment