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

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

          <div class="form-group<?php if ($errors["e"]) echo " has-danger";?>">
            <label class="control-label" for="question"><?php echo $jkl["g269"];?></label>
            <input type="text" name="question" class="form-control" value="<?php echo $JAK_FORM_DATA["question"];?>">
            <small class="form-text text-muted">
              <?php echo $jkl["h22"];?>
            </small>
          </div>

          <div class="form-group<?php if ($errors["e1"]) echo " has-danger";?>">
            <label class="control-label" for="answer"><?php echo $jkl["g273"];?></label>
            <textarea name="answer" rows="5" class="form-control"><?php if (isset($_POST["answer"])) { echo $_POST["answer"]; } else { echo $JAK_FORM_DATA["answer"]; }?></textarea>
            <small class="form-text text-muted">
              <?php echo $jkl["h21"];?>
            </small>
          </div>

        </div>
        <div class="col-md-6">
          <div class="form-group">
            <label class="control-label" for="jak_widgetid"><?php echo $jkl["g291"];?></label>
            <select name="jak_widgetid[]" class="selectpicker col-12" data-live-search="true" multiple>
              <option value="0"<?php if ($JAK_FORM_DATA["widgetids"] == 0) { ?> selected="selected"<?php } ?>><?php echo $jkl["g105"];?></option>
              <?php if (isset($JAK_WIDGETS) && is_array($JAK_WIDGETS)) foreach($JAK_WIDGETS as $w) { ?>
                <option value="<?php echo $w["id"];?>"<?php if (in_array($w["id"], explode(',', $JAK_FORM_DATA["widgetids"]))) echo ' selected';?>><?php echo $w["title"];?></option>
                
              <?php } ?>
            </select>
            <small class="form-text text-muted">
              <?php echo $jkl["h6"];?>
            </small>
          </div>

          <div class="form-group">
            <label class="control-label" for="department"><?php echo $jkl["g131"];?></label>
            <select name="jak_depid" id="department" class="selectpicker col-12" data-live-search="true">
              <option value="0"<?php if ($JAK_FORM_DATA["depid"] == 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 ($JAK_FORM_DATA["depid"] == $z["id"]) echo ' selected="selected"';?>><?php echo $z["title"];?></option>
                
              <?php } ?>
              
            </select>
          </div>

          <div class="form-group">
            <label class="control-label" for="jak_lang"><?php echo $jkl["g22"];?></label>
            <select name="jak_lang" class="selectpicker col-12" data-live-search="true">
              <?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>
      </div>

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

</div>
</div>

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