<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
    <div class="page-content">
        <!-- BEGIN PAGE HEADER-- >
        <h3 class="page-title">
            {$shcontrollname}
        </h3>
        <div class="page-bar">
            <ul class="page-breadcrumb">
                {$breadcrumbs}
            </ul>
        </div>
        <!-- END PAGE HEADER-->
        <!-- BEGIN PAGE CONTENT-->

        {if !empty($drugsinbill)}

        <div class="row">
            <div class="col-md-12">
                <div class="portlet light bg-inverse">
                    <div class="portlet-title">
                        <!--<button type="button" class="btn blue-madison pull-right myplusbtn" id="myplusbtn">Add Medicine</button>-->

                        <div class="actions" id="nestable_list_menu">
                            <a class="btn blue-madison pull-right myplusbtn loadnew" href="#" id="myplusbtn">
                                <i class="fa  fa-plus"></i>
                                Add new
                            </a>
                        </div>


                    </div>
                    <div class="portlet-body form bgwinupts">
                        <!-- BEGIN FORM-->

                        <form action="{$hosturl}/controllers/{$controllname}.php?ac=update" method="post">
                            <input type="hidden" name="billID" id="billID" value="{$billdetails->id}" />
                            <input type="hidden" name="mycounter" value="{$drugsinbill|@count}"/>
                            <div class="form-body">

                                <div class="col-md-4">
                                    <div class="form-group form-md-line-input has-success">
                                        <input type="text" class="form-control" id="form_control_1" value="{$billdetails->invoicenum}" placeholder="Invoice Number" name="invoicenumberup" required>
                                        <label for="form_control_1">Invoice Number</label>
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group form-md-line-input has-success">
                                        <input type="text" class="form-control date-picker" id="form_control_1" value="{$billdetails->invoicedate}" data-date-format="yyyy-mm-dd" placeholder="yyyy-mm-dd" name="invoicedateup">
                                        <label for="form_control_1">Invoice Date</label>
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="form-group form-md-line-input has-success">
                                        <input type="text" class="form-control" id="form_control_1" value="{$billdetails->suppliers}" placeholder="Supplier Name" name="suppliernameup">
                                        <label for="form_control_1">Supplier Name</label>
                                    </div>
                                </div>
                            </div>
                            <!-- BEGIN PAGE CONTENT-->



                            <div class="col-md-12">
                                <!-- BEGIN CONDENSED TABLE PORTLET-->
                                <div class="portlet box green">

                                    <div class="portlet-body">
                                        <div class="table-scrollable">
                                            <table class="table table-condensed table-hover small_table">
                                                <thead>
                                                    <tr>

                                                        <th>Drug Name</th>
                                                        <th>Amount</th>
                                                        <th class="wds10">&nbsp;</th>

                                                    </tr>
                                                </thead>
                                                <tbody id="plusitem">
                                                    {assign var=i value=1}
                                                    {foreach $drugsinbill as $med}
                                                    <tr>
                                                <input type="hidden" name="billId{$i}" id="billId" value="{$med->ddetails->id}"  />

                                                <td class="wds60">
                                                    <div class="form-group form-md-line-input has-info">
                                                        <!--selectdrugs-->
                                                        <select class="form-control select2me" data-placeholder="Select..."  name="medicinenameitr{$i}">

                                                            {foreach $allmededit as $alldd}

                                                            <option value="{$alldd->id}" {if $alldd->id eq $med->ddetails->id }selected="selected" {/if}>{$alldd->drugname}</option>

                                                            {/foreach}
                                                        </select>
                                                    </div>
                                                </td>
                                                <td>
                                                    <div class="form-group form-md-line-input has-success">
                                                        <input type="text" class="form-control"  value="{$med->amount}" placeholder="Amount" name="medicineamount{$i}">
                                                    </div>
                                                </td>
                                                <td>
                                                    <button type="button" data-id="{$med->ddetails->id}" data-edit="0" data-bill="{$med->bill_id}" data-link="{$controllname}" class="btn red hmt20 delinedit"><i class="fa fa-close"></i></button>

                                                </td>

                                                </tr>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <!-- END CONDENSED TABLE PORTLET-->
                            </div>
                            <input type="hidden" id="invoiceconn" name="invoiceconn" value="1" />
                            <!-- END PAGE CONTENT -->
                            <div class="form-actions">
                                <div class="row">

                                    <div class="col-md-2 pull-right">
                                        <button class="btn green btn-block btn-lg">update</button>
                                    </div>

                                </div>
                            </div>
                        </form>
                        <!-- END FORM-->
                    </div>
                </div>
            </div>
        </div>
        {else}
        <div class="caption-subject font-red-sunglo bold uppercase ">Sorry , No drugs to update.</div>
        {/if}
        <!-- END PAGE CONTENT-->
    </div>
</div>
<!-- END CONTENT -->
<div id="drugsload" style="display: none;">
    <option value=""></option>
    {foreach $allmededit as $alldd}
    <option class="elementID" value="{$alldd->id}">{$alldd->drugname}</option>
    {/foreach}
</div>
