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

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

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

          <div class="form-group">
            <label for="jak_icon"><?php echo $jkl["hd223"];?></label>
            <div class="input-group">
              <input type="text" name="jak_icon" class="form-control" value="<?php echo $JAK_FORM_DATA["icon"];?>">
              <div class="input-group-append">
                <span class="input-group-text">
                  <a href="https://fontawesome.com/v5/search" target="_blank"><i class="fa fa-link"></i></a>
                </span>
              </div>
            </div>
          </div>

          <div class="form-group">
            <label for="title"><?php echo $jkl["hd287"];?></label>
            <input type="text" name="tags" id="tags" class="form-control tagin" value="<?php echo jak_get_tags($opcacheid, "faqid", $page2);?>" data-placeholder="<?php echo $jkl['hd288'];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="order"><?php echo $jkl["g102"];?></label>
            <input type="number" name="order" id="order" class="form-control" value="<?php echo $JAK_FORM_DATA["dorder"];?>">
          </div>

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

          <div class="form-group">
            <select name="jak_catid" id="department" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl["g131"];?></option>
              <option value="0"<?php if ($JAK_FORM_DATA["catid"] == 0) echo ' selected="selected"';?>><?php echo $jkl["g105"];?></option>
              <?php if (isset($JAK_CATEGORIES) && is_array($JAK_CATEGORIES)) foreach($JAK_CATEGORIES as $z) { ?>

                <option value="<?php echo $z["id"];?>"<?php if ($JAK_FORM_DATA["catid"] == $z["id"]) echo ' selected="selected"';?>><?php echo $z["title"];?></option>

              <?php } ?>

            </select>
            <input type="hidden" name="jak_old_catid" value="<?php echo $JAK_FORM_DATA["catid"];?>">
          </div>

          <div class="form-group">
            <select name="jak_lang" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl["g22"];?></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["lang"] == $lf) { ?> selected="selected"<?php } ?>><?php echo ucwords($lf);?></option><?php } ?>
            </select>
          </div>

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

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

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

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

            </div>
          </div>

        </div>
      </div>

      <div class="form-group">
        <textarea name="content" id="content-editor" rows="5" class="form-control"><?php echo htmlspecialchars($JAK_FORM_DATA["content"]);?></textarea>
      </div>

    </div>
    <div class="card-footer">
      <a href="<?php echo JAK_rewrite::jakParseurl('faq');?>" 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';?>
