<style>
    .select2-container .select2-choice > .select2-chosen {
        margin-left: 25%;
    }

    .pl5{
        padding-left: 5px !important;
    }
</style>
<meta charset="utf8">
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">

            <div class="col-md-12 ">
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">   Visits  </div>
                        <div class="tools">
                            <a class="fff bold" href="{$hosturl}/controllers/invsdept.php?ac=index">Show All Visits</a>
                            <a href="#" class="collapse" title="تصغير / تكبير"></a>
                        </div>
                    </div>

                    <div class="portlet-body form">
                        <div class="form-body">
                            <div class="clinick rtl">
                                <div class="row">
                                    <form action="#" id="myvisitform" method="post" class="awval">
                                        <input type="hidden"    id="cardVisitPatient" name="cardVisitPatient"   value="{$cardVisitPatient}">
                                        <input type="hidden"    id="lab_visit"  value="1">
                                        <input type="hidden"    id="labCompleteVisit"  value="1">
                                        <input type="hidden" id="controllName" value="visits"/>
                                        <input type="hidden"    id="past_visits"  value="{$rolePastVisits}">
                                        <input type="hidden" name="invstDataForERP" id="invstDataForERP" value=""/>
                                        <input type="hidden"    id="past_search"  value="{$programesetting->past_search}">
                                        <input type="hidden"    id="past_search_check"  value="1">
                                        <input type="hidden"    id="printserial"  value="{$programesetting->printserial}">
                                        {if $programesetting->branches != 1  }
                                        <input type="hidden"  id="branch_id"  name="branch_id"  value="1"> 
                                        {/if}
                                        <input type="hidden"  name="labStyle"  id="labStyle"  value="{$labSetting->lab_style}">
                                        <input type="hidden"  name="price_in"  id="price_in"  value="{$labSetting->price_in}">
                                        <input type="hidden"    id="orgDiscountType"  value="{$programesetting->organizations}">
                                        <input type="hidden"    id="orgIn"  value="{$programesetting->org_in}">

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

                                            <table class="table table-bordered  table-hover ltr" 
                                                   style="margin-bottom: 0px; background-color: yellowgreen;">
                                                <tr>
                                                    <td class="wds11 txtc">Entry Date  </td>
                                                    <td>
                                                        <input class="form-control patientvisitidCheckDate  datepicker edited"  type="text"
                                                               id="visitdate" name="visitdate" required value="{$today}" readonly>
                                                    </td>
                                                    <td class="wds13 txtc"  id="currentTime"></td>
                                                    <td class="wds13 txtc">Receive Date   </td>
                                                    <td>
                                                        <input class="form-control patientvisitidCheckDate  datepicker edited"  readonly 
                                                               type="text"  id="receiveDate" name="receiveDate" required value="{$today}">
                                                    </td>
                                                    <td class="wds16 txtc" id="receiveTime"></td>
                                                </tr>
                                            </table>

                                            <table class="table table-bordered  table-hover ltr m10" style=" background-color: #e1786e;">
                                                <tr>
                                                    <td class="wds11 txtc"> Pat No.</td>
                                                    <td class="wds18">
                                                        <input type="text"  id="statusNoRemoteLab"
                                                               class="form-control  txtc searchPatRemoteLab positiveNo " >
                                                    </td>

                                                    <td class="wds11 txtc"> Pat Id.</td>
                                                    <td class="wds18">
                                                        <input type="text"  id="patIdRemote"
                                                               class="form-control  txtc searchPatLab " >
                                                    </td>

                                                    <td class="wds11 txtc"> Mobile.</td>
                                                    <td class="wds18">
                                                        <input type="text"  id="patMobileRemote"
                                                               class="form-control  txtc searchPatLab " >
                                                    </td>

                                                </tr>
                                                <tr>
                                                    <td class="wds11 txtc">Pat. Name </td>

                                                    <td class="txtc" colspan="3">
                                                        <input type="hidden" class="form-control"   data-isLab="1"
                                                               id="patientvisitid" name="patientid"  >
                                                        <div class="txtc ltr" id="phonesContainer"></div>
                                                    </td>

                                                    <td class="wds11 txtc"> Org Pat No.</td>
                                                    <td class="wds18">
                                                        <input type="text"  id="orgPatNoRemote" name="orgPatNoRemote"
                                                               class="form-control  txtc searchPatLab " >
                                                    </td>


                                                </tr>
                                            </table>

                                            {if  $programesetting->system_lang == 1}
                                            <table class="table table-bordered  table-hover ltr m10" style=" background-color: #e1786e;">
                                                <tr>
                                                    <td class="wds11 txtc">   For </td>

                                                    <td class=" txtl">
                                                        <div class="md-radio-inline" style="    margin: 5px 0;  ">
                                                            <div class="md-radio">
                                                                <input type="radio" id="for_husband0" name="for_husband"
                                                                       class="md-radiobtn for_husband"       value="0" checked>
                                                                <label for="for_husband0">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Wife       </label>
                                                            </div>

                                                            <div class="md-radio">
                                                                <input type="radio" id="for_husband_1" name="for_husband"
                                                                       class="md-radiobtn for_husband"     value="1"  >
                                                                <label for="for_husband_1">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Husband  </label>
                                                            </div>

                                                            <div class="md-radio">
                                                                <input type="radio" id="for_husband2" name="for_husband"
                                                                       class="md-radiobtn for_husband"       value="2">
                                                                <label for="for_husband2">
                                                                    <span></span>
                                                                    <span class="check"></span>
                                                                    <span class="box"></span>
                                                                    Child        </label>
                                                            </div>
                                                        </div>
                                                    </td>

                                                    <td class="wds5"  id="childHead" style="display: none" >Child</td>

                                                    <td class="wds40" id="childContain" style="display: none" >
                                                        <select  class="form-control select2" name="child" id="childFor" placeholder="اختر طفل " >
                                                            <option value=""></option>
                                                        </select>
                                                    </td>
                                                </tr>
                                            </table>
                                            {/if}

                                            <div id="newPatientDiv" class="m10 p10"    style="display: none;background-color: burlywood;" >

                                                <table class="table table-bordered  table-hover ltr" style="margin-bottom: 0px;">
                                                    <tr>
                                                        <th class="wds13">Title</th>

                                                        <td class="wds18">
                                                            <select class="form-control"  id="wifetype" name="wifetype" >
                                                                <option value=""></option>
                                                                {foreach $allTypes as $row}
                                                                <option value="{$row->id}" >{$row->title}</option>
                                                                {/foreach}

                                                                {foreach $husbandtypes as $row}
                                                                <option value="{$row->id}" >{$row->title}</option>
                                                                {/foreach}


                                                            </select>
                                                        </td>

                                                        <th class="wds13"> Pat. Name </th>

                                                        <td>
                                                            <input type="text" id="wifename" name="wifename"  class="form-control"   />
                                                            <span id="lb_ckwifename" class="help-block clrred fleft"
                                                                  style="display: none;">This name exist ...</span>
                                                        </td>

                                                        <td class="wds20">
                                                            <div class="radio-list fleft">
                                                                <label class="radio-inline">
                                                                    <input type="radio" name="gender"  value="0" > F </label>
                                                                <label class="radio-inline">
                                                                    <input type="radio" name="gender"  value="1"> M </label>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </table>

                                                <table class="table table-bordered  table-hover ltr" style="margin-bottom: 0px;">
                                                    <tr>
                                                        <th class="wds13">Mobile 1</th>
                                                        <td class="wds20">
                                                            <input type="text" name="phone" id="phone"
                                                                   class="form-control  digitsOnly "    maxlength="{$labSetting->phone_length}" >
                                                            <span id="lb_ckphone" class="help-block clrred fleft"
                                                                  style="display: none;">No exist ...</span>
                                                        </td>

                                                        <th class="wds13">Mobile 2</th>
                                                        <td class="wds20">
                                                            <input type="text" name="mobile" id="mobile"
                                                                   class="form-control  digitsOnly "  maxlength="{$labSetting->phone_length}"  >
                                                            <span id="lb_ckmobile" class="help-block clrred fleft"
                                                                  style="display: none;">No exist ... </span>
                                                        </td>

                                                        <th class="wds9">Age </th>
                                                        <td class="wds11">
                                                            <input class="form-control "   type="text"   name="age" id="age" />
                                                        </td>
                                                        <td class="wds13" >
                                                            <select class="form-control select2h"   name="ageType"  id="ageType" >
                                                                <option value="1" >Years</option>
                                                                <option value="2" >Months</option>
                                                                <option value="3" >Days</option>
                                                            </select>
                                                        </td>
                                                    </tr>
                                                </table>

                                                <table class="table table-bordered  table-hover ltr" style="margin-bottom: 0px;">
                                                    <tr>
                                                        <th class="wds13">Patient Id </th>
                                                        <td>
                                                            <input type="text" id="labPatientId"  name="labPatientId" class="form-control ">
                                                            <span id="lb_ckecklabPatientId" class="help-block clrred fleft"
                                                                  style="display: none;">This Id exist ...</span>
                                                        </td>
                                                        {if $labSetting->saudi == 1 }
                                                        <td class="wds24">
                                                            <div class="radio-list fleft">
                                                                <label class="radio-inline">
                                                                    <input type="radio" name="saudi" id="saudi0"   value="0" class="detectionvalue" > Saudi </label>
                                                                <label class="radio-inline">
                                                                    <input type="radio" name="saudi"  id="saudi1"  value="1" class="detectionvalue"> Non Saudi </label>
                                                            </div>
                                                        </td>
                                                        {/if}
                                                    </tr>

                                                </table>

                                                <table class="table table-bordered  table-hover ltr" style="margin-bottom: 0px;">
                                                    <tr>
                                                        <th class="wds13">Address</th>
                                                        <td>
                                                            <input type="text" id="address"  name="address" class="form-control ">
                                                        </td>

                                                        <th class="wds13"> Org Pat No.</td>
                                                        <td class="wds18">
                                                            <input type="text"  id="orgPatNoAdd" name="orgPatNoAdd"  class="form-control " >
                                                        </td>
                                                    </tr>
                                                </table>

                                            </div>


                                            <table class="table table-bordered  table-hover ltr m10">
                                                <tr>
                                                    <th class="wds13 txtc">  Doctor   </th>

                                                    {if $programesetting->refer_doctor == 1 }
                                                    <td>
                                                        <select class="form-control  refer_doctor editData"     name="refer_doctor"
                                                                id="refer_doctor" data-ptname="refer_doctor" >
                                                            <option value=""></option>
                                                            {foreach $refer as $data}
                                                            <option value="{$data->id}" {if $lastpatient->refer_doctor eq
                                                                $data->id && $lastpatient->refer_doctor_tb == 0 }selected{/if}>{$data->refer_id} - {$data->name}</option>
                                                            {/foreach}

                                                            {foreach $py_all_doc as $data}
                                                            <option value="*{$data.user_id}" {if $lastpatient->refer_doctor eq
                                                                $data.user_id && $lastpatient->refer_doctor_tb == 1 }selected{/if}>{$data.name}</option>
                                                            {/foreach}


                                                            {if $smarty.session.role_id neq 3}
                                                            <option value="0" class="deleteoptincompo">Delete</option>
                                                            {/if}
                                                        </select>
                                                    </td>
                                                    {else}
                                                    <td>
                                                        <select class="form-control select2"   id="doctor1" name="for_doctor">
                                                            <option value=""></option>
                                                            <option value="-1" >لا يوجد</option>
                                                            {foreach $py_all_doc as $data}
                                                            <option value="{$data.user_id}" >{$data.name}</option>
                                                            {/foreach}
                                                        </select>
                                                    </td>

                                                    {/if} 

                                                    {if $programesetting->branches == 1  } 
                                                    <th class="wds10 txtc"  {if $showBrancheSelect != 1 }  style="display: none;" {/if}>Branch   </th> 

                                                    <td {if $showBrancheSelect != 1 } style="display: none;" {/if} >
                                                        <select class="form-control select2h" id="branch_id"  name="branch_id" >
                                                            <option value=""></option>
                                                            {foreach $branches as $data}
                                                            <option value="{$data->id}" {if $selectedBranch eq $data->id  }selected{/if}>{$data->name}</option>
                                                            {/foreach}
                                                        </select>
                                                    </td>
                                                    {/if} 
                                                </tr>

                                                <tr>
                                                    <th class="wds13 txtc">  Service   </th>
                                                    <td>
                                                        <select  class="form-control " name="detectionidLab" id="detectionidLab" 
                                                                 placeholder="  Choose Service " required select-tableName="visits" 
                                                                 data-tableName="visits" data-maintable = "detections" 
                                                                 data-colName="detectionid" data-id="0">
                                                            <option value=""></option>
                                                            {foreach $allDetections as $row}
                                                            <option value="{$row->id}" >{$row->title} ({$row->detectionval})</option>
                                                            {/foreach}
                                                            <option value="-1">Add </option>
                                                            <option value="-2" class="deleteoptincompo">Del</option>
                                                        </select>
                                                        <input type="hidden"    id="labDetectionPrice" name="labDetectionPrice"  value="0">
                                                    </td>
                                                </tr>


                                            </table>

                                            {if $programesetting->organizations  != 1}
                                            <table class="table table-bordered  table-hover ltr m10">
                                                <tr>
                                                    <th class="wds13 txtc">  Organizations   </th>
                                                    <td>
                                                        <select  class="form-control select2h" name="organizations" id="organizations"
                                                                 placeholder="اختر  " required="required" select-tableName="visits"
                                                                 data-tableName="visits" data-maintable = "organizations"
                                                                 data-colName="organization_id" data-id="0" >
                                                            <option value="" selected>لا يوجد </option>
                                                            {foreach $organizations as $row}
                                                            <option value="{$row->id}" > {$row->org_id} -  {$row->organization_name}</option>
                                                            {/foreach}
                                                            {if $programesetting->organizations  == 2 }
                                                            <option value="-1" class="deleteoptincompo">تعديل </option>
                                                            {/if}
                                                        </select>
                                                    </td>

                                                    {if $programesetting->organizations  == 3}
                                                    <th class="wds13 txtc">  Contract Price   </th>
                                                    <td class="wds13 txtc">
                                                        <input type="text" name="contractPrice" id="contractPrice"
                                                               class="form-control txtc " value="0" readonly>

                                                        <input type="hidden" name="patient_hold" id="patient_hold" value="0">
                                                        <input type="hidden" name="originalPrice" id="originalPrice" value="0">
                                                    </td>
                                                    {/if}
                                                    <th class="wds13 txtc">  Discount   </th>
                                                    <td class="wds13 txtc">
                                                        <input type="text" name="discountRatio" id="discountRatio"
                                                               class="form-control txtc " value="0" readonly>
                                                        <input type="hidden" name="discountRatioType" id="discountRatioType" value="0">
                                                    </td>
                                                </tr>
                                            </table>
                                            {/if}



                                            <table class="table table-bordered  table-hover rtl m10" style="background-color: wheat;">
                                                <tbody style="direction: ltr;">
                                                    <tr>
                                                        <td>
                                                            <span style="margin-right: 13%;">عدد ساعات الصيام </span>
                                                            <input type="text" id="fasting_hours"   name="fasting_hours"    class="form-control digitsOnly "
                                                                   style="display: inline ;  width: 25%; float: left;margin-left:  13%;height: 23px;">
                                                        </td>

                                                        <td class="wds30">
                                                            <span>  هل يؤخذ علاج للسكر  </span>
                                                            <input type="checkbox"  class="checks"  name="checks[]"    value="sugar" >
                                                        </td>

                                                        <td class="wds30">
                                                            <span> مريض بفقر الدم   </span>
                                                            <input type="checkbox"  class="checks"    name="checks[]"    value="aanemia" >
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td>
                                                            <span>  هل يؤخذ علاج لسيولة الدم   </span>
                                                            <input type="checkbox"   class="checks"   name="checks[]"    value="haemophilia" >
                                                        </td>

                                                        <td>
                                                            <span>  هل يؤخذ علاج للغدد  </span>
                                                            <input type="checkbox"  class="checks"   name="checks[]"    value="glands" >
                                                        </td>

                                                        <td>
                                                            <span> مريض بالتهاب المفاصل   </span>
                                                            <input type="checkbox"  class="checks"    name="checks[]"    value="arthritis" >
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td>
                                                            <span>  هل يؤخذ علاج للفيروسات   </span>
                                                            <input type="checkbox"   class="checks"  name="checks[]"    value="viruses" >
                                                        </td>

                                                        <td>
                                                            <span>  هل يؤخذ مضاد حيوى    </span>
                                                            <input type="checkbox"  class="checks"  name="checks[]"    value="antibiotic" >
                                                        </td>

                                                        <td>
                                                            <span> مريض بضغط الدم   </span>
                                                            <input type="checkbox"  class="checks"   name="checks[]"    value="pressure" >
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td>
                                                            <span> هل يوجد حمل   </span>
                                                            <input type="checkbox"   class="checks"  name="checks[]"    value="pregnant" >
                                                        </td>

                                                        <td>
                                                            <span>  هل يؤخذ علاج للكبد   </span>
                                                            <input type="checkbox"   class="checks"   name="checks[]"    value="liver" >
                                                        </td>

                                                        <td>
                                                            <span>   مريض بالفشل الكلوى </span>
                                                            <input type="checkbox"   class="checks"   name="checks[]"    value="kidney_failure" >
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td colspan="2">
                                                            <span>  هل تم عمل أشعة بالصبغة أو بالموجات الصوتية خلال يومين  </span>
                                                            <input type="checkbox"   class="checks"     name="checks[]"    value="sonar" >
                                                        </td>

                                                        <td>
                                                            <span> مريض بالذئبة الحمراء   </span>
                                                            <input type="checkbox"   class="checks"   name="checks[]"    value="sle" >
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>

                                            <table class="table table-bordered  table-hover ltr  m10 p10">
                                                <tr>
                                                    <th class="wds13 txtc">Notes</th>
                                                    <td>
                                                        <input type="text" id="notes" name="notes"  class="form-control ">
                                                    </td>
                                                </tr>
                                            </table>

                                            <table class="table table-bordered  table-hover ltr m10 p10 wds100" id="externalTable"
                                                   style=" background-color: #deb1c1; display: none;">
                                                <thead>
                                                    <tr>
                                                        <th class="txtc wds50">Invest  </th>
                                                        <th class="txtc">Lab  </th>
                                                    </tr>
                                                </thead>
                                                <tbody id="externalContainer">
                                                    <tr>
                                                        <td >

                                                        </td>
                                                        <td >

                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>

                                            <table class="table noborder ltr" style=" margin-bottom: 0px; background-color: #bcea5d;">
                                                <tr>
                                                    <td class="txtc">Total </td>
                                                    <td class="txtc">Discount </td>
                                                    <td class="txtc wds15">  Discount Type</td>
                                                    {if $labSetting->saudi == 1 } <td class="txtc">VAT </td>  {/if}
                                                    <td class="txtc">Cash </td>
                                                    <td class="txtc">Visa </td>
                                                    <td class="txtc">Rest </td>

                                                    <td  rowspan="2">
                                                        <a class=" bg-blue-chambray btn" id="saveLabVisit" style="margin-top: 25%;">Save </a>
                                                        <a class=" bg-green btn  saveEditLabVisit wds90" id="saveEditLabVisit" 
                                                           data-visitId="0" style="display: none;">Save </a>
                                                        <a class=" bg-red btn  cancelEditLabVisit wds90" id="cancelEditLabVisit" 
                                                           data-visitId="0" style="display: none;">Cancel</a>

                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td >
                                                        <input  class="form-control digitsOnly detectionvalue"  type="text"  id="totaldetectionvalue" value="0" name="totaldetectionvalue" required="required" readonly>
                                                    </td>
                                                    <td >
                                                        <input  class="form-control digitsOnly detectionvalue"  type="text"  id="discount" value="0" name="discount" required="required">
                                                    </td>
                                                    <td >
                                                        <div class="radio-list">
                                                            <label class="radio-inline">
                                                                <input type="radio" class="detectionvalue" name="discountType" id="discountType_0" checked  value="0" > Value  </label>
                                                            <label class="radio-inline">
                                                                <input type="radio" class="detectionvalue" name="discountType"  id="discountType_1"  value="1">  % </label>
                                                        </div>
                                                    </td>
                                                    {if $labSetting->saudi == 1 }
                                                    <td>
                                                        <input  class="form-control digitsOnly"  type="text"  id="vatCalc"  name="vatCalc" value="0" readonly>
                                                    </td>
                                                    {/if}
                                                    <td >
                                                        <input  class="form-control digitsOnly detectionvalue"  type="text"  id="detectionvalue_cash" value="0" name="detectionvalue_cash" required="required">
                                                    </td>
                                                    <td >
                                                        <input  class="form-control digitsOnly detectionvalue"  type="text"  id="detectionvalue_visa" value="0" name="detectionvalue_visa" required="required">
                                                    </td>
                                                    <td >
                                                        <input  class="form-control digitsOnly"  type="text"  id="restdetectionvalue" value="0" name="restdetectionvalue" required="required" readonly="">
                                                    </td>

                                                </tr>

                                            </table>

                                            <span id="addLabVisitError"  class="help-block clrred wds100 txtl"></span>

                                        </div>

                                        <div class="col-md-5">
                                            <table class="table table-bordered  table-hover rtl">
                                                <tr>
                                                    <td id="labInvestsTd">
                                                        <select  class="form-control" name="labInvests[]"  id="labInvests"
                                                                 multiple="multiple"   size="20" >
                                                            <option value="" disabled
                                                                    style="background-color: cadetblue;color: black;text-align: center;">
                                                                Offers
                                                            </option>


                                                            {foreach $invoffers as $offer}
                                                            {if !empty($offer->name)}
                                                            <optgroup label="{$offer->name} {if $offer->price > 0 }  ({$offer->price})  {else }  ( 0 )    {/if}"  class="txtl" >

                                                                {foreach $offer->offerInvests as $offerInv}
                                                                {if !empty($offerInv.name)}
                                                                <option class="txtl" value="offer_{$offerInv.id}" id="offer_{$offerInv.id}"
                                                                        data-price="{$offerInv.price}"  data-id="{$offerInv.id}"
                                                                        data-discount="0" data-hold="{$offerInv.price}" data-originalPrice="{$offerInv.price}"
                                                                        data-external="{$offerInv.external}" data-name="{$offerInv.name}" >
                                                                    {$offerInv.name}
                                                                    {if $offerInv.price > 0 }  ({$offerInv.price})  {else }  ( 0 )    {/if}
                                                                </option>
                                                                {/if}
                                                                {/foreach}

                                                            </optgroup>
                                                            {/if}
                                                            {/foreach}
                                                            <option value="" disabled
                                                                    style="background-color: cadetblue;color: black;text-align: center;">
                                                                Investigations
                                                            </option>

                                                            {foreach $invests as $row}
                                                            {if !empty($row.name)}
                                                            <option class="txtl" value="{$row.id}" id="{$row.id}" data-price="{$row.price}"
                                                                    data-discount="0" data-hold="{$row.price}" data-originalPrice="{$row.price}"
                                                                    data-id="{$row.id}" data-external="{$row.external}"
                                                                    data-name="{$row.name}" >
                                                                {$row.name}
                                                                {if $row.price > 0 }  ({$row.price})  {else }  ( 0 )    {/if}
                                                            </option>
                                                            {/if}
                                                            {/foreach}
                                                        </select>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>

                                        <div  id="restDiv" class="col-md-12"  > </div>



                                        <input type="hidden"  name="editView"  id="editView"  value="0">
                                        <input type="hidden"  name="mVisitId"  id="mVisitId"  value="0">
                                        <input type="hidden"  name="vat"  id="vat"  value="{$labSetting->vat}">

                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-md-12 ">
                <div class="todayvisit" >
                    <div class="portlet box blue">
                        <div class="portlet-title">
                            <div class="caption">
                                All Visits
                            </div>
                            <div class="tools">
                                <a href="#" class="collapse" title="تصغير / تكبير"></a>
                            </div>
                        </div>
                        <div class="portlet-body form">

                            <div class="table-toolbar">
                                <div class="row">

                                    <div class="col-md-2 wds10">
                                        <div class="form-group">
                                            <label class="control-label ls2">Date From </label>
                                            <input type="text"  id="date_from" value="{$today}"  readonly 
                                                   class=" form-control  pastSearchDate" placeholder="  Date From   "/>
                                        </div>
                                    </div>

                                    <div class="col-md-2 wds9">
                                        <div class="form-group">
                                            <label class="control-label ls2"> Date To  </label>
                                            <input type="text"  id="date_to" value="{$today}"  readonly 
                                                   class=" form-control  datepicker" placeholder="  Date To  "/>
                                        </div>
                                    </div>


                                    <div class="col-md-2 wds9">
                                        <div class="form-group">
                                            <label class="control-label ls2">Sample Id .</label>
                                            <input type="text"  id="sampleIdShow"
                                                   class="form-control  txtc  positiveNo " >
                                        </div>
                                    </div>

                                    <div class="col-md-2 wds9">
                                        <div class="form-group">
                                            <label class="control-label ls2">Pat Id .</label>
                                            <input type="text"  id="patIdShow"
                                                   class="form-control  txtc  positiveNo " >
                                        </div>
                                    </div>

                                    <div class="col-md-2 wds11">
                                        <div class="form-group">
                                            <label class="control-label ls2">Pat Mobile.</label>
                                            <input type="text"   id="patMobileShow"
                                                   class="form-control  txtc  positiveNo " >
                                        </div>
                                    </div>

                                    <div class="col-md-2 wds11">
                                        <div class="form-group">
                                            <label class="control-label ls2">Pat No.</label>
                                            <input type="text"  id="statusNoRemote"
                                                   class="form-control  txtc searchPatRemote positiveNo " >
                                        </div>
                                    </div>

                                    <div class="col-md-4 wds25">
                                        <div class="form-group">
                                            <label class="control-label ls2"> Pat. Name  </label>
                                            <input type="hidden" class="form-control"    id="patientIdRemote"  >
                                        </div>
                                    </div>

                                    {if $programesetting->branches == 1 && $showBrancheSelect  } 
                                    <div class="col-md-2">
                                        <div class="form-group">
                                            <label class="control-label ls2">Branch    </label>
                                            <select class="form-control select2h" id="branchSearch" >
                                                <option value="">All</option>
                                                {foreach $allBranches as $data}
                                                <option value="{$data->id}">{$data->name}</option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </div>
                                    {/if}

                                    <a class="btn btn-primary btn-sm" id="searchvisitIndexBtn" data-deptId ="12" style="margin-top: 20px;" >
                                        <i class="fa fa-search"></i> Search </a>

                                </div>
                            </div>
                            <div id="visitNew"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--------------------------------------------------------------------------- internal Investigation Model-------------------------------------------------------------------------------------->
