{% 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">
                            		<h4 class="m-t-0 header-title"><b>Update Price for Client:<code>{{ client.business_legal_name }}</code></b></h4>

									<form id="id_ajax_form_edit_client" action="/dashboard/update_client_price/{{ client.client_id }}/" class="form-horizontal" method="post" enctype="multipart/form-data">
                                        {% csrf_token %}
                                        <input type="hidden"  name="client_id" value="{{ client.client_id }}"/>
                                        <div>
                                              {% if exams %}
                                                  <div class="">
                                                        <table id="datatable" class="table table-striped table-bordered">
                                                            <thead>
                                                                <tr>
                                                                    <th>Test Code</th>
                                                                    <th>CPT Code</th>
                                                                    <th>Case Type</th>
                                                                    <th>Default Price</th>
                                                                    <th>Price for this Client</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                  {% for exam in exams %}
                                                                      {% if forloop.counter|divisibleby:2 %}
                                                                            <tr class="gradeX">
                                                                                <td>{{ exam.exam_name }}</td>
                                                                                <td>{{ exam.cpt_name }}</td>
                                                                                <td>{{ exam.exam_casetype.case_type_name }}</td>
                                                                                <td>{{ exam.exam_default_price }}</td>
                                                                                <td>
                                                                                    <div class="input-group m-t-25">
                                                                                        <span class="input-group-addon btn-default"><i class="fa fa-dollar"></i></span>
                                                                                        <input type="text" id="example-input3-group1"  maxlength="6" required name="{{ exam.exam_id }}" class="form-control" placeholder="Enter Exam Price" value="{% if exam.clienexamprice_set.all %}{% for price in exam.clienexamprice_set.all %}{% if price.client_exam_id.exam_id == exam.exam_id and price.created_for_client.client_id == client.client_id%}{{ price.price }}{% endif %}{% endfor %}{% else %}{{ exam.exam_default_price }}{% endif %}">
                                                                                        <span class="input-group-addon">USD</span>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                      {% else %}
                                                                            <tr class="gradeC">
                                                                                <td>{{ exam.exam_name }}</td>
                                                                                <td>{{ exam.cpt_name }}</td>
                                                                                <td>{{ exam.exam_casetype.case_type_name }}</td>
                                                                                <td>{{ exam.exam_default_price }}</td>
                                                                                <td>
                                                                                    <div class="input-group m-t-25">
                                                                                        <span class="input-group-addon btn-default"><i class="fa fa-dollar"></i></span>
                                                                                        <input type="text" id="example-input3-group1"  maxlength="6" required name="{{ exam.exam_id }}" class="form-control" placeholder="Enter Exam Price" value="{% if exam.clienexamprice_set.all %}{% for price in exam.clienexamprice_set.all %}{% if price.client_exam_id.exam_id == exam.exam_id and price.created_for_client.client_id == client.client_id %}{{ price.price }}{% endif %}{% endfor %}{% else %}{{ exam.exam_default_price }}{% endif %}">
                                                                                        <span class="input-group-addon">USD</span>
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                      {% endif %}

                                                                  {% endfor %}

                                                            </tbody>
                                                        </table>
                                                  </div>
                                              {% endif %}
                                              <div class="form-group m-b-0">
	                                                <div class="col-sm-offset-10 col-sm-10">
	                                                  <button type="submit" name="edit_client_price" class="btn btn-default waves-effect waves-light">Save</button>
                                                      <a href="/dashboard/pending_client/" class="btn btn-default waves-effect waves-light">Back</a>
	                                                </div>
	                                          </div>

                                              <div class="col-lg-12">
                                                   <div class="form-group clearfix">
                                                     <label class="col-lg-6 control-label ">{{ message }}</label>
                                                   </div>
                                              </div>
                                              <div class="row">
                                              </div>

                                        </div>
                                    </form>


                            	</div>


                            <!-- End row -->

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

						<!-- end row -->



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

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


{% endblock %}