<?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-3">
    <div class="card-columns">
      <?php foreach ($searchresult as $s) {
        $faqparseurl = JAK_rewrite::jakParseurl(JAK_FAQ_URL, 'a', $s["id"], JAK_rewrite::jakCleanurl($s["title"]));
        ?>

        <div class="card text-center" style="width: 20rem;">
          <div class="card-body">
            <span class="badge badge-primary"><?php echo JAK_base::jakTimesince($s['time'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></span>
            <h4 class="card-title"><?php echo $s["title"];?></h4>
            <p class="card-text"><?php echo jak_cut_text($s["content"], 200, '...');?></p>
            <a href="<?php echo $faqparseurl;?>" class="btn btn-primary"><?php echo $jkl["hd1"];?></a>
          </div>
        </div>

      <?php } ?>
    </div>
  </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">
    <div class="card-columns">
      <?php foreach ($searchblog as $s) {
        $blogparseurl = JAK_rewrite::jakParseurl(JAK_BLOG_URL, 'a', $s["id"], JAK_rewrite::jakCleanurl($s["title"]));
        ?>

        <div class="card text-center" style="width: 20rem;">
          <div class="card-body">
            <span class="badge badge-primary"><?php echo JAK_base::jakTimesince($s['time'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></span>
            <h4 class="card-title"><?php echo $s["title"];?></h4>
            <p class="card-text"><?php echo jak_cut_text($s["content"], 200, '...');?></p>
            <a href="<?php echo $blogparseurl;?>" class="btn btn-primary"><?php echo $jkl["hd1"];?></a>
          </div>
        </div>

      <?php } ?>
    </div>
  </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">
    <div class="card-columns">
      <?php foreach ($searchsupport as $s) {
        $supportparseurl = JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 't', $s["id"], JAK_rewrite::jakCleanurl($s["subject"]));
        ?>

        <div class="card text-center" style="width: 20rem;">
          <div class="card-body">
            <span class="badge badge-primary"><?php echo JAK_base::jakTimesince($s['time'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></span>
            <h4 class="card-title"><?php echo $s["subject"];?></h4>
            <p class="card-text"><?php echo jak_cut_text($s["content"], 200, '...');?></p>
            <a href="<?php echo $supportparseurl;?>" class="btn btn-primary"><?php echo $jkl["hd1"];?></a>
          </div>
        </div>

      <?php } ?>
    </div>
  </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';?>
