
<div class="page-content-wrapper">
    <div class="page-content all">
        <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> Lab Requests
                        </div>
                        <div class="actions">
                            <a class="btn yellow-gold btn-xs" href="{$hosturl}/controllers/{$controllname}.php?ac=invsData" style=" float: left;"  >
                                Investigation Details 
                            </a>
                            <a class="btn btn-success btn-xs" href="{$hosturl}/controllers/visits.php?ac=lab_visit" style=" float: left;"  >
                                new Visit
                            </a>
                            <!--a class="btn red-soft btn-xs" href="{$hosturl}/controllers/patients.php" style=" float: left;"  >
                                <i class="fa fa-pencil"></i> new Patient
                            </a-->
                        </div>
                    </div>
                    <div class="portlet-body" >
                        <div class="table-toolbar">

                        </div>

                        <div class="form-body">
                            <div class="row">
                                <div class="col-md-2 wds9">
                                    <div class="form-group">
                                        <label class="control-label ls2">Date From</label>
                                        <input type="text" class="form-control datepicker"  style=" border: 1px solid #000000;"  
                                               readonly="readonly"  id="searchValue1" data-type="invests" data-type1="lab" 
                                               data-status="0"   value=""/>
                                    </div>
                                </div>

                                <div class="col-md-2 wds9">
                                    <div class="form-group">
                                        <label class="control-label ls2">Date To</label>
                                        <input type="text" class="form-control datepicker  "  style=" border: 1px solid #000000;"   
                                               readonly="readonly" id="searchValue2" data-type="invests" data-type1="lab"  data-status="0" 
                                               value=""/>
                                    </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">Patient No</label>
                                        <input type="text"  id="statusNoRemote"  
                                               class="form-control  txtc searchPatRemote positiveNo "  data-alert="no"  >
                                    </div>
                                </div>

                                <div class="col-md-5 wds25">
                                    <div class="form-group">
                                        <label class="control-label ls2">Patient Name</label>
                                        <input type="hidden" class="form-control"    id="patientIdRemote" 
                                               data-type="invests" data-type1="lab" >
                                    </div>
                                </div>

                                {if $programesetting->branches != 1  }
                                <input type="hidden"  id="branch_id"  name="branch_id"  value="1"> 
                                {else}
                                <div class="col-md-2 wds14">
                                    <div class="form-group form-md-line-input has-success">
                                        <select class="form-control select2h" id="branch_id"  name="branch_id" >
                                            {if $showStart == 1  } <option value="-1">choose</option>  {/if}
                                            {if $showAll == 1  } <option value="">All</option> {/if}
                                            {foreach $branches as $data}
                                            <option value="{$data->id}" {if $selectedBranch eq $data->id  }selected{/if}>{$data->name}</option>
                                            {/foreach}
                                        </select>
                                        <label for="branch_id">Branch </label>
                                    </div>
                                </div>
                                {/if} 

                                <div class="col-md-5 wds25">
                                    <div class="form-group">
                                        <label class="control-label ls2">Tests</label>
                                        <select class="form-control select2h" id="testId"  name="testId" >
                                            <option value=""></option>
                                            {foreach $invests as $invest}
                                            {if !empty($invest.name)}
                                            <option value="{$invest.id}" >{$invest.name}</option>
                                            {/if}
                                            {/foreach}
                                        </select>
                                    </div>
                                </div>

                                <div class="col-md-5 wds25">
                                    <label class="control-label ls2">Status </label>
                                    <select class="form-control select2h" id="testStatus"  name="testStatus" >
                                        <option value="1" selected >Unfinished</option>
                                        <option value="2">Finished</option>
                                        <option value="">All</option>
                                    </select>
                                </div>


                                <div class="col-md-1">
                                    <a class="btn btn-primary btn-sm"   id="searchRecords" 
                                       style="    margin-top: 21px;" data-type="invests" data-type1="lab"  data-status="0" >
                                        <i class="fa fa-search"></i> Search </a>
                                </div>

                            </div>
                            <div class="row">
                                <div class="col-md-12">
                                    <span id="oldSearchError" 
                                          style="color: red ; float: right; direction: rtl;padding-right: 15px;display: none;font-weight: bold"
                                          >حدد بيانات للبحث أولا ...............................</span>
                                </div>
                            </div>
                            <div class="row" >


                                <div class="col-md-8" id="invStatusDiv"> </div>

                                <div class="col-md-4" id="resultTableDiv">
                                    <table class="table table-striped table-hover table-bordered rtl" style=" width: 98%;margin-bottom: 2px;">
                                        <thead>
                                            <tr>
                                                <th colspan="6">     عدد المرضى          </th>
                                            </tr>
                                            <tr style="    background-color: yellow;">
                                                <td class="col-md-2 wds15">{$rescount}</td>
                                                <td class="col-md-2 wds14">{$res2count}</td>
                                                <td class="col-md-2 wds15">{$res3count}</td>
                                                <td class="col-md-2 wds14">{$res6count}</td>
                                                <td class="col-md-2 wds14">{$res4count}</td>
                                                <td class="col-md-2 wds14">{$res5count}</td>
                                                <td class="col-md-2 wds14">{$res9count}</td>
                                            </tr>
                                            <tr>
                                                <th class="col-md-2 wds15  searchRecords2"   data-cat ="1"
                                                    style="background-color: white;" data-type="invests" data-type1="lab" >
                                                    <img alt="" class="img-circle" 
                                                         src="{$hosturl}/../upload/inv_status/all.png" 
                                                         style="height: 30px;border-radius: 0%;width: 50%;"/>
                                                </th>
                                                <th class="col-md-2 wds14  searchRecords2"   data-cat ="2"
                                                    style="background-color: #82e6e6;" data-type="invests" data-type1="lab" >
                                                    <img alt="" class="img-circle" 
                                                         src="{$hosturl}/../upload/inv_status/new2.png" 
                                                         style="height: 30px;border-radius: 0%;width: 50%;"/>
                                                </th>
                                                <th class="col-md-2 wds15  searchRecords2"   data-cat ="3"
                                                    style="background-color: white;" data-type="invests" data-type1="lab" >
                                                    <img alt="" class="img-circle" 
                                                         src="{$hosturl}/../upload/inv_status/inProgress.jpeg" 
                                                         style="height: 30px;border-radius: 0%;width: 50%;"/>
                                                </th>
                                                <th class="col-md-2 wds14  searchRecords2"   data-cat ="6"
                                                    style="background-color: #82e6e6;" data-type="invests" data-type1="lab" >
                                                    <img alt="" class="img-circle" 
                                                         src="{$hosturl}/../upload/inv_status/sand_clock.png" 
                                                         style="height: 30px;border-radius: 0%;width: 50%;"/>
                                                </th>
                                                <th class="col-md-2  wds14 searchRecords2"   data-cat ="4"
                                                    style="background-color: white;" data-type="invests" data-type1="lab" >
                                                    <img alt="" class="img-circle" 
                                                         src="{$hosturl}/../upload/inv_status/printed.png" 
                                                         style="height: 30px;border-radius: 0%;width: 50%;"/>
                                                </th>
                                                <th class="col-md-2  wds14  searchRecords2"   data-cat ="5"
                                                    style="background-color: #82e6e6;" data-type="invests" data-type1="lab" >
                                                    <img alt="" class="img-circle" 
                                                         src="{$hosturl}/../upload/inv_status/verified-symbol.png" 
                                                         style="height: 30px;border-radius: 0%;width: 50%;"/>
                                                </th>

                                                <th class="col-md-2  wds14  searchRecords2"   data-cat ="9"
                                                    style="background-color: white;" data-type="invests" data-type1="lab" >
                                                    <img alt="" class="img-circle" 
                                                         src="{$hosturl}/../upload/inv_status/s-icon.png" 
                                                         style="height: 30px;border-radius: 0%;width: 50%;"/>
                                                </th>
                                            </tr>
                                        </thead>
                                    </table>

                                    <div style="overflow-y:  auto; max-height: 550px;" id='result_1'>
                                        <table class="table table-striped table-hover table-bordered rtl" style=" width: 98%;" >
                                            <tbody>

                                                {foreach $requests_all as $single}
                                                <tr>
                                                    <td>
                                                        <a class="invStatus"   id="invStatus{$single.visitid}" href="javascript:;" style=" float: right;"  data-visitid="{$single.visitid}" >
                                                            {if  $single.for_husband == 1 }
                                                            {$single.husbandName}
                                                            {else if  $single.for_husband == 2}

                                                            {if $single.child_name != ''  && $single.child_name != null } 
                                                            {$single.child_name}  /  {$single.wifeName}
                                                            {else}
                                                            {if $single.child_gender eq 1} طفل {else} طفلة  {/if}     /  {$single.wifeName}
                                                            {/if} 

                                                            {else}
                                                            {$single.wifeName}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td class="wds10">
                                                        <img alt="" class="img-circle" 
                                                             src="{$hosturl}/../upload/inv_status/{$single.statusImg}" 
                                                             style="height: 30px;border-radius: 0%;width: 100%;"/>
                                                    </td>
                                                </tr> 
                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>

                                    <div style="overflow-y:  auto; max-height: 550px;display: none;" id='result_2'>
                                        <table class="table table-striped table-hover table-bordered rtl" 
                                               style=" width: 98%;" >
                                            <tbody>

                                                {foreach $requests_2 as $single}
                                                <tr>
                                                    <td>
                                                        <a class=" invStatus"   id=" invStatus{$single.visitid}" href="javascript:;" style=" float: right;"  data-visitid="{$single.visitid}" >
                                                            {if  $single.for_husband == 1 }
                                                            {$single.husbandName}
                                                            {else if  $single.for_husband == 2}

                                                            {if $single.child_name != ''  && $single.child_name != null } 
                                                            {$single.child_name}  /  {$single.wifeName}
                                                            {else}
                                                            {if $single.child_gender eq 1} طفل {else} طفلة  {/if}     /  {$single.wifeName}
                                                            {/if} 

                                                            {else}
                                                            {$single.wifeName}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td class="wds10">
                                                        <img alt="" class="img-circle" 
                                                             src="{$hosturl}/../upload/inv_status/{$single.statusImg}" 
                                                             style="height: 30px;border-radius: 0%;width: 100%;"/>
                                                    </td>

                                                </tr> 

                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>
                                    <div style="overflow-y:  auto; max-height: 550px;display: none;" id='result_3'>
                                        <table class="table table-striped table-hover table-bordered rtl" 
                                               style=" width: 98%;" '>
                                            <tbody>

                                                {foreach $requests_3 as $single}
                                                <tr>
                                                    <td>
                                                        <a class=" invStatus"   id=" invStatus{$single.visitid}" href="javascript:;" style=" float: right;"  data-visitid="{$single.visitid}" >
                                                            {if  $single.for_husband == 1 }
                                                            {$single.husbandName}
                                                            {else if  $single.for_husband == 2}

                                                            {if $single.child_name != ''  && $single.child_name != null } 
                                                            {$single.child_name}  /  {$single.wifeName}
                                                            {else}
                                                            {if $single.child_gender eq 1} طفل {else} طفلة  {/if}     /  {$single.wifeName}
                                                            {/if} 

                                                            {else}
                                                            {$single.wifeName}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td class="wds10">
                                                        <img alt="" class="img-circle" 
                                                             src="{$hosturl}/../upload/inv_status/{$single.statusImg}" 
                                                             style="height: 30px;border-radius: 0%;width: 100%;"/>
                                                    </td>

                                                </tr> 

                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>

                                    <div style="overflow-y:  auto; max-height: 550px;display: none;" id='result_6'>
                                        <table class="table table-striped table-hover table-bordered rtl" 
                                               style=" width: 98%;" '>
                                            <tbody>

                                                {foreach $requests_6 as $single}
                                                <tr>
                                                    <td>
                                                        <a class=" invStatus"   id=" invStatus{$single.visitid}" href="javascript:;" style=" float: right;"  data-visitid="{$single.visitid}" >
                                                            {if  $single.for_husband == 1 }
                                                            {$single.husbandName}
                                                            {else if  $single.for_husband == 2}

                                                            {if $single.child_name != ''  && $single.child_name != null } 
                                                            {$single.child_name}  /  {$single.wifeName}
                                                            {else}
                                                            {if $single.child_gender eq 1} طفل {else} طفلة  {/if}     /  {$single.wifeName}
                                                            {/if} 

                                                            {else}
                                                            {$single.wifeName}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td class="wds10">
                                                        <img alt="" class="img-circle" 
                                                             src="{$hosturl}/../upload/inv_status/{$single.statusImg}" 
                                                             style="height: 30px;border-radius: 0%;width: 100%;"/>
                                                    </td>

                                                </tr> 

                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>


                                    <div style="overflow-y:  auto; max-height: 550px;display: none;" id='result_4'>
                                        <table class="table table-striped table-hover table-bordered rtl" 
                                               style=" width: 98%;">
                                            <tbody>

                                                {foreach $requests_4 as $single}
                                                <tr>
                                                    <td>
                                                        <a class=" invStatus"   id=" invStatus{$single.visitid}" href="javascript:;" style=" float: right;"  data-visitid="{$single.visitid}" >
                                                            {if  $single.for_husband == 1 }
                                                            {$single.husbandName}
                                                            {else if  $single.for_husband == 2}

                                                            {if $single.child_name != ''  && $single.child_name != null } 
                                                            {$single.child_name}  /  {$single.wifeName}
                                                            {else}
                                                            {if $single.child_gender eq 1} طفل {else} طفلة  {/if}     /  {$single.wifeName}
                                                            {/if} 

                                                            {else}
                                                            {$single.wifeName}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td class="wds10">
                                                        <img alt="" class="img-circle" 
                                                             src="{$hosturl}/../upload/inv_status/{$single.statusImg}" 
                                                             style="height: 30px;border-radius: 0%;width: 100%;"/>
                                                    </td>

                                                </tr> 

                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>
                                    <div style="overflow-y:  auto; max-height: 550px;display: none;" id='result_5'>
                                        <table class="table table-striped table-hover table-bordered rtl" 
                                               style=" width: 98%;" >
                                            <tbody>

                                                {foreach $requests_5 as $single}
                                                <tr>
                                                    <td>
                                                        <a class=" invStatus"   id=" invStatus{$single.visitid}" href="javascript:;" style=" float: right;"  data-visitid="{$single.visitid}" >
                                                            {if  $single.for_husband == 1 }
                                                            {$single.husbandName}
                                                            {else if  $single.for_husband == 2}

                                                            {if $single.child_name != ''  && $single.child_name != null } 
                                                            {$single.child_name}  /  {$single.wifeName}
                                                            {else}
                                                            {if $single.child_gender eq 1} طفل {else} طفلة  {/if}     /  {$single.wifeName}
                                                            {/if} 

                                                            {else}
                                                            {$single.wifeName}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td class="wds10">
                                                        <img alt="" class="img-circle" 
                                                             src="{$hosturl}/../upload/inv_status/{$single.statusImg}" 
                                                             style="height: 30px;border-radius: 0%;width: 100%;"/>
                                                    </td>

                                                </tr> 

                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>

                                    <div style="overflow-y:  auto; max-height: 550px;display: none;" id='result_9'>
                                        <table class="table table-striped table-hover table-bordered rtl" 
                                               style=" width: 98%;" >
                                            <tbody>

                                                {foreach $requests_9 as $single}
                                                <tr>
                                                    <td>
                                                        <a class=" invStatus"   id=" invStatus{$single.visitid}" href="javascript:;" style=" float: right;"  data-visitid="{$single.visitid}" >
                                                            {if  $single.for_husband == 1 }
                                                            {$single.husbandName}
                                                            {else if  $single.for_husband == 2}

                                                            {if $single.child_name != ''  && $single.child_name != null } 
                                                            {$single.child_name}  /  {$single.wifeName}
                                                            {else}
                                                            {if $single.child_gender eq 1} طفل {else} طفلة  {/if}     /  {$single.wifeName}
                                                            {/if} 

                                                            {else}
                                                            {$single.wifeName}
                                                            {/if}
                                                        </a>
                                                    </td>
                                                    <td class="wds10">
                                                        <img alt="" class="img-circle" 
                                                             src="{$hosturl}/../upload/inv_status/{$single.statusImg}" 
                                                             style="height: 30px;border-radius: 0%;width: 100%;"/>
                                                    </td>

                                                </tr> 

                                                {/foreach}
                                            </tbody>
                                        </table>
                                    </div>



                                </div>
                            </div>


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

</div>












