<meta charset="utf8">
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
    <div class="page-content">
        <!--go-->
        <!-- BEGIN PAGE HEADER--  >
        <h3 class="page-title">
            {$shcontrollname}
        </h3>
        <div class="page-bar">
            <ul class="page-breadcrumb">
                {$breadcrumbs}
            </ul>
        </div>
        <!-- END PAGE HEADER-->
        <!-- BEGIN PAGE CONTENT-->
        <div class="row">
            <div class="col-md-12 ">

                <!-- BEGIN SAMPLE FORM PORTLET-->
                <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=show">عرض جميع  الزيارات</a>
                        </div>
                    </div>
                    <div class="portlet-body form">

                        <!--<form method="post">-->
                        <div class="form-body">
                            <div class="clinick rtl">
                                <div class="row">
                                    <form action="{$hosturl}/controllers/{$controllname}.php?ac=savenewvisit" id="myvisitform" method="post" class="awval">

                                        <table class="table table-bordered  table-hover rtl" style="margin-bottom: 0px;">
                                            <tr>
                                                <th style="width: 10%;">رقم المريضة</th>
                                                <th colspan="2" style="width: 50%;">اسم المريضة</th>
                                                <th style="width: 10%;"> تاريخ الزيارة </th>
                                                <th style="width: 15%;">نوع الكشف</th>
                                                <th style="width: 10%;">قيمة الكشف</th>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <select  class="form-control select2me patientvisitidCheck" name="patientid" id="patientvisitidNo" placeholder="اختر  " required="required">
                                                        <option value=""></option>
                                                        {foreach $allPatients as $row}
                                                        <option value="{$row->id}">{$row->statusno}</option>
                                                        {/foreach}

                                                    </select>
                                                </td>
                                                <td colspan="2">
                                                    <select  class="form-control select2me patientvisitidCheck" name="patientid" id="patientvisitid" placeholder="اختر المريضة " required="required">
                                                        <option value=""></option>
                                                        {foreach $allPatients as $row}
                                                        <option value="{$row->id}">{$row->wifename} - {$row->husdandname}</option>
                                                        {/foreach}

                                                    </select>
                                                </td>
                                                <td>
                                                    <input class="form-control patientvisitidCheckDate  datepicker edited"  type="text"  id="visitdate" name="visitdate" required value="{$today}">
                                                </td>
                                                <td>
                                                    <select  class="form-control " name="detectionid" id="detectionid" placeholder="اختر نوع الكشف " required select-tableName="visits" data-tableName="visits" data-maintable = "detections" data-colName="detectionid" data-id="0">
                                                        <option value=""></option>
                                                        {assign var=i value=1}
                                                        {foreach $allDetections as $row}
                                                        {if $i == 1}{assign var=k value={$row->detectionval}}{/if}
                                                        <option value="{$row->id}" {if $i == 1}selected{/if}>{$row->title}</option>
                                                        {capture assign=i}{$i+1}{/capture}
                                                        {/foreach}
                                                    </select>
                                                </td>

                                                <td>
                                                    <input  class="form-control digitsOnly"  type="text"  id="detectionvalue" value="{$k}" name="detectionvalue" required="required">
                                                </td>
                                            </tr>
                                        </table>
                                        <table class="table table-bordered  table-hover rtl">
                                            <tr>
                                                <th id="invTypeHead" style="width: 30%;">النوع</th>
                                                <th style="width: 20%;">Husband</th>
                                                <th style="width: 10%;"></th>
                                            </tr>
                                            <tr>

                                                <td id="invTypeDiv">
                                                    <select  class="form-control" name="invType" id="invType" placeholder="اختر نوع " required>
                                                        <option value="-1">اختر </option>
                                                        <option value="0">خارجى</option>
                                                        <option value="1">داخلى</option>
                                                    </select>
                                                </td>

                                                <td>
                                                    <input type="checkbox"  name="for_husband" value="1"></span>
                                                </td>
                                                <td>
                                                    <select class="form-control" style="width: 75%; display: none"   id="fordepartment" placeholder="اختر القسم " required >
                                                        <option value="{$fordepartment}" selected="">{$fordepartment}</option>
                                                    </select>
                                                    <input type="hidden"  name="fordepartment"  value="{$fordepartment}">
                                                    <input type="submit" name="submit" id="visitaddsubmit"  class="btn blue  addbtnvisit wds100" value="إضافة" />
                                                </td>
                                            </tr>
                                        </table>

                                        <input type="hidden"  name="itr"  id="itr"  value="0">
                                        <input type="hidden"  name="itr_offer"  id="itr_offer"  value="0">

                                        <div class="col-md-12" id="selectedFromModel">

                                        </div>

                                        <div class="clearfix"></div>
                                        <span id="checkvisitbefore" {if $found != 1}style="display: none; " {/if}>عفواً,لقد تمت الزيارة من قبل لهذه المريضة </span>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <!--</form>-->
                    </div>
                </div>
            </div>


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

    <!--------------------------------------------------------------------------- add rays Model-------------------------------------------------------------------------------------->
    {if $fordepartment == 5 }
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="addPatientRays" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds95">
            <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">
                        <form class="form-horizontal" role="form" action="" method="post" id="gynaRay" enctype="multipart/form-data">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="portlet blue-hoki box">
                                        <div class="portlet-title">
                                            <div class="actions">
                                                <button type="button" class="btn default"  id="addVisitRays"> Save </button>
                                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                                            </div>
                                        </div>

                                        <div class="portlet-body">
                                            <input type="hidden" id="pId11" value="" name="patientId"/>
                                            <div class="row" style="padding-left: 9px;padding-top:5px;overflow-y: scroll;">
                                                <div class="wds33 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $allRayCats1 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->rays as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="rayCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}

                                                    {assign var=i value=1}
                                                    {foreach $allRayCats3 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->rays as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" id="" class="iiin {$cat->id}Check"  value="{$inv->id}" name="rayCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}


                                                </div>
                                                <div class="wds33 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $allRayCats2 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->rays as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="rayCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}

                                                    {assign var=i value=1}
                                                    {foreach $allRayCats4 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->rays as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" id="" class="iiin {if $cat->name == 'Male(Husband)'}husbandCheck{/if} {$cat->id}Check" value="{$inv->id}" name="rayCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}


                                                </div>



                                                <div class="wds34 fleft">
                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1">  Favorites
                                                        <span>
                                                            <input type="checkbox" data-gClass="favoriteCheck" class="iiin checkGroup">
                                                        </span>

                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $favoritesRays as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="favoriteCheck iiin" id="" value="{$inv->id}" name="rayCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>

                                                    {foreach $otherRays  as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->rays as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="{$cat->id}Check iiin" id="" value="{$inv->id}" name="rayCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}

                                                    {assign var=i value=1}
                                                    {foreach $allRayCats5 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->rays as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="rayCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                            </div>

                                            <div  id="ray_div">

                                            </div>




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

                            </div>


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

    {/if}
    <!--------------------------------------------------------------------------- add Investigation Model-------------------------------------------------------------------------------------->
    {if $fordepartment == 12 }
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="addPatientInvestigation" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds95" style="max-width: 90%;">
            <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">
                        <form class="form-horizontal" role="form" action="" method="post" id="gynaInvest" enctype="multipart/form-data">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="portlet blue-hoki box">
                                        <div class="portlet-title">
                                            <div class="actions">
                                                <button type="button" class="btn default" id="addVisitInvs"> Save </button>
                                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                                            </div>
                                        </div>
                                        <div class="portlet-body">
                                            <input type="hidden" id="pId1" value="" name="patientId"/>
                                            <div class="row" style="padding-left: 9px;padding-top:5px;overflow-y: scroll;">
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group1 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group2 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group3 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}


                                                </div>

                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group4 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" id="" class="iiin {if $cat->name == 'Male(Husband)'}husbandCheck{/if} {$cat->id}Check" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}

                                                    {assign var=i value=1}
                                                    {foreach $others  as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="{$cat->id}Check iiin" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>

                                                <div class="wds20 fleft">
                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1">  Favorites
                                                        <span>
                                                            <input type="checkbox" data-gClass="favoriteCheck" class="iiin checkGroup">
                                                        </span>

                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $favorites as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="favoriteCheck iiin" id="" value="{$inv->id}" name="invCheck[]"  data-name="{$inv->name}" data-price="{$inv->price}">
                                                            </span> {$inv->name} ( {$inv->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>


                                                    <!---   lab offers ------>

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1">  Offers
                                                        <span>
                                                            <input type="checkbox" data-gClass="offersCheck" class="iiin checkGroup">
                                                        </span>

                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $invoffers as $offer}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="offersCheck iiin" id="" value="{$offer->id}" name="offersCheck[]"  data-name="{$offer->name}" data-price="{$offer->price}">
                                                            </span> {$offer->name} ( {$offer->price} )
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>

                                                </div>
                                            </div>


                                            <div  id="inv_div">

                                            </div>



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


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

    {/if}
    <!--------------------------------------------------------------------------- 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>


