File: /mnt/data/doccure-wp-market/wp-content/themes/doccure/directory/dashboard-staff.php
<?php
/**
*
* The template part for displaying the user dashboard
*
* @package doccure
* @author Dreams Technologies
* @link https://dreamstechnologies.com/
* @since 1.0
*/
if (!defined('ABSPATH')) {
exit;
}
global $current_user, $wp_roles, $userdata, $post, $doccure_options;
$user_identity = $current_user->ID;
$url_identity = !empty($_GET['identity']) ? intval($_GET['identity']) : '';
$user_type = apply_filters('doccure_get_user_type', $user_identity);
$post_id = doccure_get_linked_profile_id($user_identity);
$is_verified = get_post_meta($post_id, '_is_verified', true);
$ref = !empty($_GET['ref']) ? sanitize_text_field($_GET['ref']) : '';
$mode = !empty($_GET['mode']) ? sanitize_text_field($_GET['mode']) : '';
$verify_user = !empty($doccure_options['verify_user']) ? $doccure_options['verify_user'] : '';
$doctor_location = !empty($doccure_options['doctor_location']) ? $doccure_options['doctor_location'] : '';
$doctros_pages = apply_filters('doccure_doctor_redirect_after_login', '');
$doctor_booking_option = '';
if (function_exists('doccure_get_booking_oncall_doctors_option')) {
$doctor_booking_option = doccure_get_booking_oncall_doctors_option();
}
if (have_posts()) {
while (have_posts()):
the_post();
the_content();
wp_link_pages(array(
'before' => '<div class="dc-paginationvtwo"><nav class="dc-pagination"><ul>',
'after' => '</ul></nav></div>',
));
endwhile;
wp_reset_postdata();
}
$remove_payouts = doccure_theme_option('enable_checkout_page');
$payment_type = doccure_theme_option('payment_type');
$show_payout_settings = true;
if (!empty($payment_type) && $payment_type == 'offline') {
if (empty($remove_payouts) && $remove_payouts === 'hide') {
$show_payout_settings = false;
}
}
if (is_user_logged_in() && ($user_type === 'doctors' || $user_type === 'staff')) {
if (empty($is_verified) || $is_verified === 'no') {
$verify = doccure_get_signup_page_url();
?>
<div class="container">
<div class="dc-haslayout dc-jobalertsdashboard re-sendverification">
<?php if (!empty($verify_user) && $verify_user === 'no') {
doccure_Prepare_Notification::doccure_warning(esc_html__('Verification', 'doccure'), esc_html__('Your account will be approved after the verification', 'doccure'), '', '');
} elseif (!empty($verify_user) && $verify_user === 'yes') {
doccure_Prepare_Notification::doccure_warning(esc_html__('Verification', 'doccure'), esc_html__('Your account is not verified. Please check your email for the verification', 'doccure'), 'javascript:;', esc_html__('Resend email', 'doccure'));
}
?>
</div>
</div>
<?php } ?>
<div class="content">
<div class="container users_dashboard">
<div class="row">
<div class="col-lg-4 col-xl-3">
<?php doccure_Profile_Menu::doccure_profile_menu_left(); ?>
</div>
<div class="col-md-7 col-lg-8 col-xl-9">
<div
class="<?php echo ($user_type === 'doctors' || $user_type === 'staff') ? '' : 'dc-haslayout'; ?> dc-dbsectionspace">
<?php
if (!empty($ref) && $ref === 'profile' && $mode === 'settings' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'profile-settings');
} elseif (!empty($ref) && $ref === 'profile' && $mode === 'social' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'social-profile');
} elseif ($mode === 'educations') {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'profile-settings-educations');
} elseif (!empty($ref) && $ref === 'prescription' && $mode === 'view' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'update-prescription');
} elseif ($mode === 'awards') {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'profile-settings-awards');
} elseif ($mode === 'registrations') {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'profile-settings-registrations');
} elseif ($mode === 'location') {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'profile-location');
} elseif ($mode === 'gallery') {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'profile-gallery');
} elseif ($mode === 'booking' && $user_type === 'doctors' && empty($doctor_booking_option)) {
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'profile-booking-options');
} elseif ($user_type === 'doctors' && $ref === 'manage-article' && $mode === 'listings' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'manage-article');
} elseif ($user_type === 'doctors' && $ref === 'manage-clinics' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'clinics-manage');
} elseif ($user_type === 'doctors' && $ref === 'manage-doctors' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'doctors-manage');
} elseif ($user_type === 'doctors' && $ref === 'manage-schedule' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'schedule-manage');
} elseif ($user_type === 'doctors' && $ref === 'appointment' && $mode === 'setting' && ($url_identity === $user_identity)) {
if (!empty($doctor_location) && $doctor_location !== 'clinic' && apply_filters('doccure_is_appointment_allowed', 'dc_bookings', $url_identity) === true) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'appointment-setting');
}
} elseif ($user_type === 'doctors' && $ref === 'appointment' && $mode === 'location-settings' && ($url_identity === $user_identity)) {
if (!empty($doctor_location) && $doctor_location !== 'hospitals') {
get_template_part('directory/front-end/templates/doctors/dashboard', 'appointment-location-settings');
}
} elseif ($user_type === 'doctors' && $ref === 'appointment' && $mode === 'details' && ($url_identity === $user_identity)) {
if (apply_filters('doccure_is_appointment_allowed', 'dc_bookings', $url_identity) === true) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'appointment-detials');
}
} elseif ($user_type === 'doctors' && $ref === 'appointment' && $mode === 'listing' && ($url_identity === $user_identity)) {
if (apply_filters('doccure_is_appointment_allowed', 'dc_bookings', $url_identity) === true) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'appointment-listing');
}
} elseif ($user_type === 'doctors' && !empty($ref) && $ref === 'package' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'packages');
} elseif ($user_type === 'doctors' && !empty($ref) && $ref === 'invoices' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'invoices');
} elseif ($user_type === 'doctors' && !empty($ref) && $ref === 'payouts' && ($url_identity === $user_identity)) {
if (!empty($show_payout_settings)) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'payouts');
}
} elseif ($user_type === 'doctors' && !empty($ref) && $ref === 'specialities' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'profile-settings-specialities');
} elseif ($user_type === 'hospitals' && $ref === 'team' && $mode === 'manage' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/hospitals/dashboard', 'team');
} elseif ($user_type === 'hospitals' && $ref === 'location' && $mode === 'details') {
get_template_part('directory/front-end/templates/hospitals/dashboard', 'location-details');
} elseif ($user_type === 'hospitals' && !empty($ref) && $ref === 'specialities' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'profile-settings-specialities');
} elseif ($user_type === 'staff' && $ref === 'appointment' && $mode === 'listing' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/staff/dashboard', 'appointment-listing');
}else if ($user_type === 'staff' && !empty($ref) && $_GET['ref'] === 'manage-inbox' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/staff/dashboard', 'inbox-listing');
}
elseif ($user_type === 'staff' && !empty($ref) && $ref === 'invoices' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'invoices');
} else if ($user_type === 'staff' && !empty($ref) && $_GET['ref'] === 'payments-info' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'payments-info');
} else if ($user_type === 'staff' && !empty($ref) && $_GET['ref'] === 'manage-leave' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/staff/dashboard', 'leave-listing');
} else if ($user_type === 'doctors' && !empty($ref) && $_GET['ref'] === 'payments-info' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/doctors/dashboard', 'payments-info');
} else if ($user_type === 'staff' && !empty($ref) && $_GET['ref'] === 'manage-attendance' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/staff/dashboard', 'attendance-listing');
} elseif (!empty($ref) && $ref === 'account-settings' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'account-manage');
} elseif (!empty($ref) && $ref === 'saved' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/dashboard', 'saved-items');
} else if ($user_type === 'staff' && !empty($ref) && $_GET['ref'] === 'payments-info' && ($url_identity === $user_identity)) {
get_template_part('directory/front-end/templates/staff/dashboard', 'payments-info');
} else if ($user_type === 'staff' && $ref === 'appointment' && $mode === 'listing' && ($url_identity === $user_identity)) {
if (apply_filters('doccure_is_appointment_allowed', 'dc_bookings', $url_identity) === true) {
get_template_part('directory/front-end/templates/staff/dashboard', 'appointment-listing');
}
} else if (!empty($ref) && $ref === 'chat' && ($url_identity === $user_identity)) {
if (
(!empty($user_type)
&& ($user_type === 'doctors' && apply_filters('doccure_is_feature_allowed', 'dc_chat', $user_identity) === true))
|| $user_type === 'doctors_staff'
|| $user_type === 'regular_users'
|| $user_type === 'staff'
) {
get_template_part('directory/front-end/templates/dashboard', 'messaging');
}
} else {
// Default template when no ref/mode is specified
if ($user_type === 'staff') {
// For staff users, default to appointment listing
get_template_part('directory/front-end/templates/staff/dashboard', 'current-appointment-listing');
} else {
// For doctors, use the insights template
get_template_part('directory/front-end/templates/' . $user_type . '/dashboard', 'insights');
}
}
?>
</div>
</div>
</div>
</div>
</div>
<?php } else { ?>
<div class="container">
<div class="dc-haslayout page-data">
<?php
doccure_Prepare_Notification::doccure_warning(
esc_html__('Restricted Access', 'doccure'),
esc_html__('You do not have permission to view this page. Please login as Doctor or Staff.', 'doccure')
);
?>
</div>
</div>
<?php } ?>