<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" style="height:5px">
                        <div class="caption">
                            <i class="fa fa-edit"></i> Operation Data
                        </div>

                        <div class="actions">
                            <a  class="btn btn-default btn-sm"
                                href="{$hosturl}/controllers/{$controllname}.php?ac=operation_all&patientid={$opPatId}"  >
                                Show All </a>
                        </div>

                        <div class="actions">
                            <input autofocus class="form-control" name="card_patient_id" id="card_patient_id" 
                                   type="text" data-deviceId=""  data-patientId="" 
                                   style="    position: fixed; top: 15%;right: 24%; width: 5%;">
                        </div>


                    </div>
                    <div class="portlet-body " >
                        <input type="hidden" id="operationData" value="1">
                        <input type="hidden" id="controllName" value="operationreport">
                        <input type="hidden" id="labVisitId" value="{$labVisitId}">
                        <input type="hidden" id="opPatId" value="{$opPatId}">
                        <input type="hidden" id="deviceNo" value="{$deviceNo}">

                        <div class="portlet-title tbox txtc" style="background: #deb8b8;">
                            <div class="caption  col-md-6">
                                <span class="caption-subject bold uppercase">  
                                    Operation  Date : <span  id="VisitDateDetails"> {$visitDate}  </span></span>
                            </div>
                            <div class="actions col-md-6"></div>
                        </div>

                        <div class="tabbable tabbable-custom tabbable-noborder">

                            <ul class="nav nav-tabs" id="rowTab">
                                <li class="aw_3d_list active"> <a href="#tab1" data-toggle="tab"> Lab </a> </li>
                                <li class="aw_3d_list"> <a href="#tab2" data-toggle="tab"> Board </a> </li>
                                <li class="aw_3d_list"> <a href="#tab3" data-toggle="tab"> Sheet  </a> </li>
                                <li class="aw_3d_list"> <a href="#tab4" data-toggle="tab"> Rays  </a> </li>
                                <li class="aw_3d_list"> <a href="#tab5" data-toggle="tab"> Others  </a> </li>
                            </ul>

                            <div class="tab-content">
                                <!---======================================================== tab1============================================================================================ ----->
                                <div class="tab-pane active " id="tab1">
                                    <div class="row">
                                        <div class="portlet-title tbox">
                                            <div class="caption font-green-haze col-md-6">
                                                <span class="caption-subject bold uppercase"> Lab ( Visit Date : {$labVisitDate} )</span>
                                            </div>
                                            <div class="actions col-md-6"></div>
                                        </div>


                                        {if $labVisitCount > 0 }
                                        <div class="col-md-12" id="labVisitDiv">
                                            <h3 style="text-align: center;color: green;"> Loading Available  Visit Now.</h3>
                                        </div>
                                        {else}
                                        <div class="col-md-12">
                                            <h3 style="text-align: center;color: red;"> No Lab Visits Available Now.</h3>
                                        </div>

                                        {/if}

                                    </div>

                                    <div id="talks-loading1" style="z-index: 3000;position: absolute;top: 35%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
                                        <img src="{$hosturl}/../upload/loading.gif">
                                    </div>
                                </div>
                                <!---======================================================== tab2============================================================================================ ----->
                                <div class="tab-pane " id="tab2">
                                    <div class="row">
                                        <div class="portlet-title tbox">
                                            <div class="caption font-green-haze col-md-6">
                                                <span class="caption-subject bold uppercase"> Board</span>
                                            </div>
                                            <div class="actions col-md-6"></div>
                                        </div>

                                        {if $boardCount > 0 }
                                        <div class="col-md-12">
                                            <table class="table table-bordered table-striped table-hover rtl">
                                                <tr>
                                                    <th>اسم المريضة  </th>
                                                    <td colspan="2">   {$visPatientName}  </td>
                                                </tr>

                                                <tr>
                                                    <th>اسم الجراح  </th>
                                                    <td colspan="2">   {$drName}  </td>
                                                </tr>

                                                <tr>
                                                    <th>اسم العملية   </th>
                                                    <td colspan="2">   {$detectionName}  </td>
                                                </tr>

                                                <tr>
                                                    <th>دكتور التخدير   </th>
                                                    <td colspan="2">         
                                                        <select class="form-control select2me  updateElement "   id="anaesthetists"
                                                                data-placeholder="Select..." data-id="{$board->id}"  
                                                                data-colName="anesthesiologist_id" data-tableName="operation_data">
                                                            <option></option>
                                                            {foreach  $anaesthetists as $data}
                                                            <option value="{$data.user_id}" {if $data.user_id == $board->anesthesiologist_id} selected {/if}>{$data.name}</option>
                                                            {/foreach}
                                                        </select> 
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <th>اسم الممرضة    </th>
                                                    <td colspan="2">         
                                                        <select class="form-control select2me  updateElement " id="nurses"
                                                                data-placeholder="Select..." data-id="{$board->id}"  
                                                                data-colName="nurse_id" data-tableName="operation_data">
                                                            <option></option>
                                                            {foreach  $nurses as $data}
                                                            <option value="{$data.user_id}" {if $data.user_id == $board->nurse_id} selected {/if}>{$data.name}</option>
                                                            {/foreach}
                                                        </select> 
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <th> عدد الآلات    </th>
                                                    <td>         
                                                        <input type="number" class="form-control updateElement positiveNo" data-id="{$board->id}" 
                                                               data-colName="machine_no"   data-tableName="operation_data"  id="machineNo"
                                                               value="{$board->machine_no}" data-toggle="popover" data-trigger="hover"  
                                                               data-placement="bottom"  data-content="{$board->machine_no}" readonly/>
                                                    </td>
                                                    <td class="wds10">
                                                        <a href="javascript:;" class="btn green-haze plusOne" data-target="machineNo"> + </a>
                                                        <a href="javascript:;" class="btn red minusOne" data-target="machineNo"> - </a>
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <th> عدد الشاش    </th>
                                                    <td>         
                                                        <input type="number" class="form-control updateElement positiveNo" data-id="{$board->id}" 
                                                               data-colName="gauze_no"   data-tableName="operation_data"  id="gauzeNo"
                                                               value="{$board->gauze_no}" data-toggle="popover" data-trigger="hover"  
                                                               data-placement="bottom"  data-content="{$board->gauze_no}" readonly/>
                                                    </td>
                                                    <td>
                                                        <a href="javascript:;" class="btn green-haze plusOne" data-target="gauzeNo"> + </a>
                                                        <a href="javascript:;" class="btn red minusOne" data-target="gauzeNo"> - </a>
                                                    </td>
                                                </tr>

                                                <tr>
                                                    <th> عدد الفوط    </th>
                                                    <td>         
                                                        <input type="number" class="form-control updateElement positiveNo" data-id="{$board->id}" 
                                                               data-colName="pads_no"   data-tableName="operation_data"  id="padsNo"
                                                               value="{$board->pads_no}" data-toggle="popover" data-trigger="hover"  
                                                               data-placement="bottom"  data-content="{$board->pads_no}" readonly/>
                                                    </td>
                                                    <td>
                                                        <a href="javascript:;" class="btn green-haze plusOne" data-target="padsNo"> + </a>
                                                        <a href="javascript:;" class="btn red minusOne" data-target="padsNo"> - </a>
                                                    </td>
                                                </tr>


                                                <!--tr>
                                                    <th>  ملاحظات    </th>
                                                    <td>         
                                                        <textarea class="form-control has-info updateElement " rows="3" placeholder="Enter more text" 
                                                                  data-id="{$board->id}"   data-colName="notes"   data-tableName="operation_data"   >
                                                            {$board->notes}
                                                        </textarea>
                                                    </td>
                                                </tr-->

                                            </table>
                                        </div>

                                        {else}
                                        <div class="col-md-12">
                                            <h3 style="text-align: center;color: red;">  No Operation Visits Available Today For This  Patient.</h3>
                                        </div>

                                        {/if}
                                    </div>

                                    <div id="talks-loading2" style="z-index: 3000;position: absolute;top: 35%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
                                        <img src="{$hosturl}/../upload/loading.gif">
                                    </div>
                                </div>
                                <!---======================================================== tab3============================================================================================ ----->
                                <div class="tab-pane " id="tab3">
                                    <div class="row">
                                        <div class="portlet-title tbox">
                                            <div class="caption font-green-haze col-md-6">
                                                <span class="caption-subject bold uppercase"> Sheet </span>
                                            </div>
                                            <div class="actions col-md-6"></div>
                                        </div>


                                        {if $opPatId > 0 }
                                        <div class="col-md-12" id="sheetDiv">
                                            <h3 style="text-align: center;color: green;"> Loading  Now.....</h3>
                                        </div>
                                        {else}
                                        <div class="col-md-12" id="sheetDiv">
                                            <h3 style="text-align: center;color: red;"> No Data Available Now.</h3>
                                        </div>

                                        {/if}

                                    </div>

                                    <div id="talks-loading3" style="z-index: 3000;position: absolute;top: 35%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
                                        <img src="{$hosturl}/../upload/loading.gif">
                                    </div>
                                </div>
                                <!---======================================================== tab4============================================================================================ ----->
                                <div class="tab-pane  " id="tab4">
                                    <div class="row">
                                        <div class="portlet-title tbox">
                                            <div class="caption font-green-haze col-md-6">
                                                <span class="caption-subject bold uppercase"> Rays </span>
                                            </div>
                                            <div class="actions col-md-6"></div>
                                        </div>


                                        {if $raysVisitCount > 0 }
                                        <div class="col-md-12" id="raysDiv">
                                            <table class="table table-striped table-hover table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th>Data</th>
                                                        <th>Rays</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    {foreach $raysVisits as $visit}
                                                    <tr>
                                                        <td class="col-md-2">  {$visit.visitdate}</td>
                                                        <td class="col-md-9" >
                                                            {foreach $visit.raysresults as $ray}
                                                            <a  class=" btn default  showOpRayImgs"  
                                                                data-id="{$ray->id}" style="margin:  5px 0 ;float: left; "  > 
                                                                {$ray->invname} </a> 
                                                            {/foreach}
                                                        </td>
                                                    </tr>
                                                    {/foreach}
                                                </tbody>
                                            </table>
                                        </div>
                                        {else}
                                        <div class="col-md-12">
                                            <h3 style="text-align: center;color: red;"> No Data Available Now.</h3>
                                        </div>

                                        {/if}

                                    </div>

                                    <div id="talks-loading4" style="z-index: 3000;position: absolute;top: 35%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
                                        <img src="{$hosturl}/../upload/loading.gif">
                                    </div>
                                </div>

                                <!---======================================================== tab5============================================================================================ ----->
                                <div class="tab-pane  " id="tab5">

                                    <div class="row m-b15">
                                        <div class="portlet-title tbox">
                                            <div class="caption font-green-haze col-md-6">
                                                <span class="caption-subject bold uppercase"> Pictures</span>
                                            </div>
                                            <div class="actions col-md-6"></div>
                                        </div>


                                        {if $picsCount > 0 }
                                        <div class="col-md-12" id="PicsDiv">
                                            {foreach $pics as $pic}
                                            {if $pic.imagename}
                                            <div class="col-md-3">
                                                <div class="row clinick ltr" >
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info col-md-12">
                                                        <input type="text" class="form-control  txtc"  readonly value="{$pic.sonardate}"/>
                                                    </div>

                                                    <div class="col-md-12">
                                                        <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 250px; height: 170px;"> 
                                                            <img class="showOpPicFile" 
                                                                 {if $pic.imagename} src="{$hosturl}/../upload/sonar/{$pic.imagename}"{/if} />
                                                        </div>
                                                    </div>

                                                    <div class="form-group form-md-line-input form-md-floating-label has-info col-md-12">
                                                        <input type="text" class="form-control" readonly  value="{$pic.notes}"/>
                                                    </div>
                                                </div>
                                            </div>
                                            {/if}
                                            {/foreach}
                                        </div>
                                        {else}
                                        <div class="col-md-12">
                                            <h3 style="text-align: center;color: red;"> No Pictures Available Now.</h3>
                                        </div>

                                        {/if}
                                    </div>


                                    <div class="row m-b15">
                                        <div class="portlet-title tbox">
                                            <div class="caption font-green-haze col-md-6">
                                                <span class="caption-subject bold uppercase">  Videos </span>
                                            </div>
                                            <div class="actions col-md-6"></div>
                                        </div>

                                        {if $videosCount > 0 }
                                        <div class="col-md-12" id="videosDiv">
                                            {foreach $videos as $video}
                                            {if $video.vediourl}
                                            <div class="col-md-3">
                                                <div class="row clinick ltr" >
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info col-md-12">
                                                        <input type="text" class="form-control  txtc"  readonly value="{$video.sonardate}"/>
                                                    </div>

                                                    <div class="col-md-12">
                                                        <a  class="input-group-addon btn vidOpShow" 
                                                            data-file="{$video.vediourl}"> Show </a> 
                                                        <a  class="input-group-addon btn vid-download" 
                                                            href="{$hosturl}/controllers/sonar.php?ac=downloadfile&id={$video.id} &type=1" > Download </a> 
                                                    </div>
                                                </div>
                                            </div>
                                            {/if}
                                            {/foreach}
                                        </div>
                                        {else}
                                        <div class="col-md-12">
                                            <h3 style="text-align: center;color: red;"> No Videos Available Now.</h3>
                                        </div>
                                        {/if}
                                    </div>


                                    <div class="row m-b15">
                                        <div class="portlet-title tbox">
                                            <div class="caption font-green-haze col-md-6">
                                                <span class="caption-subject bold uppercase">  PDF </span>
                                            </div>
                                            <div class="actions col-md-6"></div>
                                        </div>

                                        {if $pdfCount > 0 }
                                        <div class="col-md-12" id="pdfsDiv">
                                            {foreach $pdfs as $pdf}
                                            {if $pdf.vediourl}
                                            <div class="col-md-2">
                                                <div class="row clinick ltr" >
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info col-md-12">
                                                        <input type="text" class="form-control  txtc"  readonly value="{$pdf.sonardate}"/>
                                                    </div>

                                                    <div class="col-md-12">
                                                        <a  class="input-group-addon btn vid-download"    target="_blank"
                                                            href="{$hosturl}/../upload/sonarpdf/1/{$pdf.vediourl}" > Show </a> 
                                                    </div>
                                                </div>
                                            </div>
                                            {/if}
                                            {/foreach}
                                        </div>
                                        {else}
                                        <div class="col-md-12">
                                            <h3 style="text-align: center;color: red;"> No PDF Available Now.</h3>
                                        </div>
                                        {/if}
                                    </div>




                                    <div id="talks-loading5" style="z-index: 3000;position: absolute;top: 35%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
                                        <img src="{$hosturl}/../upload/loading.gif">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" 
     data-keyboard="false"   id="showFileM" style="min-width:1000px;">
    <div class="modal-dialog  modal-lg wds65">
        <div class="modal-content" style="">
            <div class="modal-body" style="background: rgba(0,0,0,.5);">
                <div class="portlet-body">
                    <button type="button" class="close"
                            style="margin-right: 5px; margin-top: 10px; width: 20px; height: 20px;"
                            data-dismiss="modal" aria-hidden="true"></button>
                    <div class="row">
                        <div class="col-md-12" style="text-align: center;"  id="scrollImgDiv"></div>
                        <div class="col-md-12" style="text-align: center;" >
                            <div class="fileinput fileinput-new" data-provides="fileinput">
                                <div class="fileinput-preview thumbnail" data-trigger="fileinput"> 
                                    <img id="source_image" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

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

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


<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="showVideo" style="min-width:1000px;">
    <div class="modal-dialog  modal-lg wds90">
        <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">

                    <div class="row">
                        <div class="col-md-12">
                            <video style="width: 100%;"   id="video_vediourl" controls>
                                <source src="" type="video/mp4" id="source_vediourl" >
                                Your browser does not support HTML5 video.
                            </video>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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




<div id="talks-loading" style="z-index: 3000;position: absolute;top: 0%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
    <img src="{$hosturl}/../upload/loading.gif">
</div>








