PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.2.1
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.2.1
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 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 9 months ago _contact_form.php 9 months ago _limit_reached.php 1 year ago _monthly_calendar_days.php 1 year ago _order_summary.php 1 year ago
_cart_summary.php
207 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-route="<?php echo esc_attr(OsRouterHelper::build_route_name( 'carts', 'remove_item_from_cart' )); ?>">
70 <div class="os-remove-from-cart-icon"></div></div>
71 <?php } ?>
72 <div class="sbc-big-item"><?php echo esc_html($bundle->name); ?></div>
73 <div class="sbc-highlighted-item">
74 <?php echo esc_html(implode( ', ', $bundle_services_descriptions )); ?>
75 </div>
76 </div>
77 </div>
78 </div>
79 <?php
80 }
81 }
82
83 if ( $cart_bookings && $cart_bundles && $output_target != 'summary_panel' ) {
84 ?>
85 <div class="summary-heading summary-variant-heading">
86 <div class="pb-heading">
87 <div class="pbh-label"><?php esc_html_e( 'Individual Services', 'latepoint' ); ?></div>
88 <div class="pbh-line"></div>
89 </div>
90 </div>
91 <?php
92 }
93 if ( $cart_bookings ) {
94
95 $same_location = OsBookingHelper::bookings_have_same_location( $cart_bookings );
96 $same_agent = OsBookingHelper::bookings_have_same_agent( $cart_bookings );
97
98 $recurrent_bookings_packs = [];
99 foreach ( $cart_bookings as $cart_item_id => $cart_booking ) {
100 $cart_booking->cart_item_id = $cart_item_id;
101 if($cart_booking->recurrence_id){
102 $recurrent_bookings_packs['recurrence_'.$cart_booking->recurrence_id][] = $cart_booking;
103 }else{
104 echo '<div class="cart-item-wrapper ' . esc_attr($count_class) . '">';
105 echo OsBookingHelper::generate_summary_for_booking( $cart_booking, $cart_item_id );
106 if ( ! $same_agent || ! $same_location ) {
107 echo '<div class="booking-summary-info-w">';
108 echo '<div class="summary-boxes-columns">';
109 if ( ! $same_agent && ( OsAgentHelper::count_agents() > 1 ) ) {
110 OsAgentHelper::generate_summary_for_agent( $cart_booking );
111 }
112 if ( ! $same_location ) {
113 OsLocationHelper::generate_summary_for_location( $cart_booking );
114 }
115 echo '</div>';
116 echo '</div>';
117 }
118 echo '</div>';
119 }
120 }
121 if(!empty($recurrent_bookings_packs)){
122 foreach($recurrent_bookings_packs as $recurrent_bookings_pack){
123 echo '<div class="cart-item-wrapper ' . esc_attr($count_class) . '">';
124 $recurrent_bookings_sequence_info = apply_filters('latepoint_recurrent_bookings_sequence_info', '', $recurrent_bookings_pack, $same_location, $same_agent);
125 echo $recurrent_bookings_sequence_info;
126 echo '</div>';
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 ( !empty($customer) && !$customer->is_new_record() ) {
141 OsCustomerHelper::generate_summary_for_customer( $customer, ($current_step_code != 'customer') );
142 }
143 echo '</div>';
144 echo '</div>';
145 } else {
146 if ( !empty($customer) && !$customer->is_new_record() ) {
147 echo '<div class="booking-summary-info-w">';
148 echo '<div class="summary-boxes-columns">';
149 OsCustomerHelper::generate_summary_for_customer( $customer, ($current_step_code != 'customer') );
150 echo '</div>';
151 echo '</div>';
152 }
153 }
154 }
155 if ( OsCartsHelper::can_checkout_multiple_items() ) {
156 echo '<div class="latepoint-add-another-item-trigger-wrapper on-summary">
157 <div class="latepoint-add-another-item-trigger" tabindex="0" data-step="' . esc_attr(OsStepsHelper::get_first_step_code( 'booking' )) . '">
158 <i class="latepoint-icon latepoint-icon-plus"></i>
159 <span>' . esc_html__( 'Add More', 'latepoint' ) . '</span>
160 </div>
161 </div>';
162 }
163
164 do_action( 'latepoint_cart_summary_before_price_breakdown', $cart );
165 ?>
166 </div>
167 <?php if ( ! $cart->is_empty() || ( $booking && ! empty( $active_cart_item ) ) ) {
168
169 if ( $cart->is_empty() ) {
170 // cart is empty - temporary add active cart item to cart to get a breakdown
171 $cart->add_item( $active_cart_item, false );
172 $just_added = true;
173 }else{
174 $just_added = false;
175 }
176 $price_breakdown_rows = $cart->generate_price_breakdown_rows( [ 'payments', 'balance' ] );
177 $extra_css_classes = [];
178 $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';
179 $extra_css_classes[] = ( count( $cart->get_items() ) > 1 ) ? 'multi-item' : 'single-item';
180 ?>
181 <div class="summary-price-breakdown-wrapper <?php echo esc_attr(implode(' ', $extra_css_classes)); ?>">
182 <?php if( $cart->get_subtotal() > 0 || OsSettingsHelper::is_off('hide_breakdown_if_subtotal_zero')){ ?>
183 <div class="summary-price-breakdown-inner">
184 <div class="price-breakdown-unfold">
185 <i class="latepoint-icon latepoint-icon-chevron-right"></i>
186 <span><?php esc_html_e( 'Breakdown', 'latepoint' ); ?></span>
187 </div>
188 <div class="pb-heading">
189 <div class="pbh-label"><?php esc_html_e( 'Cost Breakdown', 'latepoint' ); ?></div>
190 <div class="pbh-line"></div>
191 </div>
192 <?php
193 OsPriceBreakdownHelper::output_price_breakdown( $price_breakdown_rows ); ?>
194 </div>
195 <?php } ?>
196 <?php
197 if ( OsCartsHelper::can_checkout_multiple_items() ) {
198 echo '<div class="latepoint-add-another-item-trigger-wrapper on-verify">
199 <div class="latepoint-add-another-item-trigger" tabindex="0" data-step="' . esc_attr(OsStepsHelper::get_first_step_code( 'booking' )) . '">
200 <i class="latepoint-icon latepoint-icon-plus"></i>
201 <span>' . esc_html__( 'Add more items to this order', 'latepoint' ) . '</span>
202 </div>
203 </div>';
204 }
205 ?>
206 </div>
207 <?php } ?>