<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 fright">   الزيارات  </div>
                        <div class="tools fleft">
                            <a href="#" class="collapse" title="تصغير / تكبير"></a>
                            <a class="fff bold" href="{$hosturl}/controllers/invsdept.php?ac=index">عرض جميع  الزيارات</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="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">

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

                                            <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px; background-color: yellowgreen;">
                                                <tr>
                                                    <td class="wds11">تاريخ الدخول  </td>
                                                    <td>
                                                        <input class="form-control patientvisitidCheckDate  datepicker edited"  type="text"
                                                               id="visitdate" name="visitdate" required value="{$today}" readonly>
                                                    </td>
                                                    <td class="wds13"  id="currentTime" style="direction: ltr;"></td>
                                                    <td class="wds13">تاريخ الاستلام  </td>
                                                    <td>
                                                        <input class="form-control patientvisitidCheckDate  datepicker edited"  readonly 
                                                               type="text"  id="receiveDate" name="receiveDate" required value="{$today}">
                                                    </td>
                                                    <td class="wds16" id="receiveTime" style="direction: ltr;"></td>
                                                </tr>
                                            </table>

                                            <table class="table table-bordered  table-hover rtl m10" style=" background-color: #e1786e;">
                                                <tr>
                                                    <td class="wds11">رقم المريضة</td>

                                                    <td class="wds18">
                                                        <input type="text"  id="statusNoRemoteLab"
                                                               class="form-control  txtc searchPatRemoteLab positiveNo " >
                                                    </td>

                                                    <td class="wds11">اسم المريضة</td>

                                                    <td>
                                                        <input type="hidden" class="form-control"    id="patientvisitid" name="patientid"  >
                                                        <div class="txtc ltr" id="phonesContainer"></div>
                                                    </td>
                                                </tr>
                                            </table>

                                            <table class="table table-bordered  table-hover rtl m10" style=" background-color: #e1786e;">
                                                <tr>
                                                    <td class="wds12"> صاحب  الزيارة </td>

                                                    <td class="wds40">
                                                        <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>
                                                                    الزوجة       </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>
                                                                    الزوج  </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>
                                                                    طفل        </label>
                                                            </div>
                                                        </div>
                                                    </td>

                                                    <td class="wds5"  id="childHead" style="display: none" >الطفل</td>

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

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

                                                <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px;">
                                                    <tr>
                                                        <th class="wds13">الصفة</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">اسم المريضة</th>

                                                        <td>
                                                            <input type="text" id="wifename" name="wifename"  class="form-control"   />
                                                            <span id="lb_ckwifename" class="help-block clrred"
                                                                  style="display: none;">هذا الاسم موجود من قبل</span>
                                                        </td>

                                                        <td class="wds20">
                                                            <div class="radio-list">
                                                                <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 rtl" style="margin-bottom: 0px;">
                                                    <tr>
                                                        <th class="wds13">الموبايل 1</th>
                                                        <td class="wds20">
                                                            <input type="text" name="phone" id="phone"
                                                                   class="form-control  digitsOnly uniquePhone"    maxlength="11" >
                                                            <span id="lb_ckphone" class="help-block clrred"
                                                                  style="display: none;">هذا الرقم موجود من قبل</span>
                                                        </td>

                                                        <th class="wds13">الموبايل 2</th>
                                                        <td class="wds20">
                                                            <input type="text" name="mobile" id="mobile"
                                                                   class="form-control  digitsOnly uniquePhone"  maxlength="11"  >
                                                            <span id="lb_ckmobile" class="help-block clrred"
                                                                  style="display: none;">هذا الرقم موجود من قبل</span>
                                                        </td>

                                                        <th class="wds10">السن </th>
                                                        <td class="wds10">
                                                            <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 rtl" style="margin-bottom: 0px;">
                                                    <tr>
                                                        <th class="wds13">العنوان</th>
                                                        <td>
                                                            <input type="text" id="address"  name="address" class="form-control ">
                                                        </td>
                                                    </tr>
                                                </table>

                                            </div>


                                            <table class="table table-bordered  table-hover rtl m10">
                                                <tr>
                                                    <th class="wds13"> الطبيب المعالج </th>

                                                    <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>
                                                </tr>
                                            </table>

                                            <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 rtl m10 p10">
                                                <tr>
                                                    <th class="wds13">ملاحظات</th>
                                                    <td>
                                                        <input type="text" id="notes" name="notes"  class="form-control ">
                                                    </td>
                                                </tr>
                                            </table>

                                            <table class="able table-bordered  table-hover rtl m10 p10 wds100" id="externalTable"
                                                   style=" background-color: #deb1c1; display: none;">
                                                <thead>
                                                    <tr>
                                                        <th class="txtc wds50">التحليل  </th>
                                                        <th class="txtc">المعمل  </th>
                                                    </tr>
                                                </thead>
                                                <tbody id="externalContainer">
                                                    <tr>
                                                        <td >

                                                        </td>
                                                        <td >

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

                                            <table class="table noborder   rtl" style=" margin-bottom: 0px; background-color: #bcea5d;">
                                                <tr>
                                                    <td class="txtc">الإجمالى </td>
                                                    <td class="txtc">الخصم </td>
                                                    <td class="txtc wds15">نوع  الخصم</td>
                                                    <td class="txtc">كاش </td>
                                                    <td class="txtc">فيزا </td>
                                                    <td class="txtc">المتبقى </td>

                                                    <td  rowspan="2">
                                                        <a class=" bg-blue-chambray btn" id="saveLabVisit" style="margin-top: 25%;">حفظ </a>
                                                        <a class=" bg-green btn  saveEditLabVisit wds90" id="saveEditLabVisit" 
                                                           data-visitId="0" style="display: none;">حفظ </a>
                                                        <a class=" bg-red btn  cancelEditLabVisit wds90" id="cancelEditLabVisit" 
                                                           data-visitId="0" style="display: none;">إلغاء</a>

                                                    </td>
                                                </tr>

                                                <tr>
                                                    <td >
                                                        <input  class="form-control digitsOnly detectionvalue"  type="text"  id="totaldetectionvalue" value="0" name="totaldetectionvalue" required="required">
                                                    </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" checked  value="0" > قيمة  </label>
                                                            <label class="radio-inline">
                                                                <input type="radio" class="detectionvalue" name="discountType"  value="1">  % </label>
                                                        </div>
                                                    </td>
                                                    <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>

                                        </div>

                                        <div class="col-md-5">
                                            <table class="table table-bordered  table-hover rtl">
                                                <tr>
                                                    <td>
                                                        <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-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-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">

                                    </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 fright">
                                عرض الزيارات
                            </div>
                            <div class="tools fleft">
                                <a href="#" class="collapse" title="تصغير / تكبير"></a>
                                <!--a class="fff bold" href="{$hosturl}/controllers/{$controllname}.php?ac=getalldepts">تفريغ  الزيارات</a-->
                            </div>
                        </div>
                        <div class="portlet-body form">

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

                                    <div class="col-md-5">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label txtr">التاريخ من  </label>
                                            <div class="col-md-6">
                                                <input type="text"  id="date_from" value="{$today}"  readonly 
                                                       class=" form-control input-medium pastSearchDate" placeholder="التاريخ من "/>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-md-5">
                                        <div class="form-group">
                                            <label class="col-md-3 control-label txtr">التاريخ الى </label>
                                            <div class="col-md-6">
                                                <input type="text"  id="date_to" value="{$today}"  readonly 
                                                       class=" form-control input-medium datepicker" placeholder="التاريخ إلى"/>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-md-2">
                                        <div class="form-group">
                                            <div class="col-md-6">
                                                <a class="btn btn-primary btn-sm" id="searchvisitIndexBtn" data-deptId ="12" >
                                                    <i class="fa fa-search"></i> بحث </a>
                                            </div>
                                            <label class="col-md-3 control-label txtr">  </label>
                                        </div>
                                    </div>

                                </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="addVisitInvsInternal"> 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 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}








