{include file="mheader.tpl"}
<div class="header-title-breadcrumb element-box-shadow">
              <div class="container">
                  <div class="row">
                      <div class="col-md-7 col-sm-6 col-xs-12 text-left">
                        <h3>Edit Account</h3>
                      </div>
                      <div class="col-md-5 col-sm-6 col-xs-12 hide-on-tablet">
                          <ol class="breadcrumb text-right">
                            <li><a href="?a=account">Home</a></li> 
                            <li class="active">Edit Account</li>
                          </ol>                    
                      </div>
                  </div>
              </div>
            </div>
            <div class="spacer_80"></div>

{literal}


<script language=javascript>
function IsNumeric(sText) {
  var ValidChars = "0123456789.";
  var IsNumber=true;
  var Char;
  if (sText == '') return false;
  for (i = 0; i < sText.length && IsNumber == true; i++) { 
    Char = sText.charAt(i); 
    if (ValidChars.indexOf(Char) == -1) {
      IsNumber = false;
    }
  }
  return IsNumber;
}

function checkform() {
  if (document.editform.fullname.value == '') {
    alert("Please type your full name!");
    document.editform.fullname.focus();
    return false;
  }
{/literal}
{if $settings.use_user_location == 1}
{literal}
  if (document.editform.address.value == '') {
    alert("Please enter your address!");
    document.editform.address.focus();
    return false;
  }
  if (document.editform.city.value == '') {
    alert("Please enter your city!");
    document.editform.city.focus();
    return false;
  }
  if (document.editform.state.value == '') {
    alert("Please enter your state!");
    document.editform.state.focus();
    return false;
  }
  if (document.editform.zip.value == '') {
    alert("Please enter your ZIP!");
    document.editform.zip.focus();
    return false;
  }
  if (document.editform.country.options[document.editform.country.selectedIndex].text == '--SELECT--') {
    alert("Please choose your country!");
    document.editform.country.focus();
    return false;
  }
{/literal}
{/if}
{literal}
  if (document.editform.password.value != document.editform.password2.value) {
    alert("Please check your password!");
    document.editform.fullname.focus();
    return false;
  }
{/literal}
{if $settings.use_transaction_code}
{literal}
  if (document.editform.transaction_code.value != document.editform.transaction_code2.value) {
    alert("Please check your transaction code!");
    document.editform.transaction_code2.focus();
    return false;
  }
{/literal}
{/if}
{literal}
{/literal}
{if $settings.usercanchangeemail == 1}
{literal}
  if (document.editform.email.value == '') {
    alert("Please enter your e-mail address!");
    document.editform.email.focus();
    return false;
  }
{/literal}
{/if}
{literal}

  for (i in document.editform.elements) {
    f = document.editform.elements[i];
    if (f.name && f.name.match(/^pay_account/)) {
      if (f.value == '') continue;
      var notice = f.getAttribute('data-validate-notice');
      var invalid = 0;
      if (f.getAttribute('data-validate') == 'regexp') {
        var re = new RegExp(f.getAttribute('data-validate-regexp'));
        if (!f.value.match(re)) {
          invalid = 1;
        }
      } else if (f.getAttribute('data-validate') == 'email') {
        var re = /^[^\@]+\@[^\@]+\.\w{2,4}$/;
        if (!f.value.match(re)) {
          invalid = 1;
        }
      }
      if (invalid) {
        alert('Invalid account format. Expected '+notice);
        f.focus();
        return false;
      }
    }
  }

  return true;
}
</script>
{/literal}

            <div class="container">
              <div class="row">
                <div class="col-md-12 col-lg-4">
                  <div class="panel element-box-shadow">
                    <div class="section1 text-center">
                      <div class="top animated bounceIn">
                        
                      </div>
                      
                      <div id="user-image-v1">
                        <div id="container">
                          <div class="box">
                            <div class="progress"></div>
                          </div>
                          <div class="v-align">
                            <img src="1/assets/images/profile-pic.jpg" alt="user-image">
                            <!--<svg>
                              <path d="M25,75a50,50 0 1,0 100,0a50,50 0 1,0 -100,0"></path>
                            </svg>-->
                            <div class="arrow"></div>
                          </div>
                          <img id="image-holder">
                        </div>
                        <!-- <img src="1/assets/images/profile-pic.jpg" alt="user-image"> -->
                        <i class="fa fa-camera" aria-hidden="true"> Change</i>
                      </div>
                      <div class="clearfix"></div>
                      <div class="spacer_80"></div>
                      <div class="spacer_70"></div>
                      <div class="clearfix"></div>
                      <h3 class="text-bold">{$userinfo.username}</h3>
                      <h4 class="text-bold"> {$userinfo.date_register}</h4>
                      <h4 class="text-bold"><i class="fa fa-envelope-o"></i> {$userinfo.email}</h4>
                    </div>
                    
                    
                  </div>
                </div>
