| 1 |
<?php |
| 2 |
/** |
| 3 |
* Final Setup Wizard draft-review page. |
| 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 |
$draft = $template_context['draft']; |
| 14 |
$step_data = $template_context['step_data']; |
| 15 |
$journey = isset( $step_data['journey'] ) && is_array( $step_data['journey'] ) ? $step_data['journey'] : array(); |
| 16 |
$groups = isset( $step_data['groups'] ) && is_array( $step_data['groups'] ) ? $step_data['groups'] : array(); |
| 17 |
$is_completed = 'completed' === $draft['status']; |
| 18 |
$step_count = isset( $journey['journey'] ) && is_array( $journey['journey'] ) ? count( $journey['journey'] ) : 0; |
| 19 |
$email_state = isset( $step_data['email_state'] ) && is_array( $step_data['email_state'] ) ? $step_data['email_state'] : array(); |
| 20 |
$email_error = isset( $step_data['email_error'] ) && is_scalar( $step_data['email_error'] ) ? (string) $step_data['email_error'] : ''; |
| 21 |
?> |
| 22 |
<section class="wpbc_setup_wizard__step-content wpbc_setup_wizard__review" aria-labelledby="wpbc-setup-wizard-step-title"> |
| 23 |
<header class="wpbc_setup_wizard__step-heading"> |
| 24 |
<h1 id="wpbc-setup-wizard-step-title"><?php esc_html_e( 'Review your setup', 'booking' ); ?></h1> |
| 25 |
<p class="wpbc_setup_wizard__lead"><?php esc_html_e( 'Review the settings saved during this setup before you finish.', 'booking' ); ?></p> |
| 26 |
</header> |
| 27 |
|
| 28 |
<form id="wpbc-setup-wizard-step-form" novalidate> |
| 29 |
<div class="wpbc_setup_wizard__review-plan"> |
| 30 |
<?php foreach ( $groups as $group ) : ?> |
| 31 |
<section class="wpbc_setup_wizard__review-group" aria-labelledby="wpbc-setup-review-group-<?php echo esc_attr( $group['id'] ); ?>"> |
| 32 |
<h2 id="wpbc-setup-review-group-<?php echo esc_attr( $group['id'] ); ?>"><?php echo esc_html( $group['label'] ); ?></h2> |
| 33 |
<?php if ( 'booking_experience' === $group['id'] ) : ?> |
| 34 |
<article class="wpbc_setup_wizard__review-journey" data-wpbc-review-step="customer_journey"> |
| 35 |
<div class="wpbc_setup_wizard__review-journey-summary"> |
| 36 |
<span class="wpbc_setup_wizard__review-eyebrow"><?php esc_html_e( 'Your selected journey', 'booking' ); ?></span> |
| 37 |
<h3><?php echo isset( $journey['title'] ) ? esc_html( $journey['title'] ) : esc_html__( 'Customer journey', 'booking' ); ?></h3> |
| 38 |
<p><?php echo isset( $journey['description'] ) ? esc_html( $journey['description'] ) : ''; ?></p> |
| 39 |
<button type="button" class="button button-link wpbc_setup_wizard__review-edit wpbc_setup_wizard__review-edit--journey" data-wpbc-setup-wizard-edit-step="customer_journey"> |
| 40 |
<?php esc_html_e( 'Edit', 'booking' ); ?> |
| 41 |
<span class="screen-reader-text"> <?php esc_html_e( 'customer journey', 'booking' ); ?></span> |
| 42 |
</button> |
| 43 |
</div> |
| 44 |
|
| 45 |
<?php if ( 0 < $step_count ) : ?> |
| 46 |
<div |
| 47 |
class="wpbc_setup_wizard__journey wpbc_setup_wizard__review-journey-visual wpbc_setup_wizard__journey--<?php echo esc_attr( (string) $step_count ); ?>" |
| 48 |
data-wpbc-customer-journey-id="<?php echo isset( $journey['id'] ) ? esc_attr( $journey['id'] ) : ''; ?>" |
| 49 |
aria-hidden="true" |
| 50 |
> |
| 51 |
<?php foreach ( $journey['journey'] as $step_index => $step_label ) : ?> |
| 52 |
<?php |
| 53 |
$preview_type = isset( $journey['preview_types'][ $step_index ] ) ? $journey['preview_types'][ $step_index ] : 'details'; |
| 54 |
$hero_icon_class = 'property' === $preview_type ? 'wpbc_icn_home' : 'wpbc_icn_content_cut'; |
| 55 |
?> |
| 56 |
<span class="wpbc_setup_wizard__journey-step wpbc_setup_wizard__journey-step--<?php echo esc_attr( $preview_type ); ?>"> |
| 57 |
<strong class="wpbc_setup_wizard__journey-step-title"><?php echo esc_html( $step_label ); ?></strong> |
| 58 |
<span class="wpbc_setup_wizard__journey-preview"> |
| 59 |
<span class="wpbc_setup_wizard__preview-hero"> |
| 60 |
<i class="menu_icon icon-1x <?php echo esc_attr( $hero_icon_class ); ?>" aria-hidden="true"></i> |
| 61 |
<span class="wpbc_setup_wizard__preview-lines"><span></span><span></span></span> |
| 62 |
</span> |
| 63 |
<span class="wpbc_setup_wizard__preview-people"> |
| 64 |
<?php for ( $person_index = 0; $person_index < 3; $person_index++ ) : ?> |
| 65 |
<span><i class="menu_icon icon-1x wpbc_icn_person" aria-hidden="true"></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 66 |
<?php endfor; ?> |
| 67 |
</span> |
| 68 |
<span class="wpbc_setup_wizard__preview-calendar"> |
| 69 |
<?php for ( $calendar_index = 0; $calendar_index < 28; $calendar_index++ ) : ?> |
| 70 |
<span></span> |
| 71 |
<?php endfor; ?> |
| 72 |
</span> |
| 73 |
<span class="wpbc_setup_wizard__preview-options"> |
| 74 |
<?php for ( $option_index = 0; $option_index < 3; $option_index++ ) : ?> |
| 75 |
<span><i></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 76 |
<?php endfor; ?> |
| 77 |
</span> |
| 78 |
<span class="wpbc_setup_wizard__preview-fields"> |
| 79 |
<span><i class="menu_icon icon-1x wpbc_icn_person" aria-hidden="true"></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 80 |
<span><i class="menu_icon icon-1x wpbc_icn_mail_outline" aria-hidden="true"></i><span class="wpbc_setup_wizard__preview-bar"></span></span> |
| 81 |
</span> |
| 82 |
</span> |
| 83 |
</span> |
| 84 |
<?php if ( $step_index < $step_count - 1 ) : ?> |
| 85 |
<span class="wpbc_setup_wizard__journey-arrow"><i class="menu_icon icon-1x wpbc_icn_arrow_forward" aria-hidden="true"></i></span> |
| 86 |
<?php endif; ?> |
| 87 |
<?php endforeach; ?> |
| 88 |
</div> |
| 89 |
<?php endif; ?> |
| 90 |
|
| 91 |
<div class="wpbc_setup_wizard__review-best-for"> |
| 92 |
<strong><?php esc_html_e( 'Best for:', 'booking' ); ?></strong> |
| 93 |
<p><?php echo isset( $journey['best_for'] ) ? esc_html( $journey['best_for'] ) : ''; ?></p> |
| 94 |
</div> |
| 95 |
</article> |
| 96 |
<?php endif; ?> |
| 97 |
<dl> |
| 98 |
<?php foreach ( $group['rows'] as $row ) : ?> |
| 99 |
<div class="wpbc_setup_wizard__review-row" data-wpbc-review-step="<?php echo esc_attr( $row['step_id'] ); ?>"> |
| 100 |
<dt><?php echo esc_html( $row['label'] ); ?></dt> |
| 101 |
<dd> |
| 102 |
<strong class="wpbc_setup_wizard__review-row-summary"><?php echo esc_html( $row['summary'] ); ?></strong> |
| 103 |
<?php if ( ! empty( $row['details'] ) ) : ?> |
| 104 |
<div class="wpbc_setup_wizard__review-details"> |
| 105 |
<?php foreach ( $row['details'] as $detail ) : ?> |
| 106 |
<div class="wpbc_setup_wizard__review-detail"> |
| 107 |
<span><?php echo esc_html( $detail['label'] ); ?></span> |
| 108 |
<?php if ( ! empty( $detail['url'] ) ) : ?> |
| 109 |
<strong> |
| 110 |
<a href="<?php echo esc_url( $detail['url'] ); ?>" target="_blank" rel="noopener noreferrer"> |
| 111 |
<?php echo esc_html( $detail['value'] ); ?> |
| 112 |
<span class="screen-reader-text"> <?php esc_html_e( '(opens in a new tab)', 'booking' ); ?></span> |
| 113 |
</a> |
| 114 |
</strong> |
| 115 |
<?php else : ?> |
| 116 |
<strong><?php echo esc_html( $detail['value'] ); ?></strong> |
| 117 |
<?php endif; ?> |
| 118 |
</div> |
| 119 |
<?php endforeach; ?> |
| 120 |
</div> |
| 121 |
<?php endif; ?> |
| 122 |
<?php if ( ! empty( $row['items'] ) ) : ?> |
| 123 |
<details class="wpbc_setup_wizard__review-items"> |
| 124 |
<summary> |
| 125 |
<?php echo esc_html( $row['items_label'] ); ?> |
| 126 |
<span aria-hidden="true"><?php echo esc_html( '(' . count( $row['items'] ) . ')' ); ?></span> |
| 127 |
</summary> |
| 128 |
<ul> |
| 129 |
<?php foreach ( $row['items'] as $item ) : ?> |
| 130 |
<li><strong><?php echo esc_html( $item['label'] ); ?></strong><span><?php echo esc_html( $item['value'] ); ?></span></li> |
| 131 |
<?php endforeach; ?> |
| 132 |
</ul> |
| 133 |
</details> |
| 134 |
<?php endif; ?> |
| 135 |
</dd> |
| 136 |
<dd class="wpbc_setup_wizard__review-row-action"> |
| 137 |
<button type="button" class="button button-link wpbc_setup_wizard__review-edit" data-wpbc-setup-wizard-edit-step="<?php echo esc_attr( $row['step_id'] ); ?>"> |
| 138 |
<?php esc_html_e( 'Edit', 'booking' ); ?> |
| 139 |
<span class="screen-reader-text"> <?php echo esc_html( $row['label'] ); ?></span> |
| 140 |
</button> |
| 141 |
</dd> |
| 142 |
</div> |
| 143 |
<?php endforeach; ?> |
| 144 |
</dl> |
| 145 |
</section> |
| 146 |
<?php endforeach; ?> |
| 147 |
|
| 148 |
<?php if ( 'failed' === ( isset( $email_state['status'] ) ? $email_state['status'] : '' ) || '' !== $email_error ) : ?> |
| 149 |
<p class="wpbc_setup_wizard__message wpbc_setup_wizard__message--warning wpbc_setup_wizard__review-status" role="status"> |
| 150 |
<i class="menu_icon icon-1x wpbc_icn_warning_amber" aria-hidden="true"></i> |
| 151 |
<span><?php esc_html_e( 'Your setup is ready to review, but the optional setup-details feedback failed. Reload this page to retry.', 'booking' ); ?></span> |
| 152 |
</p> |
| 153 |
<?php endif; ?> |
| 154 |
|
| 155 |
<?php if ( $is_completed ) : ?> |
| 156 |
<p class="wpbc_setup_wizard__message wpbc_setup_wizard__message--info wpbc_setup_wizard__review-status" role="status"> |
| 157 |
<i class="menu_icon icon-1x wpbc_icn_check_circle" aria-hidden="true"></i> |
| 158 |
<span><?php esc_html_e( 'This Setup Wizard route was revalidated and completed. Settings and publishing changes saved on earlier steps remain active.', 'booking' ); ?></span> |
| 159 |
</p> |
| 160 |
<?php endif; ?> |
| 161 |
</div> |
| 162 |
</form> |
| 163 |
</section> |
| 164 |
|