<center>
    <span>&nbsp;&nbsp;</span>
</center>
<table class="table table-condensed table-striped">
    <thead>
        <th style="text-align:center">รอบ</th>
        <th style="text-align:center">#</th>
        <th style="text-align:center">ใบนัด</th>
        <th style="text-align:center">HN</th>
        <th style="text-align:center">ผู้ป่วย</th>
        <th style="text-align:center">สิทธ์</th>
        <th style="text-align:center">แพทย์</th>
        <th style="text-align:center">ชั้น</th>
        <th style="text-align:center">เตียง</th>
        <th style="text-align:center">บันทึกการรักษา</th>
    </thead>
    <tbody>
        {{#each lines }}
            {{#if footer}}
                <tr>
                    <td rowspan="3" align="middle" style="vertical-align:middle; background-color:#4183c4;color:white"><span><b>สรุป</b></span></td>
                </tr>
                <tr>
                    <td colspan="12" style="text-align:right; background-color:#dbdbdb"><b>{{details4}}</b></td>
                </tr>
            {{else}}
                <tr style="background-color:{{visit_color}}">
                    {{#if title}}
                        <td style="background-color:#ddddff" colspan="4"><b>{{cycle_name}}</b></td>
                        <td style="background-color:#ddddff" colspan="7"></td>
                    {{else}}
                        <td style="background-color:{{cycle_color}};color:white;width:6%"><center>{{cycle_name}}</center></td>
                        <td style="background-color:{{visit_color}}">{{no}}</td>
                        <td style="background-color:{{visit_color}};width:12%">
                            <a href="/ui#name=clinic_visit&active_id={{visit_id}}&mode=form">
                                {{#ifeq number "Waiting"}}
                                    <span class="glyphicon glyphicon-arrow-right">&nbsp;{{number}}</span>
                                {{else}}
                                    {{#ifeq number "Cancelled"}}
                                        <span class="glyphicon glyphicon-remove-sign">&nbsp;{{number}}</span>
                                    {{else}}
                                        <span class="glyphicon glyphicon-ok-sign">&nbsp;{{number}}</span>
                                    {{/ifeq}}
                                {{/ifeq}}
                            </a>
                        </td>
                        <td style="background-color:{{visit_color}}">{{hn_name}}</td>
                        <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_patient&active_id={{patient_id}}&mode=form">{{patient_name}}</a></td>
                        <td style="background-color:{{visit_color}}">{{patient_type}}</td>
                        <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_staff&active_id={{doctor_id}}&mode=form">{{doctor_name}}</a></td>
                        <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_department&active_id={{department_id}}&mode=form">{{department_name}}</a></td>
                        {{#if sickbed_id}}
                            <td style="background-color:{{visit_color}}"><a href="/ui#name=clinic_sickbed&active_id={{sickbed_id}}&mode=form">{{sickbed_name}}</a></td>
                        {{else}}
                            <td style="background-color:{{visit_color}}">{{sickbed_name}}</td>
                        {{/if}}
                        <td style="background-color:{{visit_color}}">
                            <a href="/ui#name=clinic_hd_case&active_id={{hd_case_id}}&mode=form">
                                {{#ifeq number "Waiting"}}
                                    
                                {{else}}
                                    {{#ifeq number "Cancelled"}}
                                        <!--
                                        <span class="glyphicon glyphicon-thumbs-down">
                                        -->
                                    {{else}}
                                        {{#ifeq hd_case_state "waiting_treatment"}}
                                        <span class="glyphicon glyphicon-arrow-right">
                                        {{else}}
                                            {{#ifeq hd_case_state "in_progress"}}
                                            <span class="glyphicon glyphicon-refresh">
                                            {{else}}
                                                {{#ifeq hd_case_state "cancelled"}}
                                                <span class="glyphicon glyphicon-remove">
                                                {{else}}
                                                <span class="glyphicon glyphicon-ok-sign">
                                                {{/ifeq}}
                                            {{/ifeq}}
                                        {{/ifeq}}
                                            {{hd_case_number}}
                                    {{/ifeq}}
                                {{/ifeq}}
                                </span>
                            </a>
                        </td>
                    {{/if}}
                </tr>
            {{/if}}
        {{/each}}
    </tbody>
    <tfoot>
    </tfoot>
</table>