<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->programview == 1 }  الزوجة  {else} المريض  {/if}
                        </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" id="awval" 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">
                                        <input type="hidden" name="treeId" id="treeId" value="{$treeId}"/>
                                        <div class="col-md-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>
                                        <div class="col-md-3" id="wifeuptype">
                                            <div class="form-group  form-md-floating-label has-info">
                                                <label for="form_control_1" class="txtc">صفة {if $programesetting->programview == 1 }  المريضة  {else} المريض  {/if}</label>
                                                <select  class="form-control select2me 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}
                                                    <option value="0" class="deleteoptincompo">حذف</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="col-md-5">
                                            <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 updatelastptIDtwice" data-ptname="wifename" data-id="{$lastpatient->id}" value="{$lastpatient->wifename}"  required="required" />
                                                <span  id="lb_ckwifename" class="help-block clrred" style="display: none;">هذا الاسم موجود من قبل</span>
                                                <label for="form_control_1" class="txtc">اسم {if $programesetting->programview == 1 }  المريضة  {else} المريض  {/if}</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">اسم {if $programesetting->programview == 1 }  المريضة  {else} المريض  {/if}</label>
                                                                                            <span  id="lb_ckwifename" class="help-block clrred" style="display: none;">هذا الاسم موجود من قبل</span>
                                                                                        </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 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>
                                        <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>
                                    </div>
                                    <div class="row">
                                        <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 select2me 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}
                                                    <option value="0" class="deleteoptincompo">حذف</option>
                                                </select>

                                            </div>
                                        </div>
                                        <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 select2me 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}
                                                <option value="0" class="deleteoptincompo" > حذف </option>
                                                </select>
                                            </div>
                                        </div>
                                        <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 select2me 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}
                                                    <option value="0" class="deleteoptincompo">حذف </option>
                                                </select>
                                            </div>
                                        </div>
                                        {if $programesetting->programview == 0 }
                                        <div class="col-md-2">
                                            <div class="form-group form-md-floating-label has-info">
                                                <label class="txtc">النوع</label>
                                                <select class="form-control select2me updatelastptID" data-id="{$lastpatient->id}" data-ptname="gender" name="gender" id="gender" style="width: 150px !important" >
                                                    <option value=""></option>
                                                    <option value="0" {if $lastpatient->gender eq 0}selected{/if}>ذكر</option>
                                                    <option value="1" {if $lastpatient->gender eq 1}selected{/if}>انثي</option>
                                                </select>
                                            </div>
                                        </div>
                                        {/if}

                                        {if $programesetting->programview == 1 } 
                                        {if $lastpatient->statuesid == 1}
                                        <div class="displaynot"  style="display: none;"  >
                                            {elseif $lastpatient->statuesid == 3}
                                            <div class="displaynot">
                                                {else}
                                                <div class="displaynot">
                                                    {/if}
                                                    <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>

                                                    <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>

                                                    <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>
                                            {else}
                                        </div>
                                        {/if}


                                        <div class="row">
                                            <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>
                                            <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"  class="form-control updatelastptID digitsOnly uniquePhone "  maxlength="11" 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">الموبايل</label>
                                                </div>
                                            </div>
                                            <div class="col-md-2">
                                                <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" 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>
                                            <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 select2me 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}
                                                    <option value="0" class="deleteoptincompo">حذف</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>

                                        <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="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>

                                            <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>

                                        </div>

                                        <div class="row">
                                            <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>
                                            <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 select2me 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>
                                        </div>

                                        {if $programesetting->patient_doctor == 1 } 
                                        <div class="row">
                                            <div class="col-md-6">
                                                <div class="form-group form-md-floating-label has-info">
                                                    <label for="form_control_1" class="txtc">   الطبيب المعالج </label>
                                                    <select  class="form-control select2me updatelastptID" name="doctorid" data-id="{$lastpatient->id}" data-ptname="doctorid" id="doctorid" >
                                                        <option value=""></option>
                                                        {foreach $doctors as $row}
                                                        <option value="{$row.user_id}" {if $lastpatient->doctorid eq $row.user_id}selected{/if}>{$row.name}</option>
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        {/if}

                                        {if $programesetting->previous_marriage == 1 } 
                                        <input type="hidden" id="controllName" value="instruction"/>
                                        <div class="portlet box blue portletcustom wds75">
                                            <div class="portlet-title">
                                                <div class="caption fright">
                                                    <a class="fff bold" href="javascript:;"  id="addPrevMarr" data-for="1"
                                                       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="prevMarrContainer1">

                                                {foreach $previous_marriages as $previous_marriage }
                                                <div class="row">

                                                    <div class="col-md-2">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input type="text"  name="period{$previous_marriage->id}" 
                                                                   class="form-control updateElement" 
                                                                   data-colName="period" data-tableName="previous_marriage"    
                                                                   data-id="{$previous_marriage->id}"     value="{$previous_marriage->period}" 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 type="text"  name="males{$previous_marriage->id}" 
                                                                   class="form-control updateElement" 
                                                                   data-colName="males" data-tableName="previous_marriage"    
                                                                   data-id="{$previous_marriage->id}"     value="{$previous_marriage->males}" 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 type="text"  name="females{$previous_marriage->id}" 
                                                                   class="form-control updateElement" 
                                                                   data-colName="females" data-tableName="previous_marriage"    
                                                                   data-id="{$previous_marriage->id}"     value="{$previous_marriage->females}" 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 type="text"  name="last_age{$previous_marriage->id}" 
                                                                   class="form-control updateElement" 
                                                                   data-colName="last_age" data-tableName="previous_marriage"    
                                                                   data-id="{$previous_marriage->id}"     value="{$previous_marriage->last_age}" required  />
                                                            <label for="form_control_1" class="txtc">سن الأصغر  </label>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-1" style="margin-top: 25px;">
                                                        <a class="btn grey-cascade btn-xs deletemsgEX"  data-tableName="previous_marriage" 
                                                           data-id="{$previous_marriage->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->programview == 1 } 
                                        {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">
                                                                بيانات الزوج
                                                            </div>
                                                        </div>
                                                    </div>


                                                    <div class="row">
                                                        <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 select2me 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}
                                                                <option value="0" class="deleteoptincompo">حذف</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-5">
                                                            <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                <input type="text" name="husdandname" class="form-control updatelastptID" data-id="{$lastpatient->id}" data-ptname="husdandname" value="{$lastpatient->husdandname}" />
                                                                <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="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>
                                                        <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>
                                                    </div>
                                                    <div class="row">
                                                        <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 select2me 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}
                                                                <option value="0" class="deleteoptincompo">حذف</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <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 select2me 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}
                                                                <option value="0" class="deleteoptincompo">حذف</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <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>
                                                        <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 select2me 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}
                                                                <option value="0" class="deleteoptincompo">حذف</option>
                                                                </select>
                                                            </div>
                                                        </div>

                                                        <div class="col-md-6">
                                                            <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                <textarea class="form-control save_husband_patient_notes" rows="2" name="husband_notes">{$lastpatient->husband_notes}</textarea>
                                                                <label for="form_control_1" class="txtc"> ملاحظات</label>
                                                            </div>
                                                        </div>

                                                        <div class="col-md-6">
                                                            <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                <textarea class="form-control save_husband_patient_habits" rows="2" name="husband_habbits">{$lastpatient->husband_habbits}</textarea>
                                                                <label for="form_control_1" class="txtc"> عادات</label>
                                                            </div>
                                                        </div>

                                                    </div>

                                                    {if $programesetting->previous_marriage == 1 } 
                                                    <div class="portlet box blue portletcustom wds75">
                                                        <div class="portlet-title">
                                                            <div class="caption fright">
                                                                <a class="fff bold" href="javascript:;"  id="addPrevMarr" data-for="2"
                                                                   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="prevMarrContainer2">

                                                            {foreach $hus_previous_marriages as $hus_previous_marriage }
                                                            <div class="row">

                                                                <div class="col-md-2">
                                                                    <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                                        <input type="text"  name="period{$hus_previous_marriage->id}" 
                                                                               class="form-control updateElement" 
                                                                               data-colName="period" data-tableName="hus_previous_marriage"    
                                                                               data-id="{$hus_previous_marriage->id}"     value="{$hus_previous_marriage->period}" 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 type="text"  name="males{$hus_previous_marriage->id}" 
                                                                               class="form-control updateElement" 
                                                                               data-colName="males" data-tableName="hus_previous_marriage"    
                                                                               data-id="{$hus_previous_marriage->id}"     value="{$hus_previous_marriage->males}" 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 type="text"  name="females{$hus_previous_marriage->id}" 
                                                                               class="form-control updateElement" 
                                                                               data-colName="females" data-tableName="hus_previous_marriage"    
                                                                               data-id="{$hus_previous_marriage->id}"     value="{$hus_previous_marriage->females}" 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 type="text"  name="last_age{$hus_previous_marriage->id}" 
                                                                               class="form-control updateElement" 
                                                                               data-colName="last_age" data-tableName="hus_previous_marriage"    
                                                                               data-id="{$hus_previous_marriage->id}"     value="{$hus_previous_marriage->last_age}" required  />
                                                                        <label for="form_control_1" class="txtc">سن الأصغر   </label>
                                                                    </div>
                                                                </div>

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

                                                            </div>
                                                            {/foreach} 
                                                        </div>
                                                    </div>
                                                    {/if}
                                                </div>
                                                <div class="clearfix"></div>
                                            </div>
                                            {/if}
                                            <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->

                                            <!-- The table listing the files available for upload/download -->


                                            <div class="scroller" style="height: 300px;">
                                                <ul class="files ng-cloak anjuploadfiles" data-ng-repeat="file in queue" data-ng-class="{literal}{'processing': file.$processing()}{/literal} ">
                                                    <li data-ng-switch data-on="!!file.thumbnailUrl" style="display: none;">
                                                        <div class="preview fileptipload" data-ng-switch-when="true">
                                                            <a data-ng-href="{literal}{{file.url}}{/literal}" title="{literal}{{file.name}}{/literal}" download="{literal}{{file.name}}{/literal}" data-gallery><img data-ng-src="{literal}{{file.thumbnailUrl}}{/literal}" alt=""></a>
                                                        </div>
                                                        <div class="preview fileptipload" data-ng-switch-default data-file-upload-preview="file"></div>
                                                        <!--                                    </li>
                                                                                            <li>-->
                                                        <p class="name" data-ng-switch data-on="!!file.url">
                                                            <span data-ng-switch-when="true" data-ng-switch data-on="!!file.thumbnailUrl">
                                                                <a data-ng-switch-when="true" data-ng-href="{literal}{{file.url}}{/literal}" title="{literal}{{file.name}}{/literal}" download="{literal}{{file.name}}{/literal}" data-gallery>{literal}{{file.name}}{/literal}</a>
                                                                <a data-ng-switch-default data-ng-href="{literal}{{file.url}}{/literal}" title="{literal}{{file.name}}{/literal}" download="{literal}{{file.name}}{/literal}">{literal}{{file.name}}{/literal}</a>
                                                            </span>
                                                            <span data-ng-switch-default>{literal}{{file.name}}{/literal}</span>
                                                        </p>
                                                        <strong data-ng-show="file.error" class="error text-danger">{literal}{{file.error}}{/literal}</strong>
                                                        <!--                                    </li>
                                                                                            <li>-->
                                                        <p class="size">{literal}{{file.size| formatFileSize}}{/literal}</p>
                                                        <div class="progress progress-striped active fade" data-ng-class="{literal}{pending: 'in'}{/literal}[file.$state()]" data-file-upload-progress="file.$progress()">
                                                            <div class="progress-bar progress-bar-success" data-ng-style="{literal}{width: num + '%'}{/literal}"></div>
                                                        </div>
                                                        <!--                                    </li>

                                                                                            <li>-->
                                                        <button style="float: left;" type="button" class="btn btn-primary start" data-ng-click="file.$submit()" data-ng-hide="!file.$submit || options.autoUpload" data-ng-disabled="file.$state() == 'pending' || file.$state() == 'rejected'">
                                                            <i class="glyphicon glyphicon-upload"></i>
                                                            <span>ابدأ الرفع</span>
                                                        </button>
                                                        <button type="button" class="btn btn-warning cancel" data-ng-click="file.$cancel()" data-ng-hide="!file.$cancel">
                                                            <i class="glyphicon glyphicon-ban-circle"></i>
                                                            <span>إلغاء</span>
                                                        </button>
                                                        <button data-ng-controller="FileDestroyController" type="button" class="btn btn-danger destroy" data-ng-click="file.$destroy()" data-ng-hide="!file.$destroy">
                                                            <i class="glyphicon glyphicon-trash"></i>
                                                            <span>حذف</span>
                                                        </button>
                                                    </li>
                                                </ul>
                                            </div>

                                            <div class="portlet box blue portletcustom">
                                                <div class="portlet-title">
                                                    <div class="caption fright">
                                                        أضافة زيارة
                                                        <input type="checkbox" id="addV" name="addV"  class="md-check" value="1" checked="">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="clinick rtl">
                                                <div class="row" id="vDiv">

                                                    <div class="col-md-2 wds10">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <!--<input class="form-control datepicker22 edited" name="visitdate"   type="text" value="{$smarty.now|date_format:'%Y-%m-%d'}"  id="visitdate" required disabled>-->
                                                            <input class="form-control datepicker edited"  type="text"  id="visitdate" name="visitdate"  value="{$today}">
                                                            <label for="form_control_1"  class="txtc">تاريخ الزيارة </label>
                                                        </div>
                                                    </div>
                                                    {if $programesetting->visitsform  != 1}
                                                    <div class="col-md-2">
                                                        <label for="form_control_1">نوع الكشف</label>
                                                        <div class="form-group  form-md-floating-label has-info">
                                                            <select  class="form-control" name="detectionid" id="detectionid" required select-tableName="visits" data-tableName="visits" data-maintable = "detections" data-colName="detectionid" data-id="0">
                                                                <option value=""></option>
                                                                {assign var=i value=1}
                                                                {foreach $allDetections as $row}
                                                                {if $i == 1}{assign var=k value={$row->detectionval}}{/if}
                                                                <option value="{$row->id}" {if $i == 1}selected{/if}>{$row->title}</option>
                                                                {capture assign=i}{$i+1}{/capture}
                                                                {/foreach}
                                                                <option value="-1">إضافة كشف</option>
                                                                <option value="0" class="deleteoptincompo">حذف</option>
                                                            </select>
                                                        </div>
                                                    </div>

                                                    {else}
                                                    <div class="col-md-3">
                                                        <label for="form_control_1">القسم</label>
                                                        <div class="form-group  form-md-floating-label has-info">
                                                            <select  class="form-control " name="detectionid" id="detectionid" required select-tableName="visits" data-tableName="visits" data-maintable = "detections" data-colName="detectionid" data-id="0">
                                                                <option value=""></option>
                                                                {assign var=i value=1}
                                                                {foreach $allDetections as $row}
                                                                <option value="{$row->id}" {if $i == 1}selected{/if}>{$row->title}</option>
                                                                {capture assign=i}{$i+1}{/capture}
                                                                {/foreach}
                                                                <option value="-1">إضافة قسم</option>
                                                                <option value="0" class="deleteoptincompo">حذف</option>
                                                            </select>
                                                        </div>
                                                    </div>
                                                    {/if}

                                                    {if $programesetting->visit_period  == 1} 
                                                    <input type="hidden"    id="visitPeriod"  value="1">
                                                    <div class="col-md-2">
                                                        <label for="form_control_1">فترة  الكشف</label>
                                                        <div class="form-group  form-md-floating-label has-info">
                                                            <select  class="form-control select2me visit_periods" name="visit_period" id="visit_period" 
                                                                     placeholder="اختر  الفترة  " required="required"  >
                                                                <option value=""></option>
                                                                {assign var=i value=1}
                                                                {foreach $visit_periods as $data}
                                                                <option value="{$data->id}"  {if $i == 1}selected {/if} >{$data->name}</option>
                                                                {capture assign=i}{$i+1}{/capture}
                                                                {/foreach}
                                                                <option value="-2" class="deleteoptincompo">حذف</option>
                                                            </select>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control"  type="text" value="" id="periodPatCount" disabled>
                                                            <label for="form_control_1"  class="txtr">   الزيارات   </label>
                                                        </div>
                                                    </div>

                                                    {/if}

                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control digitsOnly detectionvalue"  type="text"  id="totaldetectionvalue" value="{$k}" name="totaldetectionvalue" required="required">
                                                            <label for="form_control_1"  class="txtr"> قيمة الكشف </label>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control digitsOnly detectionvalue"  type="text"  id="discount" value="0" name="discount" required="required">
                                                            <label for="form_control_1"  class="txtr">  الخصم </label>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control digitsOnly detectionvalue"  type="text"  id="detectionvalue_cash" value="{$k}" name="detectionvalue_cash" required="required">
                                                            <label for="form_control_1"  class="txtr">  كاش </label>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control digitsOnly detectionvalue"  type="text"  id="detectionvalue_visa" value="0" name="detectionvalue_visa" required="required">
                                                            <label for="form_control_1"  class="txtr">  فيزا </label>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control digitsOnly"  type="text"  id="restdetectionvalue" value="0" name="restdetectionvalue" required="required" readonly="">
                                                            <label for="form_control_1"  class="txtr">  المتبقى </label>
                                                        </div>
                                                    </div>

                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control"  type="checkbox"  id="payVisit" value="1" name="payVisit" checked="checked">
                                                            <label for="form_control_1"  class="txtr">دفع</label>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-1 wds7">
                                                        <div class="form-group form-md-line-input form-md-floating-label has-info">
                                                            <input  class="form-control"  type="checkbox"  id="urgent" value="1" name="urgent" >
                                                            <label for="form_control_1"  class="txtr">إنتظار </label>
                                                        </div>
                                                    </div>

                                                </div>
                                            </div>
                                            {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->mobile}" />
                                                    </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}
                                        </div>

                                        <div class="form-actions">
                                            {if $programesetting->programview == 1 } 
                                            <div class="col-md-4">
                                                <div class=" fileupload-buttonbar">
                                                    <div class="col-lg-12">
                                                        <!-- The fileinput-button span is used to style the file input field as button -->
                                                        <span class="btn btn-success fileinput-button" ng-class="{literal}{disabled: disabled}{/literal}">
                                                            <i class="glyphicon glyphicon-plus"></i>
                                                            <span>إضافة ملف...</span>
                                                            <input type="file" name="files[]" multiple ng-disabled="disabled">
                                                        </span>
                                                        <button type="button" class="btn btn-primary start" data-ng-click="submit()">
                                                            <i class="glyphicon glyphicon-upload"></i>
                                                            <span>ابدأ الرفع</span>
                                                        </button>
                                                        <button type="button" class="btn btn-warning cancel" data-ng-click="cancel()">
                                                            <i class="glyphicon glyphicon-ban-circle"></i>
                                                            <span>إلغاء الرفع</span>
                                                        </button>
                                                        <!-- The global file processing state -->
                                                        <span class="fileupload-process"></span>
                                                    </div>
                                                    <!-- The global progress state -->
                                                    <div class="col-lg-5 fade" data-ng-class="{literal}{in: active()}{/literal}">
                                                        <!-- The global progress bar -->
                                                        <div class="progress progress-striped active" data-file-upload-progress="progress()">
                                                            <div class="progress-bar progress-bar-success" data-ng-style="{literal}{width: num + '%'}{/literal}"></div></div>
                                                        <!-- The extended global progress state -->
                                                        <div class="progress-extended">&nbsp;</div>
                                                    </div>
                                                </div>
                                            </div>

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

                                            <div class="col-md-8">
                                                <input type="submit" class="btn green btn-block btn-lg" id="patient_submit"  name="submit" value="إضافة">
                                            </div>
                                        </div>
                                        </form>




                                    </div>
                                </div>
                                <!-- END SAMPLE FORM PORTLET-->
                            </div>
                    </div>
                    <div style="clear: both;">
                    </div>
                    <!-- END PAGE CONTENT-->
                </div>
            </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="wifestatusmodel" 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 id="sourcejob" style="display: none;">
                <option value="">لايوجد</option>
                {foreach $allWifeJobs as $row}
                <option value="{$row->id}">{$row->title}</option>
                {/foreach}
                <option value="0" > حذف </option>
            </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}