← All changes
|
includes/page-availability/_src/availability_page.js
+26
-22
10.1.3
→
11.8.4
View file →
| @@ -127,9 +127,8 @@ | ||
| 127 | 127 | 'ajx_data_arr' : ajx_data_arr = { ajx_booking_resources:[], booked_dates: {}, resource_unavailable_dates:[], season_availability:{},.... } |
| 128 | 128 | 'ajx_cleaned_params' : { |
| 129 | 129 | calendar__days_selection_mode: "dynamic" |
| 130 | 130 | calendar__start_week_day: "0" |
| 131 | - calendar__timeslot_day_bg_as_available: "" | |
| 132 | 131 | calendar__view__cell_height: "" |
| 133 | 132 | calendar__view__months_in_row: 4 |
| 134 | 133 | calendar__view__visible_months: 12 |
| 135 | 134 | calendar__view__width: "100%" |
| @@ -157,9 +156,9 @@ | ||
| 157 | 156 | //------------------------------------------------------------------------------------------------------------------ |
| 158 | 157 | /** |
| 159 | 158 | * Define showing mouse over tooltip on unavailable dates |
| 160 | 159 | * It's defined, when calendar REFRESHED (change months or days selection) loaded in jquery.datepick.wpbc.9.0.js : |
| 161 | - * $( 'body' ).trigger( 'wpbc_datepick_inline_calendar_refresh', ... //FixIn: 9.4.4.13 | |
| 160 | + * $( 'body' ).trigger( 'wpbc_datepick_inline_calendar_refresh', ... // FixIn: 9.4.4.13. | |
| 162 | 161 | */ |
| 163 | 162 | jQuery( 'body' ).on( 'wpbc_datepick_inline_calendar_refresh', function ( event, resource_id, inst ){ |
| 164 | 163 | // inst.dpDiv it's: <div class="datepick-inline datepick-multi" style="width: 17712px;">....</div> |
| 165 | 164 | inst.dpDiv.find( '.season_unavailable,.before_after_unavailable,.weekdays_unavailable' ).on( 'mouseover', function ( this_event ){ |
| @@ -173,9 +172,9 @@ | ||
| 173 | 172 | //------------------------------------------------------------------------------------------------------------------ |
| 174 | 173 | /** |
| 175 | 174 | * Define height of the calendar cells, and mouse over tooltips at some unavailable dates |
| 176 | 175 | * It's defined, when calendar loaded in jquery.datepick.wpbc.9.0.js : |
| 177 | - * $( 'body' ).trigger( 'wpbc_datepick_inline_calendar_loaded', ... //FixIn: 9.4.4.12 | |
| 176 | + * $( 'body' ).trigger( 'wpbc_datepick_inline_calendar_loaded', ... // FixIn: 9.4.4.12. | |
| 178 | 177 | */ |
| 179 | 178 | jQuery( 'body' ).on( 'wpbc_datepick_inline_calendar_loaded', function ( event, resource_id, jCalContainer, inst ){ |
| 180 | 179 | |
| 181 | 180 | // Remove highlight day for today date |
| @@ -180,14 +179,14 @@ | ||
| 180 | 179 | |
| 181 | 180 | // Remove highlight day for today date |
| 182 | 181 | jQuery( '.datepick-days-cell.datepick-today.datepick-days-cell-over' ).removeClass( 'datepick-days-cell-over' ); |
| 183 | 182 | |
| 184 | - // Set height of calendar cells if defined this option | |
| 183 | + // Set height of calendar cells if defined this option // FixIn: 10.12.4.2. | |
| 185 | 184 | if ( '' !== calendar_params_arr.ajx_cleaned_params.calendar__view__cell_height ){ |
| 186 | 185 | jQuery( 'head' ).append( '<style type="text/css">' |
| 187 | 186 | + '.hasDatepick .datepick-inline .datepick-title-row th, ' |
| 188 | 187 | + '.hasDatepick .datepick-inline .datepick-days-cell {' |
| 189 | - + 'height: ' + calendar_params_arr.ajx_cleaned_params.calendar__view__cell_height + ' !important;' | |
| 188 | + + 'max-height: ' + calendar_params_arr.ajx_cleaned_params.calendar__view__cell_height + ' !important;' | |
| 190 | 189 | + '}' |
| 191 | 190 | +'</style>' ); |
| 192 | 191 | } |
| 193 | 192 | |
| @@ -217,9 +216,8 @@ | ||
| 217 | 216 | |
| 218 | 217 | '<div class="' + ' bk_calendar_frame' |
| 219 | 218 | + ' months_num_in_row_' + calendar_params_arr.ajx_cleaned_params.calendar__view__months_in_row |
| 220 | 219 | + ' cal_month_num_' + calendar_params_arr.ajx_cleaned_params.calendar__view__visible_months |
| 221 | - + ' ' + calendar_params_arr.ajx_cleaned_params.calendar__timeslot_day_bg_as_available // 'wpbc_timeslot_day_bg_as_available' || '' | |
| 222 | 220 | + '" ' |
| 223 | 221 | + 'style="' + width + '">' |
| 224 | 222 | |
| 225 | 223 | + '<div id="calendar_booking' + calendar_params_arr.resource_id + '">' + 'Calendar is loading...' + '</div>' |
| @@ -318,10 +316,12 @@ | ||
| 318 | 316 | onChangeMonthYear: null, |
| 319 | 317 | showOn: 'both', |
| 320 | 318 | numberOfMonths: calendar_params_arr.calendar__view__visible_months, |
| 321 | 319 | stepMonths: 1, |
| 322 | - prevText: '«', | |
| 323 | - nextText: '»', | |
| 320 | + // prevText: '«', | |
| 321 | + // nextText: '»', | |
| 322 | + prevText : '‹', | |
| 323 | + nextText : '›', | |
| 324 | 324 | dateFormat: 'yy-mm-dd',// 'dd.mm.yy', |
| 325 | 325 | changeMonth: false, |
| 326 | 326 | changeYear: false, |
| 327 | 327 | minDate: 0, //null, //Scroll as long as you need |
| @@ -377,8 +377,9 @@ | ||
| 377 | 377 | */ |
| 378 | 378 | function wpbc__inline_booking_calendar__apply_css_to_days( date, calendar_params_arr, datepick_this ){ |
| 379 | 379 | |
| 380 | 380 | var today_date = new Date( _wpbc.get_other_param( 'today_arr' )[ 0 ], (parseInt( _wpbc.get_other_param( 'today_arr' )[ 1 ] ) - 1), _wpbc.get_other_param( 'today_arr' )[ 2 ], 0, 0, 0 ); |
| 381 | + var real_today_date = new Date( _wpbc.get_other_param( 'time_local_arr' )[ 0 ], (parseInt( _wpbc.get_other_param( 'time_local_arr' )[ 1 ] ) - 1), _wpbc.get_other_param( 'time_local_arr' )[ 2 ], 0, 0, 0 ); | |
| 381 | 382 | |
| 382 | 383 | var class_day = ( date.getMonth() + 1 ) + '-' + date.getDate() + '-' + date.getFullYear(); // '1-9-2023' |
| 383 | 384 | var sql_class_day = wpbc__get__sql_class_date( date ); // '2023-01-09' |
| 384 | 385 | |
| @@ -392,30 +393,33 @@ | ||
| 392 | 393 | if ( date.getDay() == _wpbc.get_other_param( 'availability__week_days_unavailable' )[ i ] ) { |
| 393 | 394 | return [ !!false, css_date__standard + ' date_user_unavailable' + ' weekdays_unavailable' ]; |
| 394 | 395 | } |
| 395 | 396 | } |
| 396 | - | |
| 397 | - // BEFORE_AFTER :: Set unavailable days Before / After the Today date | |
| 398 | - if ( ( (wpbc_dates__days_between( date, today_date )) < parseInt(_wpbc.get_other_param( 'availability__unavailable_from_today' )) ) | |
| 399 | - || ( | |
| 400 | - ( parseInt( '0' + parseInt( _wpbc.get_other_param( 'availability__available_from_today' ) ) ) > 0 ) | |
| 401 | - && ( wpbc_dates__days_between( date, today_date ) > parseInt( '0' + parseInt( _wpbc.get_other_param( 'availability__available_from_today' ) ) ) ) | |
| 402 | - ) | |
| 403 | - ){ | |
| 404 | - return [ !!false, css_date__standard + ' date_user_unavailable' + ' before_after_unavailable' ]; | |
| 397 | + // 10.9.6.3. | |
| 398 | + var date_midnight = new Date( parseInt( date.getFullYear() ), (parseInt( date.getMonth() ) - 0), parseInt( date.getDate() ), 0, 0, 0 ); | |
| 399 | + // BEFORE_AFTER :: Set unavailable days Before / After the Today date. | |
| 400 | + //if ( ((wpbc_dates__days_between( date, real_today_date )) < parseInt( _wpbc.get_other_param( 'availability__unavailable_from_today' ) )) | |
| 401 | + if ( | |
| 402 | + ( (today_date.getTime() - date_midnight.getTime() ) > 0 ) | |
| 403 | + || ( | |
| 404 | + (parseInt( '0' + parseInt( _wpbc.get_other_param( 'availability__available_from_today' ) ) ) > 0) | |
| 405 | + && (wpbc_dates__days_between( date_midnight, real_today_date ) >= parseInt( '0' + parseInt( _wpbc.get_other_param( 'availability__available_from_today' ) ) )) | |
| 406 | + ) | |
| 407 | + ) { | |
| 408 | + return [ false, css_date__standard + ' date_user_unavailable' + ' before_after_unavailable' ]; | |
| 405 | 409 | } |
| 406 | 410 | |
| 407 | 411 | // SEASONS :: Booking > Resources > Availability page |
| 408 | 412 | var is_date_available = calendar_params_arr.season_availability[ sql_class_day ]; |
| 409 | - if ( false === is_date_available ){ //FixIn: 9.5.4.4 | |
| 413 | + if ( false === is_date_available ){ // FixIn: 9.5.4.4. | |
| 410 | 414 | return [ !!false, css_date__standard + ' date_user_unavailable' + ' season_unavailable' ]; |
| 411 | 415 | } |
| 412 | 416 | |
| 413 | 417 | // RESOURCE_UNAVAILABLE :: Booking > Availability page |
| 414 | - if ( wpdev_in_array(calendar_params_arr.resource_unavailable_dates, sql_class_day ) ){ | |
| 418 | + if ( wpbc_in_array(calendar_params_arr.resource_unavailable_dates, sql_class_day ) ){ | |
| 415 | 419 | is_date_available = false; |
| 416 | 420 | } |
| 417 | - if ( false === is_date_available ){ //FixIn: 9.5.4.4 | |
| 421 | + if ( false === is_date_available ){ // FixIn: 9.5.4.4. | |
| 418 | 422 | return [ !false, css_date__standard + ' date_user_unavailable' + ' resource_unavailable' ]; |
| 419 | 423 | } |
| 420 | 424 | |
| 421 | 425 | //-------------------------------------------------------------------------------------------------------------- |
| @@ -878,11 +882,11 @@ | ||
| 878 | 882 | interactiveBorder: 10, |
| 879 | 883 | maxWidth : 550, |
| 880 | 884 | theme : 'wpbc-tippy-times', |
| 881 | 885 | placement : 'top', |
| 882 | - delay : [400, 0], //FixIn: 9.4.2.2 | |
| 886 | + delay : [400, 0], // FixIn: 9.4.2.2. | |
| 883 | 887 | ignoreAttributes : true, |
| 884 | - touch : true, //['hold', 500], // 500ms delay //FixIn: 9.2.1.5 | |
| 888 | + touch : true, //['hold', 500], // 500ms delay // FixIn: 9.2.1.5. | |
| 885 | 889 | appendTo: () => document.body, |
| 886 | 890 | }); |
| 887 | 891 | } |
| 888 | 892 | } |