{include file="header.tpl"}

                <!-- PAGE-NAVIGATOR -->
        <section id="page-navigator">
            <div class="container-fluid">
                <div aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="https://petrocapital.tech/user/dashboard">Home</a></li>
                        <li class="breadcrumb-item"><a href="javascript:void(0)"
                                                       class="cursor-inherit">Profile Settings</a></li>
                    </ol>
                </div>
            </div>
        </section>
        <!-- /PAGE-NAVIGATOR -->
        </header>
    <!-- DASHBOARD-HEADER -->

    <main id="page-container">
        {include file="left.tpl"}
{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}
 <section id="dashboard">
        <div class="dashboard-wrapper add-fund pb-50">
            <div class="row">
                <div class="col-sm-4">
                    <div class="card secbg br-4">
                        <div class="card-body br-4">
<form action="" method=post onsubmit="return checkform()" name=editform>
<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}
{if $errors.turing_image}<div class="error">Invalid turing image</div>{/if}
{if $errors.invalid_transaction_code}<div class="error">You have provided invalid Current Transaction Code</div>{/if}
{if $errors.tfa_code}<div class="error">Invalid 2FA code</div>{/if}
{if $errors.no_fullname}<div class="error">Please enter your full name</div>{/if}
{if $errors.ip_exists_in_database}<div class="error">Your IP already exists in our database. Sorry, but registration impossible</div>{/if}
{if $errors.invalid_username}<div class="error">Please enter valid username! It should contains English letters and digits only.</div>{/if}
{if $errors.username_too_short}<div class="error">Username should contains {$errors.username_too_short} charaters at least</div>{/if}
{if $errors.username_exists}<div class="error">The Username is already taken. Please try another Username.</div>{/if}
{if $errors.password_confirm}<div class="error">Please correcty confirm your password</div>{/if}
{if $errors.password_too_small}<div class="error">The password you provided is too small, please enter at least {$errors.password_too_small} characters!</div>{/if} 
{if $errors.invalid_email}<div class="error">Please valid email address</div>{/if} 
{if $errors.email_confirm}<div class="error">Please correcty confirm your email address</div>{/if}
{if $errors.email_exists}<div class="error">An account with this email is already exist</div>{/if}
{if $errors.no_address}<div class="error">Please enter your address</div>{/if}
{if $errors.no_city}<div class="error">Please enter your city</div>{/if}
{if $errors.no_state}<div class="error">Please enter your state</div>{/if}
{if $errors.no_zip}<div class="error">Please enter your zip</div>{/if}
{if $errors.no_country}<div class="error">Please enter your country</div>{/if}
{if $errors.transaction_code_confirm}<div class="error">Please correcty confirm your transaction code</div>{/if}
{if $errors.transaction_code_too_small}<div class="error">The transaction code you provided is too small, please enter at least {$errors.transaction_code_too_small} characters!</div>{/if} 
{if $errors.transaction_code_vs_password}<div class="error">The Transaction Code should not be equal to the Password you have defined</div>{/if}
{if $errors.invalid_account_format}
 {foreach from=$errors.invalid_account_format item=err}
 <div class="error">{$err}</div>
 {/foreach}
{/if}
{/if}

                                <div class="form-group">
                       <div class="image-input ">
