<tr>
    <td>
        <select class="form-control xx chronicCat " id="chronicCat{$itr}"
                name="chronicCat{$itr}"  data-itr="{$itr}"  data-placeholder="Select..."  >
            <option value="" {if $pre->drugcat == ""}selected{/if}>Choose Category</option>
            {foreach $allDrugcats as $cat}
            <option value="{$cat['drugcat']}" {if $pre->drugcat == $cat['drugcat'] }selected{/if}>{$cat['drugcat']}</option>
            {/foreach}
            <option value="" {if $pre->drugcat == ""}selected{/if}>Choose Category</option>
        </select>
    </td>
    <td>
        <select class="form-control xx chronicName  updateElement" data-createNew="0" 
                id="chronicName{$itr}" data-id="{$pre->id}" data-colName="drugid"
                data-tableName="gynachronicdrugs" data-itr="{$itr}"
                data-placeholder="Select..."  >
            <option value="" {if $pre->drugid == ""}selected{/if}>Choose Drug</option>
            {foreach $drugs as $drug}
            <option value="{$drug['id']}" {if $pre->drugid == $drug['id'] }selected{/if}>{$drug['drugname']} </option>
            {/foreach}
            <option value="" {if $pre->drugid == ""}selected{/if}>Choose Drug</option>
        </select>

    </td>
    <td>
        <select class="form-control xx chronicType  updateElement"
                id="chronicType{$itr}" data-id="{$pre->id}" data-colName="drugtype"
                data-tableName="gynachronicdrugs" data-itr="{$itr}"
                data-placeholder="Select..."  >
            <option value="" {if $pre->drugtype == ""}selected{/if}>Choose Form</option>
            {foreach $allDrugTypes as $type}
            <option value="{$type['drugtype']}" {if $pre->drugtype == $type['drugtype'] }selected{/if}>{$type['drugtype']}</option>
            {/foreach}
            <option value="" {if $pre->drugtype == ""}selected{/if}>Choose Form</option>
        </select>
    </td>
    <td>
        <select class="form-control xx  updateElement" id="chronicDos{$itr}"
                data-id="{$pre->id}" data-colName="drugdos"
                data-tableName="gynachronicdrugs" data-itr="{$itr}"
                data-placeholder="Select..."  >
            <option value="" {if $pre->drugdos == ""}selected{/if}>choose dose </option>
            {foreach $allDrugDoses as $dos}
            <option value="{$dos['drugdos']}" {if $pre->drugdos == $dos['drugdos'] }selected{/if}>{$dos['drugdos']}</option>
            {/foreach}
            <option value="" {if $pre->drugdos == ""}selected{/if}>choose dose </option>
        </select>
    </td>

    {if $programSettingData->drug_quantity eq 1}
    <td >
       <input type="text" class="form-control updateElement" data-id="{$pre->id}"
              data-colName="quantity" data-tableName="gynachronicdrugs"
              value="{$pre->quantity}" data-itr="{$itr}"  />
    </td>
    {/if}

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

{literal}
<script type="text/javascript" >
    var itr = $('#drugChronicItr').val();
    if ($().select2)
    {
        $('#chronicCat' + itr).select2({placeholder: "Select", allowClear: true});
        $('#chronicName' + itr).select2({placeholder: "Select", allowClear: true});
        $('#chronicDos' + itr).select2({placeholder: "Select", allowClear: true});
        $('#chronicType' + itr).select2({placeholder: "Select", allowClear: true});
    }
</script>
{/literal}