
<div class="page-content-wrapper">
    <div class="page-content all">
        <div class="row">
            <div class="col-md-12" style="padding-right: 0px; padding-left: 0px;">
                <div class="portlet box blue">
                    <div class="portlet-title" style="height: 5px">
                        <div class="caption">
                            <i class="fa fa-edit"></i> Antenatal visits
                        </div>
                        <div class="actions">
                            <a href="{$hosturl}/controllers/antenalvisit.php?ac=archive&patientid={$patientid}" class="btn btn-default btn-sm">
                                Archive pregnancy
                            </a>
                        </div>

                    </div>
                    <div class="portlet-body">


                        <table class="table table-striped table-hover table-bordered">
                            <thead>
                                <tr>
                                    <th class="col-md-2 wds7">
                                        LMP
                                    </th>
                                    <th class="col-md-2 wds7">
                                        EDD
                                    </th>
                                    <!--                                    <th class="col-md-2">
                                                                            IVF
                                                                        </th>-->
                                    <th class="col-md-1 wds2">
                                        G
                                    </th>
                                    <th class="col-md-1 wds2">
                                        P
                                    </th>

                                    <th class="col-md-4">
                                        Notes
                                    </th>

                                    <th class="col-md-1 wds3">
                                        Hb
                                    </th>
                                    <th class="col-md-1 wds5">
                                        Placenta
                                    </th>
                                    <th class="col-md-1 wds1">

                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>
                                        <input type="text" class="form-control  datepicker" data-id="{$mainObj->id}" data-colName="lmp" id="lmp" data-tableName="mainantenental" value="{$mainObj->lmp}" readonly />
                                    </td>
                                    <td>
                                        <input type="text" class="form-control datepicker" data-id="{$mainObj->id}"  data-colName="eed" id="eed" data-tableName="mainantenental" value="{$mainObj->eed}" readonly/>
                                    </td>
                                    <!--                                    <td>
                                                                            <input type="text" class="form-control" id="ivf" value="{$mainObj->ivf}" readonly/>
                                                                        </td>-->
                                    <td>
                                        {$mainObj->g}
                                    </td>
                                    <td>
                                        {$p}
                                    </td>
                                    <td>
                                        <textarea class="form-control txtc updateElement" rows="1" data-id="{$mainObj->id}" data-colName="notes" data-tableName="mainantenental" placeholder="Enter more text" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="{$mainObj->notes}">{$mainObj->notes}</textarea>
                                    </td>
                                    <td>
                                        <input type="text" class="form-control updateElement" data-id="{$mainObj->id}" data-colName="hb" id="hb" data-tableName="mainantenental" value="{$mainObj->hb}" />
                                    </td>


                                    <td>
                                        <input type="text" class="form-control updateElement" data-id="{$mainObj->id}" data-colName="placentaOut" id="placentaOut" value="{$lastPlacenta}" />
                                    </td>
                                    <td>
                                        <a href="{$hosturl}/controllers/instruction.php?ac=showtransfer&patientid={$patientid}" class="btn btn-default btn-sm" >
                                            Print</a>
                                    </td>

                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12" style="padding-right: 0px; padding-left: 0px;">
                <div class="portlet box blue">
                    <div class="portlet-title" style="height: 5px">
                        <div class="caption">
                            <i class="fa fa-edit"></i> All visits
                        </div>
                        <div class="actions">
                            <a href="javascript:;" class="btn btn-default btn-sm" id="antenal_add">
                                Add New</a>
                        </div>
                        <div class="actions">
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" href="javascript:;" data-toggle="dropdown">
                                    TTT <i class="fa fa-angle-down"></i>
                                </a>
                                <ul class="dropdown-menu pull-right">
                                    <li>
                                        <a href="javascript:;" id="addDrug" data-date="{$presDate}" data-controller="antenalvisit">
                                            Add </a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" id="showDrugs" data-controller="antenalvisit">
                                            Show </a>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div class="actions">
                            <div class="btn-group">
                                <a class="btn btn-default btn-sm" href="javascript:;" data-toggle="dropdown">
                                    Lab <i class="fa fa-angle-down"></i>
                                </a>
                                <ul class="dropdown-menu pull-right">
                                    <li>
                                        <a href="javascript:;" id="addInv">
                                            Add </a>
                                    </li>
                                    <li>
                                        <a href="javascript:;" id="showInv" data-controller="antenalvisit">
                                            Show </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <!--
                            <div class="actions">
                                <span class="btn btn-default btn-sm addicobtn">
                                    TTT

                                    <a href="javascript:;" id="addDrug" data-date="{$presDate}" data-controller="antenalvisit">
                                        <i class="fa fa-plus"></i> </a>

                                    <a href="javascript:;" id="showDrugs" data-controller="antenalvisit">
                                        <i class="fa fa-eye"></i> </a>
                                </span>
                            </div>
                            <div class="actions">
                                <span class="btn btn-default btn-sm addicobtn">
                                    Lab

                                    <a href="javascript:;" id="addInv">
                                        <i class="fa fa-plus"></i> </a>

                                    <a href="javascript:;" id="showInv" data-controller="antenalvisit">
                                        <i class="fa fa-eye"></i> </a>
                                </span>
                            </div>
                        -->
                        <div class="actions">
                            <a href="javascript:;" class="btn btn-default btn-sm" id="addUS">
                                &nbsp;&nbsp;
                                US
                                &nbsp;&nbsp;&nbsp;
                            </a>
                        </div>
                    </div>

                    <div class="portlet-body check_heigt_and_make_new_class" id="justfordrugs" >

                        <table class="table table-striped table-hover table-bordered" id="antenalvisit">
                            <thead>
                                <tr>
                                    <th class="col-md-2 wds11">
                                        Date
                                    </th>
                                    <th class="wds3">
                                        W
                                    </th>
                                    <th class="wds30">
                                        Complaint
                                    </th>
                                    {if $ProgramesettingData->diagnosshow eq 0}
                                    <th class="wds30">
                                        Diagnosis
                                    </th>
                                    {/if}
                                    <th class="wds6">
                                        Wt
                                    </th>
                                    <th class="wds7">
                                        Bp
                                    </th>

                                    <th class="wds40">
                                        Notes
                                    </th>
                                    <th>
                                        Delete
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                {foreach $allantenalvisit as $myObject}
                                <tr>
                                    <td>
                                        <input type="text" class="form-control datepicker vdate" data-id="{$myObject->id}" data-colName="antenaldate" data-tableName="antenalvisit" value="{$myObject->antenaldate}" readonly />
                                    </td>

                                    <td>
                                        <label data-id="{$myObject->id}" {if $myObject->dateFlag == 1}style="color: red;font-size: 18px;" {else} style="color: maroon; font-weight : bolder; font-size: 18px;" {/if}>{$myObject->w}</label>
                                    </td>
                                    {if $ProgramesettingData->diagnosshow eq 0}
                                    <td>
                                        <!--     -->
                                        <!--select2me complaint-->
                                        <select multiple="" size="1" class="form-control select2me complaintant updateDiagnosis" id="complaint{$myObject->id}" data-id="{$myObject->id}" data-colName="complaintid" data-tableName="antenalvisit">
                                            <option value="">choose</option>

                                            {foreach $allcomplaint as $comp}
                                            <option value="{$comp->id}" {if $comp->id|in_array:$myObject->compselect}selected="selected"{/if}>{$comp->name}</option>
                                            {/foreach}
                                            <option value="-1" class="addDiagnosis">Add</option>
                                            <option value="-2" class="deleteoptincompo">Delete</option>
                                        </select>
                                    </td>
                                    <td>
                                        <!--     -->
                                        <!--select2me diagnosis-->
                                        <select multiple="" size="1" class="form-control select2me diagnosisant updateDiagnosis" id="diagnosis{$myObject->id}" data-id="{$myObject->id}" data-colName="diagnosisid" data-tableName="antenalvisit">
                                            <option value="">choose</option>

                                            {foreach $alldiagnosis as $mydiagnosis}
                                            <option value="{$mydiagnosis->id}" {if $mydiagnosis->id|in_array:$myObject->select}selected="selected"{/if}>{$mydiagnosis->name}</option>
                                            {/foreach}
                                            <option value="-1" class="addDiagnosis">Add</option>
                                            <option value="-2" class="deleteoptincompo">Delete</option>
                                        </select>
                                    </td>
                                    {else}
                                    <td>
                                        <input type="text" class="form-control updateElement" data-id="{$myObject->id}" data-colName="complaint" data-tableName="antenalvisit" value="{$myObject->complaint}" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="{$myObject->complaint}" />
                                    </td>
                                    {/if}
                                    <td>
                                        <input type="text" class="form-control updateElement" data-id="{$myObject->id}" data-colName="wt" data-tableName="antenalvisit" value="{$myObject->wt}"/>
                                    </td>
                                    <td>
                                        <input type="text" class="form-control bp_mask updateElement" data-id="{$myObject->id}" data-colName="bp" data-tableName="antenalvisit" value="{$myObject->bp}"/>
                                    </td>


                                    <td>
                                        <textarea class="form-control txtc updateElement" rows="1" data-id="{$myObject->id}" data-colName="notes" data-tableName="antenalvisit" placeholder="Enter more text" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="{$myObject->notes}" >{$myObject->notes}</textarea>
                                    </td>
                                    <td>
                                        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$myObject->id}" style=" float: left;" href="#" data-link="antenalvisit" data-fn="del">
                                            <i class="fa fa-close"></i>
                                        </a>
                                    </td>
                                </tr>

                                {/foreach}
                            </tbody>
                        </table>

                        <button id="antenalvisit_add" class="btn red">
                            End Pregnancy
                        </button>


                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<input type="hidden" id="patientId" value="{$patientid}"/>
