<?php
header('Location: news_list.php');
exit;

include_once '../src/inc/db/function.php';

/* $show_platform = $show_team = $show_privacy = $show_webSecurity = "0";
$stmt = $conn->prepare("SELECT * FROM platform WHERE itemNo IN ('platform', 'team', 'privacy','webSecurity') LIMIT 4");
$stmt->execute();
while ($row = $stmt->fetch()) {
  ${'show_' . $row['itemNo']} = $row['flag_view'];
} 
// print_r([$show_platform ,$show_team , $show_privacy ,$show_webSecurity] );
*/
?>
<!DOCTYPE html>

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <!--  <title> 系統公告</title> -->
  <?php include_once "admin_css.php"; ?>

</head>

<body>

  <!--BEGIN HEADER-->
  <?php include_once "template_header.php"; ?>
  <!--END HEADER-->

  <!--BEGIN SIDEBAR-->
  <?php include_once "template_sidebar.php"; ?>
  <!--END SIDEBAR-->

  <main id="main" class="main">
    <div class="pagetitle d-flex  justify-content-between align-items-center">
      <nav>
        <ol class="breadcrumb">
          <li class="breadcrumb-item "><a href="index.php"><i class="bi bi-house-door-fill"></i> 首頁</a></li>
          <li class="breadcrumb-item active">系統公告</li>
        </ol>
      </nav>
      <span class="float: right;">
        <a href="#" onclick="window.history.back();" class="btn btn-sm  btn-outline-primary"><i class="bi bi-arrow-90deg-left"></i> 回上一頁</a>
      </span>
    </div>


    <section class="section dashboard">
      <div class="d-flex align-items-center">
        <div class="head-line" style="width:80px;"></div>
        <span class="head-title mx-2 ">系統公告</span>
        <div class="head-line " style="flex-grow: 1;"> </div>
      </div>
      <div class="row mb-3" style="background-color: #EAF5FF; height: 66px; border-radius: 8px; display: flex; flex-direction: column; justify-content: center;  text-align: left;">
        <div class="input-group" style="width: 50%;">
          <input type="text" name="member_id" class="form-control" placeholder="請輸入關鍵字搜尋...">
          <button type="submit" class="input-group-text" title="Search"><i class="bi bi-search"></i></button>
        </div>
      </div>
      <!-- BRGIN DATATABLE -->
      <table class="table table-hover table-responsive table-bordered">
        <thead>
          <tr class="table-primary">
            <th scope="col" class="align-middle">
              <button type="button" class="btn btn-sm btn-primary" onclick="changeToEdit(0)">
                <i class="bi bi-plus-lg"></i>
              </button>
            </th>
            <th>流水號</th>
            <th>發佈日期</th>
            <th>標題</th>
            <th>發佈單位</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td class="align-middle">
              <button type="button" class="btn btn-sm btn-primary" onclick="changeToEdit()">
                <i class="bi bi-pencil-square"></i>
              </button>
            </td>
            <td class="align-middle">001</td>
            <td class="align-middle">2024/08/21</td>
            <td class="align-middle">測試</td>
            <td class="align-middle">測試</td>
          </tr>
        </tbody>
      </table>
      <!-- END DATATABLE -->

    </section>

  </main><!-- End #main -->

  <!--BEGIN FOOTER-->
  <?php include_once "template_footer.php"; ?>
  <!--END FOOTER-->

  <!-- <a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>
  <script src="../assets/js/main.js"></script> -->
  <script>
    

    function changeToEdit(idx) {
     // window.location.href = `indexEdit.php?index=${idx}`;
      window.location.href = 'news_edit.php?rid=' + idx;
    }
  </script>

</body>

</html>