<label for="image-upload" id="image-label"><i class="fas fa-upload"></i></label>
<input type="file" name="image" placeholder="Choose image" id="image">
<img id="image_preview_container" class="preview-image" style="max-width: 200px"
                                             src="/assets/admin/images/default.png"
                                             alt="preview image">
                                    </div>
                                    
                                </div>
                                <h3></h3>
                                <p>Joined At {$userinfo.date_register}</p>
                                <div class="submit-btn-wrapper text-center text-md-left">
                                    <button type="submit" class=" btn btn-primary base-btn btn-block btn-rounded">
                                        <span>Image Update</span></button>
                                </div>
                          
                        </div>
                    </div>
                </div>

                <div class="col-sm-8">
                    <div class="card secbg form-block br-4">
                        <div class="card-body">
                            <ul class="nav nav-tabs" role="tablist">
                                <li class="nav-item">
                                    <a class="nav-link  active"
                                       data-toggle="tab" href="#home">Profile Information</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link "
                                       data-toggle="tab"
                                       href="#menu1">Password Setting</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link "
                                       data-toggle="tab"
                                       href="#identity">Identity Verification</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link "
                                       data-toggle="tab"
                                       href="#addressVerification">Address Verification</a>
                                </li>

                            </ul>
  <!-- Tab panes -->
                            <div class="tab-content ">
<div id="home" class="container mt-4 tab-pane   active">
  <div class="row ">
<div class="col-md-6">
<div class="form-group ">
<label>Account Name</label>
<input class="form-control" type="text" readonly  value="{$userinfo.username}">
</div></div>

<div class="col-md-6">
<div class="form-group ">
<label>Full Name</label>
<input class="form-control" type="text" name=fullname value="{$frm.fullname|default:$userinfo.name|escape:html}" >
</div></div>

{foreach item=ps from=$pay_accounts}
<div class="col-md-6">
<div class="form-group ">
<label>{$ps.name}</label>
{if $settings.usercanchangeegoldacc == 0 && $ps.account != ''}{$ps.account|escape:html}{else}<input type=text class="form-control" 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="col-md-6">
<div class="form-group ">
<label>{$p.name}</label>
{if $settings.usercanchangeegoldacc == 0 && $ps.value != ''}{$ps.value|escape:html}{else}<input type=text class="form-control" 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}
<div class="col-md-6">
<div class="form-group ">
<label>E-mail address</label>
{if $settings.usercanchangeemail == 1}<input type=text name=email value="{$frm.email|default:$userinfo.email|escape:html}" class="form-control">{else}{$userinfo.email|escape:html}{/if}
</div></div>  </div>
<div class="form-group mb-2">
<button type="submit" class="btn btn-primary">Update User</button></div>
</div>
{if $settings.use_user_location}
<tr>
 <td>Your Address:</td>
 <td><input type=text name=address value="{$frm.address|default:$userinfo.address|escape:html}" class=inpts size=30></td>
</tr>
<tr>
 <td>Your City:</td>
 <td><input type=text name=city value="{$frm.city|default:$userinfo.city|escape:html}" class=inpts size=30></td>
</tr>
<tr>
 <td>Your State:</td>
 <td><input type=text name=state value="{$frm.state|default:$userinfo.state|escape:html}" class=inpts size=30></td>
</tr>
<tr>
 <td>Your Zip:</td>
 <td><input type=text name=zip value="{$frm.zip|default:$userinfo.zip|escape:html}" class=inpts size=30></td>
</tr>
<tr>
 <td>Your Country:</td>
 <td>
  <select name=country class=inpts>
<option value="">--SELECT--</option>
{foreach from=$countries item=c}
<option {if ($frm.country && $c.name == $frm.country) || (!$frm.country && $c.name == $userinfo.country)}selected{/if}>{$c.name|escape:html}</option>
{/foreach}
  </select>
 </td>
</tr>
{/if}
<div id="menu1" class="container mt-4 tab-pane ">
<div class="form-group mt-4">
<label>New Password</label>
<input class="form-control" type="password" name=password value="" >
</div>
<div class="form-group mt-4">
<label>Retype Password</label>
<input class="form-control" type="password" name=password2 value="" >
</div>
<div class="form-group mb-2">
<button type="submit" class="btn btn-primary"> Update Password </button></div>

                                </div>

