PluginProbe
Booking Calendar / 10.1.3
Booking Calendar v10.1.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 / page-availability / availability__toolbar_ui.php

availability__toolbar_ui.php in Booking Calendar 10.1.3, at includes/page-availability/availability__toolbar_ui.php

311 lines 12.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.1
3 * @package Any
4 * @category Toolbar for Availability page. UI Elements for Admin Panel
5 * @author wpdevelop
6 *
7 * @web-site http://oplugins.com/
8 * @email info@oplugins.com
9 *
10 * @modified 2022-11-18
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly
14
15 ////////////////////////////////////////////////////////////////////////////////
16 // T o o l b a r s
17 ////////////////////////////////////////////////////////////////////////////////
18
19
20 /**
21 * Show top toolbar on Booking Listing page
22 *
23 * @param $escaped_search_request_params - escaped search request parameters array
24 */
25 function wpbc_ajx_availability__toolbar( $escaped_search_request_params ) {
26
27 wpbc_clear_div();
28
29 // Toolbar ////////////////////////////////////////////////////////////////
30
31 $default_param_values = WPBC_AJX__Availability::get__request_values__default();
32
33 $selected_tab = $escaped_search_request_params['ui_usr__availability_selected_toolbar'];
34
35 ?><div id="toolbar_booking_availability" class="wpbc_ajx_toolbar"><?php
36
37 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
38 // Info
39 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
40 ?><div><?php //Required for bottom border radius in container
41
42 ?><div class="ui_container ui_container_toolbar ui_container_mini ui_container_info ui_container_filter_row_1" style="<?php echo ( 'info' == $selected_tab ) ? 'display: flex' : 'display: none' ?>;"><?php
43
44 // Here will be composed template with real HTML
45 ?><div class="ui_group" id="wpbc_hidden_template__select_booking_resource" ><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
46 // Resource select-box here. Defined as template at: private function template_toolbar_select_booking_resource(){
47 ?></div><?php
48
49 ?><div class="ui_group" id="wpbc_toolbar_dates_hint"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
50
51 wpbc_ajx_avy__ui__info( $escaped_search_request_params, $default_param_values );
52
53 ?></div><?php
54
55 ?></div><?php
56
57 ?></div><?php //Required for bottom border radius in container
58
59
60 // <editor-fold defaultstate="collapsed" desc=" C a l e n d a r S e t t i n g s " >
61
62 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
63 // C a l e n d a r S e t t i n g s
64 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
65
66 ?><div class="ui_container ui_container_toolbar ui_container_small ui_container_options ui_container_actions_row_1" style="<?php echo ( 'calendar_settings' == $selected_tab ) ? 'display: flex' : 'display: none' ?>;"><?php
67
68 ?><div class="ui_group"><?php
69
70 ?><div class="ui_element"><?php
71 wpbc_avy__ui__toolbar_erase_availability_button();
72 ?></div><?php
73
74 ?></div><?php
75
76 ?><div class="ui_group" style="flex:1 1 auto;"><?php
77
78 // Reset Button
79 ?><div class="ui_element" style="margin-left: auto;"><?php
80 wpbc_avy__ui__toolbar_reset_button();
81 ?></div><?php
82
83 ?></div><?php
84
85 ?></div><?php
86 // </editor-fold>
87
88
89 ?></div><?php
90 }
91
92
93 /**
94 * Costs Min - Max
95 *
96 * @param $escaped_search_request_params - escaped search request parameters array
97 * @param $defaults - default parameters values
98 */
99 function wpbc_ajx_avy__ui__info( $escaped_search_request_params, $defaults ){
100
101 $params_addon = array(
102 'type' => 'span'
103 , 'html' => sprintf( __('%sSelect days%s in calendar then select %sAvailable%s / %sUnavailable%s status and click %sApply%s availability button.' ,'booking')
104 , '<strong>', '&nbsp;</strong>'
105 , '<strong>&nbsp;', '&nbsp;</strong>'
106 , '<strong>&nbsp;', '&nbsp;</strong>'
107 , '<strong>&nbsp;', '&nbsp;</strong>'
108 )
109 //, 'icon' => array( 'icon_font' => 'wpbc_icn_info_outline', 'position' => 'left', 'icon_img' => '' )
110 , 'class' => 'wpbc_help_text'
111 , 'style' => 'height:auto;'
112 //, 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' )
113 , 'attr' => array()
114 );
115
116 ?><div class="ui_element"><?php
117
118 wpbc_flex_addon( $params_addon );
119
120 ?></div><?php
121 ?><script type="text/javascript">
122
123 jQuery(document).ready(function(){
124
125 jQuery( '.wpbc_ajx_availability_container' ).on( 'wpbc_page_content_loaded', function ( event, ajx_data_arr, ajx_search_params, ajx_cleaned_params ){
126 wpbc_blink_element('.wpbc_help_text', 4, 350);
127 jQuery( '.wpbc_ajx_availability_container' ).off( 'wpbc_page_content_loaded' );
128 } );
129
130 } );
131 </script> <?php
132
133 }
134
135
136
137 ////////////////////////////////////////////////////////////////////////////////
138 // T e m p l a t e s UI
139 ////////////////////////////////////////////////////////////////////////////////
140
141 function wpbc_ajx_avy__ui__available_radio(){
142
143 $booking_action = 'set_days_availability';
144
145 $el_id = 'ui_btn_avy__' . $booking_action . '__available';
146
147 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
148
149 wpbc_flex_vertical_color( array( 'vertical_line' => 'border-left: 4px solid #11be4c;' ) ); // Green line
150
151 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id . '__outer_button'; ?>" style="padding-right: 8px;"><?php
152 $params_radio = array(
153 'id' => $el_id // HTML ID of element
154 , 'name' => $booking_action
155 , 'label' => array( 'title' => __('Available' ,'booking') , 'position' => 'right' )
156 , 'style' => 'margin:1px 0 0;' // CSS of select element
157 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
158 , 'disabled' => false
159 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
160 , 'legend' => '' // aria-label parameter
161 , 'value' => 'available' // Some Value from options array that selected by default
162 , 'selected' => !false // Selected or not
163 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
164 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
165 );
166 wpbc_flex_radio( $params_radio );
167
168 ?></span><?php
169
170
171
172
173 }
174
175
176 function wpbc_ajx_avy__ui__unavailable_radio(){
177
178
179 $booking_action = 'set_days_availability';
180
181 $el_id = 'ui_btn_avy__' . $booking_action . '__unavailable';
182
183 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
184
185 wpbc_flex_vertical_color( array( 'vertical_line' => 'border-left: 4px solid #e43939;' ) ); // Green line
186
187 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id . '__outer_button'; ?>" style="padding-right: 8px;"><?php
188 $params_radio = array(
189 'id' => $el_id // HTML ID of element
190 , 'name' => $booking_action
191 , 'label' => array( 'title' => __('Unavailable' ,'booking') , 'position' => 'right' )
192 , 'style' => 'margin:1px 0 0;' // CSS of select element
193 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
194 , 'disabled' => false
195 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
196 , 'legend' => '' // aria-label parameter
197 , 'value' => 'unavailable' // Some Value from options array that selected by default
198 , 'selected' => !false // Selected or not
199 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
200 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
201 );
202 wpbc_flex_radio( $params_radio );
203
204 ?></span><?php
205
206 }
207
208
209 function wpbc_ajx_avy__ui__availability_apply_btn(){
210
211 $el_id = 'wpbc_availability_apply_btn';
212
213 $params_button = array(
214 'type' => 'button'
215 , 'title' => __( 'Apply', 'booking' ) // Title of the button
216 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
217 , 'link' => 'javascript:void(0)' // Direct link or skip it
218 , 'action' => //"console.log( 'ON CLICK:', jQuery( '[name=\"set_days_availability\"]:checked' ).val() , jQuery( 'textarea[id^=\"date_booking\"]' ).val() );" // Some JavaScript to execure, for example run the function
219 " wpbc_ajx_availability__send_request_with_params( {
220 'do_action': 'set_availability'
221 , 'dates_availability': jQuery( '[name=\"set_days_availability\"]:checked' ).val()
222 , 'dates_selection': jQuery( 'textarea[id^=\"date_booking\"]' ).val()
223 , 'ui_clicked_element_id': '{$el_id}'
224 } );
225 wpbc_button_enable_loading_icon( this );
226 wpbc_admin_show_message_processing( '' );
227 "
228 , 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary
229 //, 'icon_position' => 'left' // Position of icon relative to Text: left | right
230 , 'icon' => array(
231 'icon_font' => 'wpbc_icn_check', // 'wpbc_icn_check_circle_outline',
232 'position' => 'left',
233 'icon_img' => ''
234 )
235 , 'style' => '' // Any CSS class here
236 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
237 , 'attr' => array( 'id' => $el_id )
238 );
239
240 wpbc_flex_button( $params_button );
241 }
242
243
244
245 /**
246 * Reset button - init to default options
247 *
248 */
249 function wpbc_avy__ui__toolbar_reset_button(){
250
251 $params = array(
252 'type' => 'button' ,
253 'title' => __( 'Reset', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
254 'hint' => array( 'title' => __( 'Reset selected options to default values', 'booking' ), 'position' => 'top' ), // Hint
255 'link' => 'javascript:void(0)', // Direct link or skip it
256 'action' => "wpbc_ajx_availability__send_request_with_params( {
257 'do_action': 'make_reset'
258 } );
259 wpbc_button_enable_loading_icon( this );", // JavaScript
260 'icon' => array(
261 'icon_font' => 'wpbc_icn_settings_backup_restore', //'wpbc_icn_rotate_left',
262 'position' => 'left',
263 'icon_img' => ''
264 ),
265 'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary'
266 'style' => '', // Any CSS class here
267 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
268 'attr' => array()
269 );
270
271 wpbc_flex_button( $params );
272
273 }
274
275
276
277 function wpbc_avy__ui__toolbar_erase_availability_button(){
278
279 $booking_action = 'erase_availability';
280
281 $el_id = 'ui_btn_' . $booking_action;
282
283 // if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
284 // return false;
285 // }
286
287 $params = array(
288 'type' => 'button' ,
289 'title' => __( 'Reset availability', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
290 'hint' => array( 'title' => __( 'Remove all unavailable dates for this calendar', 'booking' ), 'position' => 'top' ), // Hint
291 'link' => 'javascript:void(0)', // Direct link or skip it
292 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) {
293 wpbc_ajx_availability__send_request_with_params( {
294 'do_action': '{$booking_action}',
295 'ui_clicked_element_id': '{$el_id}'
296 } );
297 wpbc_button_enable_loading_icon( this );
298 }" ,
299 'icon' => array(
300 'icon_font' => 'wpbc_icn_close',
301 'position' => 'right',
302 'icon_img' => ''
303 ),
304 'class' => 'wpbc_ui_button_danger', // '' | 'wpbc_ui_button_primary'
305 'style' => '', // Any CSS class here
306 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
307 'attr' => array( 'id' => $el_id )
308 );
309
310 wpbc_flex_button( $params );
311 }