import React, { ReactElement, useEffect } from 'react';
import Head from 'next/head'
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import dayjs from "dayjs";
import {useAppDispatch, useAppSelector} from "../../stores/hooks";
import {useRouter} from "next/router";
import { fetch } from '../../stores/doctor_profiles/doctor_profilesSlice'
import {saveFile} from "../../helpers/fileSaver";
import dataFormatter from '../../helpers/dataFormatter';
import ImageField from "../../components/ImageField";
import LayoutAuthenticated from "../../layouts/Authenticated";
import {getPageTitle} from "../../config";
import SectionTitleLineWithButton from "../../components/SectionTitleLineWithButton";
import SectionMain from "../../components/SectionMain";
import CardBox from "../../components/CardBox";
import BaseButton from "../../components/BaseButton";
import BaseDivider from "../../components/BaseDivider";
import {mdiChartTimelineVariant} from "@mdi/js";
import {SwitchField} from "../../components/SwitchField";
import FormField from "../../components/FormField";

import {hasPermission} from "../../helpers/userPermissions";


const Doctor_profilesView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { doctor_profiles } = useAppSelector((state) => state.doctor_profiles)
    
    const { currentUser } = useAppSelector((state) => state.auth);
    

    const { id } = router.query;
    
    function removeLastCharacter(str) {
      console.log(str,`str`)
      return str.slice(0, -1);
    }

    useEffect(() => {
        dispatch(fetch({ id }));
    }, [dispatch, id]);


    return (
      <>
          <Head>
              <title>{getPageTitle('View doctor_profiles')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View doctor_profiles')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/doctor_profiles/doctor_profiles-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>User</p>
                    
                    
                        <p>{doctor_profiles?.user?.firstName ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>DoctorType</p>
                    <p>{doctor_profiles?.doctor_type ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              
                {hasPermission(currentUser, 'READ_ORGANIZATIONS') && 
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Organization</p>
                    
                    
                    
                    
                    
                    
                    
                    
                        <p>{doctor_profiles?.organization?.name ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                  } 
              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>MedicalLicenseNumber</p>
                    <p>{doctor_profiles?.medical_license_number}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Specialization</p>
                    <p>{doctor_profiles?.specialization}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>Qualification</p>
                    <p>{doctor_profiles?.qualification}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              
                <div className={'mb-4'}>
                  <p className={'block font-bold mb-2'}>YearsOfExperience</p>
                  <p>{doctor_profiles?.years_of_experience || 'No data'}</p>
                </div>
              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>AvailabilityStatus</p>
                    <p>{doctor_profiles?.availability_status ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>ConsultationFeeNote</p>
                    <p>{doctor_profiles?.consultation_fee_note}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Patient_profiles PrimaryRuralDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                <th>PatientIdentifier</th>
                                
                                
                                
                                <th>Gender</th>
                                
                                
                                
                                <th>DateOfBirth</th>
                                
                                
                                
                                <th>BloodGroup</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>Village</th>
                                
                                
                                
                                <th>District</th>
                                
                                
                                
                                <th>State</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>ConsentForTelemedicine</th>
                                
                                
                                
                                <th>ConsentForNotifications</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.patient_profiles_primary_rural_doctor && Array.isArray(doctor_profiles.patient_profiles_primary_rural_doctor) &&
                              doctor_profiles.patient_profiles_primary_rural_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/patient_profiles/patient_profiles-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    <td data-label="patient_identifier">
                                        { item.patient_identifier }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="gender">
                                        { item.gender }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="date_of_birth">
                                        { dataFormatter.dateTimeFormatter(item.date_of_birth) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="blood_group">
                                        { item.blood_group }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line">
                                        { item.address_line }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="village">
                                        { item.village }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="district">
                                        { item.district }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="state">
                                        { item.state }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="consent_for_telemedicine">
                                        { dataFormatter.booleanFormatter(item.consent_for_telemedicine) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="consent_for_notifications">
                                        { dataFormatter.booleanFormatter(item.consent_for_notifications) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.patient_profiles_primary_rural_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Medical_camps CampLeadDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>CampName</th>
                                
                                
                                
                                <th>CampType</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>StartAt</th>
                                
                                
                                
                                <th>EndAt</th>
                                
                                
                                
                                <th>LocationLabel</th>
                                
                                
                                
                                <th>Address</th>
                                
                                
                                
                                <th>Latitude</th>
                                
                                
                                
                                <th>Longitude</th>
                                
                                
                                
                                <th>CampStatus</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.medical_camps_camp_lead_doctor && Array.isArray(doctor_profiles.medical_camps_camp_lead_doctor) &&
                              doctor_profiles.medical_camps_camp_lead_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/medical_camps/medical_camps-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="camp_name">
                                        { item.camp_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="camp_type">
                                        { item.camp_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="start_at">
                                        { dataFormatter.dateTimeFormatter(item.start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="end_at">
                                        { dataFormatter.dateTimeFormatter(item.end_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="location_label">
                                        { item.location_label }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address_line">
                                        { item.address_line }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="latitude">
                                        { item.latitude }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="longitude">
                                        { item.longitude }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="camp_status">
                                        { item.camp_status }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.medical_camps_camp_lead_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Appointments Doctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>ScheduledStartAt</th>
                                
                                
                                
                                <th>ScheduledEndAt</th>
                                
                                
                                
                                <th>AppointmentType</th>
                                
                                
                                
                                <th>AppointmentStatus</th>
                                
                                
                                
                                <th>Reason</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.appointments_doctor && Array.isArray(doctor_profiles.appointments_doctor) &&
                              doctor_profiles.appointments_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/appointments/appointments-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="scheduled_start_at">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_start_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduled_end_at">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_end_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="appointment_type">
                                        { item.appointment_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="appointment_status">
                                        { item.appointment_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="reason">
                                        { item.reason }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.appointments_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Consultations PrimaryDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>EndedAt</th>
                                
                                
                                
                                <th>Channel</th>
                                
                                
                                
                                <th>ConsultationStatus</th>
                                
                                
                                
                                <th>ChiefComplaint</th>
                                
                                
                                
                                
                                
                                <th>DiagnosisSummary</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.consultations_primary_doctor && Array.isArray(doctor_profiles.consultations_primary_doctor) &&
                              doctor_profiles.consultations_primary_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/consultations/consultations-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ended_at">
                                        { dataFormatter.dateTimeFormatter(item.ended_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="channel">
                                        { item.channel }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="consultation_status">
                                        { item.consultation_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="chief_complaint">
                                        { item.chief_complaint }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="diagnosis_summary">
                                        { item.diagnosis_summary }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.consultations_primary_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Consultations SecondaryDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>EndedAt</th>
                                
                                
                                
                                <th>Channel</th>
                                
                                
                                
                                <th>ConsultationStatus</th>
                                
                                
                                
                                <th>ChiefComplaint</th>
                                
                                
                                
                                
                                
                                <th>DiagnosisSummary</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.consultations_secondary_doctor && Array.isArray(doctor_profiles.consultations_secondary_doctor) &&
                              doctor_profiles.consultations_secondary_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/consultations/consultations-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ended_at">
                                        { dataFormatter.dateTimeFormatter(item.ended_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="channel">
                                        { item.channel }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="consultation_status">
                                        { item.consultation_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="chief_complaint">
                                        { item.chief_complaint }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="diagnosis_summary">
                                        { item.diagnosis_summary }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.consultations_secondary_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Medical_reports AuthorDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>ReportType</th>
                                
                                
                                
                                <th>ReportDate</th>
                                
                                
                                
                                <th>ReportTitle</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>QRPayload</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.medical_reports_author_doctor && Array.isArray(doctor_profiles.medical_reports_author_doctor) &&
                              doctor_profiles.medical_reports_author_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/medical_reports/medical_reports-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="report_type">
                                        { item.report_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="report_date">
                                        { dataFormatter.dateTimeFormatter(item.report_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="report_title">
                                        { item.report_title }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="qr_payload">
                                        { item.qr_payload }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.medical_reports_author_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Prescriptions PrescribedByDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>PrescribedAt</th>
                                
                                
                                
                                <th>PrescriptionStatus</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.prescriptions_prescribed_by_doctor && Array.isArray(doctor_profiles.prescriptions_prescribed_by_doctor) &&
                              doctor_profiles.prescriptions_prescribed_by_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/prescriptions/prescriptions-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="prescribed_at">
                                        { dataFormatter.dateTimeFormatter(item.prescribed_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="prescription_status">
                                        { item.prescription_status }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.prescriptions_prescribed_by_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Medicine_dispatches DispatchedByDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>DispatchedAt</th>
                                
                                
                                
                                <th>ExpectedDeliveryAt</th>
                                
                                
                                
                                <th>DeliveredAt</th>
                                
                                
                                
                                <th>DispatchStatus</th>
                                
                                
                                
                                <th>TrackingReference</th>
                                
                                
                                
                                <th>LastKnownLatitude</th>
                                
                                
                                
                                <th>LastKnownLongitude</th>
                                
                                
                                
                                <th>DeliveryNotes</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.medicine_dispatches_dispatched_by_doctor && Array.isArray(doctor_profiles.medicine_dispatches_dispatched_by_doctor) &&
                              doctor_profiles.medicine_dispatches_dispatched_by_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/medicine_dispatches/medicine_dispatches-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="dispatched_at">
                                        { dataFormatter.dateTimeFormatter(item.dispatched_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="expected_delivery_at">
                                        { dataFormatter.dateTimeFormatter(item.expected_delivery_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="delivered_at">
                                        { dataFormatter.dateTimeFormatter(item.delivered_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="dispatch_status">
                                        { item.dispatch_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="tracking_reference">
                                        { item.tracking_reference }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_known_latitude">
                                        { item.last_known_latitude }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="last_known_longitude">
                                        { item.last_known_longitude }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="delivery_notes">
                                        { item.delivery_notes }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.medicine_dispatches_dispatched_by_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Chat_sessions Doctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>SessionType</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>SessionStatus</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>EndedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.chat_sessions_doctor && Array.isArray(doctor_profiles.chat_sessions_doctor) &&
                              doctor_profiles.chat_sessions_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/chat_sessions/chat_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="session_type">
                                        { item.session_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="session_status">
                                        { item.session_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ended_at">
                                        { dataFormatter.dateTimeFormatter(item.ended_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.chat_sessions_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                <>
                    <p className={'block font-bold mb-2'}>Chat_sessions SecondDoctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>SessionType</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>SessionStatus</th>
                                
                                
                                
                                <th>StartedAt</th>
                                
                                
                                
                                <th>EndedAt</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.chat_sessions_second_doctor && Array.isArray(doctor_profiles.chat_sessions_second_doctor) &&
                              doctor_profiles.chat_sessions_second_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/chat_sessions/chat_sessions-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="session_type">
                                        { item.session_type }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="session_status">
                                        { item.session_status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="started_at">
                                        { dataFormatter.dateTimeFormatter(item.started_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="ended_at">
                                        { dataFormatter.dateTimeFormatter(item.ended_at) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.chat_sessions_second_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Feedbacks Doctor</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>Rating</th>
                                
                                
                                
                                
                                
                                <th>SubmittedAt</th>
                                
                                
                                
                                <th>Visibility</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctor_profiles.feedbacks_doctor && Array.isArray(doctor_profiles.feedbacks_doctor) &&
                              doctor_profiles.feedbacks_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/feedbacks/feedbacks-view/?id=${item.id}`)}>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="rating">
                                        { item.rating }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="submitted_at">
                                        { dataFormatter.dateTimeFormatter(item.submitted_at) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="visibility">
                                        { item.visibility }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctor_profiles?.feedbacks_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                

                <BaseDivider />

                <BaseButton
                    color='info'
                    label='Back'
                    onClick={() => router.push('/doctor_profiles/doctor_profiles-list')}
                />
              </CardBox>
          </SectionMain>
      </>
    );
};

Doctor_profilesView.getLayout = function getLayout(page: ReactElement) {
    return (
      <LayoutAuthenticated
        
        permission={'READ_DOCTOR_PROFILES'}
        
      >
          {page}
      </LayoutAuthenticated>
    )
}

export default Doctor_profilesView;