<?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="row">
    <div class="col-md-8">
      <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["hd326"];?></h4>
         </div>
        <div class="card-body">

          <div class="form-group">
            <label for="title"><?php echo $jkl["g16"];?></label>
            <input type="text" name="jak_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">
            <p><label for="jak_class"><?php echo $jkl["m13"];?></label></p>
            <select name="jak_class" class="selectpicker col-12" data-live-search="true">
              <option value="secondary"<?php if ($JAK_FORM_DATA["class"] == "default") echo ' selected';?>>Default</option>
              <option value="primary"<?php if ($JAK_FORM_DATA["class"] == "primary") echo ' selected';?>>Primary</option>
              <option value="success"<?php if ($JAK_FORM_DATA["class"] == "success") echo ' selected';?>>Success</option>
              <option value="info"<?php if ($JAK_FORM_DATA["class"] == "info") echo ' selected';?>>Info</option>
              <option value="warning"<?php if ($JAK_FORM_DATA["class"] == "warning") echo ' selected';?>>Warning</option>
              <option value="danger"<?php if ($JAK_FORM_DATA["class"] == "danger") echo ' selected';?>>Danger</option>
              <option value="dark"<?php if ($JAK_FORM_DATA["class"] == "dark") echo ' selected';?>>Dark</option>
            </select>
          </div>

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

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

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

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

        </div>
        <div class="card-footer">
          <a href="<?php echo JAK_rewrite::jakParseurl('customfield', 'ticketstatus');?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
          <button type="submit" name="save" class="btn btn-primary"><?php echo $jkl["g38"];?></button>
        </div>
      </div>
    </div>
    <div class="col-md-4">
      <div class="card">
        <div class="card-header card-header-icon card-header-rose">
          <div class="card-icon">
            <i class="material-icons">language</i>
          </div>
          <h4 class="card-title "><?php echo $jkl["hd146"];?></h4>
        </div>
        <div class="card-body">

          <?php if (isset($lang_files) && is_array($lang_files)) foreach($lang_files as $lf) { ?>

            <?php $newtransl = array();
            if (isset($JAK_PRIO_TRANSLATION) && is_array($JAK_PRIO_TRANSLATION)) foreach($JAK_PRIO_TRANSLATION as $tr) {
              if ($tr['lang'] == $lf) {
                $newtransl = $tr;
              }
            }?>

            <div class="form-group">
              <label class="control-label" for="title_<?php echo $lf;?>"><?php echo strtoupper($lf).' - '.$jkl["g16"];?></label>
              <input type="text" name="title_<?php echo $lf;?>" id="title_<?php echo $lf;?>" class="form-control" value="<?php if (isset($newtransl['title'])) echo $newtransl['title'];?>">
            </div>

            <?php if (is_array($newtransl) && !empty($newtransl)) { ?>
              <div class="form-check form-check-inline">
                <label class="form-check-label">
                  <input class="form-check-input" type="checkbox" name="deltrans_<?php echo $lf;?>" value="<?php echo $lf;?>"> <?php echo $jkl["hd147"];?>
                  <span class="form-check-sign">
                    <span class="check"></span>
                  </span>
                </label>
              </div>
              <hr>
            <?php } } ?>
          </div>
          <div class="card-footer">
            <a href="<?php echo JAK_rewrite::jakParseurl('customfield', 'ticketstatus');?>" 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>
      </div>
    </div>
  </form>

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