<div class="col-md-12 col-lg-8">
<form action="" method=post onsubmit="return checkform()" name=editform class="form-horizontal">
<input type=hidden name=a value=edit_account>
<input type=hidden name=action value=edit_account>
<input type=hidden name=say value="">

{if $frm.say eq 'changed'}
Your account data has been updated successfully.<br><br>
{/if}
{if $errors}
<ul style="color:red">
{section name=e loop=$errors}
{if $errors[e] eq 'full_name'}
<li>Please enter your Full Name!
{/if}
{if $errors[e] eq 'address'}
<li>Please enter your address!
{/if}
{if $errors[e] eq 'city'}
<li>Please enter your city!
{/if}
{if $errors[e] eq 'state'}
<li>Please enter your state!
{/if}
{if $errors[e] eq 'zip'}
<li>Please enter your zip!
{/if}
{if $errors[e] eq 'country'}
<li>Please choose your country!
{/if}
{if $errors[e] eq 'username'}
<li>Please enter your username!
{/if}
{if $errors[e] eq 'password'}
    <li>Please enter a password!
{/if}
{if $errors[e] eq 'password_confirm'} 
    <li>Please check your password!
{/if}
{if $errors[e] eq 'password_too_small'}
<li>Password is too small, please enter at least {$settings.min_user_password_length} chars!
{/if}
{if $errors[e] eq 'transaction_code'}
    <li>Please enter the Transaction Code! {/if} {if $errors[e] eq 'transaction_code_confirm'} 
    <li>Please check your Transaction Code!
{/if}
{if $errors[e] eq 'transaction_code_too_small'}
<li>Transaction Code is too small, please enter at least {$settings.min_user_password_length} chars!
{/if}
{if $errors[e] eq 'wrong_current_password'}
<li>You entered wrong current password
{/if}
{if $errors[e] eq 'transaction_code_vs_password'}
    <li>Transaction Code should be different then the Password! {/if} {if $errors[e] 
      eq 'invalid_transaction_code'} 
    <li>You have provided invalid Current Transaction Code!
{/if}
{if $errors[e] eq 'email'}
<li>Please enter your e-mail!
{/if}
{if $errors[e] eq 'turing_image'}
<li>Enter the verification code as it is shown in the corresponding box.
{/if}
{if $errors[e] eq 'tfa_code'} 
  <li>Invalid 2FA code
{/if}
{if $errors[e] eq 'invalid_account_format'}
 {foreach from=$account_errors item=err}
 <li>{$err}
 {/foreach}
{/if}

