PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
booking / includes / page-setup-wizard / step-services / template.php

template.php in Booking Calendar 11.9, at includes/page-setup-wizard/step-services/template.php

169 lines 9.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Modular Step 6 Service proposal editor.
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 $services = isset( $step_data['services'] ) && is_array( $step_data['services'] ) ? $step_data['services'] : array();
15 $inactive_service_ids = isset( $step_data['inactive_service_ids'] ) && is_array( $step_data['inactive_service_ids'] ) ? array_values( array_map( 'absint', $step_data['inactive_service_ids'] ) ) : array();
16 $pricing_available = ! empty( $step_data['pricing_available'] );
17 $currency_symbol = isset( $step_data['currency_symbol'] ) ? (string) $step_data['currency_symbol'] : '$';
18 $max_services = isset( $step_data['max_services'] ) ? absint( $step_data['max_services'] ) : 20;
19 $services_json = wp_json_encode( $services );
20 $services_json = false === $services_json ? '[]' : $services_json;
21 $inactive_service_ids_json = wp_json_encode( $inactive_service_ids );
22 $inactive_service_ids_json = false === $inactive_service_ids_json ? '[]' : $inactive_service_ids_json;
23 ?>
24 <section class="wpbc_setup_wizard__step-content wpbc_setup_wizard__services-step" aria-labelledby="wpbc-setup-wizard-step-title">
25 <header class="wpbc_setup_wizard__step-heading">
26 <h1 id="wpbc-setup-wizard-step-title"><?php esc_html_e( 'Create your services', 'booking' ); ?></h1>
27 <p class="wpbc_setup_wizard__lead"><?php esc_html_e( 'Add the services customers can choose in the guided appointment flow.', 'booking' ); ?></p>
28 </header>
29 <?php
30 $template_context['templates']->render(
31 'settings-hint',
32 array( 'settings_hint' => $template_context['settings_hint'] )
33 );
34 ?>
35
36 <form id="wpbc-setup-wizard-step-form" novalidate>
37 <input
38 type="hidden"
39 name="services"
40 value="<?php echo esc_attr( $services_json ); ?>"
41 required
42 data-wpbc-setup-wizard-field
43 data-wpbc-service-draft
44 data-max-services="<?php echo esc_attr( (string) $max_services ); ?>"
45 aria-describedby="wpbc-setup-wizard-services-error"
46 >
47 <input
48 type="hidden"
49 name="inactive_service_ids"
50 value="<?php echo esc_attr( $inactive_service_ids_json ); ?>"
51 data-wpbc-setup-wizard-field
52 data-wpbc-inactive-service-ids
53 >
54
55 <div class="wpbc_setup_wizard__services-layout" data-wpbc-services-editor data-pricing-available="<?php echo $pricing_available ? 'true' : 'false'; ?>">
56 <aside class="wpbc_setup_wizard__services-list-panel" aria-labelledby="wpbc-setup-wizard-services-list-title">
57 <h2 id="wpbc-setup-wizard-services-list-title"><?php esc_html_e( 'Your services', 'booking' ); ?></h2>
58 <div class="wpbc_setup_wizard__services-list" role="group" aria-label="<?php esc_attr_e( 'Services to edit', 'booking' ); ?>" data-wpbc-services-list></div>
59 <button type="button" class="button button-secondary wpbc_setup_wizard__add-service" data-wpbc-add-service>
60 <i class="menu_icon icon-1x wpbc_icn_add" aria-hidden="true"></i>
61 <span><?php esc_html_e( 'Add another service', 'booking' ); ?></span>
62 </button>
63 </aside>
64
65 <section class="wpbc_setup_wizard__service-details-panel" aria-labelledby="wpbc-setup-wizard-service-details-title">
66 <header class="wpbc_setup_wizard__service-details-heading">
67 <h2 id="wpbc-setup-wizard-service-details-title"><?php esc_html_e( 'Service details', 'booking' ); ?></h2>
68 <span><?php esc_html_e( '* Required fields', 'booking' ); ?></span>
69 </header>
70
71 <div class="wpbc_setup_wizard__service-details-grid">
72 <div class="wpbc_setup_wizard__field wpbc_setup_wizard__service-title-field">
73 <label for="wpbc-setup-wizard-service-title"><?php esc_html_e( 'Service title', 'booking' ); ?> <span aria-hidden="true">*</span></label>
74 <input id="wpbc-setup-wizard-service-title" type="text" maxlength="200" required data-wpbc-service-field="title" data-wpbc-setup-wizard-error-control-for="services">
75 </div>
76
77 <div class="wpbc_setup_wizard__field wpbc_setup_wizard__service-price-field">
78 <label for="wpbc-setup-wizard-service-price">
79 <?php
80 printf(
81 /* translators: %s: Current currency symbol. */
82 esc_html__( 'Price (%s)', 'booking' ),
83 esc_html( $currency_symbol )
84 );
85 ?>
86 <?php if ( ! $pricing_available ) : ?><span class="wpbc_setup_wizard__edition-badge"><?php esc_html_e( 'Pro', 'booking' ); ?></span><?php endif; ?>
87 </label>
88 <div class="wpbc_setup_wizard__price-control"><input id="wpbc-setup-wizard-service-price" type="number" min="0" max="1000" step="0.01" data-wpbc-service-field="base_cost" <?php disabled( ! $pricing_available ); ?>></div>
89 <?php if ( ! $pricing_available ) : ?><span class="wpbc_setup_wizard__field-help"><?php esc_html_e( 'Available in Business Small or higher.', 'booking' ); ?></span><?php endif; ?>
90 </div>
91
92 <div class="wpbc_setup_wizard__field wpbc_setup_wizard__service-description-field">
93 <label for="wpbc-setup-wizard-service-description"><?php esc_html_e( 'Description', 'booking' ); ?></label>
94 <textarea id="wpbc-setup-wizard-service-description" maxlength="2000" rows="6" data-wpbc-service-field="description"></textarea>
95 </div>
96
97 <div class="wpbc_setup_wizard__field wpbc_setup_wizard__service-picture-field">
98 <label><?php esc_html_e( 'Picture (optional)', 'booking' ); ?></label>
99 <div class="wpbc_setup_wizard__service-picture-preview" data-wpbc-service-picture-preview>
100 <img alt="" hidden data-wpbc-service-picture-image>
101 <i class="menu_icon icon-1x wpbc-bi-image-fill" aria-hidden="true" data-wpbc-service-picture-placeholder></i>
102 </div>
103 <input id="wpbc-setup-wizard-service-picture-url" type="hidden" data-wpbc-service-field="picture_url">
104 <div class="wpbc_setup_wizard__service-picture-actions">
105 <button
106 type="button"
107 class="button button-secondary wpbc_media_upload_button"
108 data-modal_title="<?php esc_attr_e( 'Select Service image', 'booking' ); ?>"
109 data-btn_title="<?php esc_attr_e( 'Use this image', 'booking' ); ?>"
110 data-url_field="wpbc-setup-wizard-service-picture-url"
111 ><?php esc_html_e( 'Select image', 'booking' ); ?></button>
112 <button type="button" class="button button-secondary" data-wpbc-remove-service-picture><?php esc_html_e( 'Remove', 'booking' ); ?></button>
113 </div>
114 </div>
115
116 <div class="wpbc_setup_wizard__service-time-grid">
117 <div class="wpbc_setup_wizard__field">
118 <label for="wpbc-setup-wizard-service-duration"><?php esc_html_e( 'Duration (minutes)', 'booking' ); ?></label>
119 <div class="wpbc_setup_wizard__service-number-control">
120 <input id="wpbc-setup-wizard-service-duration" type="number" min="0" max="1440" step="1" required data-wpbc-service-field="duration_minutes">
121 <input type="range" min="0" max="480" step="5" value="30" data-wpbc-service-range="duration_minutes" aria-label="<?php esc_attr_e( 'Adjust Service duration in minutes', 'booking' ); ?>">
122 </div>
123 </div>
124 <div class="wpbc_setup_wizard__field">
125 <label for="wpbc-setup-wizard-service-buffer-before"><?php esc_html_e( 'Buffer before (minutes)', 'booking' ); ?></label>
126 <div class="wpbc_setup_wizard__service-number-control">
127 <input id="wpbc-setup-wizard-service-buffer-before" type="number" min="0" max="1440" step="1" required data-wpbc-service-field="buffer_before_minutes">
128 <input type="range" min="0" max="480" step="5" value="0" data-wpbc-service-range="buffer_before_minutes" aria-label="<?php esc_attr_e( 'Adjust the buffer before the Service in minutes', 'booking' ); ?>">
129 </div>
130 </div>
131 <div class="wpbc_setup_wizard__field">
132 <label for="wpbc-setup-wizard-service-buffer-after"><?php esc_html_e( 'Buffer after (minutes)', 'booking' ); ?></label>
133 <div class="wpbc_setup_wizard__service-number-control">
134 <input id="wpbc-setup-wizard-service-buffer-after" type="number" min="0" max="1440" step="1" required data-wpbc-service-field="buffer_after_minutes">
135 <input type="range" min="0" max="480" step="5" value="0" data-wpbc-service-range="buffer_after_minutes" aria-label="<?php esc_attr_e( 'Adjust the buffer after the Service in minutes', 'booking' ); ?>">
136 </div>
137 </div>
138 </div>
139 </div>
140
141 <div class="wpbc_setup_wizard__service-summary wpbc_setup_wizard__message wpbc_setup_wizard__message--info">
142 <p><strong><?php esc_html_e( 'Customers see:', 'booking' ); ?></strong><span data-wpbc-service-summary></span></p>
143 </div>
144 </section>
145 </div>
146 <span class="wpbc_setup_wizard__field-error wpbc_setup_wizard__field-error--group" id="wpbc-setup-wizard-services-error" data-wpbc-setup-wizard-error-for="services"></span>
147 </form>
148
149 <template data-wpbc-service-card-template>
150 <div class="wpbc_setup_wizard__service-card">
151 <label class="wpbc_setup_wizard__service-card-selection">
152 <input class="screen-reader-text" type="radio" name="wpbc_setup_wizard_service_editor_selection">
153 <span class="wpbc_setup_wizard__radio-mark" aria-hidden="true"></span>
154 <span class="wpbc_setup_wizard__service-card-picture"><img alt="" hidden><i class="menu_icon icon-1x wpbc-bi-image-fill" aria-hidden="true"></i></span>
155 <span class="wpbc_setup_wizard__service-card-copy"><strong></strong><span><span data-wpbc-service-card-duration></span> &middot; <em><?php esc_html_e( 'Active', 'booking' ); ?></em></span></span>
156 </label>
157 <button
158 type="button"
159 class="wpbc_setup_wizard__service-card-remove"
160 data-wpbc-remove-service
161 aria-label="<?php esc_attr_e( 'Remove Service', 'booking' ); ?>"
162 title="<?php esc_attr_e( 'Remove Service', 'booking' ); ?>"
163 >
164 <i class="menu_icon icon-1x wpbc_icn_delete_outline" aria-hidden="true"></i>
165 </button>
166 </div>
167 </template>
168 </section>
169