| 1 |
<?php |
| 2 |
/** |
| 3 |
* Phase 3 Page 5 customer-journey chooser. |
| 4 |
* |
| 5 |
* @package Booking Calendar |
| 6 |
* @var array<string,mixed> $template_context Authorized step context. |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$step_data = $template_context['step_data']; |
| 14 |
$selected_journey = $step_data['values']['customer_journey']; |
| 15 |
?> |
| 16 |
<section class="wpbc_setup_wizard__step-content" aria-labelledby="wpbc-setup-wizard-step-title"> |
| 17 |
<header class="wpbc_setup_wizard__step-heading"> |
| 18 |
<h1 id="wpbc-setup-wizard-step-title"><?php esc_html_e( 'How should customer booking work?', 'booking' ); ?></h1> |
| 19 |
<p class="wpbc_setup_wizard__lead"><?php esc_html_e( 'Choose the customer journey that best matches your business. You can change this later.', 'booking' ); ?></p> |
| 20 |
</header> |
| 21 |
|
| 22 |
<form id="wpbc-setup-wizard-step-form" novalidate> |
| 23 |
<fieldset class="wpbc_setup_wizard__experience-fieldset" data-wpbc-setup-wizard-fields> |
| 24 |
<legend class="screen-reader-text"><?php esc_html_e( 'Choose a customer journey', 'booking' ); ?></legend> |
| 25 |
<div class="wpbc_setup_wizard__journey-groups" data-wpbc-selected-booking-mode="<?php echo esc_attr( $step_data['selected_booking_mode_id'] ); ?>"> |
| 26 |
<?php foreach ( $step_data['journey_groups'] as $journey_group ) : ?> |
| 27 |
<?php |
| 28 |
$group_heading_id = 'wpbc-setup-wizard-journey-group-' . $journey_group['id']; |
| 29 |
?> |
| 30 |
<section |
| 31 |
class="wpbc_setup_wizard__journey-group<?php echo $journey_group['is_additional'] ? ' wpbc_setup_wizard__journey-group--additional' : ' wpbc_setup_wizard__journey-group--recommended'; ?>" |
| 32 |
aria-labelledby="<?php echo esc_attr( $group_heading_id ); ?>" |
| 33 |
> |
| 34 |
<header class="wpbc_setup_wizard__journey-group-heading"> |
| 35 |
<h2 id="<?php echo esc_attr( $group_heading_id ); ?>"><?php echo esc_html( $journey_group['label'] ); ?></h2> |
| 36 |
<p><?php echo esc_html( $journey_group['description'] ); ?></p> |
| 37 |
</header> |
| 38 |
<div class="wpbc_setup_wizard__journey-option-list"> |
| 39 |
<?php foreach ( $journey_group['journeys'] as $journey ) : ?> |
| 40 |
<?php |
| 41 |
$edition_requirement = isset( $journey['edition_requirement'] ) && is_array( $journey['edition_requirement'] ) |
| 42 |
? $journey['edition_requirement'] |
| 43 |
: array(); |
| 44 |
$is_available = ! empty( $edition_requirement['is_available'] ); |
| 45 |
$is_selected = $is_available && $selected_journey === $journey['id']; |
| 46 |
$disabled_reason = ! empty( $edition_requirement['disabled_reason'] ) ? (string) $edition_requirement['disabled_reason'] : ''; |
| 47 |
$step_count = count( $journey['journey'] ); |
| 48 |
?> |
| 49 |
<label |
| 50 |
class="wpbc_setup_wizard__experience-card wpbc_setup_wizard__journey-option-card<?php echo $journey_group['is_additional'] ? ' is-additional' : ''; ?><?php echo $is_selected ? ' is-selected' : ''; ?><?php echo $is_available ? '' : ' is-locked'; ?>" |
| 51 |
data-wpbc-customer-journey-branches="<?php echo esc_attr( implode( ' ', $journey['branches'] ) ); ?>" |
| 52 |
data-wpbc-customer-journey-priority="<?php echo $journey_group['is_additional'] ? 'additional' : 'recommended'; ?>" |
| 53 |
data-wpbc-customer-journey-id="<?php echo esc_attr( $journey['id'] ); ?>" |
| 54 |
<?php if ( ! $is_available ) : ?>aria-disabled="true" title="<?php echo esc_attr( $disabled_reason ); ?>"<?php endif; ?> |
| 55 |
> |
| 56 |
<span class="wpbc_setup_wizard__journey-option-summary"> |
| 57 |
<span class="wpbc_setup_wizard__experience-choice"> |
| 58 |
<input |
| 59 |
class="screen-reader-text" |
| 60 |
type="radio" |
| 61 |
name="customer_journey" |
| 62 |
value="<?php echo esc_attr( $journey['id'] ); ?>" |
| 63 |
<?php checked( $is_selected ); ?> |
| 64 |
<?php disabled( ! $is_available ); ?> |
| 65 |
required |
| 66 |
data-wpbc-setup-wizard-field |
| 67 |
aria-describedby="wpbc-setup-wizard-customer-journey-error" |
| 68 |
> |
| 69 |
<span class="wpbc_setup_wizard__radio-mark" aria-hidden="true"></span> |
| 70 |
<strong class="wpbc_setup_wizard__experience-title"><?php echo esc_html( $journey['title'] ); ?></strong> |
| 71 |
<?php if ( ! empty( $edition_requirement['badge_label'] ) ) : ?> |
| 72 |
<span class="wpbc_setup_wizard__journey-edition-badge"> |
| 73 |
<?php echo esc_html( $edition_requirement['badge_label'] ); ?> |
| 74 |
<?php if ( ! $is_available ) : ?> |
| 75 |
<span class="screen-reader-text"><?php echo esc_html( $disabled_reason ); ?></span> |
| 76 |
<?php endif; ?> |
| 77 |
</span> |
| 78 |
<?php endif; ?> |
| 79 |
</span> |
| 80 |
<span class="wpbc_setup_wizard__journey-option-description"><?php echo esc_html( $journey['description'] ); ?></span> |
| 81 |
</span> |
| 82 |
|
| 83 |
<span class="wpbc_setup_wizard__journey wpbc_setup_wizard__journey--<?php echo esc_attr( (string) $step_count ); ?>" aria-hidden="true"> |
| 84 |
<?php foreach ( $journey['journey'] as $step_index => $step_label ) : ?> |
| 85 |
<?php |
| 86 |
$preview_type = isset( $journey['preview_types'][ $step_index ] ) ? $journey['preview_types'][ $step_index ] : 'details'; |
| 87 |
$hero_icon_class = 'property' === $preview_type ? 'wpbc_icn_home' : 'wpbc_icn_content_cut'; |
| 88 |
?> |
| 89 |
<span class="wpbc_setup_wizard__journey-step wpbc_setup_wizard__journey-step--<?php echo esc_attr( $preview_type ); ?>"> |
| 90 |
<strong class="wpbc_setup_wizard__journey-step-title"><?php echo esc_html( $step_label ); ?></strong> |
| 91 |
<span class="wpbc_setup_wizard__journey-preview"> |
| 92 |
<span class="wpbc_setup_wizard__preview-hero"> |
| 93 |
<i class="menu_icon icon-1x <?php echo esc_attr( $hero_icon_class ); ?>" aria-hidden="true"></i> |
| 94 |
<span class="wpbc_setup_wizard__preview-lines"><span></span><span></span></span> |
| 95 |
</span> |
| 96 |
<span class="wpbc_setup_wizard__preview-people"> |
| 97 |
<?php for ( $person_index = 0; $person_index < 3; $person_index++ ) : ?> |
| 98 |
<span><i class="menu_icon icon-1x wpbc_icn_person" aria-hidden="true"></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 99 |
<?php endfor; ?> |
| 100 |
</span> |
| 101 |
<span class="wpbc_setup_wizard__preview-calendar"> |
| 102 |
<?php for ( $calendar_index = 0; $calendar_index < 28; $calendar_index++ ) : ?> |
| 103 |
<span></span> |
| 104 |
<?php endfor; ?> |
| 105 |
</span> |
| 106 |
<span class="wpbc_setup_wizard__preview-options"> |
| 107 |
<?php for ( $option_index = 0; $option_index < 3; $option_index++ ) : ?> |
| 108 |
<span><i></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 109 |
<?php endfor; ?> |
| 110 |
</span> |
| 111 |
<span class="wpbc_setup_wizard__preview-fields"> |
| 112 |
<span><i class="menu_icon icon-1x wpbc_icn_person" aria-hidden="true"></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 113 |
<span><i class="menu_icon icon-1x wpbc_icn_mail_outline" aria-hidden="true"></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 114 |
</span> |
| 115 |
</span> |
| 116 |
</span> |
| 117 |
<?php if ( $step_index < $step_count - 1 ) : ?> |
| 118 |
<span class="wpbc_setup_wizard__journey-arrow"><i class="menu_icon icon-1x wpbc_icn_arrow_forward" aria-hidden="true"></i></span> |
| 119 |
<?php endif; ?> |
| 120 |
<?php endforeach; ?> |
| 121 |
</span> |
| 122 |
|
| 123 |
<span class="wpbc_setup_wizard__journey-option-best-for"> |
| 124 |
<strong><?php esc_html_e( 'Best for:', 'booking' ); ?></strong> |
| 125 |
<span><?php echo esc_html( $journey['best_for'] ); ?></span> |
| 126 |
</span> |
| 127 |
</label> |
| 128 |
<?php endforeach; ?> |
| 129 |
</div> |
| 130 |
</section> |
| 131 |
<?php endforeach; ?> |
| 132 |
</div> |
| 133 |
<span class="wpbc_setup_wizard__field-error wpbc_setup_wizard__field-error--group" id="wpbc-setup-wizard-customer-journey-error" data-wpbc-setup-wizard-error-for="customer_journey"></span> |
| 134 |
</fieldset> |
| 135 |
</form> |
| 136 |
</section> |
| 137 |
|