:::

10-5 templates/index.tpl

<!DOCTYPE html>
<html lang="zh-TW">

{include file="header.tpl"}

<body>
    <div class="container">
        <nav class="navbar navbar-expand-sm navbar-dark bg-primary">
            <a class="navbar-brand" href="{$action}">
                <img src="images/logo.jpg" class='rounded-circle' height="200rem">
                <h3 class="text-center">{$header}</h3>
            </a>
            <button class="navbar-toggler d-lg-none" type="button" data-toggle="collapse"
                data-target="#collapsibleNavId" aria-controls="collapsibleNavId" aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="collapsibleNavId">
                <ul class="navbar-nav ml-auto mt-2 mt-lg-0">
                    <li class="nav-item active">
                        <a class="nav-link" href="{$action}">{$navbar.home}<span class="sr-only">(current)</span></a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{$action}?op=post_form">{$navbar.post}</a>
                    </li>
                </ul>
            </div>
        </nav>

        <hr>
        <div class="row">
            <div class="col-sm-3">
                <p>
                    日期:{$now}
                </p>
            </div>
            <div class="col-sm-9">
                <ol>
                    <li>今天到期:1</li>
                    <li>逾期:2</li>
                </ol>
            </div>
        </div>

        {if $op=='post_form'}
            {include file="post_form.tpl"}
        {elseif $op=='show_one'}
            {include file="show_one.tpl"}
        {else}
            {if $content}
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover table-sm">
                        <thead class="thead-dark">
                            <th><i class="fas fa-check"></i> 是否完成</th>
                            <th>標題</th>
                            <th>到期日</th>
                            <th>優先順序</th>
                            <th>指派對象</th>
                            <th>功能</th>
                        </thead>
                        <tbody>
                            {foreach $content as $c}
                                <tr>
                                    <td>
                                        {if $c.done}
                                            <span class="badge badge-success text-center"><i class="fas fa-check"></i></span>
                                        {else}
                                            <span class="badge badge-danger text-center"><i class="fas fa-times-circle"></i></span>
                                        {/if}
                                    </td>
                                    <td><a href="{$action}?sn={$c.sn}">{$c.title}</a></td>
                                    <td>{$c.end}</td>
                                    <td>{$c.priority}</td>
                                    <td>{$c.assign}</td>
                                    <td>
                                        <a class="btn btn-warning" href="{$action}?op=post_form&sn={$c.sn}" title="編輯""><i class="
                                            fas fa-pencil-alt"></i> 編輯</a>
                                        <a href="{$action}?op=delete&sn={$c.sn}" class="btn btn-danger"  title="刪除"><i class="fas fa-times-circle"></i> 刪除</a>
                                    </td>
                                </tr>
                            {/foreach}
                        </tbody>
                    </table>
                </div>
            {else}
                <div class="jumbotron text-center">
                    <a class="btn btn-info" href="{$action}?op=post_form" role="button">新增待辦事項</a>
                </div>
            {/if}
        {/if}

    </div>
</body>

</html>