<meta charset="utf8" />

<input type="hidden" id=ifsend value="{$ifsend}"/>
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row" style="display: none;">
            <div class="top-menu" style=" background: #fff; height: 40px; ">
                <ul class="nav navbar-nav pull-right">
                    <!-- BEGIN USER LOGIN DROPDOWN -->
                    <!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
                    <li class="dropdown dropdown-user">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true" style=" padding: 10px; ">
                            <img alt="" class="img-circle" src="{$path}/_assets/admin/layout/img/avatar3_small.png"  style=" height: 20px; "/>
                            <span class="username username-hide-on-mobile">
                                {$openname}  </span>
                            <i class="fa fa-angle-down"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-default">
                            <li>
                                <a href="{$hosturl}/controllers/_myprofile.php">
                                    <i class="icon-user"></i> My Profile</a>
                            </li>
                            <li class="divider">
                            </li>
                            <li>
                                <a href="{$hosturl}/controllers/login.php?ac=logout">
                                    <i class="icon-key"></i> Log Out</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>

        <!--START-->


        <div class="row">
            <input type="hidden"    id="search_letters_no"  value="{$programesetting->search_letters_no}">

            <form action="{$hosturl}/controllers/patients.php?ac=search" method="post">
                <div class="col-md-5 indexsearchbox"  {if $focussearchindex == 1} style=" z-index: 9999999999999999999; "{/if}>
                    <div class="portlet box blue">
                        <div class="portlet-title">
                            <div class="col-md-9 searchgo ">
                                {if $programesetting->system_type  == 2 || $programesetting->system_lang == 2  }  
                                <input type="text" name="search" id="wifenamesearchable" class="form-control search txtc sbystno" placeholder="البحث بإسم الحالة ..." autofocus>
                                {else}  
                                <input type="text" name="search" id="wifenamesearchable" class="form-control search txtc sbystno" placeholder="البحث بإسم المريضة ..." autofocus>
                                {/if}   

                            </div>
                            <div class=" tools col-md-3 fff txtr arsearchname fright">
                                اسم {if $programesetting->system_type  == 2 || $programesetting->system_lang == 2}  
                                الحالة 
                                {else}  
                                المريضة
                                {/if}    
                                <a href="#" class="expand" data-original-title="تصغير / تكبير" title="">
                                </a>
                            </div>
                        </div>
                        <div class="portlet-body form xhide" {if $focussearchindex == 1} style="display: block !important; "{/if}>
                            <div class="form-body inpuptsindex-g">

                                {if $programesetting->system_lang != 2} 
                                <div class="form-group">
                                    <div class="col-md-9">
                                        <input type="text" class="form-control search" id="husbandname" name="husbandname" placeholder="اسم الزوج">
                                    </div>
                                    <label class="col-md-3 control-label sneng fntsz12 txtr">
                                        اسم الزوج
                                    </label>
                                </div>

                                <div class="clearfix"></div>

                                <div class="form-group">
                                    <div class="col-md-9">
                                        <input type="text" class="form-control search" id="jobtitle" name="jobtitle" placeholder="وظيفة الزوج">
                                    </div>
                                    <label class="col-md-3 control-label sneng fntsz12 txtr">
                                        وظيفة الزوج
                                    </label>
                                </div>

                                <div class="clearfix"></div>
                                {/if}    

                                <div class="form-group">
                                    <div class="col-md-9">
                                        <input type="text" class="form-control search" name="address" id="address" placeholder="العنوان">
                                    </div>
                                    <label class="col-md-3 control-label sneng fntsz12 txtr">
                                        العنوان
                                    </label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="form-group">
                                    <div class="col-md-9">
                                        <input type="text" class="form-control search" name="phone" id="phone" placeholder="الهاتف">
                                    </div>
                                    <label class="col-md-3 control-label sneng fntsz12 txtr">
                                        الهاتف
                                    </label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="form-group">
                                    <div class="col-md-9">
                                        <input type="text" class="form-control search" name="mobile" id="mobile" placeholder="الموبايل">
                                    </div>
                                    <label class="col-md-3 control-label sneng fntsz12 txtr">
                                        الموبايل
                                    </label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="form-group">
                                    <div class="col-md-9">
                                        <input type="text" class="form-control search" name="age" id="age" placeholder="العمر">
                                    </div>
                                    <label class="col-md-3 control-label sneng fntsz12 txtr">
                                        العمر
                                    </label>
                                </div>
                                <div class="clearfix"></div>
                                <div class="form-group">
                                    <div class="col-md-9">
                                        <input type="text" class="form-control search " name="nationalid" id="nationalid" placeholder="الرقم القومي">
                                    </div>
                                    <label class="col-md-3 control-label sneng fntsz12 txtr">
                                        الرقم القومي
                                    </label>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>

                    <div   id="ermsg"  class="xhide"  {if $focussearchindex == 1} style="display: block" {/if}>
                        <p>
                            يرجى إختيار حالة  اولاً
                        </p>
                    </div>
                    <!--rusindex-->
                    <div class="success" style=" overflow: scroll; direction: rtl;max-height: 543px;"></div>


                </div>
            </form>

            <div class="col-md-7" id="visit_container">

                <div class="col-md-12">
                    {if $showBtn1 == 1 }
                    <div class="col-md-6">
                        <a class="btn red-soft addnewindex wds97 fright" id="pulsate-regular" 
                           href="{$hosturl}/controllers/patients.php">
                            {if $programesetting->system_type  == 2 || $programesetting->system_lang == 2}  
                            إضافة حالة  جديدة
                            {else}  
                            إضافة مريضة جديدة
                            {/if} 
                        </a>
                    </div>
                    {/if}
                    {if $showBtn2 == 1 }
                    <div class="col-md-6">
                        <a class="btn btn-success addnewindex wds97 fright" href="{$hosturl}/controllers/visits.php">إضافة زيارة جديدة</a>
                    </div>
                    {/if}

                    <div class="clearfix"></div>

                    <div class="portlet box blue wds98 fright">
                        <div class="portlet-title">
                            <div class="caption txtc fright">
                                اسم / رقم الحالة  
                            </div>

                            <div class="col-md-9 searchgo ">
                                <input type="text" name="indexVisitsSearch" id="indexVisitsSearch" 
                                       class="form-control  txtc" placeholder="البحث بإسم الحالة ..." autofocus>
                            </div>
                        </div>

                        {if $viewAll ==  -1}
                        <input type="hidden" id="select_filter_visit" value="{$firstDept}">
                        <input type="hidden" id="select_filter_doc" value="0">
                        <div class="portlet-body mp0">
                            <div class=" mxhitx_new" data-always-visible="1" data-rail-visible="0" 
                                 style="direction: rtl;    max-height: none;overflow: hidden;">

                                {if $allvisit}

                                <div class="portlet box green-soft " style="margin: 5px 0 0 0;">
                                    <div class="portlet-title" style="min-height: unset;">
                                        <div class="tools fleft" style="padding: 0px !important;">
                                            <a href="#" class="expand" title="تصغير / تكبير"></a>
                                        </div>
                                    </div>
                                    <div class="portlet-body form" style="display: none;">
                                        <div class="table-toolbar">
                                            <div class="row">
                                                <div>
                                                    <a href="javascript:;" class="btn green show_only_his_share" data-no="0">الكل</a>

                                                    {foreach $departs as $depart}
                                                    <a href="javascript:;" class="btn green show_only_his_share" data-no="{$depart->id}">{$depart->name}</a>
                                                    {/foreach}
                                                </div>

                                                <div class="clearfix"></div>

                                                {foreach $departs as $depart}
                                                {foreach $depart->doctors as $doc}
                                                <a href="javascript:;" class="btn default doc_min_{$depart->id}  doc_Id_{$doc.docId} show_doc_his  doc_for_{$depart->id}_{$doc.docId}   " data-no="{$doc.docId}">{$doc.name}</a>
                                                {/foreach}
                                                {/foreach}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <table class="table table-hover noborder scrollTableody mp0" style="direction: ltr;">
                                    <tbody id="indexVisitsContainer">
                                        {assign var=i value=1}
                                        {foreach $allvisit as $key=>$value}

                                        <tr id="visitDoneRow{$value->id}" class="entervisitors   {if $value->view == 1}  visitDone  {/if} dep_for_{$value->for_department}_{$value->for_doctor}    vi_all    vi_all_dept_{$value->for_doctor}  vi_all_doc{$value->for_department}"  
                                            {if $value->confirm_attend == 1 && $programesetting->confirm_attend  == 1} style="background-color: #d0f09f !important;"  
                                            {else if $value->confirm_attend == 2 && $programesetting->confirm_attend  == 1} style="background-color: #d1a6d1 !important;"  
                                            {else if $value->confirm_attend == 3 && $programesetting->confirm_attend  == 1} style="background-color: #fd8591 !important;"  
                                            {/if}  >
                                            <td class="col-md-1 text-center  wds6">
                                                <span  style="font-weight: bold;" class="numSpan"> {$i}</span>
                                            </td>
                                            <td class="col-md-4 wds30">
                                                {if  $value->link == -1 || $value->link == '' } 
                                                <a data-id="{$value->id}" class="visitviewed"  data-link="{$value->link}" >
                                                    {$value->patientName}
                                                </a>
                                                {else}
                                                <a data-id="{$value->id}" class="visitviewed"  
                                                   href="{$hosturl}/controllers/{$value->link}{$value->patientID}">
                                                    {$value->patientName}
                                                </a>
                                                {/if}

                                            </td>
                                            <td class="col-md-1">
                                                <span  class="vtype mp0" 
                                                       style="border-radius: 0; border-right: 1px solid #333; border-left: 1px solid #333; height: auto;">{$value->statusno}</span>
                                            </td>
                                            <td class="col-md-1 wds10">
                                                <span  class="vtype mp0" style="height: auto;">{$value->visit_time}</span>
                                            </td>
                                            <td class="col-md-3 wds20">
                                                <span  class="vtype mp0" style="height: auto;">{$value->doctorName}</span>
                                            </td>
                                            <td class="col-md-3">
                                                <span  class="vtype mp0" style="height: auto;">{$value->detectionType}</span>
                                            </td>
                                        </tr>
                                        {capture assign=i}{$i+1}{/capture}
                                        {/foreach}
                                    </tbody>
                                </table>
                                {else}
                                <p class="novisitlonger">    لا توجد زيارات بعد</p>
                                {/if}
                            </div>
                        </div>


                        {else}

                        <input type="hidden" id="select_filter_visit" value="{$smarty.session.role_id}">
                        <input type="hidden" id="select_filter_doc" value="{$smarty.session.user_id}">
                        <div class="portlet-body mp0">
                            <div class=" mxhitx_new" data-always-visible="1" data-rail-visible="0" 
                                 style="direction: rtl;    max-height: none;overflow: hidden;">
                                {if $allvisit}
                                <div class="portlet box green-soft " style="margin: 5px 0 0 0;">
                                    <div class="portlet-title" style="min-height: unset;">
                                        <div class="tools fleft" style="padding: 0px !important;">
                                            <a href="#" class="expand" title="تصغير / تكبير"></a>
                                        </div>
                                    </div>
                                    <div class="portlet-body form" style="display: none;">
                                        <div class="table-toolbar">
                                            <div class="row">

                                                <div>
                                                    {foreach $departsFor as $depart}
                                                    <a href="javascript:;" class="btn green show_only_his_share" data-no="{$depart->id}">{$depart->name}</a>
                                                    {/foreach}
                                                </div>

                                                <div class="clearfix"></div>

                                                {foreach $departsFor as $depart}
                                                {foreach $depart->doctors as $doc}
                                                <a href="javascript:;" class="btn default doc_min_{$depart->id}  doc_Id_{$doc.docId} show_doc_his  doc_for_{$depart->id}_{$doc.docId}   " data-no="{$doc.docId}">{$doc.name}</a>
                                                {/foreach}
                                                {/foreach}
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <table class="table table-hover noborder scrollTableody mp0" style="direction: ltr;">
                                    <tbody id="indexVisitsContainer">
                                        {assign var=i value=1}
                                        {foreach $allvisit as $key=>$value}

                                        <tr id="visitDoneRow{$value->id}"  class="entervisitors  {if $value->view == 1}  visitDone  {/if}  dep_for_{$value->for_department}_{$value->for_doctor}    vi_all    vi_all_dept_{$value->for_doctor}  vi_all_doc{$value->for_department} row" 
                                            {if $value->confirm_attend == 1 && $programesetting->confirm_attend  == 1} style="background-color: #d0f09f !important;"  
                                            {else if $value->confirm_attend == 2 && $programesetting->confirm_attend  == 1} style="background-color: #d1a6d1 !important;"  
                                            {else if $value->confirm_attend == 3 && $programesetting->confirm_attend  == 1} style="background-color: #fd8591 !important;"  
                                            {/if}
                                            >

                                            <td class="col-md-1 text-center  wds6">
                                                <span  style="font-weight: bold;"  class="numSpan"> {$i}</span>
                                            </td>
                                            <td class="col-md-4">
                                                {if  $value->link == -1 || $value->link == '' } 
                                                <a data-id="{$value->id}" class="visitviewed"  data-link="{$value->link}" >
                                                    {$value->patientName}
                                                </a>
                                                {else}
                                                <a data-id="{$value->id}" class="visitviewed"  
                                                   href="{$hosturl}/controllers/{$value->link}{$value->patientID}">
                                                    {$value->patientName}
                                                </a>
                                                {/if}
                                            </td>

                                            <td class="col-md-1">
                                                <span  class="vtype mp0" 
                                                       style="border-radius: 0; border-right: 1px solid #333; border-left: 1px solid #333; height: auto;">{$value->statusno}</span>
                                            </td>

                                            <td class="col-md-1">
                                                <span  class="vtype mp0" style="height: auto;">{$value->visit_time}</span>
                                            </td>

                                            {if $value->for_department eq 12 && $value->view == 1 }
                                            <td class="col-md-2">
                                                <a class=" bg-blue dltbtn  printLR" data-visitId="{$value->id}" >طباعة</a>
                                            </td>
                                            {else if $value->for_department eq 12 && $value->view != 1}
                                            <td class="col-md-2">
                                                <a class=" bg-blue dltbtn  printLR visitviewedLink" data-visitId="{$value->id}" data-index="1">طباعة</a>
                                            </td>
                                            {else }
                                            <td class="col-md-2">
                                                <span  class="vtype mp0" style="height: auto;">{$value->doctorName}</span>
                                            </td>
                                            {/if}  


                                            <td class="col-md-3">
                                                <span  class="vtype mp0" style="height: auto;">{$value->detectionType}</span>
                                            </td>

                                        </tr>
                                        {capture assign=i}{$i+1}{/capture}
                                        {/foreach}
                                    </tbody>
                                </table>
                                {else}
                                <p class="novisitlonger">    لا توجد زيارات بعد</p>
                                {/if}
                            </div>
                        </div>

                        {/if}
                    </div>
                </div>

            </div>
        </div>


        <!--END-->

    </div>
</div>
<!-- END CONTENT -->

<div class="focus-search-index" {if $focussearchindex == 1} style="display: block"{/if}></div>

<input type="hidden" id="select_filter_visit" value="0">


<div id="printRDiv"></div>