
<input type="hidden" name="tablename" id="tablename" value="{$tablename}" />
<input type="hidden" name="itr" id="itr" value="{$itr}" />
<input type="hidden" name="selectname" id="selectname" value="{$selectname}" />
<input type="hidden" id="controllName" value="patienthistory"/>
<input type="hidden" id="rowoftableid" name="rowoftableid" value="{$rowoftableid}"/>
<input type="hidden" id="patientId" name="patientId" value="{$patientid}"/>
<input type="hidden" id="maintableName" name="maintableName" value="{$maintableName}"/>
<button type="button" class="btn btn-xs blue fright" id="addnewRow"><i class="fa fa-plus"></i> Add</button></td>
<table cellspacing="10" width="100%" id="dtAddTbl">
    <thead>
        <tr>
            <th>Name</th>
            <th>Delete</th>
        </tr>
    </thead>

    <input type="hidden" id="dtcount" value="{count($alldata)}">
    {if {$tablename} eq "phobstericterminate"}
    {assign var=i value=1}
    {foreach $alldata as $mydata}
    <tr>
        <td style="width: 100%">
            <a href="#" >

                <input type="text" class="form-control updateElementSelect" data-selectClass="{$selectname}"  data-select2="yes" data-id="{$mydata->id}" data-colName="name" data-tableName="{$tablename}" value="{$mydata->name}"/>
            </a>
        </td>
        <td>
            {if {$mydata->id} >5}
            <a class="fa fa-times btn red fleft deleteElementmodelnew"  data-link="patienthistory" data-fn="delRowsommedel" data-id="{$mydata->id}" data-tableName="{$tablename}"></a>
            </a>
            {else}

            <a href="#" class="btn red fleft col-md-1 " >
                <i class="fa fa-question-circle" ></i>
            </a>

            {/if}
        </td>
    </tr>
    {capture assign=i}{$i+1}{/capture}
    {/foreach}


    {else}

    {assign var=i value=1}
    {foreach $alldata as $mydata}
    <tr>
        <td style="width: 100%">
            <a href="#" >

                <input type="text" class="form-control updateElementSelect" data-selectClass="{$selectname}"  data-select2="yes" data-id="{$mydata->id}" data-colName="name" data-tableName="{$tablename}" value="{$mydata->name}"/>
            </a>
        </td>
        <td>
            <!--            <a href="#" class="fa fa-times btn red fleft deleteElementmodel" data-id="{$mydata->id}" data-tableName="{$tablename}" >

                        </a>-->

            <a class=" fa fa-times btn red fleft deleteElementmodelnew"  data-link="patienthistory" data-fn="delRowsommedel" data-id="{$mydata->id}" data-tableName="{$tablename}" ></a>
        </td>
    </tr>
    {capture assign=i}{$i+1}{/capture}
    {/foreach}

    {/if}
</table>
