<?php include_once APP_PATH.'template/business/tplblocks/header.php';?>

<?php if (!$searchfield) { ?>
<div class="container">
  <div class="row">
    <div class="col-md-12">
      <form class="jak_form pt-4" method="post" action="<?php echo JAK_rewrite::jakParseurl(JAK_SEARCH_URL);?>">
        <div class="row">
          <div class="col-md-12">
            <div class="card card-raised card-form-horizontal no-transition">
              <div class="card-body">
                <div class="row">
                  <div class="col-md-10">
                    <div class="form-group">
                      <input type="text" name="smart_search" id="smart_search" class="form-control" placeholder="<?php echo $jkl['hd'];?>" autocomplete="off">
                    </div>
                  </div>
                  <div class="col-md-2">
                    <button type="button" class="btn btn-danger btn-block btn-search"><i class="fa fa-search"></i> &nbsp; <?php echo $jkl['hd'];?></button>
                  </div>
                  <input type="hidden" name="search_now" value="1">
                </div>
              </div>
            </div>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<?php } ?>

<div class="container pt-3">
  <div class="row">
    <div class="col-md-8 ml-auto mr-auto">
      
      <?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 } ?>
      
    </div>
  </div>
</div>

<?php if (!empty($SearchInput)) { if (JAK_FAQ_A == 1 && isset($searchresult) && !empty($searchresult)) { ?>
  <div class="container pb-5">
    <ul class="list-group list-group-flush">
      <?php foreach ($searchresult as $s) {
        $faqparseurl = JAK_rewrite::jakParseurl(JAK_FAQ_URL, 'a', $s["id"], JAK_rewrite::jakCleanurl($s["title"]));
        ?>

        <li class="list-group-item"><a href="<?php echo $faqparseurl;?>"><strong><?php echo $s["title"];?></strong></a> <span class="badge badge-primary"><?php echo JAK_base::jakTimesince($s['time'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></span>
          <br>
          <?php echo jak_cut_text($s["content"], 200, '...');?> 
        </li>

      <?php } ?>
    </ul>
  </div>
<?php } else { if (JAK_FAQ_A == 1) { ?>
  <div class="container">
    <div class="col-12">
      <div class="alert alert-info">
        <?php echo $jkl['hd4'];?>
      </div>
    </div>
  </div>
<?php } } if (JAK_BLOG_A == 1 && isset($searchblog) && !empty($searchblog)) { ?>
<div class="container pb-3">
    <ul class="list-group list-group-flush">
      <?php foreach ($searchblog as $s) {
        $blogparseurl = JAK_rewrite::jakParseurl(JAK_BLOG_URL, 'a', $s["id"], JAK_rewrite::jakCleanurl($s["title"]));
        ?>

        <li class="list-group-item"><a href="<?php echo $blogparseurl;?>"><strong><?php echo $s["title"];?></strong></a> <span class="badge badge-success"><?php echo JAK_base::jakTimesince($s['time'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></span>
          <br>
          <?php echo jak_cut_text($s["content"], 200, '...');?> 
        </li>

      <?php } ?>
    </ul>
  </div>
<?php } else { if  (JAK_BLOG_A == 1) { ?>
  <div class="container">
    <div class="col-12">
      <div class="alert alert-info">
        <?php echo $jkl['hd166'];?>
      </div>
    </div>
  </div>
<?php } } if (JAK_TICKET_GUEST_WEB == 1 && isset($searchsupport) && !empty($searchsupport)) { ?>
<div class="container pb-3">
    <ul class="list-group list-group-flush">
      <?php foreach ($searchsupport as $s) {
        $supportparseurl = JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 't', $s["id"], JAK_rewrite::jakCleanurl($s["subject"]));
        ?>

        <li class="list-group-item"><a href="<?php echo $supportparseurl;?>"><strong><?php echo $s["subject"];?></strong></a> <span class="badge badge-info"><?php echo JAK_base::jakTimesince($s['time'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></span>
          <br>
          <?php echo jak_cut_text($s["content"], 200, '...');?> 
        </li>

      <?php } ?>
    </ul>
  </div>
<?php } else { if  (JAK_TICKET_GUEST_WEB == 1) { ?>
  <div class="container">
    <div class="col-12">
      <div class="alert alert-info">
        <?php echo $jkl['hd167'];?>
      </div>
    </div>
  </div>
<?php } } } else { ?>
  <div class="container">
    <div class="col-12">
      <div class="alert alert-info">
        <?php echo $jkl['hd5'];?>
      </div>
    </div>
  </div>
  <?php } include_once APP_PATH.'template/business/tplblocks/footer.php';?>
