{% extends 'dashboard_screen/base.html' %}

{% block content %}

            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->
            <div class="content-page">
                <!-- Start content -->
                <div class="content">
                    <div class="container">
                        <div class="row">

                            <div class="col-lg-12">
                                 <!-- Basic Form Wizard -->

                            	<div class="card-box">

                                <div class="panel">
                                        <div class="panel-body">

                                             <div class="row">
                                                    <div class="col-sm-12">
                                                        <div class="card-box table-responsive">
                                                        {% if Entries %}

                                                            <h4 class="m-t-0 header-title"><b>All Pendign Exams</b></h4>

                                                            <table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
                                                                <thead>
                                                                    <tr>
                                                                        <th>Accession ID</th>
                                                                        <th>Exam Type</th>
                                                                        <th>Lab-ID</th>
                                                                        <th>Patient</th>
                                                                        <th>Client</th>
                                                                        <th>Collected date</th>
                                                                        <th>Created date</th>
                                                                        <th>Actions</th>
                                                                    </tr>
                                                                </thead>
                                                                <tbody>

                                                                    {% for Entry in Entries %}
                                                                        {% if Entry.accession_number.all %}
                                                                            {% for accesion in Entry.accession_number.all %}
                                                                                {% if accesion.exam_in.exam_casetype.case_type_id == 1 and accesion.GYN_completed == 0 %}
                                                                                        <tr>
                                                                                            <td><span class="label label-warning">{{ accesion.accession_number }}</span></td>
                                                                                            <td>{{ accesion.exam_in.exam_casetype.case_type_name |upper}}</td>
                                                                                            <td>{{ Entry.lab_id }}</td>
                                                                                            <td>{{ Entry.patient.full_name }}</td>
                                                                                            <td>{{ Entry.patient.patient_client.get_full_name }}</td>
                                                                                            <td>{{ Entry.collection_date |date:"m/d/Y" }}</td>
                                                                                            <td>{{ Entry.created_date |date:"m/d/Y"}}</td>
                                                                                            <td>
                                                                                                 <a href="/dashboard/enter_result/{{ Entry.entry_id }}/">
                                                                                                    <button type="link" name="enter_result" class="btn btn-default btn-custom waves-effect waves-light">Enter Result</button>
                                                                                                 </a>
                                                                                            </td>
                                                                                        </tr>
                                                                                {% elif accesion.exam_in.exam_casetype.case_type_id == 2 and accesion.Non_gyn_completed == 0 %}
                                                                                    <tr>
                                                                                        <td><span class="label label-warning">{{ accesion.accession_number }}</span></td>
                                                                                        <td>{{ accesion.exam_in.exam_casetype.case_type_name |upper}}</td>
                                                                                        <td>{{ Entry.lab_id }}</td>
                                                                                        <td>{{ Entry.patient.full_name }}</td>
                                                                                        <td>{{ Entry.patient.patient_client.get_full_name }}</td>
                                                                                        <td>{{ Entry.collection_date |date:"m/d/Y" }}</td>
                                                                                        <td>{{ Entry.created_date |date:"m/d/Y"}}</td>
                                                                                        <td>
                                                                                             <a href="/dashboard/enter_result/{{ Entry.entry_id }}/">
                                                                                                <button type="link" name="enter_result" class="btn btn-default btn-custom waves-effect waves-light">Enter Result</button>
                                                                                             </a>

                                                                                        </td>
                                                                                    </tr>

                                                                                {% elif accesion.exam_in.exam_casetype.case_type_id == 3 and accesion.MP_completed == 0 %}
                                                                                    <tr>
                                                                                        <td><span class="label label-warning">{{ accesion.accession_number }}</span></td>
                                                                                        <td>{{ accesion.exam_in.exam_casetype.case_type_name |upper}}</td>
                                                                                        <td>{{ Entry.lab_id }}</td>
                                                                                        <td>{{ Entry.patient.full_name }}</td>
                                                                                        <td>{{ Entry.patient.patient_client.get_full_name }}</td>
                                                                                        <td>{{ Entry.collection_date |date:"m/d/Y" }}</td>
                                                                                        <td>{{ Entry.created_date |date:"m/d/Y"}}</td>
                                                                                        <td>
                                                                                             <a href="/dashboard/enter_result/{{ Entry.entry_id }}/">
                                                                                                <button type="link" name="enter_result" class="btn btn-default btn-custom waves-effect waves-light">Enter Result</button>
                                                                                             </a>

                                                                                        </td>
                                                                                    </tr>

                                                                                {% elif accesion.exam_in.exam_casetype.case_type_id == 4 and accesion.SP_completed == 0 %}
                                                                                   <tr>
                                                                                        <td><span class="label label-warning">{{ accesion.accession_number }}</span></td>
                                                                                        <td>{{ accesion.exam_in.exam_casetype.case_type_name |upper}}</td>
                                                                                        <td>{{ Entry.lab_id }}</td>
                                                                                        <td>{{ Entry.patient.full_name }}</td>
                                                                                        <td>{{ Entry.patient.patient_client.get_full_name }}</td>
                                                                                        <td>{{ Entry.collection_date |date:"m/d/Y" }}</td>
                                                                                        <td>{{ Entry.created_date |date:"m/d/Y"}}</td>
                                                                                        <td>
                                                                                             <a href="/dashboard/enter_result/{{ Entry.entry_id }}/">
                                                                                                <button type="link" name="enter_result" class="btn btn-default btn-custom waves-effect waves-light">Enter Result</button>
                                                                                             </a>

                                                                                        </td>
                                                                                    </tr>
                                                                                {% endif %}
                                                                            {% endfor %}
                                                                        {% endif %}
                                                                    {% endfor %}
                                                                </tbody>
                                                            </table>
                                                        {% else %}
                                                            <h4 class="m-t-0 header-title"><b>There are no Pendign Exams</b></h4>

                                                        {% endif %}



                                                        </div>
                                                    </div>
                                                </div>
                                        </div>
                                        <!-- end: page -->
                                    </div> <!-- end Panel -->



                            	</div>


                            <!-- End row -->

                            </div> <!-- end col -->
                        </div>

						<!-- end row -->



                    </div> <!-- container -->

                </div> <!-- content -->


{% endblock %}