
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">
            <div class="col-md-12 clinick invz" id="gprinModel">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-user"></i>Detections
                        </div>
                        <div class="actions">
                            <a href="#" class="btn btn-default btn-sm" id="addDetectionControl"> Add </a>
                        </div>
                    </div>
                    <div class="portlet-body all">
                        <input type="hidden" id="controllName" value="{$controllname}"/>
                        <div class="row">
                            <div id="ultrasoundgynaDiv">
                                <div class="row">
                                    <div class="portlet-body form">
                                        <div class="form-body">
                                            {if $programesetting->visitsform  != 1}
                                            <table   dir="rtl" class="wds100 table table-bordered">
                                                <thead>
                                                    <tr>
                                                        {if $programesetting->birth_notify  == 1 } 
                                                        <th class="txtc wds9">إخطار ولادة    </th>
                                                        {/if}

                                                        <th class="txtc wds9">معمل الاجنة   </th>
                                                        {if $programesetting->system_type  != 2}
                                                        <th class="txtc wds9">خدمة العملاء </th>
                                                        {/if}
                                                        {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                                                        <th class="txtc wds10"> العمليات </th>
                                                        <th class="txtc wds10"> فاتورة صفريه </th>
                                                        {/if}
                                                        {if $programesetting->erpdb != ""}
                                                        <th class="txtc wds10"> تحصيلERP </th>
                                                        {/if}
                                                        <th class="txtc">الاسم</th>
                                                        <th class="txtc wds11">القيمة</th>
                                                        {if  $programesetting->system_type  == 3}
                                                        <th class="txtc wds15">النوع   </th>
                                                        <th class="txtc wds7">عدد الوحدات    </th>
                                                        <th class="txtc wds7">المقدم      </th>
                                                        <th class="txtc wds7">الباقى  على / جلسة      </th>
                                                        {/if}
                                                        {if  $programesetting->system_type  == 2}
                                                        <th class="txtc">الطبيب </th>
                                                        {/if}
                                                        <th class="txtc wds4"></th>
                                                    </tr>
                                                </thead>
                                                <tbody id="detectionControlContainer">
                                                    {assign var=i value=1}
                                                    {foreach $detections as $mydata}
                                                    <tr>
                                                        {if $programesetting->birth_notify  == 1 } 
                                                        <td>
                                                            <input type="checkbox" data-colName="for_birth" data-tableName="detections"   
                                                                   class="form-control updateElementCheck"  data-id="{$mydata->id}"
                                                                   value="1"   {if $mydata->for_birth  == 1}  checked   {/if} >
                                                        </td>
                                                        {/if}

                                                        <td>
                                                            <input type="checkbox" data-colName="for_embryo" data-tableName="detections"   
                                                                   class="form-control updateElementCheck"  data-id="{$mydata->id}"
                                                                   value="1"   {if $mydata->for_embryo  == 1}  checked   {/if} >
                                                        </td>

                                                        {if $programesetting->system_type  != 2}
                                                        <td>
                                                            <input type="checkbox" data-colName="for_customer" data-tableName="detections"   
                                                                   value="1"  class="form-control updateElementCheck"  data-id="{$mydata->id}"
                                                                   {if $mydata->for_customer  == 1}  checked   {/if} >
                                                        </td>
                                                        {/if}
                                                        {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                                                        <td>
                                                            <input type="checkbox" data-colName="for_operation" data-tableName="detections"   
                                                                   class="form-control updateElementCheck"  data-id="{$mydata->id}"
                                                                   value="1"   {if $mydata->for_operation  == 1}  checked   {/if} >
                                                        </td>
                                                        <td>
                                                            <input type="checkbox" data-colName="iserpzerobill" data-tableName="detections"   
                                                                   class="form-control updateElementCheck" data-id="{$mydata->id}"
                                                                   value="1"  {if $mydata->iserpzerobill  == 1}  checked   {/if} >
                                                        </td>
                                                        {/if}

                                                        {if $programesetting->erpdb != ""}
                                                        <td>
                                                            <input type="checkbox"  data-colName="iserppayment" data-tableName="detections"   
                                                                   class="form-control updateElementCheck"  data-id="{$mydata->id}"
                                                                   value="1"    {if $mydata->iserppayment  == 1}  checked   {/if} >
                                                        </td>
                                                        {/if}
                                                        <td>
                                                            <input type="text" class="form-control updateElement"    data-tableName="detections"
                                                                   data-colName="title" data-id="{$mydata->id}"   value='{$mydata->title}'>
                                                        </td>

                                                        <td>
                                                            <input type="text" class="form-control updateElement"  data-tableName="detections"
                                                                   data-colName="detectionval"  data-id="{$mydata->id}"  value='{$mydata->detectionval}' >
                                                        </td>

                                                        {if  $programesetting->system_type  == 3}

                                                        <td>
                                                            <div class="md-radio-inline">
                                                                <div class="md-radio">
                                                                    <input type="radio" data-colName="type" data-tableName="detections"   value="1"
                                                                           name="type{$i}"  class="form-control updateElement"   data-id="{$mydata->id}" 
                                                                           id="type1P{$i}" {if $mydata->type  == 1}  checked   {/if} >
                                                                    <label for="type1P{$i}">
                                                                        <span></span>
                                                                        <span class="check"></span>
                                                                        <span class="box"></span>
                                                                        نبضات          </label>
                                                                </div>

                                                                <div class="md-radio">
                                                                    <input type="radio" data-colName="type" data-tableName="detections"   value="2"
                                                                           name="type{$i}" class="form-control updateElement" data-id="{$mydata->id}" 
                                                                           id="type2S{$i}" {if $mydata->type  == 2}  checked   {/if} >
                                                                    <label for="type2S{$i}">
                                                                        <span></span>
                                                                        <span class="check"></span>
                                                                        <span class="box"></span>
                                                                        جلسات         </label>
                                                                </div>
                                                            </div>
                                                        </td>

                                                        <td>
                                                            <input type="text" class="form-control updateElement"  data-colName="units"
                                                                   data-id="{$mydata->id}" data-tableName="detections" value='{$mydata->units}' >
                                                        </td>

                                                        <td>
                                                            <input type="text" class="form-control updateElement"  data-colName="min_paid"
                                                                   data-id="{$mydata->id}" data-tableName="detections" value='{$mydata->min_paid}' >
                                                        </td><!-- comment -->

                                                        <td>
                                                            <input type="text" class="form-control updateElement"  data-colName="max_session"
                                                                   data-id="{$mydata->id}" data-tableName="detections" value='{$mydata->max_session}' >
                                                        </td>

                                                        {/if}

                                                        {if  $programesetting->system_type  == 2}
                                                        <td>
                                                            <select  class="form-control updateElement select2h"  placeholder="اختر طبيب "   
                                                                     data-colName="doctor_id" data-id="{$mydata->id}" 
                                                                     data-tableName="detections" >
                                                                <option value="">choose</option>
                                                                {foreach $allDocs as $doctor}
                                                                <option value="{$doctor.user_id}" {if $doctor.user_id  == $mydata->doctor_id} selected  {/if}> {$doctor.name}</option>
                                                                {/foreach}
                                                            </select>
                                                        </td>
                                                        {/if}

                                                        <td>
                                                            <a href="#" class="btn red fleft deleteelement" data-id="{$mydata->id}" data-link="visits"
                                                               data-fun="delDetectionControl" style="padding: 2px 0px;width: 100%">
                                                                <i class="fa fa-times" ></i>
                                                            </a>
                                                        </td>

                                                    </tr>

                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </tbody>
                                            </table>

                                            {else}

                                            <table  dir="rtl">
                                                <thead>
                                                    <tr>
                                                        <th><center>الاسم</center></th>
                                                <th>حذف</th>
                                                </tr>
                                                </thead>
                                                <tbody id="detectionControlContainer">
                                                    {assign var=i value=1}
                                                    {foreach $detections as $mydata}
                                                    <tr>
                                                        <td style="width: 100%">

                                                            <input type="text" class="form-control updateElement"  data-colName="title"
                                                                   data-id="{$mydata->id}" data-tableName="detections" value='{$mydata->title}' >
                                                        </td>
                                                        <td>
                                                            <a href="#" class="btn red fleft deleteelement" data-id="{$mydata->id}" 
                                                               data-link="visits" data-fun="delDetectionControl" style="padding: 2px 0px;width: 100%">
                                                                <i class="fa fa-times" ></i>
                                                            </a>

                                                        </td>
                                                    </tr>

                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </tbody>
                                            </table>
                                            {/if}
                                        </div>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>   
    </div> 
</div>