custom_day_schedule_form.php
1 year ago
default_form_fields.php
1 year ago
general.php
1 month ago
generate_instant_booking_page.php
1 year ago
get_pro.php
1 year ago
import_modal.php
1 year ago
notifications.php
1 year ago
pages.php
1 year ago
payments.php
1 year ago
premium_modal.php
1 year ago
steps_order_modal.php
5 months ago
version_5_intro.php
1 year ago
work_periods.php
1 year ago
custom_day_schedule_form.php
98 lines
| 1 | <?php |
| 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | exit; // Exit if accessed directly |
| 4 | } |
| 5 | ?> |
| 6 | <form class="latepoint-lightbox-wrapper-form" action="" data-os-success-action="reload" data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name('settings', 'save_custom_day_schedule')); ?>"> |
| 7 | <?php wp_nonce_field('save_custom_day_schedule'); ?> |
| 8 | <div class="latepoint-lightbox-heading"> |
| 9 | <h2><?php esc_html_e('Custom schedule', 'latepoint'); ?></h2> |
| 10 | </div> |
| 11 | <div class="latepoint-lightbox-content"> |
| 12 | <div class="custom-day-schedule-w"> |
| 13 | <div class="custom-day-calendar" data-show-schedule="<?php echo ($day_off) ? 'no' : 'yes'; ?>" data-period-type="<?php echo ($chain_id) ? 'range' : 'single'; ?>" data-picking="start"> |
| 14 | <div class="custom-day-settings-w"> |
| 15 | <?php echo OsFormHelper::select_field('period_type', false, ['single' => __('Single Day', 'latepoint'), 'range' => __('Date Range', 'latepoint')], ($chain_id) ? 'range' : 'single', ['class' => 'period-type-selector']); ?> |
| 16 | <?php echo OsFormHelper::hidden_field('chain_id', $chain_id); ?> |
| 17 | <div class="start-day-input-w"> |
| 18 | <?php echo OsFormHelper::text_field('start_custom_date', false, ($date_is_preselected) ? $target_date->format('Y-m-d') : '', ['placeholder' => __('Pick a Start', 'latepoint'), 'theme' => 'simple']); ?> |
| 19 | </div> |
| 20 | <div class="end-day-input-w"> |
| 21 | <?php echo OsFormHelper::text_field('end_custom_date', false, ($chain_end_date) ? $chain_end_date->format('Y-m-d') : '', ['placeholder' => __('Pick an End', 'latepoint'), 'theme' => 'simple']); ?> |
| 22 | </div> |
| 23 | </div> |
| 24 | <div class="custom-day-calendar-head"> |
| 25 | <h3 class="calendar-heading" |
| 26 | data-label-single="<?php esc_attr_e('Pick a Date', 'latepoint'); ?>" |
| 27 | data-label-start="<?php esc_attr_e('Pick a Start Date', 'latepoint'); ?>" |
| 28 | data-label-end="<?php esc_attr_e('Pick an End Date', 'latepoint'); ?>"><?php esc_html_e('Pick a Date', 'latepoint'); ?></h3> |
| 29 | <?php echo OsFormHelper::select_field('custom_day_calendar_month', false, OsUtilHelper::get_months_for_select(), $target_date->format('n')); ?> |
| 30 | <?php echo OsFormHelper::select_field('custom_day_calendar_year', false, [OsTimeHelper::today_date('Y'), OsTimeHelper::today_date('Y') + 1], $target_date->format('Y')); ?> |
| 31 | </div> |
| 32 | <div class="custom-day-calendar-month" data-route="<?php echo esc_attr(OsRouterHelper::build_route_name('calendars', 'load_monthly_calendar_days_only')); ?>"> |
| 33 | <?php OsCalendarHelper::generate_monthly_calendar_days_only($target_date->format('Y-m-d'), $date_is_preselected); ?> |
| 34 | </div> |
| 35 | </div> |
| 36 | <div class="custom-day-schedule"> |
| 37 | <div class="custom-day-schedule-head"> |
| 38 | <h3><?php esc_html_e('Set Schedule', 'latepoint'); ?></h3> |
| 39 | </div> |
| 40 | <div class="weekday-schedule-form active"> |
| 41 | <?php |
| 42 | $args = ['period_id' => false, 'agent_id' => $agent_id, 'service_id' => $service_id, 'location_id' => $location_id]; |
| 43 | $work_periods = false; |
| 44 | $preselected_date = ''; |
| 45 | if($day_off){ |
| 46 | $args['start_time'] = 0; |
| 47 | $args['end_time'] = 0; |
| 48 | }elseif($date_is_preselected){ |
| 49 | $preselected_date = $target_date->format('Y-m-d'); |
| 50 | $work_periods = new OsWorkPeriodModel(); |
| 51 | $work_periods = $work_periods->where(['agent_id' => $agent_id, |
| 52 | 'service_id' => $service_id, |
| 53 | 'location_id' => $location_id, |
| 54 | 'custom_date' => $target_date->format('Y-m-d')])->get_results_as_models(); |
| 55 | } |
| 56 | if($work_periods){ |
| 57 | $allow_remove = false; |
| 58 | $existing_work_period_ids = []; |
| 59 | foreach($work_periods as $work_period){ |
| 60 | echo OsWorkPeriodsHelper::generate_work_period_form(array('period_id' => $work_period->id, |
| 61 | 'week_day' => $target_date->format('N'), |
| 62 | 'is_active' => $work_period->is_active, |
| 63 | 'agent_id' => $work_period->agent_id, |
| 64 | 'service_id' => $work_period->service_id, |
| 65 | 'location_id' => $work_period->location_id, |
| 66 | 'start_time' => $work_period->start_time, |
| 67 | 'custom_date' => $work_period->custom_date, |
| 68 | 'end_time' => $work_period->end_time), $allow_remove); |
| 69 | $allow_remove = true; |
| 70 | $existing_work_periods_ids[] = $work_period->id; |
| 71 | } |
| 72 | echo OsFormHelper::hidden_field('existing_work_periods_ids', implode(',', $existing_work_periods_ids)); |
| 73 | |
| 74 | }else{ |
| 75 | echo OsWorkPeriodsHelper::generate_work_period_form($args, false); |
| 76 | } |
| 77 | ?> |
| 78 | <div class="ws-period-add" data- |
| 79 | data-os-params="<?php echo esc_attr(OsUtilHelper::build_os_params(['custom_date' => $preselected_date, |
| 80 | 'service_id' => $service_id, |
| 81 | 'agent_id' => $agent_id, |
| 82 | 'location_id' => $location_id])); ?>" |
| 83 | data-os-before-after="before" |
| 84 | data-os-after-call="latepoint_init_work_period_form" |
| 85 | data-os-action="<?php echo esc_attr(OsRouterHelper::build_route_name('settings', 'load_work_period_form')); ?>"> |
| 86 | <div class="add-period-graphic-w"> |
| 87 | <div class="add-period-plus"><i class="latepoint-icon latepoint-icon-plus-square"></i></div> |
| 88 | </div> |
| 89 | <div class="add-period-label"><?php esc_html_e('Add another work period', 'latepoint'); ?></div> |
| 90 | </div> |
| 91 | </div> |
| 92 | </div> |
| 93 | </div> |
| 94 | </div> |
| 95 | <div class="latepoint-lightbox-footer" <?php if(!$date_is_preselected) echo 'style="display: none;"'; ?>> |
| 96 | <button type="submit" class="latepoint-btn latepoint-btn-block latepoint-btn-lg latepoint-btn-outline latepoint-save-day-schedule-btn"><?php echo ($day_off) ? esc_html__('Set as Day Off', 'latepoint') : esc_html__('Save Schedule', 'latepoint'); ?></button> |
| 97 | </div> |
| 98 | </form> |