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

<?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">
    <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">add</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["g137"];?></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 if (isset($_POST["jak_name"])) echo $_POST["jak_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 if (isset($_POST["jak_email"])) echo $_POST["jak_email"];?>">
          </div>

          <div class="form-group<?php if (isset($errors["e3"]) || isset($errors["e4"])) echo " has-danger";?>">
            <label for="username"><?php echo $jkl["u2"];?></label>
            <input type="text" name="jak_username" id="username" class="form-control" value="<?php if (isset($_POST["jak_username"])) echo $_POST["jak_username"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_uolist"><?php echo $jkl["u43"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_uolist" value="1" 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_uolist" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_access"><?php echo $jkl["u3"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_access" value="1" 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_access" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_responses"><?php echo $jkl["u6"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_responses" value="1" 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_responses" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_files"><?php echo $jkl["u7"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_files" value="1" 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_files" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_chat"><?php echo $jkl["u13"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_chat" value="1" 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_chat" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_chatpublic"><?php echo $jkl["u41"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_chatpublic" value="1" 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_chatpublic" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_chatlist"><?php echo $jkl["g137"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_chatlist" value="1" 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_chatlist" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_transfer"><?php echo $jkl["u45"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_transfer" value="1" 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_transfer" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_latency"><?php echo $jkl["g239"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_latency" value="3000" checked> <?php echo $jkl["g240"];?>
                <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_latency" value="5000"> <?php echo $jkl["g241"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_sound"><?php echo $jkl["g2"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_sound" value="1" 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_sound" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_ringing"><?php echo $jkl["g200"];?></label>
            <select name="jak_ringing" class="selectpicker col-12" data-live-search="true">
              <?php for ($i = 1; $i < 30; $i++) {
                echo '<option value="'.$i.'">'.$i.'</option>';
              } ?>
            </select>
          </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 echo ucwords($lf);?></option><?php } ?>
            </select>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_navside"><?php echo $jkl["u57"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_navside" value="1" 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_navside" value="0"> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

        </div>
        <div class="card-footer">
          <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 (isset($_POST["jak_depid"]) && $_POST["jak_depid"] == '0') { ?> selected="selected"<?php } ?>><?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 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 (isset($_POST["jak_depids"]) && $_POST["jak_depids"] == '0') { ?> selected="selected"<?php } ?>><?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 echo $d["title"];?></option>

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

        </div>
      </div>

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

          <div class="form-group">
            <label class="control-label" for="jak_inv"><?php echo $jkl["u12"];?></label>
            <input type="text" name="jak_inv" class="form-control" value="<?php if (isset($_POST["jak_inv"])) echo $_POST["jak_inv"]; ?>">
          </div>
        </div>
      </div>

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

        </div>
        <div class="card-footer">
          <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">accessibility_new</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["u29"];?></h4>
        </div>
        <div class="card-body">

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="leads"<?php if (isset($_POST["jak_roles"]) && in_array("leads", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u30"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="leads_all"<?php if (isset($_POST["jak_roles"]) && in_array("leads_all", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u30"].' ('.$jkl["g105"].')';?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="off_all"<?php if (isset($_POST["jak_roles"]) && in_array("off_all", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["g33"].' ('.$jkl["g105"].')';?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="ochat"<?php if (isset($_POST["jak_roles"]) && in_array("ochat", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u31"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="ochat_all"<?php if (isset($_POST["jak_roles"]) && in_array("ochat_all", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u31"].' ('.$jkl["g105"].')';?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="support"<?php if (isset($_POST["jak_roles"]) && in_array("support", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["hd"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="faq"<?php if (isset($_POST["jak_roles"]) && in_array("faq", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["hd1"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="blog"<?php if (isset($_POST["jak_roles"]) && in_array("blog", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["hd13"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="statistic"<?php if (isset($_POST["jak_roles"]) && in_array("statistic", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u32"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="statistic_all"<?php if (isset($_POST["jak_roles"]) && in_array("statistic_all", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u32"].' ('.$jkl["g105"].')';?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="files"<?php if (isset($_POST["jak_roles"]) && in_array("files", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u33"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="proactive"<?php if (isset($_POST["jak_roles"]) && in_array("proactive", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u34"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="usrmanage"<?php if (isset($_POST["jak_roles"]) && in_array("usrmanage", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u42"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="client"<?php if (isset($_POST["jak_roles"]) && in_array("client", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["hd14"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="billing"<?php if (isset($_POST["jak_roles"]) && in_array("billing", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["hd22"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="responses"<?php if (isset($_POST["jak_roles"]) && in_array("responses", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u35"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="departments"<?php if (isset($_POST["jak_roles"]) && in_array("departments", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u36"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="settings"<?php if (isset($_POST["jak_roles"]) && in_array("settings", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u37"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="answers"<?php if (isset($_POST["jak_roles"]) && in_array("answers", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["u44"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="widget"<?php if (isset($_POST["jak_roles"]) && in_array("widget", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["m26"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="groupchat"<?php if (isset($_POST["jak_roles"]) && in_array("groupchat", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["m29"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="blacklist"<?php if (isset($_POST["jak_roles"]) && in_array("blacklist", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["m27"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="jak_roles[]" value="blocklist"<?php if (isset($_POST["jak_roles"]) && in_array("blocklist", $_POST["jak_roles"])) { ?> checked="checked"<?php } ?>> <?php echo $jkl["g97"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

        </div>
        <div class="card-footer">
          <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';?>