<br>
{/section}
</ul>
{/if}

                  <!--Personal details-->
                  <div class="panel panel-cryptic element-box-shadow">
                    <div class="panel-heading padding_30">
                      <h3 class="no-margin">Personal details</h3>
                    </div>
                    <div class="panel-body padding_30">
                     
                        <fieldset>
                          <div class="form-group">
                            <label for="inputFirstName" class="col-lg-12 control-label">Account name</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1" id="inputFirstName" placeholder="{$userinfo.username}" type="text" disabled>
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="inputLastName" class="col-lg-12 control-label">Registration date</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1" id="inputLastName" placeholder="{$userinfo.date_register}" type="text" disabled>
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="inputEmail" class="col-lg-12 control-label">Email adress</label>
                            <div class="col-lg-12">
                              {if $settings.usercanchangeemail == 1}
                              <input class="form-control input-type-1" id="inputEmail" placeholder="{$userinfo.email|escape:"quotes"}" type="text" name=email value='{$userinfo.email|escape:"quotes"}'>
                              {else}{$userinfo.email}{/if}
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="inputFirstName" class="col-lg-12 control-label">Full name</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1" placeholder="{$userinfo.name|escape:"quotes"}" type="text" name=fullname value='{$userinfo.name|escape:"quotes"}'>
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="inputFirstName" class="col-lg-12 control-label">New Password</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1" placeholder="New Password" type="password" name=password value="">
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="inputFirstName" class="col-lg-12 control-label">Retype Password</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1" placeholder="New Password" type="password" name=password2 value="">
                            </div>
                          </div>
                          
                          <input type=submit value="Change Account data" class="btn btn-cryptic button-element sweetalert31">
                          
                        </fieldset>
                      
                    </div><!-- END panel-body -->
                  </div><!-- END Personal details-->
                  <!--Personal adderss-->
                  <div class="panel panel-cryptic element-box-shadow">
                    <div class="panel-heading padding_30">
                      <h3 class="no-margin">Payment Accounts</h3>
                    </div>
                    <div class="panel-body padding_30">
                      
                        <fieldset>
                            {foreach item=ps from=$pay_accounts}
                          <div class="form-group">
                            <label for="inputStreet" class="col-lg-12 control-label">Your {$ps.name} acc no</label>
                            <div class="col-lg-12">
                              {if $settings.usercanchangeegoldacc == 0 && $ps.account != ''}{$ps.account|escape:html}{else}
                              <input class="form-control input-type-1"  placeholder="{$ps.name}" type="text" name="pay_account[{$ps.id}]" value="{$frm.pay_account[$ps.id]|default:$ps.account|escape:html}" data-validate="{$ps.validate.func}" data-validate-{$ps.validate.func}="{$ps.validate[$ps.validate.func]}" data-validate-notice="{$ps.validate.notification|escape:html}">
                            {/if}
                            </div>
                          </div>
                          {/foreach}
                          {foreach item=p from=$mpay_accounts}
                          {foreach item=ps from=$p.accounts}
                          <div class="form-group">
                            <label for="inputCity" class="col-lg-12 control-label">Your {$p.name} {$ps.name}</label>
                            <div class="col-lg-12">
                                {if $settings.usercanchangeegoldacc == 0 && $ps.value != ''}{$ps.value|escape:html}{else}
                              <input class="form-control input-type-1"  placeholder="{$p.name} {$ps.name}" type="text" name="pay_account[{$p.id}][{$ps.name|escape:html}]" value="{$frm.pay_account[$p.id][$ps.name]|default:$ps.value|escape:html}">
                            {/if}
                            </div>
                          </div>
                          {/foreach}
                          {/foreach}
                         <input type=submit value="Change Account data" class="btn btn-cryptic button-element sweetalert31">
                        </fieldset>
                      
                    </div><!-- END panel-body -->
                  </div><!-- END Personal address-->
                  <!--Social media-->
                  <div class="panel panel-cryptic element-box-shadow">
                    <div class="panel-heading padding_30">
                      <h3 class="no-margin">Security</h3>
                    </div>
                    <div class="panel-body padding_30">
                      
                        <fieldset>
                            {if $settings.use_transaction_code}
                             {if $settings.use_transaction_code_edit_account != 1}
                              {if $userinfo.transaction_code != ''}
                          <div class="form-group">
                            <label for="inputFacebook" class="col-lg-12 control-label">Current Transaction Code</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1"  placeholder="Current Transaction Code" type="password" name=transaction_code_current value="">
                            </div>
                          </div>
                          {/if}
                           {/if}
                          <div class="form-group">
                            <label for="inputInstagram" class="col-lg-12 control-label">New Transaction Code</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1"  placeholder="New Transaction Code" type="password" name=transaction_code value="">
                            </div>
                          </div>
                          <div class="form-group">
                            <label for="inputTwitter" class="col-lg-12 control-label">Retype Transaction Code</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1"  placeholder="Retype Transaction Code" type="password" name=transaction_code2 value="">
                            </div>
                          </div>
                          {/if}
                          {if $settings.use_transaction_code_edit_account == 1}
                          <div class="form-group">
                            <label for="inputLinkedin" class="col-lg-12 control-label">Current Transaction Code</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1"  placeholder="Current Transaction Code" type="password" name=transaction_code_current value="">
                            </div>
                          </div>
                          {/if}
                          {if $userinfo.tfa_settings.edit_account}
                          <div class="form-group">
                            <label for="inputLinkedin" class="col-lg-12 control-label">2FA Code</label>
                            <div class="col-lg-12">
                              <input class="form-control input-type-1" placeholder="2FA Code" type="text" name="tfa_code">
                              <input type="hidden" name="tfa_time" id="tfa_time">
                            </div>
                          </div>
                          {literal}
                        <script language=javascript>
                         document.getElementById('tfa_time').value = (new Date()).getTime();
                           </script>
                         {/literal}
                           {/if}
                           {if $ti.check.edit_account}
                           <div class="form-group">
                            <label for="inputLinkedin" class="col-lg-12 control-label">Validation</label>
                            <div class="col-lg-12">
                                <img src="?a=show_validation_image&{$ti.session.name}={$ti.session.id}&rand={$ti.session.rand}">
                              <input class="form-control input-type-1" placeholder="Validation" type="text" name=validation_number >
                            </div>
                          </div>
                          {/if}
                          <input type=submit value="Change Account data" class="btn btn-cryptic button-element sweetalert31">
                        </fieldset>
                      
                    </div><!-- END panel-body -->
                  </div><!-- END Social media-->
                  </form>
                </div>
</div>
            </div>


<a href="#" class="scrollToTop"><i class="fa fa-chevron-up text-white" aria-hidden="true"></i></a>
</div>
{include file="mfooter.tpl"}

