import_steps
9 months ago
_table_body.php
9 months ago
edit_form.php
1 year ago
import_csv_modal.php
9 months ago
import_load_step.php
9 months ago
index.php
4 months ago
inline_edit_form.php
1 year ago
mini_profile.php
1 year ago
new_form.php
1 year ago
query_for_booking_form.php
1 year ago
quick_edit.php
4 months ago
view_customer_log.php
1 year ago
quick_edit.php
180 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @var $customer OsCustomerModel |
| 4 | **/ |
| 5 | |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; // Exit if accessed directly |
| 9 | } |
| 10 | ?> |
| 11 | <div class="os-form-w quick-customer-form-w <?php echo ($customer->is_new_record()) ? 'is-new-customer' : 'is-existing-customer' ;?>" data-refresh-route-name="<?php echo esc_attr(OsRouterHelper::build_route_name('customers', 'quick_edit')); ?>"> |
| 12 | <form action="" |
| 13 | data-route-name="<?php echo ($customer->is_new_record()) ? esc_attr(OsRouterHelper::build_route_name('customers', 'create')) : esc_attr(OsRouterHelper::build_route_name('customers', 'update')); ?>" |
| 14 | class="customer-quick-edit-form"> |
| 15 | <div class="os-form-header"> |
| 16 | <?php if($customer->is_new_record()){ ?> |
| 17 | <h2><?php esc_html_e('New Customer', 'latepoint'); ?></h2> |
| 18 | <?php }else{ ?> |
| 19 | <h2><?php esc_html_e('Edit Customer', 'latepoint'); ?></h2> |
| 20 | <?php } ?> |
| 21 | <a href="#" class="latepoint-side-panel-close latepoint-side-panel-close-trigger"><i class="latepoint-icon latepoint-icon-x"></i></a> |
| 22 | </div> |
| 23 | <div class="os-form-content"> |
| 24 | <?php if(!$customer->is_new_record()){ ?> |
| 25 | <div class="quick-booking-info"> |
| 26 | <?php echo '<span>'.esc_html__('Customer ID:', 'latepoint').'</span><strong>'. esc_html($customer->id).'</strong>'; ?> |
| 27 | <?php if (OsAuthHelper::get_current_user()->has_capability('activity__view')) echo '<a href="#" data-customer-id="' . esc_attr($customer->id) . '" data-route="' . esc_attr(OsRouterHelper::build_route_name('customers', 'view_customer_log')) . '" class="quick-customer-form-view-log-btn"><i class="latepoint-icon latepoint-icon-clock"></i>' . esc_html__('History', 'latepoint') . '</a>'; ?> |
| 28 | </div> |
| 29 | <?php } ?> |
| 30 | <div class="fields-with-avatar"> |
| 31 | <div class="avatar-column"> |
| 32 | <div class="avatar-uploader-w"> |
| 33 | <?php echo OsFormHelper::media_uploader_field('customer[avatar_image_id]', 0, __('Set Avatar', 'latepoint'), __('Remove Avatar', 'latepoint'), $customer->avatar_image_id, [], [], true, true); ?> |
| 34 | </div> |
| 35 | </div> |
| 36 | <div class="field-column"> |
| 37 | <?php echo OsFormHelper::text_field('customer[first_name]', __('First Name', 'latepoint'), $customer->first_name, ['theme' => 'simple', 'validate' => $customer->get_validations_for_property('first_name')]); ?> |
| 38 | </div> |
| 39 | <div class="field-column"> |
| 40 | <?php echo OsFormHelper::text_field('customer[last_name]', __('Last Name', 'latepoint'), $customer->last_name, ['theme' => 'simple', 'validate' => $customer->get_validations_for_property('last_name')]); ?> |
| 41 | </div> |
| 42 | </div> |
| 43 | |
| 44 | <div class="os-form-sub-header"> |
| 45 | <h3><?php esc_html_e('Contact Info', 'latepoint'); ?></h3> |
| 46 | </div> |
| 47 | <div class="os-row"> |
| 48 | <div class="os-col-lg-12"> |
| 49 | <?php echo OsFormHelper::text_field('customer[email]', __('Email Address', 'latepoint'), $customer->email, ['theme' => 'simple', 'validate' => $customer->get_validations_for_property('email')]); ?> |
| 50 | </div> |
| 51 | <div class="os-col-lg-12"> |
| 52 | <?php echo OsFormHelper::phone_number_field('customer[phone]', __('Phone Number', 'latepoint'), $customer->phone, ['theme' => 'simple', 'validate' => $customer->get_validations_for_property('phone')]); ?> |
| 53 | </div> |
| 54 | </div> |
| 55 | <div class="os-form-sub-header"> |
| 56 | <h3><?php esc_html_e('Notes', 'latepoint'); ?></h3> |
| 57 | </div> |
| 58 | <div class="os-row"> |
| 59 | <div class="os-col-lg-12"> |
| 60 | <?php echo OsFormHelper::textarea_field('customer[notes]', __('Notes left by the customer', 'latepoint'), $customer->notes, ['theme' => 'simple', 'rows' => 3]); ?> |
| 61 | </div> |
| 62 | </div> |
| 63 | <div class="os-row"> |
| 64 | <div class="os-col-lg-12"> |
| 65 | <?php echo OsFormHelper::textarea_field('customer[admin_notes]', __('Admin notes (visible only to admins)', 'latepoint'), $customer->admin_notes, ['theme' => 'simple', 'rows' => 3]); ?> |
| 66 | </div> |
| 67 | </div> |
| 68 | <?php if(!$customer->is_new_record()){ ?> |
| 69 | <div class="customer-password-info <?php echo ($customer->is_guest) ? 'password-not-set' : 'password-set'; ?>"> |
| 70 | <?php if($customer->is_guest) { |
| 71 | esc_html_e('Guest Account', 'latepoint'); |
| 72 | }else{ |
| 73 | esc_html_e('Password Protected', 'latepoint'); |
| 74 | echo '<a href="#" data-os-success-action="reload" |
| 75 | data-os-params="'.esc_attr(OsUtilHelper::build_os_params(['id' => $customer->id], 'set_customer_as_guest_'.$customer->id)).'" |
| 76 | data-os-prompt="'.esc_attr__('Are you sure you want to allow this customer to book without logging in?', 'latepoint').'" |
| 77 | data-os-action="'.esc_attr(OsRouterHelper::build_route_name('customers', 'set_as_guest')).'">'.esc_html__('Convert to Guest', 'latepoint').'</a>'; |
| 78 | } ?> |
| 79 | </div> |
| 80 | <?php } ?> |
| 81 | <?php if(!$customer->is_new_record() && OsAuthHelper::can_wp_users_login_as_customers()){ ?> |
| 82 | <div class="connected-wp-user-status"> |
| 83 | <?php |
| 84 | if($customer->wordpress_user_id){ |
| 85 | echo '<div class="connected-note">'.esc_html__('Connected', 'latepoint').'</div>'; |
| 86 | echo '<div class="connected-buttons"> <a target="_blank" href="'.esc_attr(get_edit_user_link($customer->wordpress_user_id)).'"><i class="latepoint-icon latepoint-icon-external-link"></i><span>'.esc_html__('View Profile', 'latepoint').'</span></a> <span>or</span> <a href="#" data-os-success-action="reload" data-os-params="'.esc_attr(OsUtilHelper::build_os_params(['customer_id' => $customer->id], 'disconnect_customer_from_wp_user_'.$customer->id)).'" data-os-action="'.esc_attr(OsRouterHelper::build_route_name('customers', 'disconnect_from_wp_user')).'"><i class="latepoint-icon latepoint-icon-slash"></i><span>'.esc_html__('Disconnect', 'latepoint').'</a></div>'; |
| 87 | }else{ |
| 88 | echo '<div class="connected-note">'.esc_html__('Not Connected', 'latepoint').'</div>'; |
| 89 | echo '<div class="connected-buttons"> <a href="#" data-os-success-action="reload" data-os-params="'.esc_attr(OsUtilHelper::build_os_params(['customer_id' => $customer->id], 'connect_customer_to_wp_user_'.$customer->id)).'" data-os-action="'.esc_attr(OsRouterHelper::build_route_name('customers', 'connect_to_wp_user')).'"><i class="latepoint-icon latepoint-icon-link-2"></i><span>'.esc_html__('Connect', 'latepoint').'</span></a></div>'; |
| 90 | } |
| 91 | ?> |
| 92 | </div> |
| 93 | <?php } ?> |
| 94 | |
| 95 | <?php |
| 96 | /** |
| 97 | * Content that goes after customer edit form |
| 98 | * |
| 99 | * @since 5.0.0 |
| 100 | * @hook latepoint_customer_edit_form_after |
| 101 | * |
| 102 | * @param {OsCustomerModel} $customer Customer object that is being edited |
| 103 | */ |
| 104 | do_action('latepoint_customer_edit_form_after', $customer); ?> |
| 105 | |
| 106 | <?php if(!$customer->is_new_record()){ ?> |
| 107 | <div class="customer-appointments"> |
| 108 | <div class="os-form-sub-header"> |
| 109 | <h3><?php esc_html_e('Appointments', 'latepoint'); ?></h3> |
| 110 | <div class="os-form-sub-header-actions"> |
| 111 | <a href="#" class="latepoint-btn latepoint-btn-sm latepoint-btn-link" <?php echo OsOrdersHelper::quick_order_btn_html(false, ['customer_id' => $customer->id]); ?>> |
| 112 | <i class="latepoint-icon latepoint-icon-plus"></i><span><?php esc_html_e('Add', 'latepoint'); ?></span> |
| 113 | </a> |
| 114 | </div> |
| 115 | </div> |
| 116 | <?php |
| 117 | $customer_bookings = $customer->get_bookings(false, true); |
| 118 | if($customer_bookings){ |
| 119 | echo '<div class="customer-appointments-list">'; |
| 120 | foreach($customer_bookings as $booking){ |
| 121 | ?> |
| 122 | <div class="order-item" <?php echo OsBookingHelper::quick_booking_btn_html($booking->id); ?>> |
| 123 | <div class="avatar-w" style="background-image: url(<?php echo esc_url($booking->agent->get_avatar_url()); ?>);"> |
| 124 | <div class="agent-info-tooltip"><?php echo esc_html($booking->agent->full_name); ?></div> |
| 125 | </div> |
| 126 | <div class="oi-info"> |
| 127 | <div class="oi-service-name"><?php echo esc_html($booking->service->name); ?></div> |
| 128 | <div class="oi-date-w"> |
| 129 | <div class="oi-date-i"> |
| 130 | <span class="oi-date"><?php echo esc_html($booking->nice_start_date); ?></span>, <span class="appointment-time"><?php echo esc_html(implode('-', array($booking->nice_start_time, $booking->nice_end_time))); ?></span> |
| 131 | </div> |
| 132 | </div> |
| 133 | </div> |
| 134 | </div> |
| 135 | <?php |
| 136 | } |
| 137 | echo '</div>'; |
| 138 | }else{ ?> |
| 139 | <div class="no-results-w"> |
| 140 | <?php esc_html_e('Customer does not have any bookings', 'latepoint'); ?> |
| 141 | </div> |
| 142 | <?php |
| 143 | } ?> |
| 144 | </div> |
| 145 | <?php } ?> |
| 146 | |
| 147 | </div> |
| 148 | <div class="os-form-buttons os-quick-form-buttons"> |
| 149 | <?php |
| 150 | if($customer->is_new_record()){ |
| 151 | if(OsRolesHelper::can_user('customer__create')) echo '<button name="submit" type="submit" class="latepoint-btn latepoint-btn-block latepoint-btn-lg">'.esc_html__('Create Customer', 'latepoint').'</button>'; |
| 152 | }else{ |
| 153 | if(OsRolesHelper::can_user('customer__edit')){ |
| 154 | echo '<div class="os-full">'; |
| 155 | echo '<button name="submit" type="submit" class="latepoint-btn latepoint-btn-block latepoint-btn-lg">'.esc_html__('Save Changes', 'latepoint').'</button>'; |
| 156 | echo '</div>'; |
| 157 | } |
| 158 | if(OsRolesHelper::can_user('customer__delete')) { |
| 159 | echo '<div class="os-compact">'; |
| 160 | echo '<a href="#" class=" remove-customer-btn latepoint-btn latepoint-btn-secondary latepoint-btn-lg latepoint-btn-just-icon" |
| 161 | data-os-prompt="' . esc_attr__('Are you sure you want to delete this customer? It will remove all appointments and transactions associated with this customer.', 'latepoint') . '" |
| 162 | data-os-redirect-to="' . esc_attr(OsRouterHelper::build_link(OsRouterHelper::build_route_name('customers', 'index'))) . '" |
| 163 | data-os-params="' . esc_attr(OsUtilHelper::build_os_params(['id' => $customer->id], 'destroy_customer_'.$customer->id)) . '" |
| 164 | data-os-success-action="redirect" |
| 165 | data-os-action="' . esc_attr(OsRouterHelper::build_route_name('customers', 'destroy') ). '" |
| 166 | title="' . esc_attr__('Delete Customer', 'latepoint') . '"> |
| 167 | <i class="latepoint-icon latepoint-icon-trash1"></i> |
| 168 | </a>'; |
| 169 | echo '</div>'; |
| 170 | } |
| 171 | } |
| 172 | ?> |
| 173 | </div> |
| 174 | <?php |
| 175 | echo OsFormHelper::hidden_field('customer[id]', $customer->id); |
| 176 | wp_nonce_field($customer->is_new_record() ? 'new_customer' : 'edit_customer_'.$customer->id); |
| 177 | ?> |
| 178 | </form> |
| 179 | </div> |
| 180 |