<input type="hidden" id="mainAntenatalId" value="{$mainObj->id}"/>
<input type="hidden" id="controllName" value="antenalvisit"/>
<input type="hidden" id="iDsArray" value="{$iDsArray}"/>
<!----#########################################################################  model ##############################################################################################################--->
<div class="all">
    <!--------------------------------------------------------------------------- End Pregnancy Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="endPregnancy_model" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title"> End Pregnancy </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">

                                    <div class="portlet-title">
                                        <div class="caption">
                                            <i class="fa fa-cogs"></i> Patient history - Obstetric H data
                                        </div>
                                    </div>
                                    <div class="portlet-body">


                                        <form id="endPregH-form">
                                            <div class="row clinick">




                                                <div class="col-md-2">
                                                    <!--
                                                    <div class="form-group form-md-line-input has-info">
                                                        <div class="input-group">
                                                            <input type="text" required class="form-control"  name="obstrduration" id="obstrduration" data-colName="obstrduration"   data-id="" value="" data-tableName="phobstetric" />
                                                            <span class="input-group-addon">W</span>
                                                            <label for="contduration">Duration</label>
                                                        </div>
                                                    </div>
                                                    -->
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" class="form-control" required name="obstrduration" id="obstrduration" data-colName="obstrduration"   data-id="">
                                                        <label for="form_control_1">Duration</label>
                                                        <span class="input-group-addon">Week</span>
                                                    </div>
                                                </div>



                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <label class="control-label col-md-2 ls2">Termination</label>
                                                        <select  class="form-control obstermination editme" data-class="obstermination" required id="obstermination" data-itr="" name="obstermination" data-colName="obstermination"   data-id=""  data-tableName="phobstetric" >

                                                            <option value="">choose</option>
                                                            {foreach $terminate as $data}
                                                            <option value="{$data->id}">{$data->name}</option>
                                                            {/foreach}
                                                            <option value="-2" class="deleteoptincompo">Delete</option>

                                                        </select>
                                                    </div>
                                                </div>




                                                <div class="col-md-2">
                                                    <div class="form-group">
                                                        <label class="control-label col-md-2 ls2">Place</label>
                                                        <select  class="form-control obsplace editme" data-class="obsplace" required id="obsplace"  data-itr=""  name="obsplace" data-colName="obsplace" data-id="" data-tableName="phobstetric" >
                                                            <option value="">choose</option>
                                                            {foreach $place as $data}
                                                            <option value="{$data->id}">{$data->name}</option>
                                                            {/foreach}
                                                            <option value="-2" class="deleteoptincompo">Delete</option>

                                                        </select>
                                                    </div>
                                                </div>



                                                <div class="col-md-2">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" class="form-control datepicker" required name="obsdate" id="obsdate" data-colName="obsdate"  data-id="" value="" data-tableName="phobstetric"/>
                                                        <label for="obsdate">Date</label>
                                                    </div>
                                                </div>

                                                <div class="col-md-3">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" class="form-control" required name="obsnote" id="obsnote" data-colName="obsnote"  data-id=""  value="" data-tableName="phobstetric"/>
                                                        <label for="obsnote">Note</label>
                                                    </div>
                                                </div>


                                            </div>
                                        </form>





                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">

                                <button type="button" class="btn green" id="endpreg"> save </button>
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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

    <!--------------------------------------------------------------------------- add diagnosis Model-------------------------------------------------------------------------------------->
    <div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"  id="add_model">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title"> Add New </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form action="" id="" method="post" class="form-horizontal  emptyform" >
                            <div class="form-body">
                                <!------===========================================------->
                                <div class="form-group">
                                    <label class="col-md-1 control-label"> Name </label>
                                    <div class="col-md-10">
                                        <input type="text" class="addDiagnosisName" id="diagnosisName" data-select="" data-tablename="" data-id="" value="">
                                    </div>
                                    <label class="col-md-1 control-label"> </label>
                                </div>

                                <!------===========================================------->
                                <div class="modal-footer">
                                    <button type="button" id="amountcloseinput"   class="btn default" data-dismiss="modal">Close</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>
    </div>
    <!--------------------------------------------------------------------------- edit diagnosis Model-------------------------------------------------------------------------------------->
    <div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"  id="edit_model">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title"> Edit </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form action="" id="" method="post" class="form-horizontal  emptyform" >
                            <div class="form-body">
                                <div class="form-group">
                                    <label class="col-md-1 control-label"> </label>
                                    <div class="col-md-10">
                                        <div id="alldatadiv" class="" > </div>
                                    </div>
                                    <label class="col-md-1 control-label"> </label>
                                </div>
                                <!------===========================================------->
                                <div class="modal-footer">
                                    <button type="button" id="amountcloseinput"   class="btn default" data-dismiss="modal">Close</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>
    </div>

    <!--------------------------------------------------------------------------- antenatal form Ultrasound Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="antPatientUS" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title" >
                                        <div class="caption"> Ultrasound </div>
                                        <div class="actions">
                                            <a href="javascript:;" class="btn btn-default btn-sm addRowH" data-type="usantenatal">
                                                <i class="fa fa-plus"></i> Add </a>

                                            <a href="javascript:;" class="btn btn-default btn-sm printUsRows"  data-type="usantenatal">
                                                <i class="fa fa-print"></i> print </a>




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

                                        <table class="table table-striped table-hover table-bordered" dir="ltr">
                                            <thead>
                                                <tr>
                                                    <th class="wds1">
                                                        <input type="checkbox" id="usPrintAll">
                                                    </th>
                                                    <th class="wds1">
                                                        #
                                                    </th>
                                                    <th class="wds10">
                                                        Date
                                                    </th>
                                                    <th class="wds3">
                                                        W
                                                    </th>
                                                    <th class="wds5">
                                                        N
                                                    </th>
                                                    <th class="wds5">
                                                        GS
                                                    </th>
                                                    <th class="wds5">
                                                        CRL
                                                    </th>
                                                    <th class="wds5">
                                                        FHR
                                                    </th>
                                                    <th class="wds5">
                                                        BPD
                                                    </th>

                                                    <th class="wds5">
                                                        FL
                                                    </th>
                                                    <th class="wds15">
                                                        Placenta
                                                    </th>

                                                    <th class="wds5">
                                                        AI
                                                    </th>

                                                    <th class="wds5">
                                                        FWT
                                                    </th>
                                                    <th>
                                                        Notes
                                                    </th>


                                                    <th class="wds1">
                                                        Delete
                                                    </th>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}
                                                    <th class="wds1">
                                                        Doctor
                                                    </th>
                                                    {/if}
                                                </tr>
                                            </thead>
                                            <tbody id="usantenatal">
                                                {assign var=i value=1}
                                                {foreach $allAntUS  as $aUs }
                                                <tr>
                                                    <td>
                                                        <input type="checkbox" class="usPrint" id="usPrint{$aUs->id}"  name="pic[]"  value="{$aUs->id}"/>
                                                    </td>

                                                    <td>{$i}</td>

                                                    <td>
                                                        <input type="text" class="form-control datepicker updateElement usDate" readonly="" placeholder="Date" data-colName="date" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->date}"/>
                                                    </td>
                                                    <td>
                                                        <label id="usLabel{$aUs->id}" {if $aUs->dateFlag == 1}style="color: red;font-size: 18px;" {else} style="color: maroon; font-weight : bolder; font-size: 18px;" {/if}>{$aUs->w}</label>
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="N" data-colName="nga" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->nga}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="GS" data-colName="gs" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->gs}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="CRL" data-colName="crl" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->crl}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="FHR" data-colName="fhr" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->fhr}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="BPD" data-colName="bpd" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->bpd}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="FL" data-colName="fl" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->fl}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="Placenta" data-colName="placenta" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->placenta}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="AI" data-colName="ai" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->ai}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement" placeholder="FWT" data-colName="fwt" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->fwt}">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control updateElement amrpop" placeholder="Notes" data-colName="notes" data-id="{$aUs->id}"  data-tableName="mainantenentalus" value="{$aUs->notes}">
                                                    </td>
                                                    <td>
                                                        <a class="btn grey-cascade btn-xs deletemsgEX" data-id="{$aUs->id}" style=" float: left;" href="#" data-link="antenalvisit" data-fn="delantus">
                                                            <i class="fa fa-close"></i>
                                                        </a>
                                                    </td>
                                                    {if $ProgramesettingData->displaydoctorname eq 1}
                                                    <td class="bold">
                                                        {$aUs->doctorname}
                                                    </td>
                                                    {/if}
                                                </tr>
                                                {capture assign=i}{$i+1}{/capture}
                                                {/foreach}
                                            </tbody>
                                        </table>
                                        <input type="hidden" id="usantenatalItr" value="{$i}"/>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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


    <!---------------------------------------------------------------------------add Drugs Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="addPatientDrugs" style="min-width:1000px;">
        <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">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form class="form-horizontal" role="form" action="" method="post" id="gynaDrugs" enctype="multipart/form-data">
                            <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 " data-controller="antenalvisit"  id="presDate" name="presDate" 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="addNewDrugRow" data-tableName="mainantenentaldrugs">
                                                    <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="antenalvisit"> </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="antenalvisit"  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="mainantenentaldrugs" 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="mainantenentaldrugs" 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="mainantenentaldrugs" 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="antenalvisit" 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="mainId" value="" name="mainId"/>
                                            <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="antenalvisit"> Print  </button>
                                    <button type="button" class="btn default closeDrug" id="closemodel" data-dismiss="modal"> Close</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!---------------------------------------------------------------------------show Drugs Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="showPatientDrugs" style="min-width:1000px;z-index: 10049;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title" >
                                        <div class="caption"> Prescriptions </div>
                                    </div>
                                    <div class="portlet-body" id="showPrescriptions">

                                        <table class="table table-striped table-hover table-bordered">
                                            <thead>
                                                <tr>
                                                    <th>
                                                        Date
                                                    </th>
                                                    <th>
                                                        Drug Name
                                                    </th>

                                                    <th>
                                                        Edit
                                                    </th>
                                                    <th>
                                                        Print
                                                    </th>
                                                    <th>
                                                        {if $ProgramesettingData->displaydoctorname eq 1}Doctor{/if}
                                                    </th>
                                                </tr>
                                            </thead>

                                        </table>

                                    </div>
                                    <div id="drugPrintShow">

                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">

                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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

    <!--------------------------------------------------------------------------- add Investigation Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="addPatientInvestigation" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds95">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <form class="form-horizontal" role="form" action="" method="post" id="gynaInvest" enctype="multipart/form-data">
                            <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="invDate" name="invDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline; width: 62%"> </div>
                                            <div class="actions">
                                                <button type="button" class="btn default printInvestigation" data-print ="0" data-controller="antenalvisit"> Save </button>
                                                <button type="button" class="btn default printInvestigation" data-print ="1" data-controller="antenalvisit"> Save and Print  </button>
                                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>
                                            </div>

                                            <label class="husbandx">
                                                <span> Husband
                                                    <input type="checkbox" id="forHusbandInv" name="forHusband"  value="1" style="padding: 4px 10px;">
                                                </span>
                                            </label>
                                            <div class="caption" style=" font-size: 16px; font-weight: 700; width: 280px; "> Print Date <input type="text" class="form-control datepicker " data-controller="antenalvisit"  id="printInvDate" name="printInvDate" value="{$presDate}"  readonly="" placeholder="Date" style="display: inline;width: 110px;margin: 0px 10px;"> </div>
                                        </div>

                                        <div class="portlet-body">
                                            <input type="hidden" id="pId1" value="" name="patientId"/>
                                            <input type="hidden" id="mainId1" value="" name="mainId"/>
                                            <div class="row" style="padding-left: 9px;padding-top:5px;overflow-y: scroll;">
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group1 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group2 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group3 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" id="" class="iiin {$cat->id}Check"  value="{$inv->id}" name="invCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                                <div class="wds20 fleft">
                                                    {assign var=i value=1}
                                                    {foreach $group4 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" id="" class="iiin {if $cat->name == 'Male(Husband)'}husbandCheck{/if} {$cat->id}Check" value="{$inv->id}" name="invCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>

                                                <div class="wds20 fleft">
                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1">  Favorites
                                                        <span>
                                                            <input type="checkbox" data-gClass="favoriteCheck" class="iiin checkGroup">
                                                        </span>

                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $favorites as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="favoriteCheck iiin" id="" value="{$inv->id}" name="invCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>

                                                    {foreach $others  as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="{$cat->id}Check iiin" id="" value="{$inv->id}" name="invCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}

                                                    {assign var=i value=1}
                                                    {foreach $group5 as $cat}

                                                    <label style="font-weight:bold; text-decoration:underline" for="form_control_1"> {$cat->name}
                                                        <span>
                                                            <input type="checkbox" data-gClass="{$cat->id}Check" class="iiin checkGroup">
                                                        </span>
                                                    </label>
                                                    <div class="checkbox-list">
                                                        {assign var=j value=1}
                                                        {foreach $cat->invests as $inv}
                                                        <label>
                                                            <span>
                                                                <input type="checkbox" class="iiin {$cat->id}Check" id="" value="{$inv->id}" name="invCheck[]">
                                                            </span> {$inv->name}
                                                        </label>

                                                        {capture assign=j}{$j+1}{/capture}
                                                        {/foreach}
                                                    </div>
                                                    {capture assign=i}{$i+1}{/capture}
                                                    {/foreach}
                                                </div>
                                            </div>

                                            <div  id="inv_div">

                                            </div>




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

                            </div>


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



    <!--------------------------------------------------------------------------- show Investigation Model-------------------------------------------------------------------------------------->
    <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="showPatientInvestigation" style="min-width:1000px;">
        <div class="modal-dialog  modal-lg wds90">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                    <h4 class="modal-title">  </h4>
                </div>
                <div class="modal-body">
                    <div class="portlet-body form">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="portlet blue-hoki box">
                                    <div class="portlet-title">
                                        <div class="caption"> Investigations  </div>
                                    </div>
                                    <div class="portlet-body">
                                        <div  id="showInvs">
                                            <table class="table table-striped table-hover table-bordered">
                                                <thead>
                                                    <tr>
                                                        <th> <div align="center">Date </div></th>
                                                        <th colspan="3"> <div align="center">Investigations </div></th>
                                                    </tr>
                                                </thead>

                                            </table>
                                        </div>
                                        <div  id="inv_divShow">

                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn default" id="closemodel" data-dismiss="modal"> Close</button>

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


</div>

<div id="newDrugTableDiv"></div>



<!------------------##############################-------------------- End of Models -----------------------#########################################-------------->


