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

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

    <ul class="nav nav-pills nav-pills-warning">
      <li class="nav-item">
        <a class="nav-link active" href="<?php echo JAK_rewrite::jakParseurl('answers');?>"><?php echo $jkl["m20"];?></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="<?php echo JAK_rewrite::jakParseurl('answers', 'cms');?>"><?php echo $jkl["hd126"];?></a>
      </li>
    </ul>
    <hr>
  </div>
</div>

<div class="row">
  <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["g22"];?></h4>
      </div>
      <div class="card-body">
        <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">

          <div class="form-group">
            <select name="jak_lang_pack" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl["g22"];?></option>
              <?php if (isset($unique_lang) && is_array($unique_lang)) foreach($unique_lang as $lfu) { ?><option value="<?php echo $lfu;?>"><?php echo ucwords($lfu);?></option><?php } ?>
            </select>
          </div>

          <button type="submit" name="create_language_pack" class="btn btn-primary btn-block"><?php echo $jkl["g326"];?></button>
        </form>
      </div>
    </div>

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

        
        <?php if ($errors) { ?>
          <div class="alert alert-danger"><?php if (isset($errors["e"])) echo $errors["e"];
          if (isset($errors["e1"])) echo $errors["e1"];
          if (isset($errors["e2"])) echo $errors["e2"];?></div>
        <?php } ?>
        
        <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
          
          <div class="form-group<?php if (isset($errors["e"])) echo " has-danger";?>">
            <label class="control-label" for="title"><?php echo $jkl["g16"];?></label>
            <input type="text" name="title" class="form-control" value="<?php if (isset($_POST["title"])) echo $_POST["title"];?>">
          </div>
          
          <div class="form-group">
            <select name="jak_depid" id="department" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl["g131"];?></option>
              <option value="0"><?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 echo $z["title"];?></option>

              <?php } ?>

            </select>
            <a href="javascript:void(0)" class="btn btn-info btn-sm btn-round btn-fab" onclick="md.showNotification('add_alert', '<?php echo addslashes($jkl["hd133"]);?>', 'info', 'top', 'center')"><i class="material-icons">help</i></a>
          </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 (JAK_LANG == $lf) { ?> selected="selected"<?php } ?>><?php echo ucwords($lf);?></option><?php } ?>
            </select>
          </div>
          
          <div class="form-group">
            <select name="jak_msgtype" id="jak_msgtype" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl["g250"];?></option>
              <option value="1" checked> <?php echo $jkl["g246"];?></option>
              <option value="2"> <?php echo $jkl["g247"];?></option>
              <option value="3"> <?php echo $jkl["g248"];?></option>
              <option value="4"> <?php echo $jkl["g249"];?></option>
              <option value="5"> <?php echo $jkl["g255"];?></option>
              <option value="6"> <?php echo $jkl["g259"];?></option>
              <option value="7"> <?php echo $jkl["g260"];?></option>
              <option value="24"> <?php echo $jkl["hd209"];?></option>
              <option value="8"> <?php echo $jkl["g261"];?></option>
              <option value="9"> <?php echo $jkl["g262"];?></option>
              <option value="10"> <?php echo $jkl["g263"];?></option>
              <option value="11"> <?php echo $jkl["g307"];?></option>
              <option value="12"> <?php echo $jkl["g308"];?></option>
              <option value="13"> <?php echo $jkl["g309"];?></option>
              <option value="14"> <?php echo $jkl["hd113"];?></option>
              <option value="15"> <?php echo $jkl["hd114"];?></option>
              <option value="16"> <?php echo $jkl["hd115"];?></option>
              <option value="17"> <?php echo $jkl["hd116"];?></option>
              <option value="18"> <?php echo $jkl["hd117"];?></option>
              <option value="19"> <?php echo $jkl["hd121"];?></option>
              <option value="20"> <?php echo $jkl["hd122"];?></option>
              <option value="21"> <?php echo $jkl["hd123"];?></option>
              <option value="22"> <?php echo $jkl["hd124"];?></option>
              <option value="23"> <?php echo $jkl["hd125"];?></option>
              <option value="25"> <?php echo $jkl["g85"];?></option>
              <option value="26"> <?php echo $jkl["g328"];?></option>
              <option value="27"> <?php echo $jkl["g329"];?></option>
              <option value="28"> <?php echo $jkl["g350"];?></option>
              <option value="29"> <?php echo $jkl["g358"];?></option>
              <option value="30"> <?php echo $jkl["g359"];?></option>
            </select>
          </div>
          
          <div class="form-group">
            <select name="jak_fireup" id="fireup" class="selectpicker col-12" data-live-search="true">
              <option disabled><?php echo $jkl["g251"];?></option>
              <option value="15">15 <?php echo $jkl["g196"];?></option>
              <option value="30">30 <?php echo $jkl["g196"];?></option>
              <option value="60">1 <?php echo $jkl["g197"];?></option>
              <option value="120">2 <?php echo $jkl["g197"];?></option>
              <option value="180">3 <?php echo $jkl["g197"];?></option>
              <option value="240">4 <?php echo $jkl["g197"];?></option>
              <option value="300">5 <?php echo $jkl["g197"];?></option>
              <option value="360">6 <?php echo $jkl["g197"];?></option>
              <option value="420">7 <?php echo $jkl["g197"];?></option>
              <option value="480">8 <?php echo $jkl["g197"];?></option>
              <option value="540">9 <?php echo $jkl["g197"];?></option>
              <option value="600">10 <?php echo $jkl["g197"];?></option>
              <option value="900">15 <?php echo $jkl["g197"];?></option>
              <option value="1200">20 <?php echo $jkl["g197"];?></option>
            </select>
            <a href="javascript:void(0)" class="btn btn-info btn-sm btn-round btn-fab" onclick="md.showNotification('add_alert', '<?php echo addslashes($jkl["h17"]);?>', 'info', 'top', 'center')"><i class="material-icons">help</i></a>
          </div>
          
          <div class="form-group<?php if (isset($errors["e1"])) echo " has-danger";?>">
            <label class="control-label" for="answer"><?php echo $jkl["g245"];?></label>
            <textarea name="answer" id="answer" class="form-control" rows="3"><?php if (isset($_POST["answer"])) echo $_POST["answer"];?></textarea>
            <a href="javascript:void(0)" class="btn btn-info btn-sm btn-round btn-fab" onclick="md.showNotification('add_alert', '<?php echo addslashes($jkl["h13"]);?>', 'info', 'top', 'center')"><i class="material-icons">help</i></a>
          </div>
          
          <div class="card-footer">
            <button type="submit" name="insert_answer" class="btn btn-primary btn-block"><?php echo $jkl["g38"];?></button>
          </div>

        </form>
      </div>

    </div>
  </div>
  <div class="col-md-8">
    <div class="card">
      <div class="card-header card-header-icon card-header-rose">
        <div class="card-icon">
          <i class="material-icons">list</i>
        </div>
        <h4 class="card-title "><?php echo $jkl["g243"];?></h4>
      </div>
      <div class="card-body">

        <?php if (isset($only_used_lang) && count($only_used_lang) > 1) { ?>

          <p>
            <ul class="nav nav-pills nav-pills-primary">
              <?php foreach ($only_used_lang as $ul) { ?>
                <li class="nav-item">
                  <a class="nav-link<?php echo ($ul == $page1 ? ' active' : (empty($page1) && $ul == JAK_LANG ? ' active' : ''));?>" href="<?php echo JAK_rewrite::jakParseurl('answers', ($ul == JAK_LANG ? '' : $ul));?>"><?php echo $ul;?></a>
                </li>
              <?php } ?>
            </ul>
          </p>

        <?php } ?>

        <div class="table-responsive">
          <table class="table table-striped">
            <thead>
              <tr>
                <th>#</th>
                <th><?php echo $jkl["g16"];?></th>
                <th><?php echo $jkl["g22"];?></th>
                <th><?php echo $jkl["g47"];?></th>
                <th><?php echo $jkl["g48"];?></th>
              </tr>
            </thead>
            <?php if (isset($ANSWERS_ALL) && is_array($ANSWERS_ALL)) foreach($ANSWERS_ALL as $v) { ?>
              <tr>
                <td><?php echo $v["id"];?></td>
                <td class="title"><a href="<?php echo JAK_rewrite::jakParseurl('answers', 'edit', $v["id"]);?>"><?php echo $v["title"];?></a></td>
                <td class="desc"><?php echo $v["lang"];?></td>
                <td><a class="btn btn-default btn-sm" href="<?php echo JAK_rewrite::jakParseurl('answers', 'edit', $v["id"]);?>"><i class="fa fa-pencil"></i></a></td>
                <td><a class="btn btn-danger btn-sm btn-confirm" href="<?php echo JAK_rewrite::jakParseurl('answers', 'delete', $v["id"]);?>" data-title="<?php echo addslashes($jkl["g48"]);?>" data-text="<?php echo addslashes($jkl["e31"]);?>" data-type="warning" data-okbtn="<?php echo addslashes($jkl["g279"]);?>" data-cbtn="<?php echo addslashes($jkl["g280"]);?>"><i class="fa fa-trash"></i></a></td>
              </tr>
            <?php } ?>
          </table>
        </div>

      </div>
    </div>
  </div>    
</div>

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