PluginProbe ʕ •ᴥ•ʔ
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress / 5.1.6
Appointment Booking Plugin – LatePoint | Calendar & Scheduling for WordPress v5.1.6
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
204 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 <i class="latepoint-icon latepoint-icon-minus"></i></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 foreach ( $cart_bookings as $cart_item_id => $cart_booking ) {
98 echo '<div class="cart-item-wrapper ' . esc_attr($count_class) . '">';
99 echo OsBookingHelper::generate_summary_for_booking( $cart_booking, $cart_item_id );
100 if ( ! $same_agent || ! $same_location ) {
101 echo '<div class="booking-summary-info-w">';
102 echo '<div class="summary-boxes-columns">';
103 if ( ! $same_agent && ( OsAgentHelper::count_agents() > 1 ) ) {
104 OsAgentHelper::generate_summary_for_agent( $cart_booking );
105 }
106 if ( ! $same_location ) {
107 OsLocationHelper::generate_summary_for_location( $cart_booking );
108 }
109 echo '</div>';
110 echo '</div>';
111 }
112 echo '</div>';
113 }
114 }
115
116
117 if ( $cart_bookings ) {
118 echo '<div class="booking-summary-info-w">';
119 echo '<div class="summary-boxes-columns">';
120 if ( $same_agent && ( OsAgentHelper::count_agents() > 1 ) ) {
121 OsAgentHelper::generate_summary_for_agent( reset( $cart_bookings ) );
122 }
123 if ( $same_location ) {
124 OsLocationHelper::generate_summary_for_location( reset( $cart_bookings ) );
125 }
126 if ( $customer ) {
127 OsCustomerHelper::generate_summary_for_customer( $customer );
128 }
129 echo '</div>';
130 echo '</div>';
131 } else {
132 if ( $customer ) {
133 echo '<div class="booking-summary-info-w">';
134 echo '<div class="summary-boxes-columns">';
135 OsCustomerHelper::generate_summary_for_customer( $customer );
136 echo '</div>';
137 echo '</div>';
138 }
139 }
140 } else {
141 // no cart items, check if building a booking
142 if ( $booking ) {
143 if ( $customer ) {
144 echo '<div class="booking-summary-info-w">';
145 echo '<div class="summary-boxes-columns">';
146 OsCustomerHelper::generate_summary_for_customer( $customer );
147 echo '</div>';
148 echo '</div>';
149 }
150 }
151 }
152 if ( OsCartsHelper::can_checkout_multiple_items() ) {
153 echo '<div class="latepoint-add-another-item-trigger-wrapper on-summary">
154 <div class="latepoint-add-another-item-trigger" tabindex="0" data-step="' . esc_attr(OsStepsHelper::get_first_step_code( 'booking' )) . '">
155 <i class="latepoint-icon latepoint-icon-plus"></i>
156 <span>' . esc_html__( 'Add More', 'latepoint' ) . '</span>
157 </div>
158 </div>';
159 }
160
161 do_action( 'latepoint_cart_summary_before_price_breakdown', $cart );
162 ?>
163 </div>
164 <?php if ( ! $cart->is_empty() || ( $booking && ! empty( $active_cart_item ) ) ) {
165
166 if ( $cart->is_empty() ) {
167 // cart is empty - temporary add active cart item to cart to get a breakdown
168 $cart->add_item( $active_cart_item, false );
169 $just_added = true;
170 }else{
171 $just_added = false;
172 }
173 $price_breakdown_rows = $cart->generate_price_breakdown_rows( [ 'payments', 'balance' ] );
174 $extra_css_classes = [];
175 $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';
176 $extra_css_classes[] = ( count( $cart->get_items() ) > 1 ) ? 'multi-item' : 'single-item';
177 ?>
178 <div class="summary-price-breakdown-wrapper <?php echo esc_attr(implode(' ', $extra_css_classes)); ?>">
179 <?php if( $cart->get_subtotal() > 0 || OsSettingsHelper::is_off('hide_breakdown_if_subtotal_zero')){ ?>
180 <div class="summary-price-breakdown-inner">
181 <div class="price-breakdown-unfold">
182 <i class="latepoint-icon latepoint-icon-chevron-right"></i>
183 <span><?php esc_html_e( 'Breakdown', 'latepoint' ); ?></span>
184 </div>
185 <div class="pb-heading">
186 <div class="pbh-label"><?php esc_html_e( 'Cost Breakdown', 'latepoint' ); ?></div>
187 <div class="pbh-line"></div>
188 </div>
189 <?php
190 OsPriceBreakdownHelper::output_price_breakdown( $price_breakdown_rows ); ?>
191 </div>
192 <?php } ?>
193 <?php
194 if ( OsCartsHelper::can_checkout_multiple_items() ) {
195 echo '<div class="latepoint-add-another-item-trigger-wrapper on-verify">
196 <div class="latepoint-add-another-item-trigger" tabindex="0" data-step="' . esc_attr(OsStepsHelper::get_first_step_code( 'booking' )) . '">
197 <i class="latepoint-icon latepoint-icon-plus"></i>
198 <span>' . esc_html__( 'Add more items to this order', 'latepoint' ) . '</span>
199 </div>
200 </div>';
201 }
202 ?>
203 </div>
204 <?php } ?>