

<div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static"
     data-keyboard="false"   id="chronicTTTModal">
    <div class="modal-dialog  modal-lg wds90" >
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close closeDrug" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title"> Chronic TTT </h4>
            </div>
            <div class="modal-body">
                <div class="portlet-body form">
                    <form class="form-horizontal" role="form" action="" method="post" id="addChronicTTTForm" enctype="multipart/form-data">

                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box" style="margin-bottom: 0px;">
                                    <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="presChronicDate"
                                                   name="presChronicDate" value="{$presDate}"   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="addChronicDrug" >
                                                <i class="fa fa-plus"></i> Add Drug </a>
                                        </div>
                                        <div id="husbandFor">
                                            <label class="bold" style="font-size: 16px;">Husband
                                                <input type="checkbox" id="forChronicHusband" name="forChronicHusband"
                                                       value="1" >
                                            </label>
                                        </div>
                                        <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Print Date
                                            <input type="text" class="form-control datepicker " 
                                                   id="printChronicDate" name="printChronicDate" value="{$presDate}"  readonly=""
                                                   placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>
                                    </div>


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

                                            <table class="table table-striped table-hover table-bordered" id="preChronicTable" >
                                                <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>
                                                        {if $programSettingData->drug_quantity eq 1}
                                                        <th class="wds7"> Q Needed  </th>
                                                        {/if}
                                                        <th >  Delete </th>
                                                    </tr>
                                                </thead>
                                                <tbody id="preChronicContent">
                                                    <tr style="display: none">
                                                        <td colspan="5" >
                                                            <input type="hidden" id="drugChronicItr" value="{$drugChronicItr}" name="drugChronicItr"/>
                                                        </td>
                                                    </tr>
                                                    {assign var=itr value=1}
                                                    {foreach $PatientChronicByDate as $pre}
                                                    <tr>
                                                        <td>
                                                            <select class="form-control xx chronicCat chronics" 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 chronics updateElement"
                                                                    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 chronics 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 chronics 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>
                                                    {capture assign=itr}{$itr+1}{/capture}
                                                    {/foreach}
                                                </tbody>
                                            </table>
                                           
                                           <input type="hidden" id="preChronicType" value="{$preChronicType}" name="preChronicType"/>
                                           <input type="hidden" id="preChronicFor" value="{$preChronicFor}" name="preChronicFor"/>
                                        </div>
                                    </div>

                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn green printChronicPre"  data-type="add" > Print  </button>
                                <button type="button" class="btn default closeChronic" id="closemodel" data-dismiss="modal"> Close</button>

                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="editPreDiv"></div>
<div id="addPreLoading" 
     style="z-index: 3000;position: absolute;top: 7%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
    <img src="{$hosturl}/../upload/loading.gif">
</div>



{literal}
<script type="text/javascript" >
    $('.chronics').select2();
    $('.datepickertoday').datepicker('setDate', '+0');
    $(".datepicker").datepicker({
        todayBtn: "linked",
        autoclose: true,
        todayHighlight: true,
        format: 'yy-mm-dd',
        isRTL: true
    });
</script>
{/literal}



