{if $tableName == "ivf_records" }
<tr>
    <td>
        <input type="text" class="form-control  datepicker updateElement"   
               data-colName="record_date" value="{$data->record_date}"   id="recordDate{$data->id}"  
               data-tableName="ivf_records"    data-id="{$data->id}"/>
    </td>
    <td>
        <input type="text" class="form-control updateElement " 
               value="{$data->cycle_day}" data-colName="cycle_day"  
               data-tableName="ivf_records" data-id="{$data->id}">
    </td>
    <td>
        <input type="text" class="form-control updateElement " 
               value="{$data->e2}" data-colName="e2"  
               data-tableName="ivf_records" data-id="{$data->id}">
    </td>
    <td>
        <input type="hidden"  id="ivfRecordsId" value="{$data->id}" >
        <table >
            <thead>
                <tr>
                    <th style="width: 200px;">Type
                        <a  class="btn green-haze btn-sm fright addIvfRecordDrug" id="addIvfRecordDrug{$data->id}" 
                            data-id="{$data->id}"  data-tableName="ivf_records_drugs"    
                            data-container="ivfRecordsDrugsContent{$data->id}"  >  
                            <i class="fa fa-plus"></i>  </a>
                    </th>
                    <th style="width: 260px;">Dose</th>
                    <th style="width: 40px;"></th>
                </tr>
            </thead>
            <tbody id="ivfRecordsDrugsContent{$data->id}"> </tbody>
        </table>
    </td>
    <td>
        <input type="text" class="form-control updateElement " 
               value="{$data->r_no}" data-colName="r_no"  
               data-tableName="ivf_records" data-id="{$data->id}">
    </td>
    <td>
        <input type="text" class="form-control updateElement " 
               value="{$data->r_size}" data-colName="r_size"  
               data-tableName="ivf_records" data-id="{$data->id}">
    </td>
    <td>
        <input type="text" class="form-control updateElement " 
               value="{$data->l_no}" data-colName="l_no"  
               data-tableName="ivf_records" data-id="{$data->id}">
    </td>
    <td>
        <input type="text" class="form-control updateElement " 
               value="{$data->l_size}" data-colName="l_size"  
               data-tableName="ivf_records" data-id="{$data->id}">
    </td>
    <td>
        <input type="text" class="form-control updateElement " 
               value="{$data->endo}" data-colName="endo"  
               data-tableName="ivf_records" data-id="{$data->id}">
    </td>

    <td>
        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$data->id}"  data-tableName="ivf_records" 
           style=" float: left;" href="#" data-link="ivf_reports" data-fn="del">
            <i class="fa fa-close"></i>
        </a>
    </td>
</tr>



{else if $tableName == "ivf_drugs" || $tableName == "ivf_records_drugs" }
<tr>
    <td>
        <input type="hidden"  id="newDrudRowId" value="{$data->id}" >
        <input type="hidden"  id="drgName" value="{$drgName}" >
        <input type="hidden"  id="dosName" value="{$dosName}" >

        <select class="form-control xx dnameIvf select2D updateElement" id="{$drgName}{$data->id}" 
                data-id="{$data->id}" data-colName="drugid" data-tableName="{$tableName}" 
                data-itr="{$data->id}" data-placeholder="Select..." data-createNew="0" data-origin="{$origin}"   >
            <option value=""  >Choose Drug</option>
            {foreach $ivfDrugs as $drug}
            <option value="{$drug['id']}" >{$drug['drugname']} </option>
            {/foreach}
            <option value=""   >Choose Drug</option>
        </select>
    </td>
    <td>
        <select class="form-control xx select2D updateElement" id="{$dosName}{$data->id}" 
                data-id="{$data->id}" data-colName="drugdos" data-tableName="{$tableName}" 
                data-itr="{$data->id}" data-placeholder="Select..."  >
            <option value=""  >choose dose </option>
            {foreach $allDrugDoses as $dos}
            <option value="{$dos['drugdos']}"  >{$dos['drugdos']}</option>
            {/foreach}
            <option value=""   >choose dose </option>
        </select>
    </td>
    <td>
        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$data->id}"  data-tableName="{$tableName}" 
           style=" float: left;" href="#" data-link="ivf_reports" data-fn="del">
            <i class="fa fa-close"></i>
        </a>
    </td>
</tr>
{/if}

{literal}
<script type="text/javascript" >
    var itr = $('#newDrudRowId').val();
    var drgName = $('#drgName').val();
    var dosName = $('#dosName').val();
    if ($().select2 && itr > 0)
    {
        $('#' + drgName + itr).select2({placeholder: "Select", allowClear: true});
        $('#' + dosName + itr).select2({placeholder: "Select", allowClear: true});
        $('#newDrudRowId').remove();
        $('#drgName').remove();
        $('#dosName').remove();
    }

    var ivfRecordsId = $('#ivfRecordsId').val();
    if (ivfRecordsId > 0)
    {
        $("#recordDate" + ivfRecordsId).datepicker();
        $("#addIvfRecordDrug" + ivfRecordsId).trigger('click');
        $('#ivfRecordsId').remove();
    }
</script>
{/literal}