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