<style>
    #addultAssessmentDiv table {
        font-family: arial, sans-serif;
        border-collapse: collapse;
        width: 100%;
        table-layout: fixed
    }

    td,
    th {
        border: 1px solid #000000;
        text-align: center;
        padding: 2px;
    }

    tr:nth-child(even) {
        background-color: #dddddd;
    }
</style>
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">
            <div class="col-md-12 clinick invz" id="gprinModel">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-user"></i>Adult Patient Assessment
                        </div>
                        <div class="actions">
                            {if isset($is_add)}
                            <a href="{$hosturl}/controllers/{$controllname}.php?ac=complete_one&&show={$show}&&patientid={$patientId}&&id={$adult_assessment.id}&&tname=adult_med"
                                class="btn btn-default btn-sm pull-left" style="margin-right: 5px;">
                                save </a>
                            {/if}
                            <a href="{$hosturl}/controllers/{$controllname}.php?ac=adult_show&&patientid={$patientId}"
                                class="btn btn-default btn-sm">
                                Show </a>

                            <a class="btn btn-default btn-sm assessmentFormPrint" data-id="{$adult_assessment.id}"
                                data-fn="adult_print">
                                <i class="fa fa-print"></i> </a>
                        </div>
                    </div>
                    <div class="portlet-body all">
                        <!---======================================================== tab1============================================================================================ ----->
                        <div class="row">
                            <div id="addultAssessmentDiv">
                                <div class="row">
                                    <div class="portlet-body form">
                                        <form>
                                            <div class="form-body">
                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th class="wds12"> Date </th>
                                                            <td>
                                                                <input type="text"
                                                                    class="form-control  datepicker updateElement"
                                                                    data-colName="assessment_date"
                                                                    value="{$adult_assessment.assessment_date}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                            <th class="wds10"> Note </th>
                                                            <td>
                                                                <textarea class="form-control updateElement amrpop"
                                                                    rows="2" placeholder="Enter more text"
                                                                    data-colName="assessment_note"
                                                                    data-id="{$adult_assessment.id}"
                                                                    data-tableName="adult_assessment">
                                                                    {$adult_assessment.assessment_note}
                                                                </textarea>
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                </table>
                                                <div class="clearfix"></div>
                                                <hr>
                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th class="wds12"> Present History </th>
                                                            <td>
                                                                <div class="present_history_div">
                                                                    <select name="present_history"
                                                                        class="form-control select2me present_history updatePresentHistory"
                                                                        id="present_history"
                                                                        data-placeholder="Select..."
                                                                        data-id="{$adult_assessment.id}" multiple
                                                                        data-colName="present_history"
                                                                        data-tableName="adult_assessment">
                                                                        <option value="">choose</option>
                                                                        {foreach $allPresentHistory as $data}
                                                                        <option value="{$data.id}" {if
                                                                            $data.id|in_array:$adult_assessment.present_history}
                                                                            selected {/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="addpresentHistory">Add
                                                                        </option>
                                                                        <option value="-2" class="deleteoptincompo">
                                                                            Delete</option>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th class="wds12"> Complaints and History of Present Illness
                                                            </th>
                                                            <td>
                                                                <div class="present_illness_div">
                                                                    <select name="present_illness"
                                                                        class="form-control select2me present_illness updatePresentHistory"
                                                                        id="present_illness"
                                                                        data-placeholder="Select..."
                                                                        data-id="{$adult_assessment.id}" multiple
                                                                        data-colName="present_illness"
                                                                        data-tableName="adult_assessment">
                                                                        <option value="">choose</option>
                                                                        {foreach $allPresentIllness as $data}
                                                                        <option value="{$data.id}" {if
                                                                            $data.id|in_array:$adult_assessment.present_illness}
                                                                            selected {/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="addpresentHistory">Add
                                                                        </option>
                                                                        <option value="-2" class="deleteoptincompo">
                                                                            Delete</option>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                </table>

                                                <div class="clearfix"></div>
                                                <hr>
                                                <h4 class="bold underline">Past History</h4>
                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th class="wds12"> Co-morbidities </th>
                                                            <td>
                                                                <div class="comorbidities_div">
                                                                    <select name="comorbidities"
                                                                        class="form-control select2me comorbidities updatePresentHistory"
                                                                        id="comorbidities" data-placeholder="Select..."
                                                                        data-id="{$adult_assessment.id}" multiple
                                                                        data-colName="comorbidities"
                                                                        data-tableName="adult_assessment">
                                                                        <option value="">choose</option>
                                                                        {foreach $allComorbidities as $data}
                                                                        <option value="{$data.id}" {if
                                                                            $data.id|in_array:$adult_assessment.comorbidities}
                                                                            selected {/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="addpresentHistory">Add
                                                                        </option>
                                                                        <option value="-2" class="deleteoptincompo">
                                                                            Delete</option>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th class="wds12"> History of Previous Hospital Admission
                                                            </th>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="prev_hos_admisssion"
                                                                    value="{$adult_assessment.prev_hos_admisssion}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th class="wds12"> Previous Surgeries </th>
                                                            <td>
                                                                <div class="prev_surgeries_div">
                                                                    <select name="prev_surgeries"
                                                                        class="form-control select2me prev_surgeries updatePresentHistory"
                                                                        id="prev_surgeries" data-placeholder="Select..."
                                                                        data-id="{$adult_assessment.id}" multiple
                                                                        data-colName="prev_surgeries"
                                                                        data-tableName="adult_assessment">
                                                                        <option value="">choose</option>
                                                                        {foreach $allPrevSurgeries as $data}
                                                                        <option value="{$data.id}" {if
                                                                            $data.id|in_array:$adult_assessment.prev_surgeries}
                                                                            selected {/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="addpresentHistory">Add
                                                                        </option>
                                                                        <option value="-2" class="deleteoptincompo">
                                                                            Delete</option>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th class="wds12"> Allergies </th>
                                                            <td>
                                                                <div class="allergies_div">
                                                                    <select name="allergies"
                                                                        class="form-control select2me allergies updatePresentHistory"
                                                                        id="allergies" data-placeholder="Select..."
                                                                        data-id="{$adult_assessment.id}" multiple
                                                                        data-colName="allergies"
                                                                        data-tableName="adult_assessment">
                                                                        <option value="">choose</option>
                                                                        {foreach $allAllergies as $data}
                                                                        <option value="{$data.id}" {if
                                                                            $data.id|in_array:$adult_assessment.allergies}
                                                                            selected {/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="addpresentHistory">Add
                                                                        </option>
                                                                        <option value="-2" class="deleteoptincompo">
                                                                            Delete</option>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                        </tr>

                                                        <tr>
                                                            <th class="wds12"> Vaccinations</th>
                                                            <td>
                                                                <div class="vaccinations_div">
                                                                    <select name="vaccinations"
                                                                        class="form-control select2me vaccinations updatePresentHistory"
                                                                        id="vaccinations" data-placeholder="Select..."
                                                                        data-id="{$adult_assessment.id}" multiple
                                                                        data-colName="vaccinations"
                                                                        data-tableName="adult_assessment">
                                                                        <option value="">choose</option>
                                                                        {foreach $allVaccinations as $data}
                                                                        <option value="{$data.id}" {if
                                                                            $data.id|in_array:$adult_assessment.vaccinations}
                                                                            selected {/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="addpresentHistory">Add
                                                                        </option>
                                                                        <option value="-2" class="deleteoptincompo">
                                                                            Delete</option>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                </table>

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

                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th class="wds12">Family History</th>
                                                            <td>
                                                                <div class="family_history_div">
                                                                    <select name="family_history"
                                                                        class="form-control select2me family_history updatePresentHistory"
                                                                        id="family_history" data-placeholder="Select..."
                                                                        data-id="{$adult_assessment.id}" multiple
                                                                        data-colName="family_history"
                                                                        data-tableName="adult_assessment">
                                                                        <option value="">choose</option>
                                                                        {foreach $allFamilyhistory as $data}
                                                                        <option value="{$data.id}" {if
                                                                            $data.id|in_array:$adult_assessment.family_history}
                                                                            selected {/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="addpresentHistory">Add
                                                                        </option>
                                                                        <option value="-2" class="deleteoptincompo">
                                                                            Delete</option>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                </table>

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

                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th class="wds12"> Cardiac Examination </th>
                                                            <td colspan="3">
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="cardiac_ex"
                                                                    value="{$adult_assessment.cardiac_ex}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th class="wds12"> Chest Examination </th>
                                                            <td colspan="3">
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="chest_ex"
                                                                    value="{$adult_assessment.chest_ex}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th> ECG </th>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="ecg" value="{$adult_assessment.ecg}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                            <th> CXR </th>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="cxr" value="{$adult_assessment.cxr}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                </table>
                                                <div class="clearfix"></div>
                                                <hr>
                                                <div class="caption col-md-12">
                                                    <span class="caption-subject bold underline">Current
                                                        Medication</span>
                                                    <a class="btn btn-success btn-sm fright"
                                                        data-id="{$adult_assessment.id}" data-tableName="adult_med"
                                                        id="addNewMed">
                                                        <i class="fa fa-plus"></i> </a>
                                                </div>

                                                <input type="hidden" id="newMedItr" value="{$medCount}" />
                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th rowspan="2">Drug</th>
                                                            <th rowspan="2">Dosage frequency</th>
                                                            <th rowspan="2">Route</th>
                                                            <th rowspan="2">Duration</th>
                                                            <th colspan="3">Action</th>
                                                            <th rowspan="2">Delete</th>
                                                        </tr>
                                                        <tr>
                                                            <th>S</th>
                                                            <th>C</th>
                                                            <th>M</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody id="newMedDiv">
                                                        {assign var=itr value=1}
                                                        {foreach $allMedData as $data }
                                                        <tr>
                                                            <td>
                                                                <select
                                                                    class="form-control xx dname select2me updateElement"
                                                                    id="dname{$itr}" data-id="{$data.id}"
                                                                    data-colName="drugid" data-tableName="adult_med"
                                                                    data-itr="{$itr}" data-placeholder="Select...">
                                                                    <option value="" {if $data.drugid==""
                                                                        }selected{/if}>Choose Drug</option>
                                                                    {foreach $drugs as $drug}
                                                                    <option value="{$drug['id']}" {if
                                                                        $data.drugid==$drug['id'] }selected{/if}>
                                                                        {$drug['drugname']}</option>
                                                                    {/foreach}
                                                                    <option value="" {if $data.drugid==""
                                                                        }selected{/if}>Choose Drug</option>
                                                                </select>
                                                            </td>
                                                            <td>
                                                                <select class="form-control xx select2me updateElement"
                                                                    id="ddos{$itr}" data-id="{$data.id}"
                                                                    data-colName="drugdos" data-tableName="adult_med"
                                                                    data-itr="{$itr}" data-placeholder="Select...">
                                                                    <option value="" {if $data.drugdos==""
                                                                        }selected{/if}>choose dose </option>
                                                                    {foreach $allDrugDoses as $dos}
                                                                    <option value="{$dos['drugdos']}" {if
                                                                        $data.drugdos==$dos['drugdos'] }selected{/if}>
                                                                        {$dos['drugdos']}</option>
                                                                    {/foreach}
                                                                    <option class="deleteoptincompo" value="" {if
                                                                        $data.drugdos=="" }selected{/if}>choose dose
                                                                    </option>
                                                                </select>
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="route" value="{$data.route}"
                                                                    data-tableName="adult_med" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="duration" value="{$data.duration}"
                                                                    data-tableName="adult_med" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="action_s" value="{$data.action_s}"
                                                                    data-tableName="adult_med" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="action_c" value="{$data.action_c}"
                                                                    data-tableName="adult_med" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="action_m" value="{$data.action_m}"
                                                                    data-tableName="adult_med" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <a class="btn grey-cascade btn-xs deletemsgEX"
                                                                    data-id="{$data.id}" data-tableName="adult_med"
                                                                    style=" float: left;" href="#"
                                                                    data-link="heart_reports" data-fn="del">
                                                                    <i class="fa fa-close"></i>
                                                                </a>
                                                            </td>
                                                        </tr>
                                                        {capture assign=itr}{$itr+1}{/capture}
                                                        {/foreach}
                                                    </tbody>
                                                </table>
                                                <div class="clearfix"></div>
                                                <hr>
                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th class="wds12"> Provisional Diagnosis </th>
                                                            <td colspan="3">
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="prov_diagnos"
                                                                    value="{$adult_assessment.prov_diagnos}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th class="wds12"> Plan </th>
                                                            <td colspan="3">
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="plan" value="{$adult_assessment.plan}"
                                                                    data-tableName="adult_assessment"
                                                                    data-id="{$adult_assessment.id}" />
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                </table>
                                                <div class="clearfix"></div>
                                                <hr>
                                                <div class="caption col-md-12">
                                                    <span class="caption-subject bold underline">Physician care plan –
                                                        خطة رعاية الطبيب</span>
                                                    <a class="btn btn-success btn-sm fright"
                                                        data-id="{$adult_assessment.id}"
                                                        data-tableName="adult_care_plan" id="addCarePlan">
                                                        <i class="fa fa-plus"></i> </a>
                                                </div>

                                                <input type="hidden" id="carePlanItr" value="{$carePlanCount}" />
                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th>Date</th>
                                                            <th>Needs</th>
                                                            <th>Intervention</th>
                                                            <th>Outcome</th>
                                                            <th>Timeframe</th>
                                                            <th>Delete</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody id="carePlanDiv">
                                                        {assign var=itr value=1}
                                                        {foreach $allCarePlanData as $data }
                                                        <tr>
                                                            <td>
                                                                <input type="text"
                                                                    class="form-control  datepicker updateElement"
                                                                    data-colName="care_plan_date"
                                                                    data-tableName="adult_care_plan" data-itr="{$itr}"
                                                                    data-id="{$data.id}"
                                                                    value="{$data.care_plan_date}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="needs" value="{$data.needs}"
                                                                    data-tableName="adult_care_plan" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="intervention" value="{$data.intervention}"
                                                                    data-tableName="adult_care_plan" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="outcome" value="{$data.outcome}"
                                                                    data-tableName="adult_care_plan" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control updateElement"
                                                                    data-colName="timeframe" value="{$data.timeframe}"
                                                                    data-tableName="adult_care_plan" data-itr="{$itr}"
                                                                    data-id="{$data.id}" />
                                                            </td>
                                                            <td>
                                                                <a class="btn grey-cascade btn-xs deletemsgEX"
                                                                    data-id="{$data.id}"
                                                                    data-tableName="adult_care_plan"
                                                                    style=" float: left;" href="#"
                                                                    data-link="heart_reports" data-fn="del">
                                                                    <i class="fa fa-close"></i>
                                                                </a>
                                                            </td>
                                                        </tr>
                                                        {capture assign=itr}{$itr+1}{/capture}
                                                        {/foreach}
                                                    </tbody>
                                                </table>
                                            </div>
                                        </form>
                                    </div>

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

                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="clearfix"></div>
<div id="vvv"></div>
<input type="hidden" id="controllName" value="{$controllname}">
<input type="hidden" id="patientId" value="{$patientid}" />

<div id="forPrint"></div>
<!----#########################################################################  model ##############################################################################################################--->
<div class="all">
    <!--------------------------------------------------------------------------- add Present History 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">
                                    <div class="col-md-1"></div>
                                    <label class="col-md-3 control-label txtl"> Name </label>
                                    <div class="col-md-8">
                                        <input type="text" class="addpresentHistoryName wds95" id="presentHistoryName"
                                            data-select="" data-tablename="" data-id="" value="">
                                    </div>
                                </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 Present History  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>
</div>
<script>
    $(".amrpop,input[type='text']:not(.datepicker):not(.notPop),textarea:not(.notPop)").hover(function () {
        var pop_value = $(this).val();
        $(this).attr({
            "data-toggle": "popover",
            "data-trigger": "hover",
            "data-placement": "bottom",
            "data-content": pop_value
        });
        $(this).popover("show");
    });

</script>