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

<?php if ($errors) { ?>
  <div class="alert alert-danger"><?php if (isset($errors) && !empty($errors)) foreach ($errors as $e) { echo $e; }?></div>
<?php } if ($success) { ?>
  <div class="alert alert-success"><?php echo $success["e"];?></div>
<?php } ?>

<div class="row">
  <div class="col-md-12">

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

      <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["hd45"];?></h4>
        </div>
        <div class="card-body">

          <div class="form-group">
            <select name="jak_depid" id="jak_depid" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl['g131'];?></option>
              <?php foreach ($JAK_DEPARTMENTS as $p) { ;?><option value="<?php echo $p["id"];?>"<?php if (isset($JAK_FORM_DATA['depid']) && $JAK_FORM_DATA['depid'] == $p["id"]) { ?> selected="selected"<?php } ?>><?php echo $p["title"];?></option><?php } ?>
            </select>
          </div>

          <div class="form-group">
            <label class="control-label" for="mailbox" class="sr-only"><?php echo $jkl['hd48'];?></label>
            <input type="text" name="mailbox" class="form-control<?php if (isset($errors["e"])) echo " is-invalid";?>" value="<?php echo $JAK_FORM_DATA["mailbox"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="usrphpimap" class="sr-only"><?php echo $jkl['u2'];?></label>
            <input type="text" name="usrphpimap" class="form-control<?php if (isset($errors["e1"])) echo " is-invalid";?>" value="<?php echo $JAK_FORM_DATA["username"];?>" autocomplete="off">
          </div>

          <div class="form-group">
            <label class="control-label" for="passphpimap" class="sr-only"><?php echo $jkl['u4'];?></label>
            <input type="password" name="passphpimap" class="form-control" value="<?php echo $JAK_FORM_DATA["password"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="encryption" class="sr-only"><?php echo $jkl['hd49'];?></label>
            <input type="text" name="encryption" class="form-control" value="<?php echo $JAK_FORM_DATA["encryption"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="inbox" class="sr-only"><?php echo $jkl['hd50'];?></label>
            <input type="text" name="inbox" class="form-control" value="<?php echo $JAK_FORM_DATA["scanfolder"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="email" class="sr-only"><?php echo $jkl['u1'];?></label>
            <input type="text" name="email" class="form-control<?php if (isset($errors["e2"])) echo " is-invalid";?>" value="<?php echo $JAK_FORM_DATA["emailanswer"];?>" autocomplete="off">
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_msgdel"><?php echo $jkl["hd51"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_msgdel" value="1"<?php if ($JAK_FORM_DATA["msgdel"] == 1) { ?> checked="checked"<?php } ?>> <?php echo $jkl["hd52"];?>
                <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_msgdel" value="0"<?php if ($JAK_FORM_DATA["msgdel"] == 0) { ?> checked="checked"<?php } ?>> <?php echo $jkl["hd53"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_attachemail"><?php echo $jkl["hd284"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_attachemail" value="1"<?php if ($JAK_FORM_DATA["attachemail"] == 1) { ?> checked="checked"<?php } ?>> <?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_attachemail" value="0"<?php if ($JAK_FORM_DATA["attachemail"] == 0) { ?> checked="checked"<?php } ?>> <?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_takeattach"><?php echo $jkl["hd285"];?></label>
            <div class="form-check">
              <label class="form-check-label">
                <input class="form-check-input" type="radio" name="jak_takeattach" value="1"<?php if ($JAK_FORM_DATA["takeattach"] == 1) { ?> checked="checked"<?php } ?>> <?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_takeattach" value="0"<?php if ($JAK_FORM_DATA["takeattach"] == 0) { ?> checked="checked"<?php } ?>> <?php echo $jkl["g18"];?>
                <span class="circle">
                  <span class="check"></span>
                </span>
              </label>
            </div>
          </div>

          <div class="form-group">
            <button type="submit" name="testMail" class="btn btn-success" id="sendTM"><i id="loader" class="fa fa-spinner fa-pulse"></i> <?php echo $jkl["hd55"];?></button>
          </div>
        </div>
        <div class="card-footer">
          <a href="<?php echo JAK_rewrite::jakParseurl('settings', 'phpimap');?>" 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>
    </form>
  </div>
</div>

<?php include_once APP_PATH.JAK_OPERATOR_LOC.'/template/footer.php';?>