<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="internalShow" style="min-width:1000px;">
    <div class="modal-dialog  modal-lg wds80">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">  </h4>
            </div>
            <div class="modal-body">
                <div class="portlet-body form">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="portlet blue-hoki box">
                                <div class="portlet-title">
                                    <div class="caption">   </div>
                                </div>
                                <div class="portlet-body all">
                                    <div  id="divShow">

                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn default" id="addLabVisitInternal"> Save </button>
                            <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"  id="edit_detectionforview">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title"> Edit </h4>
            </div>
            <div class="modal-body">
                <div class="portlet-body form">
                    <form action="" id="" method="post" class="form-horizontal  emptyform" >
                        <div class="form-body">
                            <!------===========================================------->
                            <div>
                                <div id="detectionforview" class=""> </div>
                            </div>


                            <!------===========================================------->
                            <div class="modal-footer">
                                <!--                                <button type="button" class="btn green" id="editmodel_submit"> Update </button>-->
                                <button type="button" id="amountcloseinput"   class="btn default" data-dismiss="modal">Close</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
    </div>
</div>

<div class="modal fade" id="detectionadd" tabindex="-1" role="basic" aria-hidden="true">
    <meta charset="utf8"/>
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button style="float: left;" type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title txtr bold"> إضافة كشف </h4>
                <span id="sucssmsg" style="display: none;">لقد تم إضافة كشف جديد</span>
            </div>
            <div class="modal-body modtbl"  style="margin: 15px;">
                <from  id="form_add_detection" action="" method="post">
                    <table class="table table-bordered table-striped table-hover">
                        <thead>
                        <th>نوع الكشف</th>
                        <th class="wds20">قيمة الكشف</th>
                        </thead>
                        <tbody>
                            <tr>
                                <td>
                                    <div class="input-group wds100" >
                                        <input type="text" class="form-control" name="detectiontp" id="detectiontp" placeholder="ادخل نوع الكشف">
                                    </div>
                                </td>
                                <td>
                                    <div class="input-group">
                                        <input type="text" class="form-control positivefloat" name="detectionvl"  id="detectionvl" placeholder="ادخل قيمة الكشف">
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </from>

                <div class="modal-footer">
                    <button type="button" class="btn default" data-dismiss="modal">إغلاق</button>
                    <button type="button" class="btn blue" id="detectionadd_submit" >حفظ</button>

                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
</div>

<div class="modal fade" id="editModal" tabindex="-1" role="basic" aria-hidden="true"> </div>
<div id="printRDiv"></div>
<div id="editDiv"></div>
<div id="printingDiv"></div>
<div id="residDiv"></div>
<div id="editModalDiv"></div>
<div id="externalsss" style="display: none;"></div>



{literal}
<style>
    .ms-list{
        min-height: 575px  !important ;
    }

    .m10{
        margin:  10px 0px 10px 0px !important ;
    }

    .p10{
        padding:   10px 0px 10px 0px !important ;
    }

    .p105{
        padding:   10px 5px 5px 5px !important ;
    }

    td{
        text-align: right !important ;
    }

    .radio-inline{
        font-weight: 600;
        padding-left: 0;
    }

    .checkbox-inline+.checkbox-inline, .radio-inline+.radio-inline {
        margin-top: 0;
        margin-left: 0px;
    }
</style>
{/literal}








