| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * ==================================================================================================================== |
| 3 | 3 | * includes/__js/cal/days_select_custom.js |
| 4 | 4 | * ==================================================================================================================== |
| @@ -152,12 +152,42 @@ | ||
| 152 | 152 | wpbc_cal_days_select__re_init( resource_id ); |
| 153 | 153 | wpbc_cal__re_init( resource_id ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | -// --------------------------------------------------------------------------------------------------------------------- | |
| 157 | - | |
| 158 | -/** | |
| 159 | - * Set Range Days selection with 2 mouse clicks - after page load | |
| 156 | +// --------------------------------------------------------------------------------------------------------------------- | |
| 157 | + | |
| 158 | +/** | |
| 159 | + * Set the existing calendar parameters to two-click range mode after page load. | |
| 160 | + * Free uses the unrestricted shared handler; Business Small+ keeps its already initialized advanced range rules. | |
| 161 | + * | |
| 162 | + * @param resource_id ID of booking resource. | |
| 163 | + */ | |
| 164 | +function wpbc_cal_ready_days_select__range_mode( resource_id ){ | |
| 165 | + | |
| 166 | + jQuery(document).ready(function(){ | |
| 167 | + setTimeout(function(){ | |
| 168 | + wpbc_cal_days_select__range_mode( resource_id ); | |
| 169 | + }, 1000); | |
| 170 | + }); | |
| 171 | +} | |
| 172 | + | |
| 173 | +/** | |
| 174 | + * Switch to two-click range mode without changing any advanced range parameters. | |
| 175 | + * | |
| 176 | + * @param resource_id ID of booking resource. | |
| 177 | + */ | |
| 178 | +function wpbc_cal_days_select__range_mode( resource_id ){ | |
| 179 | + | |
| 180 | + _wpbc.calendar__set_parameters( resource_id, {'days_select_mode': 'dynamic'} ); | |
| 181 | + | |
| 182 | + wpbc_cal_days_select__re_init( resource_id ); | |
| 183 | + wpbc_cal__re_init( resource_id ); | |
| 184 | +} | |
| 185 | + | |
| 186 | +// --------------------------------------------------------------------------------------------------------------------- | |
| 187 | + | |
| 188 | +/** | |
| 189 | + * Set Range Days selection with 2 mouse clicks - after page load | |
| 160 | 190 | * |
| 161 | 191 | * @integer resource_id - 1 -- ID of booking resource (calendar) |
| 162 | 192 | * @integer days_min - 7 -- Min number of days to select |
| 163 | 193 | * @integer days_max - 30 -- Max number of days to select |