{if $settings.use_transaction_code}
  {if $settings.use_transaction_code_edit_account != 1}
    {if $userinfo.transaction_code != ''}
    <tr>
     <td>Current Transaction Code:</td>
     <td><input type=password name=transaction_code_current value="" class=inpts size=30></td>
    </tr>
    {/if}
  {/if}
  <tr>
   <td>New Transaction Code:</td>
   <td><input type=password name=transaction_code value="" class=inpts size=30></td>
  </tr>
  <tr>
   <td>Retype Transaction Code:</td>
   <td><input type=password name=transaction_code2 value="" class=inpts size=30></td>
  </tr>
{/if}

{if $settings.use_rcb}
<tr>
 <td>Your RCB Percent:</td>
 <td>{if $userinfo.rcb_lock}{$userinfo.rcb}%{else}<input type=text class=inpts size=30 name="rcb" value="{$frm.rcb|default:$userinfo.rcb|number_format:2}">{/if}</td>
</tr>
{/if}
{if $userinfo.admin_auto_pay_earning == 1}
<tr>
 <td colspan=2><input type=checkbox name=user_auto_pay_earning value=1 {if $userinfo.user_auto_pay_earning == 1}checked{/if}> Receive earnings directly to e-currency account</td>
</tr>
{/if}
{if $settings.use_transaction_code_edit_account == 1}
<tr>
 <td>Current Transaction Code:</td>
 <td><input type=password name=transaction_code_current value="" class=inpts size=30></td>
</tr>
{/if}
{if $userinfo.tfa_settings.edit_account}
<tr>
 <td>2FA Code:</td>
 <td><input type="text" name="tfa_code" class=inpts size=15> <input type="hidden" name="tfa_time" id="tfa_time"></td>
</tr>
{literal}
<script language=javascript>
document.getElementById('tfa_time').value = (new Date()).getTime();
</script>
{/literal}
{/if}
{include file="captcha.tpl" action="edit_account"}
 <div id="identity" class="container mt-4 tab-pane ">
 <div class="col-md-12">
                                                <div class="form-group ">
                                                    <label class="form-label"
                                                           for="identity_type">Identity Type</label>
                                                    <select name="identity_type" id="identity_type"
                                                            class="form-control ">
                                                        <option value="" selected disabled>Select Type</option>
                                                                                                                    <option
                                                                value="driving-license" >Driving License</option>
                                                                                                                    <option
                                                                value="passport" >Passport</option>
                                                                                                                    <option
                                                                value="national-id" >National ID</option>
                                                                                                            </select>
                                                                                                    </div>
                                            </div>
                                                     
                                                                    </div>

<div id="addressVerification"
                                     class="container mt-4 tab-pane ">
                                         <div class="col-md-12">
                                                <div class="form-group">
                                                    <label class="form-label">Address Proof <span
                                                            class="text-danger">*</span> </label><br>

                                                    <div class="fileinput fileinput-new "
                                                         data-provides="fileinput">
                                                        <div class="fileinput-new thumbnail "
                                                             data-trigger="fileinput">
                                                            <img class="w-150px "
                                                                 src="/assets/admin/images/default.png"
                                                                 alt="...">
                                                        </div>
                                                        <div
                                                            class="fileinput-preview fileinput-exists thumbnail wh-200-150 "></div>

                                                        <div class="img-input-div">
                                                                    <span class="btn btn-success btn-file">
                                                                        <span
                                                                            class="fileinput-new "> Select Image </span>
                                                                        <span
                                                                            class="fileinput-exists"> Change</span>
                                                                        <input type="file" name="addressProof"
                                                                               value=""
                                                                               accept="image/*">
                                                                    </span>
                                                            <a href="#" class="btn btn-danger fileinput-exists"
                                                               data-dismiss="fileinput"> Remove</a>
                                                        </div>

                                                    </div>

                                                                                                    </div>
                                            </div>


<div class="form-group mb-2">
<button type="submit" class="btn btn-primary"> Update</button></div>

</form>
          
                                </div>

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

                </div>

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

    </main>
</div>

                
{include file="footer.tpl"}