<?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["hd31"];?></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 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 echo $JAK_FORM_DATA["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="contro-label" for="title"><?php echo $jkl["hd287"];?></label></p>
            <input type="text" name="tags" id="tags" class="form-control tagin" value="<?php echo jak_get_tags($opcacheid, "blogid", $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" min="1" name="order" id="order" class="form-control" value="<?php echo $JAK_FORM_DATA["dorder"];?>">
          </div>

          <div class="form-group">
            <label class="control-label" for="hits"><?php echo $jkl["hd42"];?></label>
            <input type="number" min="0" name="hits" id="hits" class="form-control" value="<?php echo $JAK_FORM_DATA["hits"];?>">
          </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 ($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="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 ($JAK_FORM_DATA["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 ($JAK_FORM_DATA["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 ($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="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 ($JAK_FORM_DATA["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 ($JAK_FORM_DATA["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 ($JAK_FORM_DATA["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 ($JAK_FORM_DATA["membersonly"] == 0) { ?> checked="checked"<?php } ?>> <?php echo $jkl["g18"];?>
                    <span class="circle">
                      <span class="check"></span>
                    </span>
                  </label>
                </div>
              </div>
            </div>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="updatetime" value="1"> <?php echo $jkl["hd39"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </div>

          <div class="form-check form-check-inline">
            <label class="form-check-label">
              <input class="form-check-input" type="checkbox" name="delcom" value="1"> <?php echo $jkl["hd40"];?>
              <span class="form-check-sign">
                <span class="check"></span>
              </span>
            </label>
          </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('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';?>
