<meta charset="utf8">
<style>
    #mainDiv 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: #c1c1c1;
    }
</style>
<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">
            <div class="col-md-12" id="gprinModel">
                <!-- BEGIN EXAMPLE TABLE PORTLET-->
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="fa fa-user"></i>تقرير دخول مريض بالداخلي
                        </div>
                        <div class="actions">
                            {if isset($is_add)}
                            <a href="{$hosturl}/controllers/{$controllname}.php?ac=complete_one&show={$show}&patientid={$patientId}&id={$internal_entry_data.id}&tname={$tableName}"
                                class="btn btn-default btn-sm pull-left" style="margin-right: 5px;">
                                save </a>
                            {/if}
                            <a href="{$hosturl}/controllers/{$controllname}.php?ac=internal_entry_show&patientid={$patientId}"
                                class="btn btn-default btn-sm">
                                Show </a>

                            <a class="btn btn-default btn-sm assessmentFormPrint" data-id="{$internal_entry_data.id}"
                                data-fn="internal_entry_print">
                                <i class="fa fa-print"></i> </a>
                        </div>
                    </div>
                    <div class="portlet-body all rtl">
                        <!---======================================================== tab1============================================================================================ ----->
                        <div class="row">
                            <div id="mainDiv">
                                <div class="row">
                                    <div class="portlet-body form">
                                        <form>
                                            <div class="form-body">
                                                <table>
                                                    <thead>
                                                        <tr>
                                                            <th>الرقم القومي</th>
                                                            <td>
                                                                <input type="text" class="form-control"
                                                                    value="{$nationalid}" readonly />
                                                            </td>
                                                            <th>السن</th>
                                                            <td>
                                                                <input type="text" class="form-control" readonly
                                                                    value="{$age}" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <th>رقم التذكرة</th>
                                                            <td>
                                                                <input type="text"
                                                                    class="form-control updateElement positivefloat"
                                                                    data-colName="ticket_no"
                                                                    value="{$internal_entry_data.ticket_no}"
                                                                    data-tableName="internal_patient_entry"
                                                                    data-id="{$internal_entry_data.id}" />
                                                            </td>
                                                            <th class="wds10"> ملاحظات </th>
                                                            <td>
                                                                <textarea class="form-control updateElement amrpop"
                                                                    rows="2" placeholder="ملاحظات" data-colName="notes"
                                                                    data-id="{$internal_entry_data.id}"
                                                                    data-tableName="internal_patient_entry">{$internal_entry_data.notes}
                                                                </textarea>
                                                            </td>
                                                        </tr>
                                                    </thead>
                                                </table>
                                                <div class="clearfix"></div>
                                                <hr>
                                                <table>

                                                    <tr>
                                                        <th>العنوان</th>
                                                        <td>
                                                            <input type="text" class="form-control" value="{$address}"
                                                                readonly />
                                                        </td>
                                                        <th>المركز</th>
                                                        <td>
                                                            <input type="text" class="form-control" value="{$city}"
                                                                readonly />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th>رقم التليفون</th>
                                                        <td>
                                                            <input type="text" class="form-control" value="{$phone}"
                                                                readonly />
                                                        </td>
                                                        <th>المحافظة</th>
                                                        <td>
                                                            <input type="text" class="form-control"
                                                                value="{$governorate}" readonly />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th> تاريخ الدخول </th>
                                                        <td colspan="3">
                                                            <select class="form-control updateElement" id="visitId"
                                                                data-colName="visit_id"
                                                                data-id="{$internal_entry_data.id}"
                                                                data-tableName="internal_patient_entry">
                                                                <option value="">اختر</option>
                                                                {foreach $allvisits as $data}
                                                                <option value="{$data.id}" {if $data.id eq
                                                                    $internal_entry_data.visit_id } selected{/if}>
                                                                    {$data.visitdate}
                                                                </option>
                                                                {/foreach}
                                                            </select>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <div class="clearfix"></div>
                                                <hr>
                                                <table>
                                                    <tr>
                                                        <th class="wds12">التشخيص</th>
                                                        <td>
                                                            <!-- <textarea class="form-control updateElement" rows="2"
                                                                placeholder="التشخيص" data-colName="diagnosis"
                                                                data-id="{$internal_entry_data.id}"
                                                                data-tableName="internal_patient_entry">{$internal_entry_data.diagnosis}
                                                        </textarea> -->
                                                            <select multiple="" size="1"
                                                                class="form-control select2me diagnosis updatePresentHistory"
                                                                id="diagnosis"
                                                                data-id="{$internal_entry_data.id}"
                                                                data-colName="diagnosis"
                                                                data-tableName="internal_patient_entry">
                                                                <option value="">choose</option>
                                                                {foreach $alldiagnosis as $mydiagnosis}
                                                                <option value="{$mydiagnosis->id}" {if $mydiagnosis->
                                                                    id|in_array:$internal_entry_data.diagnosis}selected="selected"{/if}>{$mydiagnosis->name}
                                                                </option>
                                                                {/foreach}
                                                                <option value="-1" class="addDiagnosis">Add</option>
                                                                </option>
                                                            </select>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th class="wds12">الطبيب المعالج</th>
                                                        <td>
                                                            <input type="text" class="form-control" readonly
                                                                value="{$internal_entry_data.docName}" id="visitDoc" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th class="wds12">حالة المريض</th>
                                                        <td>
                                                            <textarea class="form-control updateElement" rows="2"
                                                                placeholder="حالة المريض" data-colName="status"
                                                                data-id="{$internal_entry_data.id}"
                                                                data-tableName="internal_patient_entry">{$internal_entry_data.status}
                                                        </textarea>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="wds12">موجه إلى</td>
                                                        <td>
                                                            <select
                                                                class="form-control slctWAdd internal_report_to updateElement allupdateselect"
                                                                id="internal_report_to"
                                                                data-val="{$internal_entry_data.internal_report_to}"
                                                                name="internal_report_to"
                                                                select-tableName="internal_report_to"
                                                                data-colName="internal_report_to"
                                                                data-id="{$internal_entry_data.id}"
                                                                data-tableName="internal_patient_entry">
                                                                <option value="">اختر</option>
                                                                {foreach $allTo as $data}
                                                                <option value="{$data.id}" {if $data.id eq
                                                                    $internal_entry_data.internal_report_to } selected
                                                                    {/if}>
                                                                    {$data.name}
                                                                </option>
                                                                {/foreach}
                                                                <option value="-2" class="deleteoptincompo">
                                                                    Delete</option>
                                                            </select>
                                                        </td>
                                                    </tr>
                                                </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="" data-mainTable="" 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");
    });

    $('#visitId').on('change', function () {
        let visitid = $(this).val();
        let hosturl = $('#hosturl').val();
        $.post(hosturl + '/controllers/heart_reports.php?ac=getVisitData', { visitid: visitid }, function (data) {
            if (data) {
                $('#visitDoc').val(data);
            }
        });
    });

</script>