
<input type="hidden" id="controllName" value="visits"/>
<input type="hidden" id="patientid" name="patientid" value="{$patientid}"/>
<input type="hidden" id="colName" name="colName" value="{$colName}"/>
<input type="hidden" id="mainId" name="mainId" value="{$mainId}"/>
<input type="hidden" id="tablename" name="tablename" value="{$maintableName}"/>
<input type="hidden" id="isHospital" name="isHospital" value="{$programesetting->visitsform}"/>
<div class="col-md-12">
    <button type="button" class="btn btn-xs blue fright" id="addRow"><i class="fa fa-plus"></i> إضافة</button>
</div>

<div class="col-md-12">
    {if $programesetting->visitsform  != 1}
    <table  id="dtAddTbl" dir="rtl" class="wds100">
        <thead>
            <tr>
                <th class="wds50 txtc">الاسم</th>
                <th  class="wds40 txtc">القيمة</th>
                <th  class="wds10 txtc">حذف</th>
            </tr>
        </thead>
        <input type="hidden" id="dtcount" value="{count($alldata)}">
        {assign var=i value=1}
        {foreach $alldata as $mydata}
        <tr>
            <td>

                <input type="text" class="form-control updateDetectionModel"  id="allnewitem_name{$i}" data-itr="{$i}" data-id="{$mydata->id}" name="newamount_name" value='{$mydata->title}' >
            </td>
            <td><input type="text" class="form-control updateDetectionModel"  id="allnewitem_value{$i}" data-itr="{$i}" data-id="{$mydata->id}" name="newamount_name" value='{$mydata->detectionval}' ></td>
            <td>
                <a href="#" class="btn red fleft deleteelement wds100" data-id="{$mydata->id}" data-link="visits" data-fun="deldetection">
                    <i class="fa fa-times" ></i>
                </a>

            </td>
        </tr>

        {capture assign=i}{$i+1}{/capture}
        {/foreach}

    </table>

    {else}

    <table  id="dtAddTbl" dir="rtl">
        <thead>
            <tr>
                <th><center>الاسم</center></th>
        <th>حذف</th>
        </tr>
        </thead>
        <input type="hidden" id="dtcount" value="{count($alldata)}">
        {assign var=i value=1}
        {foreach $alldata as $mydata}
        <tr>
            <td style="width: 100%">

                <input type="text" class="form-control updateDetectionModel"  id="allnewitem_name{$i}" data-itr="{$i}" data-id="{$mydata->id}" name="newamount_name" value='{$mydata->title}' >
            </td>
            <td>
                <a href="#" class="btn red fleft deleteelement" data-id="{$mydata->id}" data-link="visits" data-fun="deldetection">
                    <i class="fa fa-times" ></i>
                </a>

            </td>
        </tr>

        {capture assign=i}{$i+1}{/capture}
        {/foreach}

    </table>
    {/if}
</div>