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

          <div class="form-group">
            <label class="control-label" for="jak_icon"><?php echo $jkl["hd223"];?></label>
            <div class="input-group">
              <input type="text" name="jak_icon" class="form-control" value="<?php if (isset($_REQUEST["jak_icon"]) && !empty($_REQUEST["jak_icon"])) echo $_REQUEST["jak_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">
            <p><label class="control-label" for="title"><?php echo $jkl["hd287"];?></label></p>
            <input type="text" name="tags" id="tags" class="form-control tagin" value="<?php if (isset($_REQUEST["tags"])) echo $_REQUEST["tags"];?>" data-placeholder="<?php echo $jkl['hd288'];?>">
          </div>

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

          <div class="form-group">
            <select name="jak_catid" id="catid" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl["hd24"];?></option>
              <option value="0"<?php if (isset($_POST["jak_catid"]) && $_POST["jak_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 (isset($_POST["jak_catid"]) && $_POST["jak_catid"] == $z["id"]) echo ' selected="selected"';?>><?php echo $z["title"];?></option>
                
              <?php } ?>
              
            </select>
          </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 (isset($_POST["jak_lang"]) && $_POST["jak_lang"] == $lf) echo ' selected'; elseif (JAK_LANG == $lf) echo ' selected';?>><?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 (!isset($_POST["socialbutton"]) || isset($_POST["socialbutton"]) && $_POST["socialbutton"] == 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="socialbutton" value="0"<?php if (isset($_POST["socialbutton"]) && $_POST["socialbutton"] == 0) echo ' checked';?>> <?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 (!isset($_POST["shownewticket"]) || isset($_POST["shownewticket"]) && $_POST["shownewticket"] == 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="shownewticket" value="0"<?php if (isset($_POST["shownewticket"]) && $_POST["shownewticket"] == 0) echo ' checked';?>> <?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 if (isset($_POST["content"])) echo $_POST["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';?>
