<meta charset="utf8" />

<input type="hidden" id=ifsend value="{$ifsend}"/>
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row" {if $programesetting->visitsform == 0 } style="display: none;"  {/if}>
            <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>
        <div class="row">
            <form action="{$hosturl}/controllers/patients.php?ac=search" method="post">
                <div class="col-md-6 indexsearchbox"  {if $focussearchindex == 1} style=" z-index: 9999999999999999999; "{/if}>
                    <div class="portlet box blue">
                        <div class="portlet-title">
                            {if $programesetting->visitsform  != 1}
                            {else}
                            <div class="col-md-6 searchgo ">

                                <select  class="form-control  select2me" name="detectionSearch" id="detectionSearch" placeholder="اختر القسم ">
                                    <option value=""></option>
                                    {foreach $allDetections as $row}
                                    <option value="{$row->id}">{$row->title}</option>
                                    {/foreach}
                                </select>
                            </div>
                            {/if}
                            <div class="col-md-9 searchgo ">
                                <input type="text" name="search" id="wifenamesearchable" class="form-control search txtc sbystno" placeholder="البحث بإسم {if $programesetting->programview == 1 }  المريضة  {else} المريض  {/if} ..." autofocus>
                            </div>
                            <div class=" tools col-md-3 fff txtr arsearchname fright">
                                اسم {if $programesetting->programview == 1 }  المريضة  {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">
                                <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ًW" name="jobtitleًW" 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>
                                <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>
                            يرجى إختيار {if $programesetting->programview == 1 }  مريضة  {else} مريض  {/if} اولاً
                        </p>
                    </div>
                    <!--rusindex-->
                    <div class="success" style=" overflow: scroll; direction: rtl;max-height: 543px;"></div>


                </div>
                <div class="col-md-6">
                    {if $programesetting->visitsform == 1 }
                    <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->programview == 1 }  مريضة   جديدة{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>
                            {if $programesetting->entryorder == 1 }
                            <div class="portlet-body mp0">
                                <div class="scroller mxhitx" data-always-visible="1" data-rail-visible="0">
                                    {if $allvisit}
                                    <u id="sortable" class="list-group">
                                        {assign var=i value=1}
                                        {foreach $allvisit as $key=>$value}
                                        {if $value->view == 1}
                                        <li id="item_100000"  class="ainli blue unsortable disabled">
                                            {else}
                                        <li id="item_{$value->id}">
                                            {/if}
                                            <span  class="vtype">{$value->detectionType}</span>
                                            <a data-id="{$value->id}"   {if $loginPosition != 3} class="visitviewed" href="{$hosturl}/controllers/patienthistory.php?patientid={$value->patientID}" {/if}>{$value->patientName}</a>
                                            <!--<span style="position: absolute;right: 10px;">{$i}</span>-->
                                        </li>

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

                                </div>
                            </div>
                            {else}

                            <div class="portlet-body mp0">
                                <div class="scroller mxhitx" data-always-visible="1" data-rail-visible="0">

                                    {if $allvisit}

                                    <ul class="list-group">

                                        {foreach $allvisit as $key=>$value}
                                        <li class="entervisitors">
                                            <span  class="vtype">{$value->detectionType}</span>
                                            <a data-id="{$value->id}"  {if $loginPosition != 3} class="visitviewed"  href="{$hosturl}/controllers/patienthistory.php?patientid={$value->patientID}" {/if}>{$value->patientName}</a>
                                        </li>
                                        {/foreach}
                                    </ul>
                                    {else}
                                    <p class="novisitlonger">    لا توجد زيارات بعد</p>
                                    {/if}
                                </div>
                            </div>
                            {/if}
                        </div>
                        <div class="portlet box blue">
                            <div class="portlet-title">
                                <div class="caption txtc fright">
                                    تم الدخول
                                </div>
                            </div>
                            <div class="portlet-body mp0">
                                <div class="scroller mxhitx" data-always-visible="1" data-rail-visible="0">

                                    {if $allvisitentered}

                                    <ul class="list-group">

                                        {foreach $allvisitentered as $value}
                                        <li class="entervisitors">
                                            <a  {if $loginPosition != 3} href="{$hosturl}/controllers/patienthistory.php?patientid={$value->patientID}" {/if}> {$value->patientName}</a>
                                        </li>
                                        {/foreach}
                                    </ul>
                                    {/if}
                                </div>
                            </div>
                        </div>
                    </div>

                    {else}

                    <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->programview == 1 }  مريضة   جديدة{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>
                            {if $programesetting->entryorder == 1 }
                            <div class="portlet-body mp0">
                                <div class=" mxhitx_new" data-always-visible="1" data-rail-visible="0">
                                    {if $allvisit}
                                    <u id="sortable" class="list-group">
                                        {assign var=i value=1}
                                        {foreach $allvisit as $key=>$value}
                                        {if $value->view == 1}
                                        <li id="item_{$value->id}"  class="ainli blue visitDone">
                                            {else}
                                        <li id="item_{$value->id}">

                                            {/if}

                                            <span  style="float: right; width: 50px; font-weight: bold">  {$i}</span>
                                            <span  class="vtype">{$value->detectionType}</span>

                                            <span  class="vtype">{$value->statusno}</span>
                                            <a data-id="{$value->id}"   {if $loginPosition != 3} class="visitviewed"   
                                               href="{$hosturl}/controllers/{if !empty($value->go)}{$value->go}.php?ac=index&{else}patienthistory.php?ac=show&{/if}patientid={$value->patientID}" {/if}>
                                                {$value->patientName}</a>
                                        </li>

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

                                </div>
                            </div>
                            {else}

                            <div class="portlet-body mp0" style="padding-top: 3px !important;">

                                {if $visitBranches == 1 }
                                <table class="table table-hover noborder mp0" style="width: 100%;margin-bottom:  3px !important;">
                                    <thead>
                                        <tr>
                                            <th> 

                                                <a href="javascript:;" class="btn green  show_branch_his fright " 
                                                   data-no="0">الكل </a>

                                                {foreach $branches as $branch}
                                                <a href="javascript:;" class="btn green  show_branch_his fright " 
                                                   data-no="{$branch->id}">{$branch->name}</a>
                                                {/foreach}
                                            </th>
                                        </tr>

                                    </thead>
                                </table>
                                {/if}



                                {if $visitPeriod == 1 }
                                <table class="table table-hover noborder mp0" style="width: 100%;margin-bottom:  3px !important;">
                                    <thead>
                                        <tr>
                                            <th> 

                                                <a href="javascript:;" class="btn default  show_period_his fright " 
                                                   data-no="0">الكل </a>

                                                {foreach $visit_periods as $period}
                                                <a href="javascript:;" class="btn default  show_period_his fright " 
                                                   data-no="{$period->id}">{$period->name}</a>
                                                {/foreach}
                                            </th>
                                        </tr>

                                    </thead>
                                </table>
                                {/if}
                                <input type="hidden" id="indexLoad" value="1">
                                <input type="hidden" id="select_filter_period" value="0">
                                <input type="hidden" id="select_filter_branch" value="{$hasBranch}">

                                <div class=" mxhitx_new" data-always-visible="1" data-rail-visible="0">

                                    {if $allvisit}

                                    <table class="table table-hover noborder mp0" style="width: 100%;font-size: 20px;direction: rtl">
                                        <thead>
                                            <tr>
                                                <th class="col-md-1" style="    background: #85aff3;line-height: 30px;">م</th>
                                                <th style="    background: #85aff3;line-height: 30px;"> اسم الحالة  </th>
                                                <th class="col-md-2"  style="    background: #85aff3;line-height: 30px;"> رقم  الحالة  </th>
                                                <th class="col-md-3" style="    background: #85aff3;line-height: 30px;"> نوع الكشف </th>
                                                <th class="col-md-2"  style="    background: #85aff3;line-height: 30px;"> التوقيت    </th>
                                            </tr>
                                        </thead>
                                    </table>

                                    <table class="table table-hover noborder scrollTableody mp0" style="width: 100%;font-size: 20px;direction: rtl">
                                        <tbody>
                                            {assign var=i value=1}
                                            {foreach $allvisit as $key=>$value}
                                            {if $value->patientName != ''   &&  $value->patientName != null }
                                            {if $value->view == 1}

                                            <tr class="entervisitors vi_all period_for_{$value->visit_period}  
                                                branch_for_{$value->branch_id}   common_{$value->branch_id}_{$value->visit_period}    visitDone">
                                                <td class="col-md-1 numSpan">{$i}</td>
                                                <td>
                                                    <a data-id="{$value->id}"  {if $loginPosition != 3} class="visitviewed"  
                                                       href="{$hosturl}/controllers/{if !empty($value->go)}{$value->go}.php?ac=index&{else}patienthistory.php?ac=show&{/if}patientid={$value->patientID}" {/if}>
                                                        {$value->patientName}</a>
                                                </td>
                                                <td class="col-md-2">{$value->statusno}</td>
                                                <td class="col-md-3">{$value->detectionType}</td>
                                                <td class="col-md-2">{$value->approx_time}</td>
                                            </tr>

                                            {else}

                                            <tr class="entervisitors vi_all period_for_{$value->visit_period} 
                                                branch_for_{$value->branch_id}  common_{$value->branch_id}_{$value->visit_period}  ">
                                                <td class="col-md-1 numSpan">{$i}</td>
                                                <td>
                                                    <a data-id="{$value->id}"  {if $loginPosition != 3} class="visitviewed"  
                                                       href="{$hosturl}/controllers/{if !empty($value->go)}{$value->go}.php?ac=index&{else}patienthistory.php?ac=show&{/if}patientid={$value->patientID}" {/if}>
                                                        {$value->patientName}</a>
                                                </td>
                                                <td class="col-md-2">{$value->statusno}</td>
                                                <td class="col-md-3">{$value->detectionType}</td>
                                                <td class="col-md-2">{$value->approx_time}</td>
                                            </tr>

                                            {/if}
                                            {capture assign=i}{$i+1}{/capture}
                                            {/if}
                                            {/foreach}
                                        </tbody>
                                    </table>
                                    <!--ul class="list-group">
                                        {assign var=i value=1}
                                        {foreach $allvisit as $key=>$value}

                                        {if $value->view == 1}
                                        <li class="entervisitors vi_all period_for_{$value->visit_period}  visitDone">
                                            <span class="col-md-1"   style="float: right; font-weight: bold;text-align: right;">  {$i}</span>
                                            <span  class="col-md-4 vtype">{$value->detectionType}</span>
                                            <span  class="col-md-2 vtype" style=" border-radius: 0; border-right: 1px solid #333; border-left: 1px solid #333;">{$value->statusno}</span>
                                            <a data-id="{$value->id}"  {if $loginPosition != 3} class="visitviewed"  href="{$hosturl}/controllers/{if !empty($value->go)}{$value->go}.php?ac=index&{else}patienthistory.php?ac=show&{/if}patientid={$value->patientID}" {/if}>{$value->patientName}</a>
                                        </li>

                                        {else}
                                        <li class="entervisitors vi_all period_for_{$value->visit_period} ">
                                            <span class="col-md-1"  style="float: right; font-weight: bold;text-align: right;">  {$i}</span>
                                            <span class="col-md-4 vtype"  >{$value->detectionType}</span>
                                            <span class="col-md-2 vtype"   style=" border-radius: 0; border-right: 1px solid #333; border-left: 1px solid #333; ">{$value->statusno}</span>
                                            <a data-id="{$value->id}"  {if $loginPosition != 3} class="visitviewed"   href="{$hosturl}/controllers/{if !empty($value->go)}{$value->go}.php?ac=index&{else}patienthistory.php?ac=show&{/if}patientid={$value->patientID}" {/if}>{$value->patientName}</a>
                                        </li>

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


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

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