<?php include_once 'header.php';?>

<!-- Small boxes (Stat box) -->
<div class="row">
  <div class="col-md-3">
    <div class="card card-stats">
      <div class="card-header card-header-warning card-header-icon">
        <div class="card-icon">
          <img src="<?php echo BASE_URL_ORIG.JAK_FILES_DIRECTORY.$JAK_FORM_DATA["picture"];?>" class="img-fluid" width="60" alt="avatar">
        </div>
        <p class="card-category"><?php echo $JAK_FORM_DATA["name"];?></p>
        <h3 class="card-title"><?php echo JAK_base::jakTimesince($JAK_FORM_DATA["time"], JAK_DATEFORMAT, "")?></h3>
      </div>
      <div class="card-footer">
      </div>
    </div>
  </div>
  <?php if (JAK_BILLING_MODE == 1) { ?>
    <div class="col-md-3">
      <div class="card card-stats">
        <div class="card-header card-header-rose card-header-icon">
          <div class="card-icon">
            <i class="material-icons">new_releases</i>
          </div>
          <p class="card-category"><?php echo $jkl["hd74"];?></p>
          <h3 class="card-title"><?php echo $JAK_FORM_DATA["credits"]?></h3>
        </div>
        <div class="card-footer">
        </div>
      </div>
    </div>
  <?php } elseif (JAK_BILLING_MODE == 2) { ?>
    <div class="col-md-3">
      <div class="card card-stats">
        <div class="card-header card-header-rose card-header-icon">
          <div class="card-icon">
            <i class="material-icons">new_releases</i>
          </div>
          <p class="card-category"><?php echo $jkl["hd143"];?></p>
          <h3 class="card-title"><?php echo JAK_base::jakTimesince($JAK_FORM_DATA["paid_until"], JAK_DATEFORMAT, "")?></h3>
        </div>
        <div class="card-footer">
        </div>
      </div>
    </div>
  <?php } ?>
  <div class="col-md-3">
    <div class="card card-stats">
      <div class="card-header card-header-info card-header-icon">
        <div class="card-icon">
          <i class="material-icons">sms</i>
        </div>
        <p class="card-category"><?php echo $jkl["hd140"];?></p>
        <h3 class="card-title"><?php echo $JAK_FORM_DATA["chatrequests"]?></h3>
      </div>
      <div class="card-footer">
      </div>
    </div>
  </div>
  <div class="col-md-3">
    <div class="card card-stats">
      <div class="card-header card-header-primary card-header-icon">
        <div class="card-icon">
          <i class="material-icons">healing</i>
        </div>
        <p class="card-category"><?php echo $jkl["hd141"];?></p>
        <h3 class="card-title"><?php echo $JAK_FORM_DATA["supportrequests"]?></h3>
      </div>
      <div class="card-footer">
      </div>
    </div>
  </div>
</div>

<?php if ($errors) { ?>
  <div class="alert alert-danger"><?php if (isset($errors["e"])) echo $errors["e"];
  if (isset($errors["e1"])) echo $errors["e1"];
  if (isset($errors["e2"])) echo $errors["e2"];
  if (isset($errors["e3"])) echo $errors["e3"];
  if (isset($errors["e4"])) echo $errors["e4"];
  if (isset($errors["e5"])) echo $errors["e5"];
  if (isset($errors["e6"])) echo $errors["e6"];?></div>
<?php } ?>

