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/doctors/doctorsSlice'
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";


const DoctorsView = () => {
    const router = useRouter()
    const dispatch = useAppDispatch()
    const { doctors } = useAppSelector((state) => state.doctors)
    

    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 doctors')}</title>
          </Head>
          <SectionMain>
            <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={removeLastCharacter('View doctors')} main>
                <BaseButton
                  color='info'
                  label='Edit'
                  href={`/doctors/doctors-edit/?id=${id}`}
                />
            </SectionTitleLineWithButton>
            <CardBox>
            

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>الاسمالثلاثي</p>
                    <p>{doctors?.full_name}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>الرقمالوطني</p>
                    <p>{doctors?.national_number}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              
                <FormField label='تاريخالتوظيف'>
                    {doctors.hire_date ? <DatePicker
                      dateFormat="yyyy-MM-dd hh:mm"
                      showTimeSelect
                      selected={doctors.hire_date ?
                        new Date(
                          dayjs(doctors.hire_date).format('YYYY-MM-DD hh:mm'),
                        ) : null
                      }
                      disabled
                    /> : <p>No تاريخالتوظيف</p>}
                </FormField>
              

              

              

              

              

              

              

              
              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>التخصص</p>
                    <p>{doctors?.specialty}</p>
                </div>
              

              

              

              

              

              

              

              

              

              

              

              

              
              

              

              

              

              
                <div className={'mb-4'}>
                  <p className={'block font-bold mb-2'}>سعرالمعاينة</p>
                  <p>{doctors?.visit_price || 'No data'}</p>
                </div>
              

              

              

              

              

              

              

              

              

              
              

              

              

              

              

              

              

              

              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>نوعالطبيب</p>
                    <p>{doctors?.doctor_type ?? 'No data'}</p>
                </div>
              

              

              

              

              

              
              

              

              

              

              

              

              

              

              

              

              
              
                <div className={'mb-4'}>
                    <p className={'block font-bold mb-2'}>حسابالدخول</p>
                    
                    
                        <p>{doctors?.user_account?.firstName ?? 'No data'}</p>
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                </div>
                 
              

              

              

              
              

                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Patients الطبيبالمعالج</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>الاسمالثلاثي</th>
                                
                                
                                
                                <th>الرقمالوطني</th>
                                
                                
                                
                                <th>رقمالهاتف</th>
                                
                                
                                
                                <th>العنوان</th>
                                
                                
                                
                                <th>زمرةالدم</th>
                                
                                
                                
                                <th>الجنس</th>
                                
                                
                                
                                <th>تاريخالميلاد</th>
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.patients_primary_doctor && Array.isArray(doctors.patients_primary_doctor) &&
                              doctors.patients_primary_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/patients/patients-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="full_name">
                                        { item.full_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="national_number">
                                        { item.national_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="phone">
                                        { item.phone }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="address">
                                        { item.address }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="blood_group">
                                        { item.blood_group }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="gender">
                                        { item.gender }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="birth_date">
                                        { dataFormatter.dateTimeFormatter(item.birth_date) }
                                    </td>
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.patients_primary_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Visits الطبيب</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالزيارة</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>القسم</th>
                                
                                
                                
                                <th>سعرالمعاينة</th>
                                
                                
                                
                                <th>وقتالدخول</th>
                                
                                
                                
                                <th>وقتالخروج</th>
                                
                                
                                
                                <th>قياسالضغط</th>
                                
                                
                                
                                <th>قياسالسكر</th>
                                
                                
                                
                                <th>النبض</th>
                                
                                
                                
                                <th>درجةالحرارة</th>
                                
                                
                                
                                <th>الأكسجة</th>
                                
                                
                                
                                <th>الشكوىالرئيسية</th>
                                
                                
                                
                                <th>التشخيصالأولي</th>
                                
                                
                                
                                <th>أدويةالإسعاف</th>
                                
                                
                                
                                <th>سوائل/وريدي</th>
                                
                                
                                
                                <th>ملاحظات</th>
                                
                                
                                
                                <th>الحالة</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.visits_doctor && Array.isArray(doctors.visits_doctor) &&
                              doctors.visits_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/visits/visits-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="visit_number">
                                        { item.visit_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="department">
                                        { item.department }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="visit_price">
                                        { item.visit_price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="arrival_time">
                                        { dataFormatter.dateTimeFormatter(item.arrival_time) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discharge_time">
                                        { dataFormatter.dateTimeFormatter(item.discharge_time) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="blood_pressure">
                                        { item.blood_pressure }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="glucose">
                                        { item.glucose }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="pulse">
                                        { item.pulse }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="temperature">
                                        { item.temperature }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="spo2">
                                        { item.spo2 }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="chief_complaint">
                                        { item.chief_complaint }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="initial_diagnosis">
                                        { item.initial_diagnosis }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="emergency_treatment">
                                        { item.emergency_treatment }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="fluids_iv">
                                        { item.fluids_iv }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="notes">
                                        { item.notes }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.visits_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Orders مقدمالطلب</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالطلب</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>نوعالطلب</th>
                                
                                
                                
                                <th>النوعالتفصيلي</th>
                                
                                
                                
                                <th>السعر</th>
                                
                                
                                
                                <th>حالةالطلب</th>
                                
                                
                                
                                <th>تاريخالإنشاء</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.orders_requested_by && Array.isArray(doctors.orders_requested_by) &&
                              doctors.orders_requested_by.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/orders/orders-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="order_number">
                                        { item.order_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="order_type">
                                        { item.order_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="subtype">
                                        { item.subtype }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="price">
                                        { item.price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="created_datetime">
                                        { dataFormatter.dateTimeFormatter(item.created_datetime) }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.orders_requested_by?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Endoscopy_cases الطبيب</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالحالة</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>توصيات</th>
                                
                                
                                
                                
                                
                                <th>السعر</th>
                                
                                
                                
                                <th>الحالة</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.endoscopy_cases_doctor && Array.isArray(doctors.endoscopy_cases_doctor) &&
                              doctors.endoscopy_cases_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/endoscopy_cases/endoscopy_cases-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="case_number">
                                        { item.case_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="recommendations">
                                        { item.recommendations }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="price">
                                        { item.price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.endoscopy_cases_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Surgery_cases الجراح</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالعملية</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>وقتبدئالعملية</th>
                                
                                
                                
                                <th>وقتانتهاءالعملية</th>
                                
                                
                                
                                
                                
                                <th>سعرالعملية</th>
                                
                                
                                
                                
                                
                                <th>حالةالعملية</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.surgery_cases_surgeon && Array.isArray(doctors.surgery_cases_surgeon) &&
                              doctors.surgery_cases_surgeon.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/surgery_cases/surgery_cases-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="case_number">
                                        { item.case_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="scheduled_start">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_start) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduled_end">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_end) }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="price">
                                        { item.price }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.surgery_cases_surgeon?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Cathlab_cases الطبيب</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالقثطرة</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>السعر</th>
                                
                                
                                
                                <th>تاريخالإجراء</th>
                                
                                
                                
                                <th>حالة</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.cathlab_cases_doctor && Array.isArray(doctors.cathlab_cases_doctor) &&
                              doctors.cathlab_cases_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/cathlab_cases/cathlab_cases-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="case_number">
                                        { item.case_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="price">
                                        { item.price }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="scheduled_date">
                                        { dataFormatter.dateTimeFormatter(item.scheduled_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="status">
                                        { item.status }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.cathlab_cases_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                <>
                    <p className={'block font-bold mb-2'}>Ecg_stress_tests الطبيب</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالاختبار</th>
                                
                                
                                
                                
                                
                                
                                
                                
                                
                                <th>نتيجةالاختبار</th>
                                
                                
                                
                                <th>السعر</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.ecg_stress_tests_doctor && Array.isArray(doctors.ecg_stress_tests_doctor) &&
                              doctors.ecg_stress_tests_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/ecg_stress_tests/ecg_stress_tests-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="test_number">
                                        { item.test_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="result_text">
                                        { item.result_text }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="price">
                                        { item.price }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.ecg_stress_tests_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Room_bookings الطبيبالمشرف</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالحجز</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>تاريخالدخول</th>
                                
                                
                                
                                <th>تاريخالخروج</th>
                                
                                
                                
                                <th>عددالأيام</th>
                                
                                
                                
                                <th>سعراليوم</th>
                                
                                
                                
                                <th>السعرالإجمالي</th>
                                
                                
                                
                                
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.room_bookings_supervising_doctor && Array.isArray(doctors.room_bookings_supervising_doctor) &&
                              doctors.room_bookings_supervising_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/room_bookings/room_bookings-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="booking_number">
                                        { item.booking_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="admission_date">
                                        { dataFormatter.dateTimeFormatter(item.admission_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discharge_date">
                                        { dataFormatter.dateTimeFormatter(item.discharge_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="days">
                                        { item.days }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="price_per_day">
                                        { item.price_per_day }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="total_price">
                                        { item.total_price }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.room_bookings_supervising_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Maternity_cases الطبيب</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالحالة</th>
                                
                                
                                
                                
                                
                                
                                
                                <th>التشخيص</th>
                                
                                
                                
                                <th>نوعالولادة</th>
                                
                                
                                
                                <th>تاريخالدخول</th>
                                
                                
                                
                                <th>تاريخالخروج</th>
                                
                                
                                
                                <th>السعر</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.maternity_cases_doctor && Array.isArray(doctors.maternity_cases_doctor) &&
                              doctors.maternity_cases_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/maternity_cases/maternity_cases-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="case_number">
                                        { item.case_number }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="diagnosis">
                                        { item.diagnosis }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="delivery_type">
                                        { item.delivery_type }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="admission_date">
                                        { dataFormatter.dateTimeFormatter(item.admission_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discharge_date">
                                        { dataFormatter.dateTimeFormatter(item.discharge_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="price">
                                        { item.price }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.maternity_cases_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                <>
                    <p className={'block font-bold mb-2'}>Nicu_incubators الطبيبالمشرف</p>
                    <CardBox
                      className='mb-6 border border-gray-300 rounded overflow-hidden'
                      hasTable
                    >
                        <div className='overflow-x-auto'>
                            <table>
                            <thead>
                            <tr>
                                
                                
                                <th>رقمالحاضنة</th>
                                
                                
                                
                                <th>اسمالطفل</th>
                                
                                
                                
                                <th>عمرالطفل</th>
                                
                                
                                
                                <th>الأدوية</th>
                                
                                
                                
                                <th>الأجهزةالمتصلة</th>
                                
                                
                                
                                <th>سعراليومالواحد</th>
                                
                                
                                
                                
                                
                                <th>تاريخالدخول</th>
                                
                                
                                
                                <th>تاريخالخروج</th>
                                
                                
                                
                                <th>سببالإلغاء</th>
                                
                                
                            </tr>
                            </thead>
                            <tbody>
                            {doctors.nicu_incubators_admitting_doctor && Array.isArray(doctors.nicu_incubators_admitting_doctor) &&
                              doctors.nicu_incubators_admitting_doctor.map((item: any) => (
                                <tr key={item.id} onClick={() => router.push(`/nicu_incubators/nicu_incubators-view/?id=${item.id}`)}>
                                    
                                    
                                    <td data-label="incubator_number">
                                        { item.incubator_number }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="baby_name">
                                        { item.baby_name }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="baby_age">
                                        { item.baby_age }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="medications">
                                        { item.medications }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="devices">
                                        { item.devices }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="daily_price">
                                        { item.daily_price }
                                    </td>
                                    
                                    
                                    
                                    
                                    
                                    <td data-label="admission_date">
                                        { dataFormatter.dateTimeFormatter(item.admission_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="discharge_date">
                                        { dataFormatter.dateTimeFormatter(item.discharge_date) }
                                    </td>
                                    
                                    
                                    
                                    <td data-label="cancellation_reason">
                                        { item.cancellation_reason }
                                    </td>
                                    
                                    
                                </tr>
                              ))}
                            </tbody>
                        </table>
                        </div>
                        {!doctors?.nicu_incubators_admitting_doctor?.length && <div className={'text-center py-4'}>No data</div>}
                    </CardBox>
                </>
                
                
                
                
                

                <BaseDivider />

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

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

export default DoctorsView;