<?php include_once APP_PATH.'template/business/tplblocks/header.php';?>

<form method="post" action="<?php echo $_SERVER['REQUEST_URI'];?>" enctype="multipart/form-data">
  <div class="container">
    <div class="col-md-4 col-sm-6 ml-auto mr-auto">
      <div class="card card-profile card-plain">
        <div class="card-avatar border-white">
          <a href="#avatar">
            <img src="<?php echo BASE_URL.JAK_FILES_DIRECTORY.$jakclient->getVar("picture");?>" alt="Profile Picture">
          </a>
        </div>
        <div class="card-body">
          <h4 class="card-title"><?php echo $jakclient->getVar("name");?></h4>
          <h6 class="card-category"><?php echo $jakclient->getVar("email");?></h6>
          <span class="badge badge-pill badge-primary"><?php echo sprintf($jkl['hd56'], (!empty($jakclient->getVar("chatrequests")) ? $jakclient->getVar("chatrequests") : 0));?></span>
          <span class="badge badge-pill badge-primary"><?php echo sprintf($jkl['hd57'], $jakclient->getVar("supportrequests"));?></span>
          <?php if (JAK_BILLING_MODE == 1) { ?>
            <span class="badge badge-pill badge-success"><?php echo sprintf($jkl['hd44'], $jakclient->getVar("credits"));?></span>
          <?php } elseif (JAK_BILLING_MODE == 2) { ?>
            <span class="badge badge-pill badge-success"><?php echo sprintf($jkl['hd45'], JAK_base::jakTimesince($jakclient->getVar("paid_until"), JAK_DATEFORMAT, JAK_TIMEFORMAT));?></span>
          <?php } elseif (JAK_BILLING_MODE == 3) { ?>
            <span class="badge badge-pill badge-success"><?php echo sprintf($jkl['hd142'], JAK_base::jakTimesince($jakclient->getVar("support_until"), JAK_DATEFORMAT, JAK_TIMEFORMAT));?></span>
          <?php } ?>

          <hr>
          <a href="<?php echo JAK_rewrite::jakParseurl(JAK_CLIENT_URL);?>" class="btn btn-round btn-outline-primary btn-sm"><i class="fa fa-chevron-left"></i><?php echo $jkl['hd143'];?></a>
          <button type="submit" class="btn btn-round btn-success btn-sm"><i class="fa fa-check"></i> <?php echo $jkl['hd53'];?></button>

        </div>

      </div> <!-- end card -->
    </div>
  </div>
  <div class="container">
    <div class="row mb-5">

      <div class="col-md-8 ml-auto mr-auto">
        <div class="form-group">
          <label for="name" class="bmd-label-floating"><?php echo $jkl["g4"];?></label>
          <input type="text" name="name" id="name" class="form-control" value="<?php echo $jakclient->getVar("name");?>">
        </div>

        <div class="form-group">
          <label for="email" class="bmd-label-floating"><?php echo $jkl["g5"];?></label>
          <input type="text" name="email" id="email" class="form-control" value="<?php echo $jakclient->getVar("email");?>"<?php if (defined('JAK_API_PROFILE') && !empty(JAK_API_PROFILE)) echo ' readonly';?>>
          <?php if (defined('JAK_API_PROFILE') && !empty(JAK_API_PROFILE)) { ?>
            <small class="form-text text-muted">
              <?php echo sprintf($jkl['hd120'], JAK_API_PROFILE);?>
            </small>
          <?php } ?>
        </div>
        <hr>
        <div class="form-group<?php if (isset($errorsp["e2"]) || isset($errorsp["e3"])) echo " has-danger";?>">
          <label for="pass" class="bmd-label-floating"><?php echo $jkl["hd25"];?></label>
          <input type="password" value placeholder="<?php echo $jkl["hd25"];?>" name="jak_newpassword" id="pass" class="form-control"<?php if (defined('JAK_API_PROFILE') && !empty(JAK_API_PROFILE)) echo ' readonly';?>>
        </div>

        <div class="form-group<?php if (isset($errorsp["e2"]) || isset($errorsp["e3"])) echo " has-danger";?>">
          <label for="jak_cpassword" class="bmd-label-floating"><?php echo $jkl["hd59"];?></label>
          <input type="password" value placeholder="<?php echo $jkl["hd59"];?>" name="jak_cpassword" id="jak_cpassword" class="form-control"<?php if (defined('JAK_API_PROFILE') && !empty(JAK_API_PROFILE)) echo ' readonly';?>>
        </div>
        <div class="form-group">
          <div class="progress">
            <div id="jak_pstrength" class="progress-bar progress-bar-striped progress-bar-animated" style="width:0" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
          </div>
        </div>
        <?php if (defined('JAK_API_PROFILE') && !empty(JAK_API_PROFILE)) { ?>
        <small class="form-text text-muted">
          <?php echo sprintf($jkl['hd120'], JAK_API_PROFILE);?>
        </small>
        <?php } ?>
        <hr>

        <div class="form-group form-file-upload form-file-multiple<?php if (isset($errorsp["e4"])) echo " has-danger";?>">
          <label for="avatar" class="bmd-label-floating"><?php echo $jkl["g18"];?></label>
          <div class="input-group">
            <input type="file" class="form-control inputFileVisible" name="avatar" id="avatar" autocomplete="off" accept="image/*">
            <div class="input-group-append">
              <span class="input-group-text"><i class="fa fa-link"></i></span>
            </div>
          </div>
        </div>

        <div class="form-check">
          <label class="form-check-label">
            <input class="form-check-input" type="checkbox" name="deleteavatar" value="1"> <?php echo $jkl["hd126"];?>
            <span class="form-check-sign">
              <span class="check"></span>
            </span>
          </label>
        </div>

        <hr>
        
        <div class="form-group">
          <label for="jak_lang" class="bmd-label-floating"><?php echo $jkl["hd54"];?></label>
          <select name="jak_lang" class="form-control">
            <option value=""><?php echo $jkl["hd55"];?></option>
            <?php if (isset($lang_files) && is_array($lang_files)) foreach($lang_files as $lf) { if ($lf != JAK_LANG) { ?><option value="<?php echo $lf;?>"<?php if ($JAK_FORM_DATA["language"] == $lf) echo ' selected';?>><?php echo ucwords($lf);?></option><?php } } ?>
          </select>
        </div>

        <?php if (isset($custom_fields) && !empty($custom_fields)) echo $custom_fields;?>

        <hr>
        
        <div class="text-center">
          <a href="<?php echo JAK_rewrite::jakParseurl(JAK_CLIENT_URL);?>" class="btn btn-round btn-outline-primary btn-sm"><i class="fa fa-chevron-left"></i><?php echo $jkl['hd143'];?></a>
          <button type="submit" class="btn btn-round btn-success btn-sm"><i class="fa fa-check"></i> <?php echo $jkl['hd53'];?></button>
        </div>
      </div>
    </div>
  </div>
  <input type="hidden" name="action" value="save_client">
</form>
<?php include_once APP_PATH.'template/business/tplblocks/footer.php';?>