<form class="jak_form" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
  <div class="row">

    <?php if (JAK_BILLING_MODE == 3) { ?>
    <div class="col-md-12">
    <div class="card">
      <div class="card-header">
        <h3 class="card-title"><i class="fa fa-list-alt"></i> <?php echo $jkl["hd303"];?></h3>
      </div><!-- /.box-header -->
      <div class="card-body">
        <?php if (isset($allLics) && !empty($allLics)) { ?>

            <div class="table-responsive">
              <table id="sortable-data" class="table">
                <thead class="table-custom-dark">
                  <th><?php echo $jkl['hd299'];?></th>
                  <th><?php echo $jkl['hd304'];?></th>
                  <th><?php echo $jkl['hd305'];?></th>
                  <th><?php echo $jkl['hd306'];?></th>
                  <th><?php echo $jkl['hd307'];?></th>
                  <th><?php echo $jkl['stat_s41'];?></th>
                  <th><?php echo $jkl['g48'];?></th>
                </thead>
                <?php foreach($allLics as $al) { ?>
                  <tr>
                    <td><?php echo $al["product_name"];?></td>
                    <td><?php echo $al["purchase_name"];?></td>
                    <td><?php echo $al["purchase_code"];?></td>
                    <td><?php echo JAK_base::jakTimesince($al['purchased'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></td>
                    <td><?php echo JAK_base::jakTimesince($al['support_expires'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></td>
                    <td><?php if (JAK_SUPERADMINACCESS) { ?><a class="btn btn-default btn-sm" href="<?php echo JAK_rewrite::jakParseurl('users', 'clients', 'lic', $al["id"]);?>"><i class="fas fa-file-certificate"></i></a><?php } ?></td>
                    <td><?php if (JAK_SUPERADMINACCESS) { ?><a class="btn btn-default btn-sm btn-confirm" href="<?php echo JAK_rewrite::jakParseurl('users', 'clients', 'licdel', $al["id"]);?>" data-title="<?php echo addslashes($jkl["g48"]);?>" data-text="<?php echo addslashes($jkl["al"]);?>" data-type="warning" data-okbtn="<?php echo addslashes($jkl["g279"]);?>" data-cbtn="<?php echo addslashes($jkl["g280"]);?>"><i class="fa fa-trash-alt"></i></a><?php } ?></td>
                  </tr>
                <?php } ?>
              </table>
            </div>

          <?php } else { ?>

            <div class="alert alert-info">
              <?php echo $jkl['i3'];?>
            </div>

          <?php } ?>
      </div>

      <div class="card-footer">
        <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
      </div>
    </div>
    </div>
    <?php } ?>

    <div class="col-md-6">

      <div class="card">
        <div class="card-header card-header-icon card-header-success">
          <div class="card-icon">
            <i class="material-icons">create</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["g40"];?></h4>
        </div>
        <div class="card-body">

          <div class="form-group<?php if (isset($errors["e1"])) echo " has-danger";?>">
            <label class="control-label" for="name"><?php echo $jkl["u"];?></label>
            <input type="text" name="jak_name" id="name" class="form-control" value="<?php echo $JAK_FORM_DATA["name"];?>">
          </div>

          <div class="form-group<?php if (isset($errors["e2"])) echo " has-danger";?>">
            <label class="control-label" for="email"><?php echo $jkl["u1"];?></label>
            <input type="text" name="jak_email" id="email" class="form-control" value="<?php echo $JAK_FORM_DATA["email"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_lang"><?php echo $jkl["g22"];?></label>
            <select name="jak_lang" class="selectpicker col-12" data-live-search="true">
              <option value=""><?php echo $jkl["u11"];?></option>
              <?php if (isset($lang_files) && is_array($lang_files)) foreach($lang_files as $lf) { ?><option value="<?php echo $lf;?>"<?php if ($JAK_FORM_DATA["language"] == $lf) echo ' selected';?>><?php echo ucwords($lf);?></option><?php } ?>
            </select>
          </div>

          <?php if (!empty($jakosub) && $jakosub['trial']) { ?>
            <label class="control-label" for="jak_upload"><?php echo $jkl["hd139"];?></label>
            <div class="alert alert-info"><?php echo $jkl['i12'];?></div>
            <input type="hidden" name="jak_upload" value="0">
          <?php } elseif (!empty($jakosub) && !$jakosub['trial'] && !$jakosub['files']) { ?>
            <label class="control-label" for="jak_upload"><?php echo $jkl["hd139"];?></label>
            <div class="alert alert-danger"><?php echo $jkl['i13'];?></div>
            <input type="hidden" name="jak_upload" value="0">
          <?php } else { ?>

            <div class="form-group">
              <label class="control-label" for="jak_upload"><?php echo $jkl["hd139"];?></label>
              <div class="form-check">
                <label class="form-check-label">
                  <input class="form-check-input" type="radio" name="jak_upload" value="1"<?php if ($JAK_FORM_DATA["canupload"] == 1) echo ' checked';?>> <?php echo $jkl["g19"];?>
                  <span class="circle">
                    <span class="check"></span>
                  </span>
                </label>
              </div>
              <div class="form-check">
                <label class="form-check-label">
                  <input class="form-check-input" type="radio" name="jak_upload" value="0"<?php if ($JAK_FORM_DATA["canupload"] == 0) echo ' checked';?>> <?php echo $jkl["g18"];?>
                  <span class="circle">
                    <span class="check"></span>
                  </span>
                </label>
              </div>
            </div>
          <?php } ?>

          <div class="form-group">
              <label class="control-label" for="jak_frontendadmin"><?php echo $jkl["hd315"];?></label>
              <div class="form-check">
                <label class="form-check-label">
                  <input class="form-check-input" type="radio" name="jak_frontendadmin" value="1"<?php if ($JAK_FORM_DATA["frontendadmin"] == 1) echo ' checked';?>> <?php echo $jkl["g19"];?>
                  <span class="circle">
                    <span class="check"></span>
                  </span>
                </label>
              </div>
              <div class="form-check">
                <label class="form-check-label">
                  <input class="form-check-input" type="radio" name="jak_frontendadmin" value="0"<?php if ($JAK_FORM_DATA["frontendadmin"] == 0) echo ' checked';?>> <?php echo $jkl["g18"];?>
                  <span class="circle">
                    <span class="check"></span>
                  </span>
                </label>
              </div>
            </div>

        </div>
        <div class="card-footer">
          <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
          <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
        </div>
      </div>

      <?php if (!empty($custom_fields)) { ?>

        <div class="card">
          <div class="card-header card-header-icon card-header-warning">
            <div class="card-icon">
              <i class="material-icons">check_box</i>
            </div>
            <h4 class="card-title "><?php echo $jkl["hd148"];?></h4>
          </div>
          <div class="card-body">

            <?php echo $custom_fields;?>

          </div>
          <div class="card-footer">
            <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
            <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
          </div>
        </div>
      <?php } ?>

      <div class="card">
        <div class="card-header card-header-icon card-header-warning">
          <div class="card-icon">
            <i class="material-icons">vpn_key</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["g39"];?></h4>
        </div>
        <div class="card-body">

          <div class="form-group<?php if (isset($errors["e5"]) || isset($errors["e6"])) echo " has-danger";?>">
            <label class="control-label" for="pass"><?php echo $jkl["u4"];?></label>
            <input type="password" name="jak_password" id="pass" class="form-control" value="">
          </div>

          <div class="form-group<?php if (isset($errors["e5"]) || isset($errors["e6"])) echo " has-danger";?>">
            <label class="control-label" for="jak_confirm_password"><?php echo $jkl["u5"];?></label>
            <input type="password" name="jak_confirm_password" class="form-control" value="">
          </div>

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

          <hr>

          <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients', 'newpass', $page3);?>" class="btn btn-danger"><?php echo $jkl["hd347"];?></a>

        </div>
        <div class="card-footer">
          <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
          <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
        </div>
      </div>

    </div>
    <div class="col-md-6">

      <div class="card">
        <div class="card-header card-header-icon card-header-danger">
          <div class="card-icon">
            <i class="material-icons">list_alt</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["m9"];?></h4>
        </div>
        <div class="card-body">

          <div class="form-group">
            <label class="control-label" for="jak_depid"><?php echo $jkl["hd2"];?></label>
            <select name="jak_depid[]" class="selectpicker col-12" data-live-search="true" multiple>
              <option value="0"<?php if ($JAK_FORM_DATA["chat_dep"] == 0) echo ' selected';?>><?php echo $jkl["g105"];?></option>

              <?php if (isset($JAK_DEPARTMENTS) && is_array($JAK_DEPARTMENTS)) foreach($JAK_DEPARTMENTS as $v) { ?>

                <option value="<?php echo $v["id"];?>"<?php if (in_array($v["id"], explode(',', $JAK_FORM_DATA["chat_dep"]))) echo ' selected';?>><?php echo $v["title"];?></option>

              <?php } ?>
            </select>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_depids"><?php echo $jkl["hd3"];?></label>

            <select name="jak_depids[]" class="selectpicker col-12" data-live-search="true" multiple>
              <option value="0"<?php if ($JAK_FORM_DATA["support_dep"] == 0) echo ' selected';?>><?php echo $jkl["g105"];?></option>

              <?php if (isset($JAK_DEP_SUPPORT) && is_array($JAK_DEP_SUPPORT)) foreach($JAK_DEP_SUPPORT as $d) { ?>

                <option value="<?php echo $d["id"];?>"<?php if (in_array($d["id"], explode(',', $JAK_FORM_DATA["support_dep"]))) echo ' selected';?>><?php echo $d["title"];?></option>

              <?php } ?>
            </select>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_depidf"><?php echo $jkl["hd4"];?></label>

            <select name="jak_depidf[]" class="selectpicker col-12" data-live-search="true" multiple>
              <option value="0"<?php if ($JAK_FORM_DATA["faq_cat"] == 0) echo ' selected';?>><?php echo $jkl["g105"];?></option>

              <?php if (isset($JAK_CAT_FAQ) && is_array($JAK_CAT_FAQ)) foreach($JAK_CAT_FAQ as $f) { ?>

                <option value="<?php echo $f["id"];?>"<?php if (in_array($f["id"], explode(',', $JAK_FORM_DATA["faq_cat"]))) echo ' selected';?>><?php echo $f["title"];?></option>

              <?php } ?>
            </select>
          </div>

        </div>
        <div class="card-footer">
          <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
          <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
        </div>
      </div>

      <div class="card">
        <div class="card-header card-header-icon card-header-primary">
          <div class="card-icon">
            <i class="material-icons">money</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["hd235"];?></h4>
        </div>
        <div class="card-body">

          <div class="input-group">
            <input type="number" name="custom_price" class="form-control" value="<?php echo $JAK_FORM_DATA["custom_price"];?>" aria-describedby="custom-price">
            <div class="input-group-append">
              <span class="input-group-text" id="custom-price">%</span>
            </div>
          </div>
        </div>

        <div class="card-footer">
          <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
          <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
        </div>
      </div>

      <div class="card">
        <div class="card-header card-header-icon card-header-rose">
          <div class="card-icon">
            <i class="material-icons">money</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["hd142"];?></h4>
        </div>
        <div class="card-body">

          <?php if (JAK_BILLING_MODE == 1) { ?>
            <div class="form-group">
              <label class="control-label" for="credits"><?php echo $jkl["hd74"];?></label>
              <input type="number" min="0" name="jak_credits" id="credits" class="form-control" value="<?php echo $JAK_FORM_DATA["credits"];?>">
            </div>
            <input type="hidden" name="jak_validtill" value="1980-05-06">
          <?php } else { ?>
            <div class="form-group">
              <label class="control-label" for="credits"><?php echo $jkl["hd143"];?></label>
              <input type="text" name="jak_validtill" class="form-control" value="<?php echo $JAK_FORM_DATA["paid_until"];?>">
              <small class="form-text text-muted">
                <?php echo $jkl['hd144'];?>
              </small>
            </div>
            <input type="hidden" name="jak_credits" value="0">
          <?php } ?>
          
        </div>
        <div class="card-footer">
          <a href="<?php echo JAK_rewrite::jakParseurl('users', 'clients');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
          <button type="submit" name="save" class="btn btn-primary pull-right"><?php echo $jkl["g38"];?></button>
        </div>
      </div>
      
    </div>
  </div>
</form>

<?php include_once 'footer.php';?>
