<tr>
    <td>
        <select class="form-control xx dname select2me updateElement" id="dname{$itr}" data-id="{$data->id}"
            data-colName="drugid" data-tableName="chloral_med" data-itr="{$itr}" data-placeholder="Select...">
            <option value="" {if $data->drugid =="" }selected{/if}>Choose Drug</option>
            {foreach $drugs as $drug}
            <option value="{$drug['id']}">{$drug['drugname']}</option>
            {/foreach}
            <option value="" {if $data->drugid=="" }selected{/if}>Choose Drug</option>
        </select>

    </td>
    <td>
        <input type="text" class="form-control timepicker updateElement" data-colName="drug_time" value=""
            data-tableName="chloral_med" data-itr="{$itr}" data-id="{$data->id}" />
    </td>
    <td>
        <select class="form-control xx select2me updateElement" id="ddos{$itr}" data-id="{$data->id}"
            data-colName="drugdos" data-tableName="chloral_med" data-itr="{$itr}" 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>
        <input type="text" class="form-control updateElement" data-colName="drug_use" value=""
            data-tableName="chloral_med" data-itr="{$itr}" data-id="{$data->id}" />
    </td>
    <td></td>
    <td>
        <input type="text" class="form-control timepicker updateElement" data-colName="drug_taken_time" value=""
            data-tableName="chloral_med" data-itr="{$itr}" data-id="{$data->id}" data-toggle="popover"
            data-trigger="hover" data-placement="bottom" data-content="" data-date-format="HH:ii p" />
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-colName="given_by" data-tableName="chloral_med"
            data-itr="{$itr}" data-id="{$data->id}" />
    </td>
    <td>
        <input type="text" class="form-control updateElement" data-colName="revised_by" data-tableName="chloral_med"
            data-itr="{$itr}" data-id="{$data->id}" />
    </td>
    <td>
        <a class="btn grey-cascade btn-xs deletemsgEX" data-itr="{$itr}" data-id="{$data->id}"
            data-tableName="chloral_med" style=" float: left;" href="#" data-link="heart_reports" data-fn="del">
            <i class="fa fa-close"></i>
        </a>
    </td>
</tr>


{literal}
<script type="text/javascript">
    var itr = $('#newMedItr').val();
    if ($().select2) {
        $('#dname' + itr).select2({ placeholder: "Select", allowClear: true });
        $('#ddos' + itr).select2({ placeholder: "Select", allowClear: true });
    }
    $(".timepicker").timepicker({
        autoclose: true
    });
</script>
{/literal}