PluginProbe
Booking Calendar / 11.4.3
Booking Calendar v11.4.3
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / __js / admin / checkbox_selection / bookings_checkbox_selection.js

bookings_checkbox_selection.js in Booking Calendar 11.4.3, at includes/__js/admin/checkbox_selection/bookings_checkbox_selection.js

53 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1
2 /**
3 * Get ID array of selected elements
4 */
5 function wpbc_get_selected_row_id() {
6
7 var $table = jQuery( '.wpbc__wrap__booking_listing .wpbc_selectable_table' );
8 var checkboxes = $table.children( '.wpbc_selectable_body' ).filter( ':visible' ).find( '.check-column' ).find( ':checkbox' );
9 var selected_id = [];
10
11 jQuery.each(
12 checkboxes,
13 function (key, checkbox) {
14 if ( jQuery( checkbox ).is( ':checked' ) ) {
15 var element_id = wpbc_get_row_id_from_element( checkbox );
16 selected_id.push( element_id );
17 }
18 }
19 );
20
21 return selected_id;
22 }
23
24
25 /**
26 * Get ID of row, based on clciked element
27 *
28 * @param this_inbound_element - ususlly this
29 * @returns {number}
30 */
31 function wpbc_get_row_id_from_element(this_inbound_element) {
32
33 var element_id = jQuery( this_inbound_element ).closest( '.wpbc_listing_usual_row' ).attr( 'id' );
34
35 element_id = parseInt( element_id.replace( 'row_id_', '' ) );
36
37 return element_id;
38 }
39
40
41 /**
42 * == Booking Listing == Show or hide buttons on Actions toolbar at page, if we have some selected bookings.
43 */
44 function wpbc_show_hide_action_buttons_for_selected_bookings(){
45
46 var selected_rows_arr = wpbc_get_selected_row_id();
47
48 if ( selected_rows_arr.length > 0 ) {
49 jQuery( '.hide_button_if_no_selection' ).show();
50 } else {
51 jQuery( '.hide_button_if_no_selection' ).hide();
52 }
53 }