<?php
$cate_id = "mnu_message_manage"; //현재 메뉴 ID 필수!!!

include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php";
include_once _ADM_INC_PATH_ ."/auth_check.php";

include _ADM_INC_PATH_ ."/header.html";
?>

        <form method="get" name="sform" id="sform" class="sform form-inline" action="<?=$_SERVER['PHP_SELF']?>">
          <label>
          </label>
          <label>검색 내용 : <input type="text" name="stxt" class="form-control form-control-sm" value="<?=$_REQUEST['stxt']?>"></label>
          <button type="submit" class="btn btn-primary btn-sm">검색</button>
          <label> <span>라인수 :</span>
          <select name="viewnum" id="viuewnum" class="form-select-sm form-control-sm" data-defval="<?=$_REQUEST['viewnum']?:20?>" onchange="this.form.submit()">
            <option value="">라인수</option>
            <option value="10">10개</option>
            <option value="20">20개</option>
            <option value="30">30개</option>
            <option value="50">50개</option>
            <option value="100">100개</option>
          </select>
          </label>
          <?=hidden_input("ofld",$_REQUEST['ofld'])?>
          <?=hidden_input("oasc",$_REQUEST['oasc'])?>
        </form>

        <div id="cmd_bar" class="mb-2">
          <div class="h4"><i class="bi bi-files-alt"></i> 메세지 관리</div>
          <div class="text-right">
          </div>
        </div>

        <div class="container-fluid mt-3">
          <div class="row">
            <div class="col">
              <h5 class="d-flex justify-content-between">
                <span><i class="bi bi-subtract"></i> 메세지 관리</span>
              </h5>
              <div class="cont_hfix">

                <table class="table table-bordered mt-3">
                  <colgroup>
                    <col width="5%">
                    <col width="*">
                    <col width="30%">
                    <col width="15%">
                    <col width="15%">
                  </colgroup>
                  <thead class="sticky-top">
                    <tr class="text-center bg-dark text-light">
                      <th>No</th>
                      <th><a href="javascript:sort_page_move(form2qry(document.sform),'TRANS_TEXT'   );" class="text-decoration-none text-white">메시지</a></th>
                      <th><a href="javascript:sort_page_move(form2qry(document.sform),'TRANS_LENG'     );" class="text-decoration-none text-white">등록 메시지</a></th>
                      <th><a href="javascript:sort_page_move(form2qry(document.sform),'MAKE_TM'  );" class="text-decoration-none text-white">등록일</a></th>
                      <th><a href="javascript:sort_page_move(form2qry(document.sform),'EDIT_TM');" class="text-decoration-none text-white">수정일</a></th>
                    </tr>
                  </thead>
                  <tbody>
                  <?php
                  $_REQUEST['no_echo'] = true;
                  $_REQUEST['mode'] = "getTranPage";
                  include "./message.ajax.php";
                  $qry_msg_list = $retval['data'];

                  foreach( $qry_msg_list->rows as $row ){
                  ?>
                  <tr class="text-center">
                    <td><?=$qry_msg_list->line_cnt--?></td>
                    <td class="text-left"><a href="./message_in.php?TRAN_ID=<?=$row['TRAN_ID']?>"><?=$row['TRAN_TEXT']?></a></td>
                    <td><?=implode(",",array_keys((array)json_decode($row['TRAN_DATA'])))?></td>
                    <td><?=getDT_datetime($row['MAKE_TM'])?></td>
                    <td><?=getDT_datetime($row['EDIT_TM'])?></td>
                  </tr>
                  <?php
                  }
                  if( count($qry_msg_list->rows) < 1 ){
                  ?>
                  <tr>
                    <td colspan="20" class="text-center text-danger">※ <?=cUtil\Mlang::getText("결과가 존재하지 않습니다.");?></td>
                  </tr>
                  <?php
                  }
                  ?>
                  </tbody>
                </table>
                <nav aria-label="Page navigation example">
                  <ul class="pagination justify-content-center align-items-center">
                    <?php foreach( (array)$qry_msg_list->pages as $page ){?>
                    <li><?=$page?></li>
                    <?php }?>
                  </ul>
                </nav>
              </div>
            </div>
          </div>
        </div>
<?php

include _ADM_INC_PATH_ ."/footer.html";