<?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"];?>
  </div>
<?php } ?>

<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" enctype="multipart/form-data">
  <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["m16"];?></h4>
    </div>
    <div class="card-body">

      <div class="form-group">
        <label class="control-label" for="department"><?php echo $jkl["g16"];?></label>
        <select name="jak_depid" id="department" class="selectpicker col-12" data-live-search="true">
          <option value="0"<?php if (isset($JAK_FORM_DATA["department"]) && $JAK_FORM_DATA["department"] == 0) echo ' selected="selected"';?>><?php echo $jkl["g105"];?></option>
          <?php if (isset($JAK_DEPARTMENTS) && is_array($JAK_DEPARTMENTS)) foreach($JAK_DEPARTMENTS as $z) { ?>
            <option value="<?php echo $z["id"];?>"<?php if (isset($JAK_FORM_DATA["department"]) && $JAK_FORM_DATA["department"] == $z["id"]) echo ' selected="selected"';?>><?php echo $z["title"];?></option>
          <?php } ?>
        </select>
      </div>

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

      <?php if ($page1 != 'support') { ?>
      <div class="form-group">
        <label for="short_code"><?php echo $jkl["g349"];?></label>
        <input type="text" name="short_code" id="short_code" class="form-control" value="<?php echo $JAK_FORM_DATA["short_code"];?>">
      </div>
      <?php } ?>

      <div class="form-group">
        <textarea name="response" id="content-editor" rows="5" class="form-control<?php if (isset($errors["e1"])) echo " is-invalid";?>"><?php echo $JAK_FORM_DATA["message"];?></textarea>
        <small class="form-text text-muted">
          <?php echo $jkl["h13"];?>
        </small>
      </div>

  </div>
  <div class="card-footer">
    <a href="<?php echo ($page1 != 'support' ? JAK_rewrite::jakParseurl('response') : JAK_rewrite::jakParseurl('response', 'support'));?>" 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>

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