
<form id="frm_userinfo" class="Hpadd-15 Hbg-white Hround-10 Hform-med" style="" name="frm_userinfo" action="" method="post" enctype="text/plain" >
    <h3 clas="Hrow" style="padding-right:2%">ثبت | ویرایش  &nbsp; &nbsp;اطلاعات کاربر</h3>     


    
     <div class="Hcol-xlg-6 Hcol-lg-6 Hcol-xmd-6 Hcol-md-6 Hcol-xsm-6 Hcol-sm-6 Hcol-xs-12 Hcol-xss-12 Hpadd-1per">
             <label class="HpaddR-10" data-color="#424750">نام</label>
             <input type="text" class="Hrow Htxt-center" style="border:1px solid #bbb;" id="Fname" name="name" @{if model}  value="@{!model.name}" @{fi}/>
     </div> 
     <div class="Hcol-xlg-6 Hcol-lg-6 Hcol-xmd-6 Hcol-md-6 Hcol-xsm-6 Hcol-sm-6 Hcol-xs-12 Hcol-xss-12 Hpadd-1per">
             <label class="HpaddR-10" data-color="#424750">نام خانوادگی</label>
             <input type="text" id="Ffam" name="fam" class="Hrow Htxt-center" style="border:1px solid #bbb;" @{if model}  value="@{!model.fam}" @{fi}/>
     </div> 
     
     <div class="Hcol-xlg-6 Hcol-lg-6 Hcol-xmd-6 Hcol-md-6 Hcol-xsm-6 Hcol-sm-6 Hcol-xs-12 Hcol-xss-12 Hpadd-1per">
             <label class="HpaddR-10" data-color="#424750">کدملی</label>
             <input type="text" id="Fidcode" class="Hrow Htxt-center adad" style="border:1px solid #bbb;" name="idcode" @{if model} value="@{!model.idcode}" @{fi}/>
     </div>  

     <div class="Hcol-xlg-6 Hcol-lg-6 Hcol-xmd-6 Hcol-md-6 Hcol-xsm-6 Hcol-sm-6 Hcol-xs-12 Hcol-xss-12 Hpadd-1per">
             <label class="HpaddR-10" data-color="#424750">ایمیل</label>
             <input type="text" id="email" class="Hrow Htxt-center" style="border:1px solid #bbb;" name="email" @{if model}  value="@{!model.email}" @{fi} />
     </div> 
     
     <div class="Hrow Hpadd-1per">
             <label class="Hrow HpaddR-10" data-color="#424750">شماره :</label>
             <div class="Hrow listShow-N2 HpaddT-10 HpaddB-10" id="numslist">
                 @{if model}
                    @{repository.x=1}
                    @{foreach y in model.phone}
                        <div class="Hrow Hpadd-5" index="@{repository.x}"><input type="hidden" name="p@{repository.x}" value="@{y.k}" /><input type="hidden" name="p@{repository.x+1}" value="@{y.v}" /><span>@{y.k} : @{y.v}</span><b class="Hbtn-mini Hbg-digired fas fa-trash-alt Hfloat-L removenum" style="color:#fff;"></b></div>
                        @{repository.x=repository.x+2}
                    @{end}
                 @{fi}
             </div>
            <button class="trans0_25 Hbtn Hbtn-skyblue"  type="button" id="mdph" data-selector="#modal_phone" data-target="Hmodal" data-action="" style="font-size:14px;"><b class="fa fa-plus HpaddL-5" style="position:relative;top:1px;"></b> افزودن شماره</button>
            <input type="hidden" id="plist" name="plist" value=""/>
             
     </div> 
     
     @{if model}
     <div class="Hrow">
       <input type="hidden" id="userID" name="userID" placeholder=""  value="@{!model._id}" />
     </div>  
     @{fi}
   
     <div class="Hrow SubmitionBox Hpadd-2per">
       <input  class="trans0_25 Hbtn-fullfix @{if model} Hbtn-yellow2 @{else} Hbtn-lightGreen @{fi} Hpadd-15" @{if model} upd='1' @{else} upd='0' @{fi} type="button" id="userinfoINSup" data-action="" @{if model} value="ویرایش اطلاعات کاربر" @{else} value="ثبت اطلاعات کاربر" @{fi}/>
     </div>
</form>





<div class="Hmodal" id="modal_phone"> 
  <div class="Hmodal-sm Hcards" style="background:#fff;border-radius:5px;">
    <div class="Hcards-header">
      <div class="close" data-color="#ffffff" style="background:#ff3333;border-radius:4px;"></div>
    </div>
    <div class="Hcards-content Hpadd-10">
      <label class="Hrow HpaddR-10" data-color="#424750">عنوان شماره  : </label>
      <input type="text" class="Hrow Htxt-center HmarB-10" style="border:1px solid #bbb;" list="numtitle" placeholder="مثال : تلفن همراه"/>
      <datalist id="numtitle">
        <option value="تلفن همراه">
        <option value="تلفن منزل">
        <option value="تلفن محل کار">
        <option value="تلفن آشنا">
        <option value="فکس">
      </datalist>
      <label class="Hrow HpaddR-10" data-color="#424750">شماره مورد نظر : </label>
       <input type="text" class="Hrow Htxt-center adad HmarB-10" style="border:1px solid #bbb;" placeholder="مثال : 09121234567"/>
       <input  class="trans0_25 Hbtn-fullfix Hbtn-lightGreen Hpadd-15"  type="button" id="addnumber" value=" افزودن شماره"/>

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

@{section footer}

<script type="text/javascript">
$(document).ready(function(){
    
    
    
     var plist=[];
     var x=$("#numslist").children().length;
     var index=2*x+1;
     
     $("#addnumber").click(function(){
         var phone=$(this).prev().val();
         var title=$(this).prev().prev().prev().prev().val();
         var obj='<div class="Hrow Hpadd-5" index="'+index+'"><input type="hidden" name="p'+index+'" value="'+title+'"/><input type="hidden" name="p'+(index+1)+'" value="'+phone+'"/><span>'+title +' : '+ phone +'</span><b class="Hbtn-mini Hbg-digired fas fa-trash-alt Hfloat-L removenum" style="color:#fff;"></b></div>';
         plist.push(index);
         $("#plist").val(plist);
         $("#numslist").append(obj);
         $("#modal_phone .close").trigger("click");
         $(this).prev().val("");
         $(this).prev().prev().prev().prev().val("");
         index=index+2;

     });
     if(x>0){
         for(var i=0;i<x;i++){
             plist.push(2*i+1);
         }
         $("#plist").val(plist);
     }
   
     $(document).on("click","b.removenum",function(){
        $(this).parent().remove();
         var n=Number($(this).parent().attr("index"));
         n=plist.indexOf(n);
         (n>-1)?plist.splice(n, 1) : "";
         $("#plist").val(plist);
     });
 
  
});
</script>

@{end}