<meta charset="utf8">

<!-- BEGIN CONTENT -->
<div class="page-content-wrapper" id="mydiv">
    <div class="page-content">
        <!-- BEGIN PAGE HEADER-- >
    <h3 class="page-title">
        {$shcontrollname}
    </h3>
    <div class="page-bar">
        <ul class="page-breadcrumb">
            {$breadcrumbs}
        </ul>
    </div>
        <!-- END PAGE HEADER-->
        <!-- BEGIN PAGE CONTENT-->
        <div class="row">
            <div class="col-md-12">
                <!-- BEGIN SAMPLE FORM PORTLET-->
                <div class="portlet box blue placeholderlabel">
                    <div class="portlet-title">
                        <div class="caption fright">
                            {if $programesetting->system_type  == 2 || $programesetting->system_lang == 2}    بيانات الحالة  {else}        بيانات الزوجة   {/if}      
                            <input type="checkbox" id="wifeData" name="wifeData"
                                   class="md-check" value="1" checked="">
                        </div>
                        <div class="tools fleft">
                            <a href="#" class="collapse">
                            </a>
                            <a class="fff bold" href="{$hosturl}/controllers/{$controllname}.php?ac=show">عرض جميع
                                المرضى </a>
                        </div>
                    </div>
                    <!--                    {$lastpatient->id}-->

                    <div class="portlet-body form">
                        <form action="{$hosturl}/controllers/{$controllname}.php?ac=addfinish" method="post"
                              class="awval_validation patients_add_for_prt" name="patients_add_for_prt" id="addfinishForm" enctype="multipart/form-data" data-ng-app="demo"
                              data-ng-controller="DemoFileUploadController" data-file-upload="options"
                              data-ng-class="{literal}{'fileupload-processing': processing() || loadingFiles}
                                  {/literal}">
                            <div class="form-body">
                                <div class="clinick rtl">

                                    <div class="row">
                                        <div class="col-md-12 txtc" style="    background-color: bisque;">
                                            {if $programesettingex->revisioned == 1}
                                            <div class="col-md-2">
                                                <div class="form-group form-md-line-input form-md-floating-label has-info"   style="padding-top: 0px;">
                                                    <input class="form-control  mask_date_new  updateElement"
                                                           data-id="{$lastpatient->id}" type="text"    data-colName="revision_date"  
                                                           data-tableName="patients"      value="{$lastpatient->revision_date}" />
                                                </div>
                                            </div>


                                            <div class="md-checkbox-inline col-md-1">
                                                <div class="md-checkbox">
                                                    <input type="checkbox" id="revisioned" class="md-check updateElementCheck " name="revisioned" 
                                                           value="1"  data-id="{$lastpatient->id}"  data-colName="revisioned"   data-tableName="patients"  
                                                           {if $lastpatient->revisioned == 1}   checked="" {/if} >
                                                    <label for="revisioned">
                                                        <span></span>
                                                        <span class="check"></span>
                                                        <span class="box"></span>
                                                        Revisioned  </label>
                                                </div>
                                            </div>
                                            {/if}

                                            {if $programesettingex->vip == 1}
                                            <div class="md-checkbox-inline col-md-1">
                                                <div class="md-checkbox">
                                                    <input type="checkbox" id="vip" class="md-check updateElementCheck " name="vip" 
                                                           value="1"  data-id="{$lastpatient->id}"  data-colName="vip"   data-tableName="patients"  
                                                           {if $lastpatient->vip == 1}   checked="" {/if} >
                                                    <label for="vip">
                                                        <span></span>
                                                        <span class="check"></span>
                                                        <span class="box"></span>
                                                        VIP  </label>
                                                </div>
                                            </div>

                                            <div class="col-md-6">
                                                <div class="form-group form-md-line-input form-md-floating-label has-info" style="padding-top: 0px;">
                                                    <input type="text" name="vip_comment" class="form-control  updateElement" 
                                                           data-colName="vip_comment" data-tableName="patients"  
                                                           data-id="{$lastpatient->id}" value="{$lastpatient->vip_comment}"/>
                                                </div>
                                            </div>

                                            {/if}

                                            {if  $programesetting->system_lang == 2}       
                                            <input type="hidden" id="controllName" value="invoffers"/>
                                            <div class="col-md-2">
                                                <div class="form-group form-md-line-input form-md-floating-label has-info" style=" padding-top: 0; ">
                                                    <div class="md-radio-inline ltr">
                                                        <div class="md-radio">
                                                            <input type="radio" id="gender0" name="gender" 
                                                                   class="md-radiobtn updateElement"  data-id="{$lastpatient->id}"  value="0"   
                                                                   data-colName="gender" data-tableName="patients"   
                                                                   {if $lastpatient->gender == 0}checked  {/if}>
                                                            <label for="gender0">
                                                                <span></span>
                                                                <span class="check"></span>
                                                                <span class="box"></span>
                                                                أنثى      </label>
                                                        </div>
                                                        <div class="md-radio"  style="margin-right: 25px;">
                                                            <input type="radio" id="gender1" name="gender" 
                                                                   class="md-radiobtn updateElement"  data-id="{$lastpatient->id}"     value="1"
                                                                   data-colName="gender" data-tableName="patients" 
                                                                   {if $lastpatient->gender == 1}checked  {/if}   >
                                                            <label for="gender1">
                                                                <span></span>
                                                                <span class="check"></span>
                                                                <span class="box"></span>
                                                                ذكر </label>
                                                        </div>
                                                    </div>
                                                    <span class="input-group-addon go2r bold">النوع </span>
                                                </div>
                                            </div>
                                            {/if} 

                                            {if $labSetting->saudi == 1 }
                                            <div class="col-md-2">
                                                <div class="form-group form-md-line-input form-md-floating-label has-info" style=" padding-top: 0; ">
                                                    <div class="md-radio-inline ltr">

                                                        <div class="md-radio"  style="margin-right: 25px;">
                                                            <input type="radio" id="saudi1" name="saudi" 
                                                                   class="md-radiobtn updateElement"  data-id="{$lastpatient->id}"     value="1"
                                                                   data-colName="saudi" data-tableName="patients" 
                                                                   {if $lastpatient->saudi == 1}checked  {/if}   >
                                                            <label for="saudi1">
                                                                <span></span>
                                                                <span class="check"></span>
                                                                <span class="box"></span>
                                                                غير سعودي </label>
                                                        </div>

                                                        <div class="md-radio">
                                                            <input type="radio" id="saudi0" name="saudi" 
                                                                   class="md-radiobtn updateElement"  data-id="{$lastpatient->id}"  value="0"   
                                                                   data-colName="saudi" data-tableName="patients"   
                                                                   {if $lastpatient->saudi == 0}checked  {/if}>
                                                            <label for="saudi0">
                                                                <span></span>
                                                                <span class="check"></span>
                                                                <span class="box"></span>
                                                                سعودي      </label>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            {/if} 
                                        </div>
                                    </div>

                                    <div class="row">
                                        <div class="col-md-1">


                                            <input type="hidden" id="PatientAdd" value="1"/>

                                            {if isset($stausnoauto) && $stausnoauto == 0}
                                            <div class="form-group form-md-line-input form-md-floating-label has-info"
                                                 id="wifestatuscontain">
                                                <input type="text" name="statusno" readonly id="statusno"
                                                       class="form-control " data-ptname="statusno" data-mawdgod="1"
                                                       data-id="{$lastpatient->id}" value="{$lastpatient->statusno}">
                                                <label for="form_control_1" class="txtc">

                                                    <!--                                                    رقم الحالة-->

                                                </label>
                                                <span id="lb_ckwifestatusno" class="help-block clrred"
                                                      style="display: none;">هذا الاسم موجود من قبل</span>
                                            </div>
                                            {elseif $stausnoauto == 1}
                                            <div class="form-group form-md-line-input form-md-floating-label has-info"
                                                 id="wifestatuscontain">
                                                <input type="text" name="statusno" id="statusno"
                                                       class="form-control updatelastptID" data-ptname="statusno"
                                                       data-id="{$lastpatient->id}" value="{$lastpatient->statusno}">
                                                <label for="form_control_1" class="txtc">
                                                    <!--رقم الحالة-->

                                                </label>
                                                <span id="lb_ckwifestatusno" class="help-block clrred"
                                                      style="display: none;">هذا الاسم موجود من قبل</span>
                                            </div>
                                            {/if}
                                        </div>

                                        {if $programesetting->rfc  == 1}
                                        <div class="col-md-1">
                                            <div class="form-group  form-md-floating-label has-info">
                                                <label for="form_control_1" class="txtc">RFC</label>
                                                <select class="form-control  updatelastptID select2h"  required
                                                        name="wrfc" data-id="{$lastpatient->id}"
                                                        data-ptname="wrfc" id="wrfc">
                                                    <option value=""></option>
                                                    <option value="1" {if $lastpatient->wrfc eq 1 } selected {/if} >Yes</option>
                                                    <option value="2" {if $lastpatient->wrfc eq 2 } selected {/if} >No</option>
                                                </select>
                                            </div>
                                        </div>
                                        {/if}



                                        {if $programesetting->branches  == 1}
                                        <div class="col-md-2">
                                            <div class="form-group  form-md-floating-label has-info">
                                                <label for="form_control_1" class="txtc">Branch</label>
                                                <select class="form-control  updatelastptID select2h"  required
                                                        name="branch_id" data-id="{$lastpatient->id}"
                                                        data-ptname="branch_id" id="branch_id">
                                                    <option value=""></option>
                                                    {foreach $branches as $data}
                                                    <option value="{$data->id}" {if $lastpatient->branch_id eq $data->id  }selected{/if}>{$data->name}</option>
                                                    {/foreach}
                                                </select>
                                            </div>
                                        </div>
                                        {/if}

                                        {if $programesettingex->wiftypeid == 1}
                                        <div class="col-md-2" id="wifeuptype">
                                            <div class="form-group  form-md-floating-label has-info">
                                                <label for="form_control_1" class="txtc">الصفة  </label>
                                                <select class="form-control  updatelastptID wTypes"
                                                        name="wiftypeid" data-id="{$lastpatient->id}"
                                                        data-ptname="wiftypeid" id="wifetype">
                                                    <option value=""></option>
                                                    {foreach $allTypes as $row}
                                                    <option value="{$row->id}" {if $lastpatient->wiftypeid eq
                                                        $row->id}selected{/if}>{$row->title}
                                                    </option>
                                                    {/foreach}
                                                    {if $smarty.session.role_id neq 3}
                                                    <option value="0" class="deleteoptincompo">حذف</option>{/if}
                                                </select>
                                            </div>
                                        </div>
                                        {/if}


                                        <div class="col-md-4">
                                            <div class="form-group form-md-line-input form-md-floating-label has-info"
                                                 id="wifenamecontain">
                                                <input type="text" id="wifename" name="wifename"
                                                       class="form-control " data-ptname="wifename"
                                                       data-id="{$lastpatient->id}" value="{$lastpatient->wifename}" required 
                                                       />
                                                <span id="lb_ckwifename" class="help-block clrred"
                                                      style="display: none;">هذا الاسم موجود من قبل</span>
                                                <label for="form_control_1" class="txtc">الإسم </label>

                                            </div>
                                            <!--                                            <div class="form-group form-md-line-input form-md-floating-label has-info" id="wifenamecontain">
                                                                                            <input type="text" id="wifename" name="wifename" class="form-control updatelastptID" data-ptname="wifename" data-id="{$lastpatient->id}" value="{$lastpatient->wifename}">
                                                                                            <label for="form_control_1" class="txtc">اسم المريضة</label>
                                                                                            <span  id="lb_ckwifename" class="help-block clrred" style="display: none;">هذا الاسم موجود من قبل</span>
                                                                                        </div>-->
                                        </div>

                                        {if $programesettingex->dateofbirth == 1}
                                        <div class="col-md-1">
                                            <div class="form-group form-md-line-input form-md-floating-label has-info">


                                                <input class="form-control calcdatew mask_date_new txtl"
                                                       data-id="{$lastpatient->id}" type="text" data-colresult="wifeage"
                                                       data-ptname="dateofbirth" id="dateofbirth_cc"
                                                       value="{$lastpatient->dateofbirth}" name="dateofbirth"/>
                                                <label for="form_control_1" class="txtc"> </label>
                                                <span class="input-group-addon go2r">تاريخ الميلاد </span>
                                            </div>
                                        </div>
                                        {/if}

                                        {if $programesettingex->wifeage == 1}
                                        <div class="col-md-1">
                                            <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                <input type="text" class="form-control updatelastptID txtc"
                                                       data-id="{$lastpatient->id}" data-ptname="wifeage" name="wifeage"
                                                       id="wifeage" value="{$wAge}"/>
                                                <span id="errmsg"></span>
                                                <label for="form_control_1" class="txtc"></label>
                                                <span class="input-group-addon go2r">السن </span>
                                            </div>
                                        </div>
                                        {/if}

                                    </div>
                                    <div class="row">

                                        {if $programesettingex->wifenationalid == 1}
                                        <div class="col-md-3">
                                            <div class="form-group form-md-line-input form-md-floating-label has-info"
                                                 id="wifenationalidcontain">
                                                <input type="text" class="form-control digitsOnly "
                                                       maxlength="14" data-id="{$lastpatient->id}"
                                                       data-ptname="wifenationalid" name="wifenationalid"
                                                       id="wifenationalid"      
                                                       {if $smarty.session.role_id neq 19 && $programesetting->national_id_req  == 1} required {/if}
                                                value="{$lastpatient->wifenationalid}"/>
                                                <label for="form_control_1" class="txtc">رقم البطاقة</label>
                                                <span id="lb_ckeckwifenationalid" class="help-block clrred" {if
                                                      $nationalIdMatch== 2}{else} style="display: none;" {/if}>{if
                                                      $nationalIdMatch == 2}هذا الرقم خاطئ{else} {/if}</span>

                                            </div>
                                        </div>
                                        {/if}

                                        {if $programesettingex->passport == 1}
                                        <div class="col-md-2">
                                            <div class="form-group form-md-line-input form-md-floating-label has-info"
                                                 id="passportcontain">
                                                <input type="text" class="form-control  updatelastptID" data-id="{$lastpatient->id}"
                                                       data-ptname="passport" name="passport"  id="passport"  
                                                       value="{$lastpatient->passport}"/>
                                                <label for="form_control_1" class="txtc"> جواز السفر</label>
                                                <span id="lb_ckeckpassport" class="help-block clrred" {if
                                                      $passportMatch== 2}{else} style="display: none;" {/if}>{if
                                                      $passportMatch == 2}هذا الرقم مكرر{else} {/if}</span>

                                            </div>
                                        </div>
                                        {/if}

                                        {if $programesettingex->wifejob == 1}
                                        <div class="col-md-3">
                                            <div class="form-group  form-md-floating-label has-info">
                                                <label for="form_control_1" class="txtc">الوظيفة</label>
                                                <select class="form-control  updatelastptID wjob"
                                                        data-id="{$lastpatient->id}" data-ptname="wifejob"
                                                        name="wifejob" id="wifejob" >
                                                    <option value=""></option>
                                                    {foreach $wifejobs as $row}
                                                    <option value="{$row->id}" {if $lastpatient->wifejob eq
                                                        $row->id}selected{/if}>{$row->title}
                                                    </option>
                                                    {/foreach}
                                                    {if $smarty.session.role_id neq 3}
                                                    <option value="0" class="deleteoptincompo"> حذف</option>{/if}
                                                </select>
                                            </div>
                                        </div>
                                        {/if}

                                        {if $programesettingex->statuesid == 1}           
                                        <div class="col-md-2">
                                            <div class="form-group form-md-floating-label has-info">
                                                <label for="form_control_1" class="txtc">الحالة الإجتماعية</label>
                                                <select class="form-control  updatelastptID wstatus"
                                                        data-id="{$lastpatient->id}" data-ptname="statuesid"
                                                        name="wifestatus" id="wifestatus"
                                                        style="width: 150px !important">
                                                    <option value=""></option>
                                                    {foreach $wifestatus as $row}
                                                    <option value="{$row->id}" {if $lastpatient->statuesid eq
                                                        $row->id}selected{/if}>{$row->title}
                                                    </option>
                                                    {/foreach}
                                                    {if $smarty.session.role_id neq 3}
                                                    <option value="0" class="deleteoptincompo">حذف</option>
                                                    {/if}
                                                </select>
                                            </div>
                                        </div>
                                        {/if}


                                        {if $lastpatient->statuesid == 1}
                                        <div class="displaynot" style="display: none;">
                                            {elseif $lastpatient->statuesid == 3}
                                            <div class="displaynot">
                                                {else}
                                                <div class="displaynot">
                                                    {/if}


                                                    {if $programesettingex->mirragefromy == 1}
                                                    <div class="col-md-1">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">

                                                            <input type="text" name="mirragefromy"
                                                                   class="form-control updatelastptID digitsOnly"
                                                                   data-id="{$lastpatient->id}"
                                                                   data-ptname="mirragefromy" id="mirragefromy"
                                                                   value="{$lastpatient->mirragefromy}"/>
                                                            <label id="husbandLive" for="form_control_1" class="txtc">
                                                                <!--منذ--></label>
                                                            <span class="input-group-addon">سنة </span>
                                                        </div>
                                                    </div>
                                                    {/if}

                                                    {if $programesettingex->mirragefromm == 1}
                                                    <div class="col-md-1">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">

                                                            <input type="text" name="mirragefromm"
                                                                   class="form-control updatelastptID digitsOnly"
                                                                   data-id="{$lastpatient->id}"
                                                                   data-ptname="mirragefromm" id="mirragefromm"
                                                                   value="{$lastpatient->mirragefromm}"/>
                                                            <label id="husbandLive" for="form_control_1"
                                                                   class="txtc"> </label>
                                                            <span class="input-group-addon">شهر</span>
                                                        </div>
                                                    </div>
                                                    {/if}

                                                    <input type="hidden" name="mirragefrom" data-id="{$lastpatient->id}"
                                                           data-ptname="mirragefrom" value=""/>

                                                    <!--div class="col-md-1">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input type="text" name="boyson"
                                                                   class="form-control updatelastptID digitsOnly"
                                                                   data-id="{$lastpatient->id}" data-ptname="boyson"
                                                                   value="{$lastpatient->boyson}"/>
                                                            <label for="form_control_1" class="txtc"></label>
                                                            <span class="input-group-addon">الذكور </span>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-1">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input type="text" name="girlson"
                                                                   class="form-control updatelastptID digitsOnly"
                                                                   data-id="{$lastpatient->id}" data-ptname="girlson"
                                                                   value="{$lastpatient->girlson}"/>
                                                            <label for="form_control_1" class="txtc"></label>
                                                            <span class="input-group-addon">الإناث </span>
                                                        </div>
                                                    </div-->
                                                </div>



                                            </div>
                                            <div class="row">

                                                {if $programesettingex->wifeeducation == 1}
                                                <div class="col-md-4">
                                                    <div class="form-group  form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">التعليم</label>
                                                        <select class="form-control  updatelastptID edu"
                                                                data-id="{$lastpatient->id}" data-ptname="wifeeducation"
                                                                name="education" id="education">
                                                            <option value=""></option>
                                                            {foreach $education as $row}
                                                            <option value="{$row->id}" {if $lastpatient->wifeeducation eq
                                                                $row->id}selected{/if}>{$row->title}
                                                            </option>
                                                            {/foreach}
                                                            {if $smarty.session.role_id neq 3}
                                                            <option value="0" class="deleteoptincompo">حذف</option>{/if}
                                                        </select>

                                                    </div>
                                                </div>
                                                {/if}

                                                <div class="col-md-2 " >
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">

                                                        <input type="text" name="phone" id="phone" required
                                                               class="form-control updatelastptID digitsOnly uniquePhone" 
                                                               data-id="{$lastpatient->id}"
                                                               data-ptname="phone" value="{$lastpatient->phone}"/>
                                                        <span id="lb_ckphone" class="help-block clrred"
                                                              style="display: none;">هذا الرقم موجود من قبل</span>
                                                        <label for="form_control_1" class="txtc">الموبايل 1</label>
                                                    </div>
                                                </div>

                                                <div class="col-md-2 ">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" name="mobile" id="mobile"   
                                                               class="form-control updatelastptID digitsOnly uniquePhone" 
                                                               data-id="{$lastpatient->id}" 
                                                               data-ptname="mobile"  value="{$lastpatient->mobile}"/>
                                                        <span id="lb_ckmobile" class="help-block clrred"
                                                              style="display: none;">هذا الرقم موجود من قبل</span>
                                                        <label for="form_control_1" class="txtc">الموبايل 2</label>
                                                    </div>
                                                </div>

                                                {if $programesettingex->wifebl == 1}
                                                <div class="col-md-2 ">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">فصيلة الدم</label>
                                                        <select class="form-control  bloodtype updatelastptID"
                                                                data-id="{$lastpatient->id}" data-ptname="wifebl"
                                                                id="bloodtype" name="wifebl"/>
                                                        <option value=""></option>
                                                        {foreach $wifebl as $row}
                                                        <option value="{$row->id}" {if $lastpatient->wifebl eq
                                                            $row->id}selected{/if}>{$row->title}
                                                        </option>
                                                        {/foreach}
                                                        {if $smarty.session.role_id neq 3}
                                                        <option value="0" class="deleteoptincompo">حذف</option>
                                                        {/if}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesetting->organizations  != 1 && $programesetting->org_in == 2 }
                                                <div class="col-md-2 ">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc"> تابع ل  </label>
                                                        <select  class="form-control select2h updateElement" name="organization_id" id="organizations"
                                                                 placeholder="اختر  " required="required" select-tableName="patients"
                                                                 data-tableName="patients" data-maintable = "organizations"
                                                                 data-colName="organization_id" data-id="{$lastpatient->id}" >
                                                            <option value="0" selected>لا يوجد </option>
                                                            {foreach $organizations as $row}
                                                            <option value="{$row->id}"  {if $lastpatient->organization_id eq $row->id}selected{/if} >{$row->organization_name}</option>
                                                            {/foreach}
                                                            {if $programesetting->organizations  == 2 }
                                                            <option value="-1" class="deleteoptincompo">تعديل </option>
                                                            {/if}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}


                                            </div>

                                            <div class="row">
                                                {if $programesettingex->governorate == 1}
                                                <div class="col-md-4">
                                                    <div class="form-group  form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">المحافظة </label>
                                                        <select class="form-control  updatelastptID governorate"
                                                                data-id="{$lastpatient->id}" data-ptname="governorate"
                                                                name="governorate" id="governorate">
                                                            <option value=""></option>
                                                            {foreach $governorates as $row}
                                                            <option value="{$row->id}" {if $lastpatient->governorate eq
                                                                $row->id}selected{/if}>{$row->name}
                                                            </option>
                                                            {/foreach}
                                                            {if $smarty.session.role_id neq 3}
                                                            <option value="0" class="deleteoptincompo">حذف</option>{/if}
                                                        </select>

                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->governorate_center == 1}
                                                <div class="col-md-4">
                                                    <div class="form-group  form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">المركز </label>
                                                        <select class="form-control  updatelastptID governorate_centers"
                                                                data-id="{$lastpatient->id}" data-ptname="governorate_center"
                                                                name="governorate_center" id="governorate_centers">
                                                            <option value=""></option>
                                                            {foreach $governorate_centers as $row}
                                                            <option value="{$row->id}" {if $lastpatient->governorate_center eq
                                                                $row->id}selected{/if}>{$row->name}
                                                            </option>
                                                            {/foreach}
                                                            {if $smarty.session.role_id neq 3 &&  $lastpatient->governorate > 0 }
                                                            <option value="0" class="deleteoptincompo">حذف</option>{/if}
                                                        </select>

                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->address == 1}
                                                <div class="col-md-4">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" name="address"
                                                               class="form-control updatelastptID"
                                                               data-id="{$lastpatient->id}" data-ptname="address"
                                                               value="{$lastpatient->address}"/>
                                                        <label for="form_control_1" class="txtc">العنوان</label>
                                                    </div>
                                                </div>
                                                {/if}
                                            </div>

                                            <div class="row">
                                                {if $programesettingex->importantnote == 1}
                                                <div class="col-md-6">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" name="importantnote"
                                                               class="form-control updatelastptID"
                                                               data-id="{$lastpatient->id}" data-ptname="importantnote"
                                                               value="{$lastpatient->importantnote}"/>
                                                        <label for="form_control_1" class="txtc"> ملاحظات هامة</label>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->spacialnotes == 1}
                                                <div class="col-md-6">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" name="spacialnotes"
                                                               class="form-control updatelastptID"
                                                               data-id="{$lastpatient->id}" data-ptname="spacialnotes"
                                                               value="{$lastpatient->spacialnotes}"/>

                                                        <label for="form_control_1" class="txtc"> عادات خاصة</label>
                                                    </div>
                                                </div>
                                                {/if}
                                            </div>

                                            <div class="row">
                                                {if $programesettingex->risk == 1}
                                                <div class="col-md-10">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <input type="text" name="risk"
                                                               class="form-control updatelastptID"
                                                               data-id="{$lastpatient->id}" data-ptname="risk"
                                                               value="{$lastpatient->risk}"/>

                                                        <label for="form_control_1" class="txtc">نوع الخطورة</label>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->risktype == 1}
                                                <div class="col-md-2">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">درجة الخطورة</label>
                                                        <select class="form-control  updatelastptID"
                                                                data-id="{$lastpatient->id}" data-ptname="risktype"
                                                                name="risktype">
                                                            <option value=""></option>
                                                            <option value="1" {if $lastpatient->risktype eq
                                                                1}selected{/if}>منخفض
                                                            </option>
                                                            <option value="2" {if $lastpatient->risktype eq
                                                                2}selected{/if}>متوسط
                                                            </option>
                                                            <option style="background: red;" value="3" {if
                                                                    $lastpatient->risktype eq 3}selected{/if}>مرتفع
                                                            </option>

                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}
                                            </div>
                                            {if $programesetting->system_type  == 1 ||  $programesetting->system_type  == 3  ||  $programesetting->system_type  == 4}
                                            <div class="row">

                                                {if $programesettingex->refer_doctor == 1}
                                                <div class="col-md-2">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">محولة  من </label>
                                                        <select class="form-control  updatelastptID editData refer_doctor"
                                                                data-id="{$lastpatient->id}"
                                                                data-ptname="refer_doctor" name="refer_doctor" required
                                                                id="refer_doctor">
                                                            <option value=""></option>
                                                            <option value="-1" {if $lastpatient->refer_doctor eq -1 }selected{/if}>لا يوجد</option>
                                                            {foreach $refer as $data}
                                                            <option value="{$data->id}" {if $lastpatient->refer_doctor eq
                                                                $data->id && $lastpatient->refer_doctor_tb == 0 }selected{/if}>{$data->name}</option>
                                                            {/foreach}

                                                            {foreach $py_all_doc as $data}
                                                            <option value="*{$data.user_id}" {if $lastpatient->refer_doctor eq
                                                                $data.user_id && $lastpatient->refer_doctor_tb == 1 }selected{/if}>{$data.name}</option>
                                                            {/foreach}


                                                            {if $smarty.session.role_id neq 3}
                                                            <option value="0" class="deleteoptincompo">حذف</option>
                                                            {/if}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->nationality == 1}
                                                <div class="col-md-2">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">الجنسية </label>
                                                        <select class="form-control  updatelastptID editData nationality"
                                                                data-id="{$lastpatient->id}"
                                                                data-ptname="nationality" name="nationality"
                                                                id="nationality">
                                                            <option value=""></option>
                                                            {foreach $nationality as $data}
                                                            <option value="{$data->id}" {if $lastpatient->nationality eq
                                                                $data->id}selected{/if}>{$data->name}</option>
                                                            {/foreach}
                                                            {if $smarty.session.role_id neq 3}
                                                            <option value="0" class="deleteoptincompo">حذف</option>
                                                            {/if}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->religion == 1}
                                                <div class="col-md-2">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">الديانة </label>
                                                        <select class="form-control  updatelastptID editData religion"
                                                                data-id="{$lastpatient->id}"
                                                                data-ptname="religion" name="religion"
                                                                id="religion">
                                                            <option value=""></option>
                                                            {foreach $religion as $data}
                                                            <option value="{$data->id}" {if $lastpatient->religion eq
                                                                $data->id}selected{/if}>{$data->name}</option>
                                                            {/foreach}
                                                            {if $smarty.session.role_id neq 3}
                                                            <option value="0" class="deleteoptincompo">حذف</option>
                                                            {/if}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->doctor1 == 1}
                                                <div class="col-md-3">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">الطبيب المعالج 1 </label>
                                                        <select class="form-control select2 updatelastptID"
                                                                data-id="{$lastpatient->id}"
                                                                data-ptname="doctor1" name="doctor1" required 
                                                                id="doctor1">
                                                            <option value=""></option>
                                                            <option value="-1" {if $lastpatient->doctor1 eq -1 }selected{/if}>لا يوجد</option>
                                                            {foreach $py_all_doc as $data}
                                                            <option value="{$data.user_id}" {if $lastpatient->doctor1 eq
                                                                $data.user_id}selected{/if}>{$data.name}</option>
                                                            {/foreach}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->doctor2 == 1}
                                                <div class="col-md-3">
                                                    <div class="form-group form-md-floating-label has-info">
                                                        <label for="form_control_1" class="txtc">الطبيب المعالج 2 </label>
                                                        <select class="form-control  updatelastptID"
                                                                data-id="{$lastpatient->id}"
                                                                data-ptname="doctor2" name="doctor2"
                                                                id="doctor2">
                                                            <option value=""></option>
                                                            <option value="-1" {if $lastpatient->doctor2 eq -1 }selected{/if}>لا يوجد</option>
                                                            {foreach $py_all_doc as $data}
                                                            <option value="{$data.user_id}" {if $lastpatient->doctor2 eq
                                                                $data.user_id}selected{/if}>{$data.name}</option>
                                                            {/foreach}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}
                                            </div>
                                            {/if}

                                            {if $programesetting->system_lang != 2 }

                                            {if $lastpatient->statuesid == 1 }
                                            <div class="hiddenforsng" style="display: none;">
                                                {elseif $lastpatient->statuesid == 3}
                                                <div class="hiddenforsng" style="display: none;">
                                                    {else}
                                                    <div class="hiddenforsng">
                                                        {/if}
                                                        <div class="portlet box blue portletcustom">
                                                            <div class="portlet-title">
                                                                <div class="caption fright">

                                                                    <input type="checkbox" id="HusData" name="HusData"
                                                                           class="md-check" value="1" >
                                                                    بيانات الزوج
                                                                </div>
                                                            </div>
                                                        </div>


                                                        <div class="row">

                                                            {if $programesetting->rfc  == 1}
                                                            <div class="col-md-1">
                                                                <div class="form-group  form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">RFC</label>
                                                                    <select class="form-control  updatelastptID  select2h"  required
                                                                            name="rfc" data-id="{$lastpatient->id}"
                                                                            data-ptname="rfc" id="rfc">
                                                                        <option value=""></option>
                                                                        <option value="1" {if $lastpatient->rfc eq 1 } selected {/if} >Yes</option>
                                                                        <option value="2" {if $lastpatient->rfc eq 2 } selected {/if} >No</option>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}


                                                            {if $programesettingex->husbandtypeid == 1}
                                                            <div class="col-md-2">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1"
                                                                           class="txtc">الصفة</label>
                                                                    <select class="form-control  updatelastptID htype"
                                                                            data-id="{$lastpatient->id}"
                                                                            name="husbandtypeid"
                                                                            data-ptname="husbandtypeid"
                                                                            id="husbandtype"/>
                                                                    <option value=""></option>
                                                                    {foreach $husbandtypes as $row}
                                                                    <option value="{$row->id}" {if $lastpatient->
                                                                        husbandtypeid eq
                                                                        $row->id}selected{/if}>{$row->title}
                                                                    </option>
                                                                    {/foreach}
                                                                    {if $smarty.session.role_id neq 3}
                                                                    <option value="0" class="deleteoptincompo">حذف
                                                                    </option>
                                                                    {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}


                                                            <div class="col-md-5">
                                                                <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                    <input type="text" name="husdandname"  id="husdandname" required
                                                                           class="form-control updatelastptID"
                                                                           data-id="{$lastpatient->id}"
                                                                           data-ptname="husdandname"
                                                                           value="{$lastpatient->husdandname}"/>
                                                                    <label for="form_control_1" class="txtc">اسم
                                                                        الزوج</label>
                                                                </div>
                                                            </div>


                                                            {if $programesettingex->husbanddateofbirth == 1}
                                                            <div class="col-md-2">
                                                                <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                    <input class="calcdatehusband mask_date_new form-control txtl updatelastptID"
                                                                           data-id="{$lastpatient->id}"
                                                                           data-ptname="husbanddateofbirth" type="text"
                                                                           value="{$lastpatient->husbanddateofbirth}"
                                                                           id="husbanddateofbirth"
                                                                           name="husbanddateofbirth"/>
                                                                    <label for="form_control_1"></label>
                                                                    <span class="input-group-addon go2r">تاريخ الميلاد </span>
                                                                </div>
                                                            </div>
                                                            {/if}

                                                            {if $programesettingex->husbandage == 1}
                                                            <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  updatelastptID"
                                                                           data-id="{$lastpatient->id}"
                                                                           data-ptname="husbandage" name="husbandage"
                                                                           id="husbandage" value="{$hAge}"/>
                                                                    <label for="form_control_1" class="txtc"></label>
                                                                    <span class="input-group-addon go2r">السن</span>
                                                                </div>
                                                            </div>
                                                            {/if}
                                                        </div>
                                                        <div class="row">
                                                            {if $programesettingex->husbandnationalid == 1}
                                                            <div class="col-md-3">
                                                                <div class="form-group form-md-line-input form-md-floating-label has-info"
                                                                     id="husbandnationalidcontent">


                                                                    <input type="text" class="form-control digitsOnly"
                                                                           maxlength="14" data-id="{$lastpatient->id}"
                                                                           data-ptname="husbandnationalid"
                                                                           name="husbandnationalid"
                                                                           id="husbandnationalid"   
                                                                           value="{$lastpatient->husbandnationalid}"/>
                                                                    <label for="form_control_1" class="txtc">رقم
                                                                        البطاقة </label>
                                                                    <!--<label class="control-label" id="lb_ckeckhusbandnationalid" style="display: none; color: red; text-align: center; background-color: rgb(255, 255, 255);border: 1px solid;"> هذا الرقم موجود من قبل</label>-->
                                                                    <span id="lb_ckeckhusbandnationalid"
                                                                          class="help-block clrred"
                                                                          style="display: none;"></span>
                                                                </div>
                                                            </div>
                                                            {/if}

                                                            {if $programesettingex->husbandeducation == 1}
                                                            <div class="col-md-3">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">تعليم
                                                                        الزوج</label>
                                                                    <select class="form-control  updatelastptID edu"
                                                                            data-id="{$lastpatient->id}"
                                                                            data-ptname="husbandeducation"
                                                                            name="husbandeducation" id="educationhus"/>
                                                                    <option value=""></option>
                                                                    {foreach $education as $row}
                                                                    <option value="{$row->id}" {if $lastpatient->
                                                                        husbandeducation eq
                                                                        $row->id}selected{/if}>{$row->title}
                                                                    </option>
                                                                    {/foreach}
                                                                    {if $smarty.session.role_id neq 3}
                                                                    <option value="0" class="deleteoptincompo">حذف
                                                                    </option>
                                                                    {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}

                                                            {if $programesettingex->husbandjob == 1}
                                                            <div class="col-md-3">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1"
                                                                           class="txtc">الوظيفة</label>
                                                                    <select class="form-control  updatelastptID hjob" 
                                                                            data-id="{$lastpatient->id}" 
                                                                            data-ptname="husbandjob" name="husbandjob" 
                                                                            id="husbandjob"  >
                                                                        <option value=""></option>
                                                                        {foreach $husbandjobs as $row}
                                                                        <option value="{$row->id}" {if $lastpatient->
                                                                            husbandjob eq
                                                                            $row->id}selected{/if}>{$row->title}
                                                                        </option>
                                                                        {/foreach}
                                                                        {if $smarty.session.role_id neq 3}
                                                                        <option value="0" class="deleteoptincompo">حذف
                                                                        </option>
                                                                        {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}

                                                            {if $programesettingex->husbandbl == 1}
                                                            <div class="col-md-3">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">فصيلة
                                                                        الدم</label>
                                                                    <select class="form-control  bloodtype updatelastptID"
                                                                            data-id="{$lastpatient->id}"
                                                                            data-ptname="husbandbl" name="husbandbl"
                                                                            id="bloodtypehus"/>
                                                                    <option value=""></option>
                                                                    {foreach $wifebl as $row}
                                                                    <option value="{$row->id}" {if $lastpatient->
                                                                        husbandbl eq
                                                                        $row->id}selected{/if}>{$row->title}
                                                                    </option>
                                                                    {/foreach}
                                                                    {if $smarty.session.role_id neq 3}
                                                                    <option value="0" class="deleteoptincompo">حذف
                                                                    </option>
                                                                    {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}

                                                        </div>
                                                        <div class="row">

                                                            {if $programesettingex->hus_statuesid == 1}
                                                            <div class="col-md-3">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">الحالة الإجتماعية</label>
                                                                    <select class="form-control  updatelastptID hstatus"
                                                                            data-id="{$lastpatient->id}" data-ptname="hus_statuesid"
                                                                            name="husstatus" id="husstatus"
                                                                            style="width: 150px !important">
                                                                        <option value=""></option>
                                                                        {foreach $husstatus as $row}
                                                                        <option value="{$row->id}" {if $lastpatient->hus_statuesid eq
                                                                            $row->id}selected{/if}>{$row->title}
                                                                        </option>
                                                                        {/foreach}
                                                                        {if $smarty.session.role_id neq 3}
                                                                        <option value="0" class="deleteoptincompo">حذف</option>
                                                                        {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}

                                                            {if $programesettingex->hus_passport == 1}
                                                            <div class="col-md-4">
                                                                <div class="form-group form-md-line-input form-md-floating-label has-info"
                                                                     id="hpassportcontain">
                                                                    <input type="text" class="form-control  updatelastptID" 
                                                                           data-id="{$lastpatient->id}"
                                                                           data-ptname="hus_passport" name="hus_passport"  id="hus_passport"  
                                                                           value="{$lastpatient->hus_passport}"/>
                                                                    <label for="form_control_1" class="txtc"> جواز السفر</label>
                                                                    <span id="lb_ckeckpassporth" class="help-block clrred" {if
                                                                          $passportMatch== 2}{else} style="display: none;" {/if}>{if
                                                                          $passportMatch == 2}هذا الرقم مكرر{else} {/if}</span>

                                                                </div>
                                                            </div>
                                                            {/if}


                                                            {if $programesettingex->hus_mobile == 1}
                                                            <div class="col-md-4">
                                                                <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                    <input type="text" name="hus_mobile" id="hus_mobile"   
                                                                           class="form-control updatelastptID digitsOnly" 
                                                                           maxlength="11" data-id="{$lastpatient->id}" 
                                                                           data-ptname="hus_mobile"  value="{$lastpatient->hus_mobile}"/>

                                                                    <label for="form_control_1" class="txtc">الموبايل </label>
                                                                </div>
                                                            </div>
                                                            {/if}
                                                        </div>
                                                        {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}

                                                        <div class="row">

                                                            {if $programesettingex->h_refer_doctor == 1}
                                                            <div class="col-md-2">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">محول  من </label>
                                                                    <select class="form-control  updatelastptID editData h_refer_doctor"
                                                                            data-id="{$lastpatient->id}"
                                                                            data-ptname="h_refer_doctor" name="h_refer_doctor" required
                                                                            id="h_refer_doctor">
                                                                        <option value=""></option>
                                                                        <option value="-1" {if $lastpatient->h_refer_doctor eq -1 }selected{/if}>لا يوجد</option>
                                                                        {foreach $refer as $data}
                                                                        <option value="{$data->id}" {if $lastpatient->h_refer_doctor eq
                                                                            $data->id && $lastpatient->h_refer_doctor_tb == 0}selected{/if}>{$data->name}</option>
                                                                        {/foreach}

                                                                        {foreach $py_all_doc as $data}
                                                                        <option value="*{$data.user_id}" {if $lastpatient->h_refer_doctor eq
                                                                            $data.user_id && $lastpatient->h_refer_doctor_tb == 1 }selected{/if}>{$data.name}</option>
                                                                        {/foreach}

                                                                        {if $smarty.session.role_id neq 3}
                                                                        <option value="0" class="deleteoptincompo">حذف</option>
                                                                        {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}

                                                            {if $programesettingex->h_nationality == 1}
                                                            <div class="col-md-2">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">الجنسية </label>
                                                                    <select class="form-control  updatelastptID editData h_nationality"
                                                                            data-id="{$lastpatient->id}"
                                                                            data-ptname="h_nationality" name="h_nationality"
                                                                            id="h_nationality">
                                                                        <option value=""></option>
                                                                        {foreach $hnationality as $data}
                                                                        <option value="{$data->id}" {if $lastpatient->h_nationality eq
                                                                            $data->id}selected{/if}>{$data->name}</option>
                                                                        {/foreach}
                                                                        {if $smarty.session.role_id neq 3}
                                                                        <option value="0" class="deleteoptincompo">حذف</option>
                                                                        {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}


                                                            {if $programesettingex->h_religion == 1}
                                                            <div class="col-md-2">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">الديانة </label>
                                                                    <select class="form-control  updatelastptID editData h_religion"
                                                                            data-id="{$lastpatient->id}"
                                                                            data-ptname="h_religion" name="h_religion"
                                                                            id="h_religion">
                                                                        <option value=""></option>
                                                                        {foreach $hreligion as $data}
                                                                        <option value="{$data->id}" {if $lastpatient->h_religion eq
                                                                            $data->id}selected{/if}>{$data->name}</option>
                                                                        {/foreach}
                                                                        {if $smarty.session.role_id neq 3}
                                                                        <option value="0" class="deleteoptincompo">حذف</option>
                                                                        {/if}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}


                                                            {if $programesettingex->h_doctor1 == 1}
                                                            <div class="col-md-3">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">الطبيب المعالج 1 </label>
                                                                    <select class="form-control  updatelastptID"
                                                                            data-id="{$lastpatient->id}"
                                                                            data-ptname="h_doctor1" name="h_doctor1" required 
                                                                            id="h_doctor1">
                                                                        <option value=""></option>
                                                                        <option value="-1" {if $lastpatient->h_doctor1 eq -1 }selected{/if}>لا يوجد</option>
                                                                        {foreach $py_all_doc as $data}
                                                                        <option value="{$data.user_id}" {if $lastpatient->h_doctor1 eq
                                                                            $data.user_id}selected{/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}


                                                            {if $programesettingex->h_doctor2 == 1}
                                                            <div class="col-md-3">
                                                                <div class="form-group form-md-floating-label has-info">
                                                                    <label for="form_control_1" class="txtc">الطبيب المعالج 2 </label>
                                                                    <select class="form-control  updatelastptID"
                                                                            data-id="{$lastpatient->id}"
                                                                            data-ptname="h_doctor2" name="h_doctor2"
                                                                            id="h_doctor2">
                                                                        <option value=""></option>
                                                                        <option value="-1" {if $lastpatient->h_doctor2 eq -1 }selected{/if}>لا يوجد</option>
                                                                        {foreach $py_all_doc as $data}
                                                                        <option value="{$data.user_id}" {if $lastpatient->h_doctor2 eq
                                                                            $data.user_id}selected{/if}>{$data.name}</option>
                                                                        {/foreach}
                                                                    </select>
                                                                </div>
                                                            </div>
                                                            {/if}
                                                        </div>

                                                        {/if}


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



                                            <div class="portlet box blue portletcustom">
                                                <div class="portlet-title">
                                                    <div class="caption fright">
                                                        <a class="fff bold" href="javascript:;"  id="addChild"
                                                           style="margin-right: 15px;" data-patientId="{$lastpatient->id}"> 
                                                            <i class="fa fa-plus"></i></a>

                                                        الأطفال    
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-body">
                                                <div class="clinick rtl"   id="childsContainer">
                                                    <input type="hidden" id="controllName" value="invoffers"/>
                                                    {foreach $childs as $child }
                                                    <div class="row">

                                                        <div class="col-md-6">
                                                            <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                <input type="text"  name="child_name{$child->id}" class="form-control updateElement" 
                                                                       data-colName="child_name" data-tableName="patients_childs"    
                                                                       data-id="{$child->id}"     value="{$child->child_name}" required  />
                                                                <label for="form_control_1" class="txtc">الإسم </label>
                                                            </div>
                                                        </div>

                                                        <div class="col-md-2">
                                                            <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                <input class="form-control  mask_date_new  childdateofbirth updateElement"
                                                                       data-id="{$child->id}" type="text"    data-colName="birth_date"  
                                                                       name="birth_date{$child->id}"
                                                                       data-tableName="patients_childs"      value="{$child->birth_date}" />
                                                                <label for="form_control_1" class="txtc"> </label>
                                                                <span class="input-group-addon go2r">تاريخ الميلاد </span>
                                                            </div>
                                                        </div>

                                                        <div class="col-md-2" style="margin-right: 25px;">
                                                            <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                <div class="md-radio-inline ltr">
                                                                    <div class="md-radio">
                                                                        <input type="radio" id="gender{$child->id}_0" name="gender{$child->id}" 
                                                                               class="md-radiobtn updateElement"  data-id="{$child->id}"     value="0"   
                                                                               data-colName="gender" data-tableName="patients_childs"   
                                                                               {if $child->gender == 0}checked  {/if}>
                                                                        <label for="gender{$child->id}_0">
                                                                            <span></span>
                                                                            <span class="check"></span>
                                                                            <span class="box"></span>
                                                                            أنثى      </label>
                                                                    </div>
                                                                    <div class="md-radio">
                                                                        <input type="radio" id="gender{$child->id}_1" name="gender{$child->id}" 
                                                                               class="md-radiobtn updateElement"  data-id="{$child->id}"     value="1"
                                                                               data-colName="gender" data-tableName="patients_childs" 
                                                                               {if $child->gender == 1}checked  {/if}   >
                                                                        <label for="gender{$child->id}_1">
                                                                            <span></span>
                                                                            <span class="check"></span>
                                                                            <span class="box"></span>
                                                                            ذكر </label>
                                                                    </div>
                                                                </div>
                                                                <span class="input-group-addon go2r">النوع </span>
                                                            </div>
                                                        </div>

                                                        <div class="col-md-1" style="margin-top: 25px;">
                                                            <a class="btn grey-cascade btn-xs deletemsgEX"  data-tableName="patients_childs" 
                                                               data-id="{$child->id}" style=" float: left;" href="#" 
                                                               data-link="instruction" data-fn="delinst">  <i class="fa fa-close"></i>
                                                            </a>
                                                        </div>

                                                    </div>
                                                    {/foreach} 
                                                </div>
                                            </div>

                                            {/if}

                                            {if $programesetting->entrydetails == 1 } 
                                            <div class="portlet box blue portletcustom">
                                                <div class="portlet-title">
                                                    <div class="caption fright">
                                                        بيانات الدخول - خاصة بتطبيق الموبايل
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row clinick rtl">
                                                <div class="col-md-4">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <label for="form_control_1">اسم المستخدم   "الموبايل"</label>
                                                        <input readonly type="text" class="form-control" placeholder="اسم المستخدم" 
                                                               name="uName" id="uName" minlength="3" autocomplete="false" 
                                                               value="{$lastpatient->phone}" />
                                                    </div>
                                                </div>
                                                <div class="col-md-4">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <label for="form_control_1">كلمة المرور </label>
                                                        <input type="password" class="form-control" placeholder="كلمة المرور " 
                                                               name="password" id="password" minlength="3" autocomplete="false">
                                                    </div>
                                                </div>
                                                <div class="col-md-4">
                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                        <label for="form_control_1">تأكيد كلمة المرور </label>
                                                        <input type="password" class="form-control" placeholder="تأكيد كلمة المرور " 
                                                               id="confirmpassword"  name="confirmpassword" minlength="3" 
                                                               equalTo="#password" autocomplete="false">
                                                    </div>
                                                </div>
                                            </div>
                                            {/if}

                                            {if $programesetting->birth_notify  == 1 } 

                                            <div class="portlet box blue portletcustom">
                                                <div class="portlet-title">
                                                    <div class="caption fright">
                                                        إخطار ولادة     
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="form-body">
                                                <div class="clinick rtl">
                                                    <div class="row">
                                                        <div class="col-md-11">
                                                            <table class="table table-hover portlet light bg-inverse">
                                                                <thead>
                                                                    <tr>
                                                                        <th class="wds10"> م</th>
                                                                        <th class="wds25">تاريخ الإخطار   </th>
                                                                        <th> المستخدم</th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody   id="notifyContainer">
                                                                    {assign var="i" value="1"}
                                                                    {foreach $birthNotifications as $data }
                                                                    <tr>
                                                                        <td>{$i}</td>
                                                                        <td>{$data->notify_date}</td>
                                                                        <td>{$data->userName}</td>
                                                                    </tr>
                                                                    {assign var="i" value={$i+1}}
                                                                    {/foreach} 
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </div>

                                                </div>
                                            </div>

                                            {/if}

                                            <div class="portlet box blue portletcustom">
                                                <div class="portlet-title">
                                                    <div class="caption fright">
                                                        بيانات عامة   
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                {if $programesettingex->knownfrom == 1}
                                                {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                                                <div class="col-md-4" style="text-align: right; float: right;">
                                                    <label>وسيلة المعرفة بالمركز  </label>
                                                    <div class="form-group  form-md-floating-label has-info">

                                                        <select class="form-control updatelastptID  editData knownfrom"
                                                                data-id="{$lastpatient->id}"
                                                                data-ptname="knownfrom" name="knownfrom"
                                                                id="knownfrom">
                                                            <option value=""></option>
                                                            {foreach $knownfrom as $data}
                                                            <option value="{$data->id}" {if $lastpatient->knownfrom eq
                                                                $data->id}selected{/if}>{$data->name}</option>
                                                            {/foreach}
                                                            {if $smarty.session.role_id neq 3}
                                                            <option value="0" class="deleteoptincompo">حذف</option>
                                                            {/if}
                                                        </select>
                                                    </div>
                                                </div>
                                                {/if}
                                                {/if}


                                                {if $programesettingex->file_card == 1}
                                                <div class="md-checkbox-inline col-md-3 fright">
                                                    <div class="md-checkbox">
                                                        <input type="checkbox" id="file_card" class="md-check updateElementCheck " name="file_card" 
                                                               value="1"  data-id="{$lastpatient->id}"  data-colName="file_card"   data-tableName="patients"  
                                                               {if $lastpatient->file_card == 1}   checked="" {/if} >
                                                        <label for="file_card">
                                                            <span></span>
                                                            <span class="check"></span>
                                                            <span class="box"></span>
                                                            كارت الفايل  </label>
                                                    </div>
                                                </div>
                                                {/if}

                                                {if $programesettingex->case_card == 1}
                                                <div class="md-checkbox-inline col-md-3 fright">
                                                    <div class="md-checkbox">
                                                        <input type="checkbox" id="case_card" class="md-check updateElementCheck " name="case_card" 
                                                               value="1"  data-id="{$lastpatient->id}"  data-colName="case_card"   data-tableName="patients"  
                                                               {if $lastpatient->case_card == 1}   checked="" {/if} >
                                                        <label for="case_card">
                                                            <span></span>
                                                            <span class="check"></span>
                                                            <span class="box"></span>
                                                            كارت الحالة  </label>
                                                    </div>
                                                </div>
                                                {/if}

                                                <div class="col-md-12" id="patientFilesDiv">
                                                    {assign var="i" value="1"}
                                                    {foreach $allImgs as $data}
                                                    <div class="col-md-3">
                                                        <div class="row clinick ltr" >

                                                            <div class="col-md-12">
                                                                <div class="fileinput fileinput-new" data-provides="fileinput">
                                                                    <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 250px; height: 170px;"> 
                                                                        <img class="showPatFile" {if $data} src="{$hosturl}/../upload/patientfiles/{$patientId}/{$data}"{/if}/>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="row clinick ltr" >
                                                            <div class="col-md-6">

                                                                <button type="button" class="btn btn-xs red fright delPImg" data-pId="{$patientId}" data-name="{$data}">
                                                                    <i class="fa fa-close"></i>
                                                                </button>

                                                                <a class="btn btn-xs blue fright" download="{$statusno} -  {$data}" 
                                                                   href="{$hosturl}/../upload/patientfiles/{$patientId}/{$data}">
                                                                    <i class="fa fa-download"></i>
                                                                </a>

                                                            </div>
                                                        </div>

                                                    </div>
                                                    {assign var="i" value=$i+1}
                                                    {/foreach}

                                                    {assign var="i" value="1"}
                                                    {foreach $allPdf as $data}
                                                    <div class="col-md-3">
                                                        <div class="row clinick ltr" >

                                                            <div class="col-md-12">
                                                                <div class="fileinput fileinput-new" data-provides="fileinput">
                                                                    <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 250px; height: 170px;"> 
                                                                        <img src="{$hosturl}/views/obgy/_assets/custom/images/pdficon.png" width="50" height="50"/>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="row clinick ltr" >
                                                            <div class="col-md-6">

                                                                <button type="button" class="btn btn-xs red fright delPImg" data-pId="{$patientId}" data-name="{$data}">
                                                                    <i class="fa fa-close"></i>
                                                                </button>

                                                                <a class="btn btn-xs blue fright" download="{$statusno} -  {$data}" 
                                                                   href="{$hosturl}/../upload/patientfiles/{$patientId}/{$data}">
                                                                    <i class="fa fa-download"></i>
                                                                </a>

                                                            </div>
                                                        </div>

                                                    </div>
                                                    {assign var="i" value=$i+1}
                                                    {/foreach}

                                                    {assign var="i" value="1"}
                                                    {foreach $allDoc as $data}
                                                    <div class="col-md-3">
                                                        <div class="row clinick ltr" >

                                                            <div class="col-md-12">
                                                                <div class="fileinput fileinput-new" data-provides="fileinput">
                                                                    <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 250px; height: 170px;"> 
                                                                        <img src="{$hosturl}/views/obgy/_assets/custom/images/wordicon.png" width="50" height="50"/>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="row clinick ltr" >
                                                            <div class="col-md-6">

                                                                <button type="button" class="btn btn-xs red fright delPImg" data-pId="{$patientId}" data-name="{$data}">
                                                                    <i class="fa fa-close"></i>
                                                                </button>

                                                                <a class="btn btn-xs blue fright" download="{$statusno} -  {$data}" 
                                                                   href="{$hosturl}/../upload/patientfiles/{$patientId}/{$data}">
                                                                    <i class="fa fa-download"></i>
                                                                </a>

                                                            </div>
                                                        </div>

                                                    </div>
                                                    {assign var="i" value=$i+1}
                                                    {/foreach}


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

                                        <div class="form-actions">
                                            <div class="col-md-1" style="text-align: right;margin: 0 5px;">
                                                <input type="submit" class="btn green btn-block btn-lg"
                                                       id="patient_submit" name="submit" value="إضافة">
                                            </div>
                                            <div class="col-md-2" style="text-align: right;margin: 0 5px;">
                                                <input type="submit" class="btn green btn-block btn-lg"
                                                       id="patient_submit_v" name="submit_v" value="   حفظ مع إضافة  زيارة">
                                            </div>
                                            {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                                            <div class="col-md-1">
                                                <input type="button" class="btn blue btn-block btn-lg"
                                                       id="patient_submit_print" value=" طباعه">
                                            </div>
                                            {/if}
                                            <div class="col-md-3" style="text-align: right;margin: 0 5px;">
                                                <label for="patientFiles" class="btn default btn-block btn-lg">إضافة ملف</label>
                                                <input type="file" name="patientFiles[]" multiple id="patientFiles"  
                                                       class=" form-control" style="visibility:hidden;"  >
                                            </div>


                                        </div>

                                        {if $programesetting->voice_record  == 1  }
                                        <input type="hidden" id="hasRecord" value="1" />
                                        <div class="form-actions col-md-12">

                                            <div class="col-md-1">
                                                <input type="file" name="voiceFiles[]" multiple id="voiceFiles"  
                                                       class=" form-control" style="visibility:hidden;"  >
                                                <label for="voiceFiles" class="btn default btn-block btn-lg">Upload</label>       
                                            </div>

                                            <div class="col-md-4">
                                                <div id="controls">
                                                    <button class="recordButtom" id="recordButton">Record</button>
                                                    <button class="recordButtom" id="pauseButton" disabled>Pause</button>
                                                    <button class="recordButtom" id="stopButton" disabled>Stop</button>
                                                </div>

                                                <!--div id="formats">Format: start recording to see sample rate</div-->
                                            </div>

                                            <div class="col-md-6">
                                                <p><strong>Voice Record:</strong></p>
                                                <ol id="recordingsList">
                                                    {if $voiceRecord == 1 } 
                                                    <li>
                                                        <audio controls  src="{$hosturl}/../upload/patientrecords/{$lastpatient->id}.{$voiceExt}"> </audio>
                                                    </li>
                                                    {/if}
                                                </ol>
                                            </div>
                                        </div>
                                        {/if}

                                        <input type="hidden" name="ptntid" id="ptntid"
                                               value="{$lastpatient->id}"/>

                                        <input type="hidden" name="dirName" id="dirName"
                                               value="patientrecords"/>



                                        </form>


                                    </div>
                                </div>
                                <!-- END SAMPLE FORM PORTLET-->
                            </div>
                    </div>
                    <div style="clear: both;">
                    </div>
                    <!-- END PAGE CONTENT-->
                </div>
            </div>

            <div id="talks-loading" style="z-index: 3000;position: absolute;top: 10%;right: 2%;left: 6%;display:none; height: 65%; background-color: rgba(0, 0, 0,0.27); padding-top: 10%;" align="center">
                <img src="{$hosturl}/../upload/loading.gif">
            </div>
            <!-- END CONTENT -->
            <div class="modal fade" id="datareceivedwifejob" tabindex="-1" role="basic" aria-hidden="true">
            </div>
            <div class="modal fade" id="allEducation" tabindex="-1" role="basic" aria-hidden="true">
            </div>

            <div class="modal fade" id="allgovernorate" tabindex="-1" role="basic" aria-hidden="true">
            </div>

            <div class="modal fade" id="wifestatusmodel" tabindex="-1" role="basic" aria-hidden="true">
            </div>

            <div class="modal fade" id="husstatusmodel" tabindex="-1" role="basic" aria-hidden="true">
            </div>
            <div class="modal fade" id="wifetypedel" tabindex="-1" role="basic" aria-hidden="true">
            </div>
            <div class="modal fade" id="husbandtypedel" tabindex="-1" role="basic" aria-hidden="true">
            </div>

            <div class="modal fade" id="editModal" tabindex="-1" role="basic" aria-hidden="true">
            </div>

            <div id="sourcejob" style="display: none;">
                <option value="">لايوجد</option>
                {foreach $allWifeJobs as $row}
                <option value="{$row->id}">{$row->title}</option>
                {/foreach}
                {if $smarty.session.role_id neq 3}
                <option value="0"> حذف</option>
                {/if}
            </div>

            <!-----------------------------------------------Detection Models----------------------------------------------->

            <!--                <div class="modal fade" id="detectionforview" tabindex="-1" role="basic" aria-hidden="true">
            
                            </div>-->

            <div class="bootbox modal fade bootbox-alert in" tabindex="-1" role="dialog" aria-hidden="false"
                 id="edit_detectionforview">
                <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>
                                            <div id="detectionforview" class=""></div>
                                        </div>

                                        <!------===========================================------->
                                        <!--                            <div class="form-group">
                                                                        <label class="col-md-3 control-label"> Name</label>
                                                                        <div class="col-md-8">
                                                                            <input type="hidden" class="form-control"  id="newitem_id" name="newamount_id" >
                                                                            <input type="text" class="form-control"  id="newitem_name" name="newamount_name" style="text-align:left;" >
                                                                            <div id="divsucess1" style="color:red; display:none;"></div>
                                                                        </div>
                                                                    </div>-->
                                        <!------===========================================------->
                                        <div class="modal-footer">
                                            <!--                                <button type="button" class="btn green" id="editmodel_submit"> Update </button>-->
                                            <button type="button" id="amountcloseinput" class="btn default" data-dismiss="modal">
                                                Close
                                            </button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <!-- /.modal-content -->
                    </div>
                </div>
            </div>

            {if $programesetting->visitsform  != 1}
            <div class="modal fade" id="detectionadd" tabindex="-1" role="basic" aria-hidden="true">
                <meta charset="utf8"/>
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button style="float: left;" type="button" class="close" data-dismiss="modal"
                                    aria-hidden="true"></button>
                            <h4 class="modal-title txtr bold"> إضافة كشف </h4>
                            <span id="sucssmsg" style="display: none;">لقد تم إضافة كشف جديد</span>
                        </div>
                        <div class="modal-body modtbl" style="margin: 15px;">
                            <from id="form_add_detection" action="" method="post">
                                <table class="table table-bordered table-striped table-hover">
                                    <thead>
                                    <th>نوع الكشف</th>
                                    <th class="wds20">قيمة الكشف</th>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <div class="input-group wds100">
                                                    <input type="text" class="form-control" name="detectiontp" id="detectiontp">
                                                </div>
                                            </td>
                                            <td>
                                                <div class="input-group">
                                                    <input type="text" class="form-control positivefloat" name="detectionvl"
                                                           id="detectionvl">
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </from>

                            <div class="modal-footer">
                                <button type="button" class="btn default" data-dismiss="modal">إغلاق</button>
                                <button type="button" class="btn blue" id="detectionadd_submit">حفظ</button>

                            </div>
                        </div>
                        <!-- /.modal-content -->
                    </div>
                    <!-- /.modal-dialog -->
                </div>
            </div>

            {else}
            <div class="modal fade" id="detectionadd" tabindex="-1" role="basic" aria-hidden="true">
                <meta charset="utf8"/>
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button style="float: left;" type="button" class="close" data-dismiss="modal"
                                    aria-hidden="true"></button>
                            <h4 class="modal-title txtr bold"> إضافة قسم </h4>
                            <span id="sucssmsg" style="display: none;">لقد تم إضافة قسم جديد</span>
                        </div>
                        <div class="modal-body modtbl" style="margin: 15px;">
                            <from id="form_add_detection" action="" method="post">
                                <table class="table table-bordered table-striped table-hover">
                                    <thead>
                                    <th>اسم القسم</th>
                                    <th style="display: none;">قيمة الكشف</th>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <div class="input-group wds100">
                                                    <input type="text" class="form-control" name="detectiontp" id="detectiontp">
                                                </div>
                                            </td>
                                            <td style="display: none;">
                                                <div class="input-group">
                                                    <input type="text" class="form-control positivefloat" name="detectionvl" value="0"
                                                           id="detectionvl">
                                                </div>
                                            </td>

                                        </tr>
                                    </tbody>
                                </table>
                            </from>

                            <div class="modal-footer">
                                <button type="button" class="btn default" data-dismiss="modal">إغلاق</button>
                                <button type="button" class="btn blue" id="detectionadd_submit">حفظ</button>

                            </div>
                        </div>
                        <!-- /.modal-content -->
                    </div>
                    <!-- /.modal-dialog -->
                </div>
            </div>
            {/if}

            <div    id="patient_profile_print" style="display :none;">

                <div class="row text-right" style="direction: rtl;">
                    <div class="col-md-12">
                        <h1 class="h1" style="text-align: center;">إذن قبول دخول المركز  </h1>              
                    </div>

                    <div class="col-md-12">

                        <table style="width: 98%;margin: 5px auto;" cellpadding="2" class="noborder">
                            {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                            <tr>
                                <td>
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span style="float: right;margin-right: 5px;margin-left: 20%">
                                            {if $programesetting->system_lang  == 1 }
                                            <span class="bold">  RFC ( للزوجة  ) : </span>
                                            {else}
                                            <span class="bold">  RFC ( للمريض   ) : </span>
                                            {/if}
                                            <span id="prt_rfc_w" ></span>
                                        </span>
                                    </h4>
                                </td>
                                <td>
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">  RFC ( للزوج )  : </span>
                                            <span id="prt_rfc_h" ></span>
                                        </span>
                                    </h4>
                                </td>
                            </tr>
                            {/if}
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">    التاريخ  :    </span>
                                            <span id="prt_date">{$smarty.now|date_format:"%Y-%m-%d"}</span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;">
                                            <span class="bold">  وسيلة المعرفة بالمركز :      </span>
                                            <span id="prt_knownfrom"></span></span>
                                    </h4>
                                    {/if}
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold"> اسم الحالة        </span>
                                            <span id="prt_w_name"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;">
                                            <span class="bold">  اسم الزوج :      </span>
                                            <span id="prt_h_name"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">  السن:      </span>
                                            <span id="prt_wage"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;">
                                            <span class="bold">   السن :     </span>
                                            <span id="prt_hage"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">  رقم قومى :      </span>
                                            <span id="prt_wnational"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;">
                                            <span class="bold">  رقم قومى  :      </span>
                                            <span id="prt_hnational"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;margin-left: 20%"> 
                                            <span class="bold">  الوظيفة :     </span>
                                            <span id="prt_wjob"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;">
                                            <span class="bold">  الوظيفة  :      </span>
                                            <span id="prt_hjob"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold"> الجنسية / الديانة  :      </span>
                                            <span id="prt_wreligion"></span></span>
                                    </h4>
                                </td>

                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;">
                                            <span class="bold">  الجنسية / الديانة   :     </span>
                                            <span id="prt_hreligion"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            {/if}
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">    الموبايل 1 :    </span>
                                            <span id="prt_phone"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;">
                                            <span class="bold">   الموبايل 2  :     </span>
                                            <span id="prt_mobile"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;">
                                            <span class="bold">   العنوان  :     </span>
                                            <span id="prt_address"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">

                                </td>
                            </tr>
                            {if $programesetting->system_type  == 1  ||  $programesetting->system_type  == 4}
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">   الطبيب المحول  :     </span>
                                            <span id="prt_wrefer"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;">
                                            <span class="bold">   الطبيب المحول   :     </span>
                                            <span id="prt_hrefer"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">   الطبيب المعالج (1)  :     </span>
                                            <span id="prt_wdoc1"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;">
                                            <span class="bold">   الطبيب المعالج (1)   :     </span>
                                            <span id="prt_hdoc1"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">   الطبيب المعالج (2)  :     </span>
                                            <span id="prt_wdoc2"></span></span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;">
                                            <span class="bold">  الطبيب المعالج (2)   :      </span>
                                            <span id="prt_hdoc2"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            {/if}
                            <tr>
                                <td>
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">   الخدمة المطلوبة :     </span>
                                            <span id="prt_service"></span></span>
                                    </h4>
                                </td>

                                <td>
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span  style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">    اسم المستخدم  :     </span>
                                            <span>{$userName}</span></span>
                                    </h4>
                                </td>

                            </tr>

                            <tr class="emptyLine">
                                <td  colspan="2"> </td>
                            </tr>

                            <!--tr>
                                <td colspan="2">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span class="bold"  style="float: right;margin-right: 5px;margin-left: 20%">    إننى أقبل سداد تكاليف الاقامة والعلاج وجميع المصروفات الخاصة بى خلال فترة اقامتى بالمركز <span id="prt_patient_name"></span></span>
                                    </h4>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span   style="float: right;margin-right: 5px;margin-left: 20%">
                                            <span class="bold">    توقيع المريض أو ولى الامر :    </span>
                                        </span>
                                        <span style="float: right;margin-right: 5px;">.................................................</span>
                                    </h4>
                                </td>
                            </tr-->

                            <tr>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span class="bold"  style="margin-right: 20%">الطبيب المقيم       </span>
                                    </h4>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >
                                        <span class="bold"  style="float: left;    margin-left: 45%;">مدير عام المركز</span>
                                    </h4>
                                </td>
                            </tr>

                            <tr>
                                <td style="width: 50%;">
                                    </br>
                                    </br>
                                </td>
                                <td style="width: 50%;">
                                    <h4 style="direction: rtl" class="arbfnt" >

                                    </h4>
                                </td>
                            </tr>

                            <tr>
                                <td style="width: 50%;">
                                    {if $programesetting->barcode_print  == 1 }
                                    <img id="xx"  src="{$hosturl}/../upload/barcodes/{$lastpatient->statusno}.png">
                                    {/if}
                                </td>
                                <td style="width: 50%;text-align: center;">
                                    <h4 style="direction: rtl">
                                        <span id="prt_patient_no" style="font-weight: bolder; font-size: 75px;" ></span>
                                    </h4>
                                </td>
                            </tr>


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

            </div>

            {literal}
            <style>

                .noborder tr {
                    height: 10mm;
                }
                .emptyLine{
                    height: 30mm !important;
                }
                .bold {
                    font-weight: bold;
                }
                .h1 {
                    font-weight: 900;
                    font-size: 28px;
                }

                .form-group.form-md-line-input .help-block {
                    position: absolute;
                    margin: 2px 0 0 0;
                    opacity: 1;
                    filter: alpha(opacity=0);
                    font-size: 13px;
                }

                @media print {
                    #patient_profile_print {
                        transform: scale(.9);
                    }

                    .noborder tr {
                        height: 10mm;
                    }
                    .emptyLine{
                        height: 30mm !important;
                    }

                    .bold {
                        font-weight: bold;
                    }
                    .h1 {
                        font-weight: 900;
                        font-size: 28px;
                    }
                }
            </style>
            {/literal}

            <style>

                @page {
                    ldelim
                }
                size: auto;
                margin-top: {
                    $programesetting->above2
                }
                cm !important;
                margin-bottom: {
                    $programesetting->buttom2
                }
                cm !important;
                {
                    rdelim
                }

                .arbfnt {
                    ldelim
                }
                font-size: {
                    $programesetting->fontsizear2
                }
                px !important;
                {
                    rdelim
                }

                .enfnt {
                    ldelim
                }
                font-size: {
                    $programesetting->fontsizeen2
                }
                px !important;
                {
                    rdelim
                }

                #content, #page {
                    width: 100%;
                    margin: 0;
                    float: none;
                }


                /* Unnötige Elemente ausblenden für den Druck */

                #header-widgets, nav, aside.mashsb-container,
                .sidebar, .mashshare-top, .mashshare-bottom,
                .content-ads, .make-comment, .author-bio,
                .heading, .related-posts, #decomments-form-add-comment,
                #breadcrumbs, #footer, .post-byline, .meta-single,
                .site-title img, .post-tags, .readability
                {
                    display: none;
                }



            </style>





            <div class="modal fade" tabindex="-1" role="dialog" aria-hidden="false" data-backdrop="static" data-keyboard="false"   id="showPatFileM" style="min-width:1000px;">
                <div class="modal-dialog  modal-lg wds65">
                    <div class="modal-content" style="">
                        <div class="modal-body" style="background: rgba(0,0,0,.5);">
                            <div class="portlet-body">
                                <button type="button" class="close"
                                        style="margin-right: 5px; margin-top: 10px; width: 20px; height: 20px;"
                                        data-dismiss="modal" aria-hidden="true"></button>
                                <div class="row">
                                    <div class="col-md-12" style="text-align: center;" >
                                        <div class="fileinput fileinput-new" data-provides="fileinput">
                                            <div class="fileinput-preview thumbnail" data-trigger="fileinput"> 
                                                <img id="source_image" />
                                            </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 id="printPatDiv"></div>

