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

<div class="section bg-gradient-3">
  <div class="container">

    <div class="card no-transition">
      <div class="card-body">
        <div class="row">

          <div class="col-md-9 text-center text-md-left">
            <div class="row">

            </div>
            <span class="pl-0 float-left ticket-bg text-danger d-none d-sm-block"><?php echo sprintf($jkl['hd91'], $page2);?></span>
            <a href="<?php echo JAK_rewrite::jakParseurl(JAK_SUPPORT_URL);?>" class="btn btn-round btn-info btn-just-icon ticket-icon-pulse" data-toggle="tooltip" title="<?php echo $jkl['hd141'];?>" ><i class="fa fa-arrow-up"></i></a>
            <?php if (isset($JAK_NAV_PREV) && !empty($JAK_NAV_PREV)) { ?>
              <a href="<?php echo $JAK_NAV_PREV;?>" class="btn btn-round btn-primary btn-just-icon ticket-icon-pulse" data-toggle="tooltip" title="<?php echo $JAK_NAV_PREV_TITLE;?>" ><i class="fa fa-arrow-left"></i></a>
            <?php } if (isset($JAK_NAV_NEXT) && !empty($JAK_NAV_NEXT)) { ?>
              <a href="<?php echo $JAK_NAV_NEXT;?>" class="btn btn-round btn-primary btn-just-icon ticket-icon-pulse" data-toggle="tooltip" title="<?php echo $JAK_NAV_NEXT_TITLE;?>" ><i class="fa fa-arrow-right"></i></a>
            <?php } if ($ticketwrite && $ticketopen) { ?>
              <a href="#reply" class="btn btn-success btn-just-icon ticket-icon-pulse" data-toggle="tooltip" title="<?php echo $jkl['hd67'];?>"><i class="fa fa-paper-plane"></i></a>
            <?php } if (JAK_USERISLOGGED || JAK_TICKET_GUEST_WEB) { ?>
              <a href="<?php echo (JAK_USERID ? JAK_rewrite::jakParseurl(JAK_OPERATOR_LOC, 'support', 'new') : JAK_rewrite::jakParseurl(JAK_SUPPORT_URL, 'n'));?>" class="btn btn-danger btn-just-icon ticket-icon-pulse" data-toggle="tooltip" title="<?php echo $jkl['hd47'];?>"><i class="fa fa-ticket-alt"></i></a>
            <?php } ?>
          </div>

          <div class="col-md-3 d-none d-sm-block">
            <div class="row float-right pr-2">
              <a href="mailto:?subject=<?php echo $JAK_FORM_DATA["title"];?>&amp;body=<?php echo urlencode(JAK_rewrite::jakParseurl(JAK_BLOG_URL, 'a', $page2, $page3))?>" class="btn btn-just-icon btn-border btn-email"><i class="fa fa-envelope"></i></a>&nbsp;
              <a href="whatsapp://send?text=<?php echo $JAK_FORM_DATA["title"];?>%20<?php echo urlencode(JAK_rewrite::jakParseurl(JAK_BLOG_URL, 'a', $page2, $page3))?>" class="btn btn-just-icon btn-border btn-whatsapp"><i class="fab fa-whatsapp"></i></a>&nbsp;
              <a href="https://twitter.com/intent/tweet/?text=<?php echo urlencode($JAK_FORM_DATA["title"]);?>&amp;url=<?php echo urlencode(JAK_rewrite::jakParseurl(JAK_BLOG_URL, 'a', $page2, $page3))?>" target="_blank" class="btn btn-just-icon btn-border btn-twitter"><i class="fab fa-twitter"></i></a>&nbsp;
              <a href="https://www.facebook.com/sharer/sharer.php?href=<?php echo urlencode(JAK_rewrite::jakParseurl(JAK_BLOG_URL, 'a', $page2, $page3))?>&t=<?php echo $JAK_FORM_DATA["title"];?>" class="btn btn-just-icon btn-border btn-facebook"><i class="fab fa-facebook"></i></a>
            </div>
          </div>

        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-8">

        <ul class="cbp_tmtimeline">
          <li>
            <div class="cbp_tmlabel">
              <div class="media-body">
                <h2 class="media-heading"><?php echo $JAK_FORM_DATA["title"];?></h5>
                  <hr>
                  <?php echo $JAK_FORM_DATA["content"];?>
                  <div class="media-footer">

                    <a href="javascript:void(0)" class="btn btn-link">
                      <i class="fa fa-user" aria-hidden="true"></i> <?php echo $JAK_FORM_DATA["name"];?>
                    </a>

                    <button type="button" class="btn btn-link btn-round"><i class="fa fa-clock"></i> <?php echo JAK_base::jakTimesince($JAK_FORM_DATA['initiated'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></button>

                  </div>
                </div>
              </div>
              <div class="cbp_tmicon bg-info d-none d-sm-block"><i class="fas fa-ticket-alt"></i></div>
            </li>
            <?php if (isset($JAK_ANSWER_DATA) && !empty($JAK_ANSWER_DATA)) $numItems = count($JAK_ANSWER_DATA); $i = 0; foreach ($JAK_ANSWER_DATA as $a) { ?>
              <li>
                <div class="d-none d-sm-block cbp_tmicon<?php echo ($a["file"] ? '  bg-orange' : ($a["oname"] ? ' bg-green' : ' bg-info'));?>"> <i class="fa fa-<?php echo ($a["file"] ? 'file-archive' : ($a["oname"] ? 'life-ring' : 'user'));?>"></i></div>
                <div class="cbp_tmlabel">

                  <?php if ($a["file"] == 1 && !empty($targetPathTA)) { ?>
                    <div id="file-delete<?php echo $a["id"];?>"><?php echo sprintf($jkl['hd163'], '<a href="'.BASE_URL.'_showfile.php?i='.jak_single_file_encrypt($targetPathTA, $a["content"], $opcacheid, $page2).'" target="_blank" class="btn btn-warning btn-sm">'.substr($a["content"], 17).'</a>');?></div>
                  <?php } else { ?>
                    <div id="edit-content<?php echo $a["id"];?>"><?php echo $a["content"];?></div>
                  <?php } ?>

                  <div class="media-footer">
                    <a href="javascript:void(0)" class="btn btn-success btn-link">
                      <i class="fa fa-user" aria-hidden="true"></i> <?php echo ($a["cname"] ? $a["cname"] : $a["oname"]);?>
                    </a>
                    <button type="button" class="btn btn-link btn-round"><i class="fa fa-clock"></i> <?php echo JAK_base::jakTimesince($a["sent"], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></button>
                    <?php if ((++$i === $numItems && JAK_CLIENTID && $a['cid'] == JAK_CLIENTID && $a["sent"] > $mino && $a["file"] == 0) || (JAK_USERID && jak_get_access("support", $jakuser->getVar("permissions"), JAK_SUPERADMINACCESS)) && $a["sent"] > $mino && $a["file"] == 0) { $edit_last = true; $last_post_id = $a["id"];?> <a href="javascript:void(0)" class="btn btn-link" onclick="edit_post(<?php echo $a["id"];?>)"><i class="fa fa-edit"></i> <?php echo $jkl['hd66'];?></a>
                  <?php } ?>
                </div>
              </div>
            </li>
          <?php } if ($ticketwrite && $ticketopen) { ?>
            <li>
              <div class="cbp_tmicon bg-gray d-none d-sm-block" id="reply"> <i class="fa fa-paper-plane"></i></div>
              <div class="cbp_tmlabel">

                <?php if ($errors) { ?>
                  <div class="alert alert-danger">
                    <?php if (isset($errors["e"])) echo $errors["e"];?>
                  </div>
                <?php } ?>

                <form method="post" class="jak_form" action="<?php echo $_SERVER['REQUEST_URI'];?>">
                  <?php if ($edit_last) { ?>
                    <a href="javascript:void(0)" class="btn btn-info" onclick="edit_post(<?php echo $last_post_id;?>)"><i class="fa fa-edit"></i> <?php echo $jkl['hd134'];?></a>
                  <?php } ?>
                  <div class="form-group show_editor"<?php if ($edit_last) echo ' style="display:none;"';?>>
                    <label for="content-editor"><?php echo $jkl['hd90'];?></label>
                    <textarea name="content" id="content-editor" rows="5" class="form-control"><?php if (isset($_REQUEST["content"]) && !empty($_REQUEST["content"])) { echo $_REQUEST["content"]; } elseif (isset($JAK_EDIT_CONTENT) && !empty($JAK_EDIT_CONTENT)) { echo $JAK_EDIT_CONTENT;}?></textarea>
                  </div>

                  <?php if ($uploadactive) { ?>
                    <p><?php echo $jkl['hd117'];?></p>
                    <div id="share-attachments" class="dropzone upload-ticket"></div>
                    <span class="text-muted"><small><?php echo sprintf($jkl['hd168'], JAK_ALLOWED_FILES);?></small></span>
                    <div class="clearfix"></div>
                  <?php } ?>

                  <div class="show_editor"<?php if ($edit_last) echo ' style="display:none;"';?>>
                    <br>
                    <button type="submit" class="btn btn-success btn-block" id="sendTM"><?php echo $jkl['g11'];?> <i id="loader" class="fa fa-spinner fa-pulse"></i></button>
                  </div>
                  <input type="hidden" name="action" value="send_answer">
                  <input type="hidden" name="editpost" id="edit-post">

                </div>
              </li>
            <?php } ?>
          </ul>
        </div>
        <div class="col-md-4">
          <div class="card card-profile no-transition  margin-top-0">
            <div class="card-cover" style="background-image: url('<?php echo BASE_URL;?>template/business/img/card-project4.jpg')">
            </div>
            <div class="card-avatar border-white">
              <a href="#avatar">
                <img src="<?php echo BASE_URL.JAK_FILES_DIRECTORY.$JAK_FORM_DATA["picture"];?>" alt="<?php echo $JAK_FORM_DATA["name"];?>">
              </a>
            </div>
            <div class="card-body">

              <h4 class="card-title"><?php echo $JAK_FORM_DATA["name"];?></h4>
              <p><?php echo sprintf($jkl['hd91'], $page2);?></p>
              <table class="table">
                <tbody>
                  <tr>
                    <td class="text-left"><?php echo $jkl['hd9'];?></td>
                    <td class="text-left"><?php echo $JAK_FORM_DATA['department'];?></td>
                    <td class="text-center"><span class="badge badge-pill badge-success"><i class="fa fa-building" aria-hidden="true"></i></span></td>
                  </tr>
                  <tr>
                    <td class="text-left"><?php echo $jkl['hd11'];?></td>
                    <td class="text-left"><span class="badge badge-pill badge-<?php echo ($JAK_FORM_DATA["status"] == $support_status_id ? 'default' : ($JAK_FORM_DATA["status"] == ($support_status_id + 1) ? 'warning' : 'danger'));?>"><?php echo ($JAK_FORM_DATA["status"] == $support_status_id ? $jkl['hd14'] : ($JAK_FORM_DATA["status"] == ($support_status_id + 1) ? $jkl['hd15'] : $jkl['hd16']));?></span></td>
                    <td class="text-center"><span class="badge badge-pill badge-<?php echo ($JAK_FORM_DATA["status"] == $support_status_id ? 'default' : ($JAK_FORM_DATA["status"] == ($support_status_id + 1) ? 'warning' : 'danger'));?>"><i class="fa fa-clock" aria-hidden="true"></i></span></td>
                  </tr>
                  <?php if (isset($JAK_PRIORITY_DATA) && !empty($JAK_PRIORITY_DATA)) { ?>
                  <tr>
                    <td class="text-left"><?php echo $jkl['hd12'];?></td>
                    <td class="text-left"><span class="badge badge-pill badge-<?php echo $JAK_PRIORITY_DATA["class"];?>"><?php echo $JAK_PRIORITY_DATA["title"];?></span></td>
                    <td class="text-center"><span class="badge badge-pill badge-<?php echo $JAK_PRIORITY_DATA["class"];?>"><i class="fa fa-fire" aria-hidden="true"></i></span></td>
                  </tr>
                  <?php } if (isset($JAK_OPTION_DATA) && !empty($JAK_OPTION_DATA)) { ?>
                  <tr>
                    <td class="text-left"><?php echo $jkl['hd98'];?></td>
                    <td class="text-left"><?php echo $JAK_OPTION_DATA["title"];?></td>
                    <td class="text-center"><?php if (!empty($JAK_OPTION_DATA["icon"])) echo '<span class="badge badge-pill badge-info"><i class="'.$JAK_OPTION_DATA["icon"].'" aria-hidden="true"></i></span>';?></td>

                  </tr>
                  <?php } ?>
                  <tr>
                    <td class="text-left"><?php echo $jkl['hd79'];?></td>
                    <td class="text-left"><?php echo JAK_base::jakTimesince($JAK_FORM_DATA['updated'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></td>
                    <td class="text-center"><span class="badge badge-pill badge-default"><i class="fa fa-clock" aria-hidden="true"></i></span></td>
                  </tr>
                  <tr>
                    <td class="text-left"><?php echo $jkl['hd80'];?></td>
                    <td class="text-left"><?php echo JAK_base::jakTimesince($JAK_FORM_DATA['initiated'], JAK_DATEFORMAT, JAK_TIMEFORMAT);?></td>
                    <td class="text-center"><span class="badge badge-pill badge-default"><i class="fa fa-clock" aria-hidden="true"></i></span></td>
                  </tr>
                  <tr>
                    <td class="text-left"><?php echo $jkl['hd81'];?></td>
                    <td class="text-left"><?php echo ($JAK_FORM_DATA['ended'] ? JAK_base::jakTimesince($JAK_FORM_DATA['ended'], JAK_DATEFORMAT, JAK_TIMEFORMAT) : '-');?></td>
                    <td class="text-center"><span class="badge badge-pill badge-info"><i class="fa fa-lock" aria-hidden="true"></i></span></td>
                  </tr>
                </tbody>
              </table>
              <hr>
              <h5 class="card-title space-bot"><?php echo $jkl['hd11'];?></h5>
              <?php if ($ticketwrite && $ticketopen) { ?>

                <div class="form-group">
                  <label for="jak_status" class="bmd-label-floating sr-only"><?php echo $jkl['hd11'];?></label>
                  <select name="jak_status" id="jak_status" class="form-control">
                    <option value="<?php echo $support_status_id;?>"<?php if ($JAK_FORM_DATA["status"] == $support_status_id) echo ' selected';?>><?php echo $jkl["hd14"];?></option>
                    <?php if ($JAK_FORM_DATA["status"] == ($support_status_id + 1)) { ?><option value="<?php echo ($support_status_id + 1);?>" selected><?php echo $jkl["hd15"];?></option><?php } ?>
                    <option value="<?php echo ($support_status_id + 2);?>"<?php if ($JAK_FORM_DATA["status"] == ($support_status_id + 2) || $JAK_FORM_DATA["status"] == ($support_status_id + 4)) echo ' selected';?>><?php echo $jkl["hd16"];?></option>
                  </select>
                </div>

                <div class="form-check float-left">
                  <label class="form-check-label">
                    <input class="form-check-input" type="checkbox" name="changestatus" value="1"> <?php echo $jkl["hd99"];?>
                    <span class="form-check-sign">
                      <span class="check"></span>
                    </span>
                  </label>
                </div>
                <div class="clearfix"></div>
                <hr>
                <?php if (isset($custom_fields) && !empty($custom_fields)) echo $custom_fields;?>
              </form>

            <?php } ?>
          </div>
        </div>

        <div class="card card-with-shadow no-transition">
          <div class="card-body">
            <h5 class="card-title text-center"><?php echo $jkl['hd159'];?></h5>
            <div class="accounts-suggestion">
              <ul class="list-unstyled">
                <?php if (isset($involvedOperator) && is_array($involvedOperator)) foreach($involvedOperator as $io) { ?>
                  <li class="account space-top">
                    <div class="row">
                      <div class="col-md-3">
                        <div class="avatar text-center">
                          <img src="<?php echo BASE_URL.JAK_FILES_DIRECTORY.$io["picture"];?>" alt="<?php echo $io["name"];?>" class="img-circle img-no-padding img-responsive">
                        </div>
                      </div>
                      <div class="col-md-8 description-section">
                        <span class="h6"><?php echo $io["name"];?></span>
                        <br>
                        <span class="text-muted"><small><?php echo $io["aboutme"];?></small></span>
                      </div>
                    </div>
                  </li>
                <?php } ?>
              </ul>
            </div>
          </div>
        </div>

        <div class="card card-with-shadow no-transition">
          <div class="card-body">
            <h5 class="card-title text-center"><?php echo sprintf($jkl['hd82'], '(<span id="upload-counter">'.$JAK_FORM_DATA["attachments"].'</span>)');?></h5>
            <div class="accounts-suggestion">
              <ul class="list-unstyled" id="attach-list">

                <?php if (isset($JAK_TICKET_FILES) && is_array($JAK_TICKET_FILES)) foreach($JAK_TICKET_FILES as $k) { if (getimagesize($k["path"])) { ?>
                  <li class="account space-top">
                    <div class="row">
                      <div class="col-md-3">
                        <div class="avatar">
                          <img src="<?php echo BASE_URL;?>_showfile.php?i=<?php echo jak_encrypt_decrypt($k["encrypt"]);?>" alt="<?php echo $k["name"];?>" class="attachment-thumbnail img-no-padding img-responsive">
                        </div>
                      </div>
                      <div class="col-md-8 description-section">
                        <span><a href="<?php echo BASE_URL;?>_showfile.php?i=<?php echo jak_encrypt_decrypt($k["encrypt"]);?>" target="_blank"><?php echo substr($k["name"], 17);?></a></span>
                        <br>
                        <span class="text-muted"><small><?php echo sprintf($jkl['hd140'], human_filesize($k["path"]));?></small></span>
                      </div>
                    </div>
                  </li>
                <?php } else { ?>
                  <li class="account space-top">
                    <div class="row">
                      <div class="col-md-3">
                        <div class="avatar">
                          <img src="<?php echo BASE_URL;?>template/<?php echo JAK_FRONT_TEMPLATE;?>/img/attachments.jpg" alt="Circle Image" class="img-circle img-no-padding img-responsive">
                        </div>
                      </div>
                      <div class="col-md-8 description-section">
                        <span><a href="<?php echo BASE_URL;?>_showfile.php?i=<?php echo jak_encrypt_decrypt($k["encrypt"]);?>" target="_blank"><?php echo substr($k["name"], 17);?></a></span>
                        <br>
                        <span class="text-muted"><small><?php echo sprintf($jkl['hd140'], human_filesize($k["path"]));?></small></span>
                      </div>
                    </div>
                  </li>
                <?php } } ?>
              </ul>
            </div>
          </div>
        </div>

      </div>
    </div>

    <div class="card no-transition">
      <div class="card-body">
        <div class="row">
          <?php if (isset($JAK_NAV_PREV) && !empty($JAK_NAV_PREV)) { ?>
            <div class="col-6 text-left">
              <div class="row float-left pl-2 pr-1">
                <a href="<?php echo $JAK_NAV_PREV;?>" class="btn btn-outline-info btn-round"><i class="fa fa-arrow-left"></i> <?php echo $JAK_NAV_PREV_TITLE;?></a>
              </div>
            </div>
          <?php } if (isset($JAK_NAV_NEXT) && !empty($JAK_NAV_NEXT)) { ?>
            <div class="col-6 text-right">
              <div class="row float-right pr-2 pl-1">
                <a href="<?php echo $JAK_NAV_NEXT;?>" class="btn btn-outline-info btn-round"><?php echo $JAK_NAV_NEXT_TITLE;?> <i class="fa fa-arrow-right"></i></a>
              </div>
            </div>
          <?php } ?>
        </div>
      </div>
    </div>
  </div>
</div>
</div>
<?php include_once APP_PATH.'template/business/tplblocks/footer.php';?>
