<?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["hd30"];?></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="previmg"><?php echo $jkl["hd34"];?></label>
            <div class="input-group">
              <input type="text" name="previmg" id="previmg" class="form-control" value="<?php if (isset($_POST["previmg"])) echo $_POST["previmg"];?>">
              <span class="input-group-btn">
                <a class="btn btn-rose btn-round btn-fab" data-toggle="modal" data-target="#jakFM" type="button" href="javascript:void(0)"><i class="far fa-file-archive"></i></a>
              </span>
            </div><!-- /input-group -->
          </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_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="comments"><?php echo $jkl["hd29"];?></label>
                <div class="form-check">
                  <label class="form-check-label">
                    <input class="form-check-input" type="radio" name="comments" value="1"<?php if (!isset($_POST["comments"]) || isset($_POST["comments"]) && $_POST["comments"] == 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="comments" value="0"<?php if (isset($_POST["comments"]) && $_POST["comments"] == 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="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) { ?> 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 (isset($_POST["socialbutton"]) && $_POST["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="showdate"><?php echo $jkl["hd32"];?></label>
                <div class="form-check">
                  <label class="form-check-label">
                    <input class="form-check-input" type="radio" name="showdate" value="1"<?php if (!isset($_POST["showdate"]) || isset($_POST["showdate"]) && $_POST["showdate"] == 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="showdate" value="0"<?php if (isset($_POST["showdate"]) && $_POST["showdate"] == 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="membersonly"><?php echo $jkl["hd36"];?></label>
                <div class="form-check">
                  <label class="form-check-label">
                    <input class="form-check-input" type="radio" name="membersonly" value="1"<?php if (isset($_POST["membersonly"]) && $_POST["membersonly"] == 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="membersonly" value="0"<?php if (!isset($_POST["membersonly"]) || isset($_POST["membersonly"]) && $_POST["membersonly"] == 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 if (isset($_POST["content"])) echo $_POST["content"];?></textarea>
      </div>

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