list_items( array( 'status' => 'active', 'sort_by' => 'service_id', 'sort_order' => 'asc', 'limit' => 1, ) ); if ( is_wp_error( $services ) || empty( $services[0]['service_id'] ) ) { return 0; } return absint( $services[0]['service_id'] ); } /** * Enqueue and configure the AJAX Appointment Services management client. * * @param string $where_to_load Booking Calendar asset context. * * @return void */ function wpbc_appointment_services_enqueue_js( $where_to_load ) { if ( ! in_array( $where_to_load, array( 'admin', 'both' ), true ) || ! wpbc_appointment_services__is_page() ) { return; } wpbc_load_js__required_for_media_upload(); $service_listing = wpbc_appointment_services_get_catalog_listing(); $selected_service_id = wpbc_appointment_services_get_initial_service_id(); wp_enqueue_script( 'wpbc-appointment-services-page', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/appointment_services_page.js', array( 'jquery', 'wpbc_all', ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); wp_localize_script( 'wpbc-appointment-services-page', 'wpbc_appointment_services_config', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wpbc_appointment_services_ajax_nonce' ), 'actions' => array( 'list' => 'WPBC_AJX_APPOINTMENT_SERVICES_LIST', 'load' => 'WPBC_AJX_APPOINTMENT_SERVICE_LOAD', 'save' => 'WPBC_AJX_APPOINTMENT_SERVICE_SAVE', 'duplicate' => 'WPBC_AJX_APPOINTMENT_SERVICE_DUPLICATE', 'archive' => 'WPBC_AJX_APPOINTMENT_SERVICE_ARCHIVE', ), 'selected_id' => $selected_service_id, 'focus_section' => wpbc_appointment_services_get_requested_focus_section(), 'pricing_available' => wpbc_appointment_services_is_pricing_available(), 'listing' => $service_listing->get_client_settings(), 'i18n' => array( 'loading' => __( 'Loading Services', 'booking' ) . '...', 'empty' => __( 'No Services yet', 'booking' ), 'empty_help' => __( 'Create the first Service to define what customers can book.', 'booking' ), 'no_providers' => __( 'No Providers available', 'booking' ), 'no_providers_help'=> __( 'Create a Provider before assigning Services and accepting Appointments.', 'booking' ), 'not_connected' => __( 'The Services database is not ready. Reload this page as an administrator or reactivate Booking Calendar to finish the database upgrade.', 'booking' ), 'load_failed' => __( 'Services could not be loaded.', 'booking' ), 'save_failed' => __( 'The Service could not be saved.', 'booking' ), 'duplicate_failed' => __( 'The Service could not be duplicated.', 'booking' ), 'archive_failed' => __( 'The Service could not be archived.', 'booking' ), 'confirm_archive' => __( 'Archive this Service?', 'booking' ), 'confirm_discard' => __( 'Discard unsaved Service changes?', 'booking' ), 'untitled' => __( 'Untitled Service', 'booking' ), 'new_service' => __( 'New Service', 'booking' ), 'active' => __( 'Active', 'booking' ), 'draft' => __( 'Draft', 'booking' ), 'archived' => __( 'Archived', 'booking' ), 'no_provider' => __( 'No Providers assigned', 'booking' ), 'no_availability' => __( 'No weekly availability', 'booking' ), 'more_providers' => __( 'more Providers', 'booking' ), 'available' => __( 'Available', 'booking' ), 'unavailable' => __( 'Unavailable', 'booking' ), 'available_providers' => __( 'Available Providers: %s', 'booking' ), 'no_available_providers' => __( 'No assigned Providers are available', 'booking' ), 'edit_availability' => __( 'Edit availability for %s', 'booking' ), 'edit_provider_availability' => __( 'Edit Provider availability', 'booking' ), 'column_id' => __( 'ID', 'booking' ), 'column_service' => __( 'Service', 'booking' ), 'column_duration' => __( 'Duration', 'booking' ), 'column_price' => __( 'Price', 'booking' ), 'column_providers' => __( 'Providers', 'booking' ), 'column_weekly_availability' => __( 'Weekly Availability', 'booking' ), 'column_status' => __( 'Status', 'booking' ), 'column_actions' => __( 'Actions', 'booking' ), /* translators: %s: Duration in minutes. */ 'duration_minutes' => __( '%s min', 'booking' ), /* translators: 1: Buffer before in minutes, 2: Buffer after in minutes. */ 'buffers_summary' => __( 'Buffers: %1$s / %2$s min', 'booking' ), /* translators: 1: Buffer before in minutes, 2: Buffer after in minutes. */ 'buffers_tooltip' => __( 'Buffer before: %1$s min; Buffer after: %2$s min', 'booking' ), /* translators: 1: Service title, 2: Service description. */ 'service_thumbnail_tooltip' => __( 'Title: %1$s ā Description: %2$s', 'booking' ), 'no_description' => __( 'No description', 'booking' ), 'edit' => __( 'Edit Service', 'booking' ), 'archive' => __( 'Archive Service', 'booking' ), 'showing' => __( 'Showing %1$sā%2$s of %3$s Services', 'booking' ), ), 'currency_symbol' => wpbc_appointment_services_is_pricing_available() && function_exists( 'wpbc_get_currency_symbol' ) ? wpbc_get_currency_symbol() : '', 'weekdays' => array( __( 'Monday', 'booking' ), __( 'Tuesday', 'booking' ), __( 'Wednesday', 'booking' ), __( 'Thursday', 'booking' ), __( 'Friday', 'booking' ), __( 'Saturday', 'booking' ), __( 'Sunday', 'booking' ), ), ) ); } add_action( 'wpbc_enqueue_js_files', 'wpbc_appointment_services_enqueue_js', 66 ); /** * Render the global Add Service action in the Booking Calendar top toolbar. * * Creating a Service is a page-level action, while saving remains contextual * to the Service editor in the right inspector. * * @param string $page_tag Current Booking Calendar page tag. * @param string $active_page_tab Current active page tab. * @param string $active_page_subtab Current active page subtab. * * @return void */ function wpbc_appointment_services_render_top_toolbar( $page_tag, $active_page_tab, $active_page_subtab ) { if ( ! wpbc_appointment_services__is_page() || ! current_user_can( wpbc_appointment_services_get_manage_capability() ) ) { return; } ?>
> Page tab definition. */ public function tabs() { $service_hint = wpbc_appointment_services_is_pricing_available() ? __( 'Create Services and configure duration, buffers, price, Providers, and Booking Form.', 'booking' ) : __( 'Create Services and configure duration, buffers, Providers, and Booking Form.', 'booking' ); return array( 'appointment_services' => array( 'is_show_top_path' => true, 'is_show_top_navigation' => false, 'left_navigation__default_view_mode' => 'compact', 'right_vertical_sidebar__is_show' => true, 'right_vertical_sidebar__default_view_mode' => 'none', 'right_vertical_sidebar_compact__is_show' => true, 'top_path' => array( 'root_title' => false ), 'top_path_title' => __( 'Services', 'booking' ), 'title' => __( 'Services', 'booking' ), 'page_title' => __( 'Services', 'booking' ), 'hint' => $service_hint, 'font_icon' => 'wpbc-bi-grid', 'default' => true, 'disabled' => false, 'hided' => false, 'subtabs' => array(), ), ); } /** * Render the compact Settings and Help controls for the right sidebar. * * @return void */ public function right_sidebar_compact_content() { WPBC_UI_Sidebar_Panels::render_rightbar_tabs( array( array( 'id' => 'wpbc_tab_service_settings', 'panel_id' => 'wpbc_service__inspector_settings', 'title' => __( 'Settings', 'booking' ), 'icon' => 'wpbc_icn_tune', 'selected' => true, ), array( 'id' => 'wpbc_tab_service_help', 'panel_id' => 'wpbc_service__inspector_help', 'title' => __( 'Help', 'booking' ), 'icon' => 'wpbc-bi-info-circle', ), ), array( 'aria_label' => __( 'Service Panels', 'booking' ), 'context' => 'appointment_services', 'class' => 'wpbc_appointment_services__rightbar_tabs', ) ); } /** * Render the right-sidebar Settings and Help inspector panels. * * @return void */ public function right_sidebar_content() { ?>