✏️ 正在编辑: booking.php
路径:
/home/h359620/public_html/wp-content/themes/datis/woocommerce/myaccount/booking.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php defined('ABSPATH') || exit; $user_id = get_current_user_id(); $current_page = max(1, absint(get_query_var('paged'))); $per_page = (int) apply_filters('datis_myaccount_consultations_per_page', 6, $user_id); /** * Get user bookings */ $args = [ 'post_type' => Datis_Consultation_Bookings::CPT_BOOKING, 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_query' => [ [ 'key' => '_datis_cb_user_id', 'value' => $user_id, 'compare' => '=' ] ], 'orderby' => 'date', 'order' => 'DESC', ]; $all_bookings = get_posts($args); $all_bookings = is_array($all_bookings) ? $all_bookings : []; $total_items = count($all_bookings); $total_pages = (int) ceil($total_items / max(1, $per_page)); $offset = ($current_page - 1) * $per_page; $bookings = array_slice($all_bookings, $offset, $per_page); $demo = get_option('datis_active_demo'); if (!function_exists('gregorian_to_jalali')) { function gregorian_to_jalali($gy, $gm, $gd, $mod = '') { $g_d_m = array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334); $gy2 = ($gm > 2) ? ($gy + 1) : $gy; $days = 355666 + (365 * $gy) + ((int)(($gy2 + 3) / 4)) - ((int)(($gy2 + 99) / 100)) + ((int)(($gy2 + 399) / 400)) + $gd + $g_d_m[$gm - 1]; $jy = -1595 + (33 * ((int)($days / 12053))); $days %= 12053; $jy += 4 * ((int)($days / 1461)); $days %= 1461; if ($days > 365) { $jy += (int)(($days - 1) / 365); $days = ($days - 1) % 365; } if ($days < 186) { $jm = 1 + (int)($days / 31); $jd = 1 + ($days % 31); } else { $jm = 7 + (int)(($days - 186) / 30); $jd = 1 + (($days - 186) % 30); } return ($mod == '') ? array($jy, $jm, $jd) : $jy . $mod . $jm . $mod . $jd; } } ?> <div class="orders-shell"> <div class="orders-card"> <?php if (!empty($bookings)) : ?> <div class="orders-titlebar"> <h2 class="orders-title"> <?php echo esc_html_x('My consultations', 'booking title', 'datis'); ?> </h2> </div> <div class="orders-table"> <div class="orders-headrow"> <div class="orders-col orders-col-track"><?php echo esc_html_x('Booking ID', 'booking head', 'datis'); ?></div> <div class="orders-col orders-col-actions"><?php echo esc_html_x('Full Name', 'booking head', 'datis'); ?></div> <div class="orders-col orders-col-date"><?php echo esc_html_x('Date', 'booking head', 'datis'); ?></div> <div class="orders-col orders-col-status"><?php echo esc_html_x('Status', 'booking head', 'datis'); ?></div> <div class="orders-col orders-col-total"><?php echo esc_html_x('Type', 'booking head', 'datis'); ?></div> </div> <div class="orders-body"> <?php foreach ($bookings as $post) : ?> <?php $booking_id = $post->ID; $date_g = get_post_meta($booking_id, '_datis_cb_date', true); // YYYY-MM-DD $time = get_post_meta($booking_id, '_datis_cb_time', true); $status = get_post_meta($booking_id, '_datis_cb_status', true); $terms = get_the_terms($booking_id, Datis_Consultation_Bookings::TAX_CATEGORY); $author_id = (int) get_post_field('post_author', $booking_id); $user = get_post_meta($booking_id, '_datis_cb_full_name', true); if (!is_wp_error($terms) && !empty($terms)) { $categories = wp_list_pluck($terms, 'name'); $category_text = implode(', ', $categories); } else { $category_text = '—'; } if ($date_g) { [$y, $m, $d] = array_map('intval', explode('-', $date_g)); $date_text = gregorian_to_jalali($y, $m, $d, '/'); } else { $date_text = '—'; } // $status_text = $status ? ucfirst($status) : esc_html__('confirmed', 'datis'); $status_text = esc_html__('confirmed', 'datis'); ?> <div class="orders-row"> <div class="orders-cell orders-col-track" data-label="<?php echo esc_attr_x('Booking ID', 'booking label', 'datis'); ?>"> <span class="orders-text orders-track"> <?php echo esc_html('#' . $booking_id); ?> </span> </div> <div class="orders-cell orders-col-actions" data-label="<?php echo esc_attr_x('Actions', 'booking label', 'datis'); ?>"> <div class="download-actions-inline"> <span class="orders-user-name"> <?php echo esc_html($user); ?> </span> </div> </div> <div class="orders-cell orders-col-date" data-label="<?php echo esc_attr_x('Date', 'booking label', 'datis'); ?>"> <span class="orders-text"> <?php echo esc_html(trim($date_text . ' ' . $time)); ?> </span> </div> <div class="orders-cell orders-col-status" data-label="<?php echo esc_attr_x('Status', 'booking label', 'datis'); ?>"> <span class="order-status status-default"> <span class="order-status-dot" aria-hidden="true"></span> <span class="order-status-text"> <?php echo esc_html($status_text); ?> </span> </span> </div> <div class="orders-cell orders-col-total" data-label="<?php echo esc_attr_x('Type', 'booking label', 'datis'); ?>"> <span class="orders-text"> <?php echo esc_html($category_text); ?> </span> </div> </div> <?php endforeach; ?> </div> </div> <?php if ($total_pages > 1 && class_exists('Datis_Pagination')) : ?> <div class="orders-pagination mt-4"> <?php echo Datis_Pagination::get_instance()->render(null, [ 'total' => $total_pages, 'current' => $current_page, 'base_url' => wc_get_account_endpoint_url('booking'), 'format' => 'page/%#%/', 'wrap_class' => 'datis-pagination-list', 'item_class' => 'datis-pagination-item', 'current_class' => 'is-current', ]); ?> </div> <?php endif; ?> <?php else : ?> <!-- Empty state --> <div class="empty-orders d-flex flex-column align-items-center justify-content-center gap-3 w-100"> <svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect width="100" height="100" rx="20" fill="var(--datis-primary-color)" fill-opacity="0.08" /> <path d="M41 43.25H59" stroke="var(--datis-primary-color)" stroke-width="3" stroke-linecap="round" /> <path d="M41 51.125H53.375" stroke="var(--datis-primary-color)" stroke-width="3" stroke-linecap="round" /> <path d="M52.445 71.1223L53.7358 71.8864V71.8864L52.445 71.1223ZM53.6647 69.0616L52.3739 68.2976V68.2976L53.6647 69.0616ZM46.3352 69.0616L45.0444 69.8257H45.0444L46.3352 69.0616ZM47.5549 71.1223L48.8458 70.3583V70.3583L47.5549 71.1223ZM26 46.625C26 47.4534 26.6716 48.125 27.5 48.125C28.3284 48.125 29 47.4534 29 46.625H27.5H26ZM29.7422 58.2312C29.4251 57.4658 28.5477 57.1023 27.7823 57.4194C27.017 57.7364 26.6535 58.6138 26.9705 59.3792L28.3564 58.8052L29.7422 58.2312ZM40.5266 65.7308L40.5007 67.2305V67.2305L40.5266 65.7308ZM34.4448 64.8936L33.8708 66.2795H33.8708L34.4448 64.8936ZM71.6436 58.8052L73.0295 59.3792V59.3792L71.6436 58.8052ZM59.4734 65.7308L59.4475 64.231V64.231L59.4734 65.7308ZM65.5552 64.8936L66.1292 66.2795V66.2795L65.5552 64.8936ZM67.1281 29.1578L66.3444 30.4368V30.4368L67.1281 29.1578ZM70.8422 32.8719L72.1212 32.0881V32.0881L70.8422 32.8719ZM32.8719 29.1578L32.0881 27.8788V27.8788L32.8719 29.1578ZM29.1578 32.8719L27.8788 32.0881H27.8788L29.1578 32.8719ZM44.1563 66.2221L44.9104 64.9255L44.9104 64.9255L44.1563 66.2221ZM52.445 71.1223L53.7358 71.8864L54.9555 69.8257L53.6647 69.0616L52.3739 68.2976L51.1541 70.3583L52.445 71.1223ZM46.3352 69.0616L45.0444 69.8257L46.2641 71.8864L47.5549 71.1223L48.8458 70.3583L47.626 68.2976L46.3352 69.0616ZM52.445 71.1223L51.1541 70.3583C50.6478 71.2137 49.3521 71.2137 48.8458 70.3583L47.5549 71.1223L46.2641 71.8864C47.9321 74.7043 52.0679 74.7043 53.7358 71.8864L52.445 71.1223ZM46.625 27.5V29H53.375V27.5V26H46.625V27.5ZM72.5 46.625H71V48.875H72.5H74V46.625H72.5ZM40.5266 65.7308L40.5524 64.231C37.7277 64.1823 36.2152 64.0034 35.0188 63.5078L34.4448 64.8936L33.8708 66.2795C35.6458 67.0147 37.6763 67.1819 40.5007 67.2305L40.5266 65.7308ZM28.3564 58.8052L26.9705 59.3792C28.2646 62.5033 30.7467 64.9854 33.8708 66.2795L34.4448 64.8936L35.0188 63.5078C32.6298 62.5183 30.7317 60.6202 29.7422 58.2312L28.3564 58.8052ZM72.5 48.875H71C71 51.5164 70.9992 53.4224 70.8964 54.9284C70.7946 56.4209 70.5977 57.4107 70.2578 58.2312L71.6436 58.8052L73.0295 59.3792C73.546 58.1323 73.7772 56.7779 73.8895 55.1326C74.0008 53.5008 74 51.4754 74 48.875H72.5ZM59.4734 65.7308L59.4992 67.2305C62.3236 67.1819 64.3542 67.0147 66.1292 66.2795L65.5552 64.8936L64.9812 63.5078C63.7848 64.0034 62.2723 64.1823 59.4475 64.231L59.4734 65.7308ZM71.6436 58.8052L70.2578 58.2312C69.2683 60.6202 67.3702 62.5183 64.9812 63.5078L65.5552 64.8936L66.1292 66.2795C69.2533 64.9854 71.7354 62.5033 73.0295 59.3792L71.6436 58.8052ZM53.375 27.5V29C57.0867 29 59.7651 29.0016 61.8571 29.2005C63.9267 29.3973 65.267 29.7766 66.3444 30.4368L67.1281 29.1578L67.9119 27.8788C66.2839 26.8812 64.4303 26.4316 62.141 26.214C59.8741 25.9984 57.0286 26 53.375 26V27.5ZM72.5 46.625H74C74 42.9714 74.0016 40.1259 73.786 37.859C73.5684 35.5697 73.1188 33.7161 72.1212 32.0881L70.8422 32.8719L69.5632 33.6556C70.2234 34.733 70.6027 36.0733 70.7995 38.1429C70.9984 40.2349 71 42.9133 71 46.625H72.5ZM67.1281 29.1578L66.3444 30.4368C67.6563 31.2407 68.7593 32.3437 69.5632 33.6556L70.8422 32.8719L72.1212 32.0881C71.0699 30.3726 69.6274 28.9301 67.9119 27.8788L67.1281 29.1578ZM46.625 27.5V26C42.9714 26 40.1259 25.9984 37.859 26.214C35.5697 26.4316 33.7161 26.8812 32.0881 27.8788L32.8719 29.1578L33.6556 30.4368C34.733 29.7766 36.0733 29.3973 38.1429 29.2005C40.2349 29.0016 42.9133 29 46.625 29V27.5ZM27.5 46.625H29C29 42.9133 29.0016 40.2349 29.2005 38.1429C29.3973 36.0733 29.7766 34.733 30.4368 33.6556L29.1578 32.8719L27.8788 32.0881C26.8812 33.7161 26.4316 35.5697 26.214 37.859C25.9984 40.1259 26 42.9714 26 46.625H27.5ZM32.8719 29.1578L32.0881 27.8788C30.3726 28.9301 28.9301 30.3726 27.8788 32.0881L29.1578 32.8719L30.4368 33.6556C31.2407 32.3437 32.3437 31.2407 33.6556 30.4368L32.8719 29.1578ZM46.3352 69.0616L47.626 68.2976C47.1674 67.5227 46.7715 66.8508 46.3881 66.3247C45.9862 65.7733 45.5332 65.2877 44.9104 64.9255L44.1563 66.2221L43.4021 67.5188C43.5392 67.5985 43.7026 67.7335 43.9637 68.0917C44.2433 68.4753 44.5569 69.0021 45.0444 69.8257L46.3352 69.0616ZM40.5266 65.7308L40.5007 67.2305C41.4852 67.2475 42.1211 67.26 42.6089 67.314C43.0688 67.3649 43.2701 67.442 43.4021 67.5188L44.1563 66.2221L44.9104 64.9255C44.2827 64.5604 43.6257 64.4082 42.939 64.3322C42.2802 64.2593 41.4812 64.247 40.5524 64.231L40.5266 65.7308ZM53.6647 69.0616L54.9555 69.8257C55.443 69.0021 55.7567 68.4753 56.0362 68.0917C56.2973 67.7335 56.4607 67.5985 56.5978 67.5188L55.8436 66.2221L55.0895 64.9255C54.4667 65.2877 54.0137 65.7733 53.6118 66.3247C53.2284 66.8508 52.8325 67.5227 52.3739 68.2976L53.6647 69.0616ZM59.4734 65.7308L59.4475 64.231C58.5187 64.247 57.7197 64.2593 57.0609 64.3322C56.3742 64.4082 55.7172 64.5604 55.0895 64.9255L55.8436 66.2221L56.5978 67.5188C56.7299 67.442 56.9311 67.3649 57.391 67.314C57.8788 67.26 58.5147 67.2475 59.4992 67.2305L59.4734 65.7308Z" fill="var(--datis-primary-color)" /> </svg> <p> <?php echo esc_html_x('You have no consultation bookings yet.', 'Consultations empty', 'datis'); ?> </p> <a href="<?php echo esc_url(home_url('/#consultation-form')); ?>"> <?php if ($demo == 'industry') : ?> <svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M12.7701 11.8579L10.8921 10.2077M0.750669 1.29699L9.2183 0.750029M0.750669 1.29699L1.29763 9.76463M0.750669 1.29699L8.63844 8.22758" stroke="#F5F5F5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" /> </svg> <?php elseif ($demo == 'business'): ?> <svg width="44" height="40" viewBox="0 0 44 40" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M10 40C4.47715 40 -1.95703e-07 35.5228 -4.37114e-07 30L-1.31134e-06 10C-1.55275e-06 4.47715 4.47715 -1.95703e-07 10 -4.37114e-07L33.1922 -1.45088e-06C39.6979 -1.73525e-06 44.4715 6.11389 42.8937 12.4254L37.8937 32.4254C36.7807 36.877 32.7809 40 28.1922 40L10 40Z" fill="#F9E65C" /> <path d="M15.3433 15.3139H22.3286M15.3433 15.3139V22.2992M15.3433 15.3139L21.4554 21.4261M24.657 24.6276L23.2017 23.1724" stroke="#0A2647" stroke-width="1.23483" stroke-linecap="round" stroke-linejoin="round" /> </svg> <?php else : ?> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M6 6H15M6 6V15M6 6L12.5 12.5M18 18L15.5 15.5" stroke="#F7F6FE" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path> </svg> <?php endif; ?> <?php if ($demo == 'industry' || $demo == 'business') : echo esc_html_x('Book a consultation', 'Consultations empty action', 'datis'); else : ?> <span><?php echo esc_html_x('Book a consultation', 'Consultations empty action', 'datis'); ?></span> <?php endif; ?> </a> </div> <?php endif; ?> </div> </div>
💾 保存文件
← 返回文件管理器