<div class="row">
    <div class="col-md-12">
        <div class="portlet blue-hoki box">
            <div class="portlet-title" >
                <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Today <input type="text" class="form-control datepicker " id="presDate" name="presDate" value="{$presDate}" data-controller="{$controller}"  readonly="" placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>
                <div class="actions">
                    <a href="javascript:;" class="btn btn-default btn-sm" id="addNewDrugRow" data-tableName="{$drugsTable}">
                        <i class="fa fa-plus"></i> Add </a>
                    <a href="javascript:;" class="btn btn-default btn-sm" id="addNewDrugInTable">
                        <i class="fa fa-plus"></i> Add New Drug </a>
                </div>
                <div id="husbandFor">
                    <label class="bold" style="font-size: 16px;">Husband <input type="checkbox" id="forHusband" name="forHusband"  value="1" data-controller="{$controller}"></label>
                </div>
                <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Print Date <input type="text" class="form-control datepicker " data-controller="{$controller}"  id="printDate" name="printDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>
            </div>

            <div class="portlet-body  scroll_y showNum isheight">

                <table class="table table-striped table-hover table-bordered" id="pre_table" >
                    <thead>
                        <tr>
                            <th class="col-md-2">
                                Group
                            </th>
                            <th class="col-md-2">
                                Drug
                            </th>
                            <th class="col-md-2">
                                Form
                            </th>
                            <th class="col-md-5">
                                Use
                            </th>

                            <th >
                                Delete
                            </th>
                        </tr>
                    </thead>
                    <tbody id="drugContent">

                        <tr style="display: none"><td colspan="5" ><input type="hidden" id="drugItr" value="{$preItr}" name="drugItr"/></td></tr>
                        {assign var=itr value=1}
                        {foreach $PatientPresByDate as $pre}
                        <tr>
                            <td>
                                <select class="form-control xx dcat select2me" id="dcat{$itr}" name="dcat{$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 dname select2me updateElement" id="dname{$itr}" data-id="{$pre->id}" data-colName="drugid" data-tableName="{$drugsTable}" 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']} {if $ProgramesettingData->visitsform eq 3}(left {$drug['currentbalance']}){/if}</option>
                                    {/foreach}
                                    <option value="" {if $pre->drugid == ""}selected{/if}>Choose Drug</option>
                                </select>

                            </td>
                            <td>
                                <select class="form-control xx dtype select2me updateElement" id="dtype{$itr}" data-id="{$pre->id}" data-colName="drugtype" data-tableName="{$drugsTable}" 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 select2me updateElement" id="ddos{$itr}" data-id="{$pre->id}" data-colName="drugdos" data-tableName="{$drugsTable}" 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>

                            <td>
                                <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$pre->id}" style=" float: left;" href="#" data-link="{$controller}" data-fn="addprescription">
                                    <i class="fa fa-close"></i>
                                </a>
                            </td>
                        </tr>
                        {capture assign=itr}{$itr+1}{/capture}
                        {/foreach}

                    </tbody>
                </table>


                <input type="hidden" id="pId" value="" name="patientId"/>
                <input type="hidden" id="preType" value="" name="preType"/>
                <input type="hidden" id="preFor" value="" name="preFor"/>

                <div id="drugPrint">

                </div>

            </div>

        </div>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn default printPre"  data-type="add" data-controller="{$controller}"> Print  </button>
        <button type="button" class="btn default closeDrug" id="closemodel" data-dismiss="modal"> Close</button>

    </div>
</div>



