PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.1.91
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.1.91
5.6.8 5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / views / steps / partials / _cart_summary.php
latepoint / lib / views / steps / partials Last commit date
_booking_form_params.php 1 year ago _booking_form_summary_panel.php 1 year ago _booking_summary.php 1 year ago _cart_clear.php 1 year ago _cart_summary.php 1 year ago _contact_form.php 1 year ago _limit_reached.php 1 year ago _monthly_calendar_days.php 1 year ago _order_summary.php 1 year ago
_cart_summary.php
218 lines
1 <?php
2 /*
3 * Copyright (c) 2023 LatePoint LLC. All rights reserved.
4 */
5
6 /* @var $cart OsCartModel */
7 /* @var $customer OsCustomerModel */
8 /* @var $booking OsBookingModel */
9 /* @var $active_cart_item OsCartItemModel */
10 /* @var $output_target string [summary_panel, step_verify] */
11
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly
15 }
16 ?>
17
18 <div class="cart-summary-main-section">
19 <?php
20 if ( ! $cart->is_empty() ) {
21 $cart_bookings = $cart->get_bookings_from_cart_items();
22 $cart_bundles = $cart->get_bundles_from_cart_items();
23
24
25 $count_class = ( ( count( $cart_bookings ) + count( $cart_bundles ) ) == 1 ) ? 'single-item' : 'multi-item';
26
27 if ( $cart_bookings && $cart_bundles && $output_target != 'summary_panel' ) {
28 ?>
29 <div class="summary-heading summary-variant-heading">
30 <div class="pb-heading">
31 <div class="pbh-label"><?php esc_html_e( 'Service Bundles', 'latepoint' ); ?></div>
32 <div class="pbh-line"></div>
33 </div>
34 </div>
35 <?php
36 }
37
38 if ( $cart_bundles ) {
39 foreach ( $cart_bundles as $cart_item_id => $bundle ) { ?>
40 <div class="cart-item-wrapper <?php echo esc_attr($count_class); ?>">
41 <div class="summary-box main-box" data-cart-item-id="<?php echo esc_attr($cart_item_id); ?>">
42 <?php
43 $bundle_headings = [];
44 $bundle_headings = apply_filters( 'latepoint_cart_summary_bundle_headings', $bundle_headings, $bundle );
45 if ( $bundle_headings ) {
46 echo '<div class="summary-box-heading">';
47 foreach ( $bundle_headings as $heading ) {
48 echo '<div class="sbh-item">' . esc_html($heading) . '</div>';
49 }
50 echo '<div class="sbh-line"></div>';
51 echo '</div>';
52 }
53 $bundle_services = $bundle->get_services();
54 $bundle_services_descriptions = [];
55 foreach ( $bundle_services as $service ) {
56 $qty = $bundle->quantity_for_service( $service->id );
57 $qty_html = $qty > 1 ? ' [' . $qty . ']' : '';
58 $bundle_services_descriptions[] = $service->name . $qty_html;
59 }
60 ?>
61 <div class="summary-box-content os-cart-item is-removable">
62 <?php if ( OsCartsHelper::can_checkout_multiple_items() ) { ?>
63 <div class="os-remove-item-from-cart"
64 role="button"
65 tabindex="0"
66 data-confirm-text="<?php esc_attr_e( 'Are you sure you want to remove this item from your cart?', 'latepoint' ); ?>"
67 data-cart-item-id="<?php echo esc_attr($cart_item_id); ?>"
68 data-route="<?php echo esc_attr(OsRouterHelper::build_route_name( 'carts', 'remove_item_from_cart' )); ?>">
69 <div class="os-remove-from-cart-icon"></div></div>
70 <?php } ?>
71 <div class="sbc-big-item"><?php echo esc_html($bundle->name); ?></div>
72 <div class="sbc-highlighted-item">
73 <?php echo esc_html(implode( ', ', $bundle_services_descriptions )); ?>
74 </div>
75 </div>
76 </div>
77 </div>
78 <?php
79 }
80 }
81
82 if ( $cart_bookings && $cart_bundles && $output_target != 'summary_panel' ) {
83 ?>
84 <div class="summary-heading summary-variant-heading">
85 <div class="pb-heading">
86 <div class="pbh-label"><?php esc_html_e( 'Individual Services', 'latepoint' ); ?></div>
87 <div class="pbh-line"></div>
88 </div>
89 </div>
90 <?php
91 }
92 if ( $cart_bookings ) {
93
94 $same_location = OsBookingHelper::bookings_have_same_location( $cart_bookings );
95 $same_agent = OsBookingHelper::bookings_have_same_agent( $cart_bookings );
96
97 $recurrent_bookings_packs = [];
98 foreach ( $cart_bookings as $cart_item_id => $cart_booking ) {
99 $cart_booking->cart_item_id = $cart_item_id;
100 if($cart_booking->recurrence_id){
101 $recurrent_bookings_packs['recurrence_'.$cart_booking->recurrence_id][] = $cart_booking;
102 }else{
103 echo '<div class="cart-item-wrapper ' . esc_attr($count_class) . '">';
104 echo OsBookingHelper::generate_summary_for_booking( $cart_booking, $cart_item_id );
105 if ( ! $same_agent || ! $same_location ) {
106 echo '<div class="booking-summary-info-w">';
107 echo '<div class="summary-boxes-columns">';
108 if ( ! $same_agent && ( OsAgentHelper::count_agents() > 1 ) ) {
109 OsAgentHelper::generate_summary_for_agent( $cart_booking );
110 }
111 if ( ! $same_location ) {
112 OsLocationHelper::generate_summary_for_location( $cart_booking );
113 }
114 echo '</div>';
115 echo '</div>';
116 }
117 echo '</div>';
118 }
119 }
120 if(!empty($recurrent_bookings_packs)){
121 foreach($recurrent_bookings_packs as $recurrent_bookings_pack){
122 echo '<div class="cart-item-wrapper ' . esc_attr($count_class) . '">';
123 $recurrent_bookings_sequence_info = apply_filters('latepoint_recurrent_bookings_sequence_info', '', $recurrent_bookings_pack, $same_location, $same_agent);
124 echo $recurrent_bookings_sequence_info;
125 echo '</div>';
126 }
127 }
128 }
129
130
131 if ( $cart_bookings ) {
132 echo '<div class="booking-summary-info-w">';
133 echo '<div class="summary-boxes-columns">';
134 if ( $same_agent && ( OsAgentHelper::count_agents() > 1 ) ) {
135 OsAgentHelper::generate_summary_for_agent( reset( $cart_bookings ) );
136 }
137 if ( $same_location ) {
138 OsLocationHelper::generate_summary_for_location( reset( $cart_bookings ) );
139 }
140 if ( $customer ) {
141 OsCustomerHelper::generate_summary_for_customer( $customer );
142 }
143 echo '</div>';
144 echo '</div>';
145 } else {
146 if ( $customer ) {
147 echo '<div class="booking-summary-info-w">';
148 echo '<div class="summary-boxes-columns">';
149 OsCustomerHelper::generate_summary_for_customer( $customer );
150 echo '</div>';
151 echo '</div>';
152 }
153 }
154 } else {
155 // no cart items, check if building a booking
156 if ( $booking ) {
157 if ( $customer ) {
158 echo '<div class="booking-summary-info-w">';
159 echo '<div class="summary-boxes-columns">';
160 OsCustomerHelper::generate_summary_for_customer( $customer );
161 echo '</div>';
162 echo '</div>';
163 }
164 }
165 }
166 if ( OsCartsHelper::can_checkout_multiple_items() ) {
167 echo '<div class="latepoint-add-another-item-trigger-wrapper on-summary">
168 <div class="latepoint-add-another-item-trigger" tabindex="0" data-step="' . esc_attr(OsStepsHelper::get_first_step_code( 'booking' )) . '">
169 <i class="latepoint-icon latepoint-icon-plus"></i>
170 <span>' . esc_html__( 'Add More', 'latepoint' ) . '</span>
171 </div>
172 </div>';
173 }
174
175 do_action( 'latepoint_cart_summary_before_price_breakdown', $cart );
176 ?>
177 </div>
178 <?php if ( ! $cart->is_empty() || ( $booking && ! empty( $active_cart_item ) ) ) {
179
180 if ( $cart->is_empty() ) {
181 // cart is empty - temporary add active cart item to cart to get a breakdown
182 $cart->add_item( $active_cart_item, false );
183 $just_added = true;
184 }else{
185 $just_added = false;
186 }
187 $price_breakdown_rows = $cart->generate_price_breakdown_rows( [ 'payments', 'balance' ] );
188 $extra_css_classes = [];
189 $extra_css_classes[] = ( count( $cart->get_items() ) > 1 || ( !$just_added && $booking->is_ready_for_summary() && !$cart->is_empty() && isset( $active_cart_item ) && $active_cart_item->is_new_record() ) ) ? 'compact-summary' : 'full-summary';
190 $extra_css_classes[] = ( count( $cart->get_items() ) > 1 ) ? 'multi-item' : 'single-item';
191 ?>
192 <div class="summary-price-breakdown-wrapper <?php echo esc_attr(implode(' ', $extra_css_classes)); ?>">
193 <?php if( $cart->get_subtotal() > 0 || OsSettingsHelper::is_off('hide_breakdown_if_subtotal_zero')){ ?>
194 <div class="summary-price-breakdown-inner">
195 <div class="price-breakdown-unfold">
196 <i class="latepoint-icon latepoint-icon-chevron-right"></i>
197 <span><?php esc_html_e( 'Breakdown', 'latepoint' ); ?></span>
198 </div>
199 <div class="pb-heading">
200 <div class="pbh-label"><?php esc_html_e( 'Cost Breakdown', 'latepoint' ); ?></div>
201 <div class="pbh-line"></div>
202 </div>
203 <?php
204 OsPriceBreakdownHelper::output_price_breakdown( $price_breakdown_rows ); ?>
205 </div>
206 <?php } ?>
207 <?php
208 if ( OsCartsHelper::can_checkout_multiple_items() ) {
209 echo '<div class="latepoint-add-another-item-trigger-wrapper on-verify">
210 <div class="latepoint-add-another-item-trigger" tabindex="0" data-step="' . esc_attr(OsStepsHelper::get_first_step_code( 'booking' )) . '">
211 <i class="latepoint-icon latepoint-icon-plus"></i>
212 <span>' . esc_html__( 'Add more items to this order', 'latepoint' ) . '</span>
213 </div>
214 </div>';
215 }
216 ?>
217 </div>
218 <?php } ?>