:::

6-4 templates/index.tpl

<!DOCTYPE html>
<html lang="zh-Hant-TW">
  {include file='header.tpl'}
  <body>
    <div class="container">

      {include file='navbar.tpl'}

      <div class="row">
        <div class="col-12 col-sm-6 col-lg-3">
          日期:{$now}
        </div>
        <div class="col-12 col-sm-6 col-lg-9">
          <ul>
            <li>今天到期:1</li>
            <li>逾期:2</li>
          </ul>
        </div>
      </div>
      {if $op=='post_form'}
        <!-- 新增表單 -->
        {include file='post_form.tpl'}
      {elseif $op=="show_one"}
        <!-- 顯示單筆 -->
        {include file='show_one.tpl'}
      {elseif $op=="done"}
        <!-- 已完成頁面 -->
        {include file='done.tpl'}
      {else}
        <!-- 首頁 -->
        {if $content}
          <div class="table-responsive">
            <h3>待辦清單<small>( 共 {$total} 筆)</small></h3>
            <table class="table table-bordered border-primary table-hover">
              <thead class="table-primary">
                <tr>
                  <th scope="col">是否完成</th>
                  <th scope="col">標題</th>
                  <th scope="col">到期日</th>
                  <th scope="col">優先順序</th>
                  <th scope="col">指派對象</th>
                  <th scope="col">功能</th>
                </tr>
              </thead>
              <tbody>
                <!-- 迴圈 -->
                {foreach $content as $row}
                  <tr>
                    <td class='text-end'>
                      {if $row.done}
                        <span class="badge bg-success"><i class="fas fa-check"></i></span>
                      {else}
                        <span class="badge bg-danger"><i class="fas fa-times-circle"></i></span>
                      {/if}
                    </td>
                    <td><a class="btn btn-link" href="{$action}?sn={$row.sn}">{$row.title}</a></td>
                    <td>{$row.end}</td>
                    <td>{$row.priority}</td>
                    <td>{$row.assign}</td>
                    <td>
                      <a class="btn btn-warning" href="{$action}?op=post_form&sn={$row.sn}" title='編輯'><i class="fas fa-pencil-alt"></i> 編輯</a>
                      <a class="btn btn-danger" href="javascript:del({$row.sn})" title='刪除'><i class="fas fa-times-circle"></i> 刪除</a>
                    </td>
                  </tr>
                {/foreach}
              </tbody>
            </table>
            {$bar}
          </div>

        {else}
          <div class="d-grid col-12 col-md-3 mx-auto">
            <a class="btn btn-info" href="{$action}?op=post_form" role="button">新增待辦事項</a>
          </div>
        {/if}
      {/if}
    </div>

    <!-- 引入templates\sweetalert_delete.tpl -->
    {include file='sweetalert_delete.tpl'}
  </body>
</html>