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

{% block content %}

            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->
    <div class="content-page" xmlns="http://www.w3.org/1999/html">
                <!-- 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>New Order Entry Form </b></h4>

                                     {% if Step == 0 %}
                                         <form id="" action="/dashboard/wizard/{% if Patient %}{{ Patient.patient_id }}/{% endif %}" class="group-border-dashed" method="post" enctype="multipart/form-data">
                                            {% csrf_token %}
                                            {% if Patient %}<input type="hidden"  name="patient_id" value="{{ Patient.patient_id }}"/> {% endif %}
                                            <input type="hidden"  name="Step" value="{{ Step }}"/>
                                     {% endif %}
                                     {% if Step == 1 %}
                                         <form id="" action="/dashboard/wizard/{{ Step }}" class="group-border-dashed" method="post" enctype="multipart/form-data">
                                            {% csrf_token %}
                                            {% if Patient %}<input type="hidden"  name="patient_id" value="{{ Patient.patient_id }}"/> {% endif %}
                                            <input type="hidden"  name="Step" value="{{ Step }}"/>

                                     {% endif %}
                                     {% if Step == 2 %}
                                         <form id="" action="/dashboard/wizard/{{ Step }}" class="group-border-dashed" method="post" enctype="multipart/form-data">
                                            {% csrf_token %}
                                            {% if Patient %}<input type="hidden"  name="patient_id" value="{{ Patient.patient_id }}"/> {% endif %}
                                            <input type="hidden"  name="Step" value="{{ Step }}"/>

                                     {% endif %}

                                     {% if Step == 3 %}
                                         <form id="" action="/dashboard/wizard/{{ Step }}" class="group-border-dashed" method="post" enctype="multipart/form-data">
                                            {% csrf_token %}
                                            {% if Patient %}<input type="hidden"  name="patient_id" value="{{ Patient.patient_id }}"/> {% endif %}
                                            <input type="hidden"  name="Step" value="{{ Step }}"/>
									{% endif %}

                                        {% if Patient %}
                                            <input type="hidden"  name="patient_id" value="{{ Patient.patient_id }}"/>
                                        {% else %}
                                            <input type="hidden"  name="patient_id" value=""/>
                                        {% endif %}

                                        <div id="wizard">
                                            <h3>Patient Information</h3>
                                            <section>
                                                {% if Step == 0 %}
                                                    {% if Patient %}
                                                        <h4 class="m-t-0 header-title"><b>Update Patient</b></h4>
                                                    {% else %}
                                                        <h4 class="m-t-0 header-title"><b>Adding New Patient</b></h4>
                                                    {% endif %}
                                                    <div>
                                                           <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>Collection Date:(*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                       <input type="text" class="form-control" name="callection_date" data-date-format="mm/dd/yyyy" placeholder="Collection Date" id="datepicker-autoclose" value="">
                                                                       <span class="input-group-addon bg-custom b-0 text-white"><i class="icon-calender"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                           <div class="col-lg-4">
                                                                <div class="p-20">
                                                                    <h5><b>Client Name / Client Code(*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <input type="text" class="form-control" id="id_client_id"  required name="client_id" value="{{ Patient.patient_client_id.client_code }}" />
                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa fa-user"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                           <div class="col-lg-5">
                                                                <div class="p-20">
                                                                    <h5><b>Attending Physician Name (*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <input type="text" class="form-control" id="state-warning"  required name="patient_first_name" value="{% if Patient %}{{ Patient.last_name }} {% endif %}" />
                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa fa-user"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                            <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>Patient External ID:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <input type="text" class="form-control" id="state-warning" maxlength="25" name="patient_external_id" value="{% if Patient %}{{ Patient.ext_id }} {% endif %}" onKeyUp="this.value=this.value.toUpperCase();" />
                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa-users"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                            <div class="col-lg-4">
                                                                <div class="p-20">
                                                                    <h5><b>First Name: (*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <input type="text" class="form-control" id="state-warning"  required name="patient_first_name" value="{% if Patient %}{{ Patient.first_name }} {% endif %}" />
                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa fa-user"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                           <div class="col-lg-5">
                                                                <div class="p-20">
                                                                    <h5><b> Last Name: (*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <input type="text" name="patient_last_name" required class="form-control" id="state-warning" placeholder="Enter Last Name" value="{% if Patient %}{{ Patient.last_name }}{% endif %}">
                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa fa-user"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                           <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>DOB: mm/dd/yy (*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                         <input type="text" class="form-control" name="patient_dob" data-date-format="mm/dd/yyyy" placeholder="Enter patient Date of Birth " id="datepicker-autoclose" value="{% if Patient %}{{ Patient.dob |date:"m/d/Y" }} {% endif %}">
                                                                         <span class="input-group-addon bg-custom b-0 text-white"><i class="icon-calender"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                           <div class="col-lg-4">
                                                                <div class="p-20">
                                                                    <h5><b>Address:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                         <input type="text" name="patient_address" class="form-control" id="id_patient_address" placeholder="Enter Patient address" value="{% if Patient %}{{ Patient.address }}{% endif %}">
                                                                    <span class="input-group-addon bg-custom b-0 text-white"><i class="fa ion-map "></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                            <div class="col-lg-5">
                                                                <div class="p-20">
                                                                    <h5><b>Address 2:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                         <input type="text" name="patient_address2" class="form-control" id="id_patient_address2" placeholder="Enter Patient address" value="{% if Patient %}{{ Patient.address2 }}{% endif %}">
                                                                         <span class="input-group-addon bg-custom b-0 text-white"><i class="fa ion-map "></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                            <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>SSN:(*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                         <input type="text" class="form-control" maxlength="9" name="patient_ssn" id="exampleInputPassword1" placeholder="Enter patient SSN" value="{% if Patient %}{{ Patient.SSN_number }}{% endif %}">
                                                                     <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa-legal"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                            <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>Phone:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <input type="tel" step="1" name="patient_phone" class="form-control" id="id_patient_phone" placeholder="Enter Patient Phone" value="{% if Patient %}{{ Patient.phone }}{% endif %}">
                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa-phone"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                           <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>City:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                       <input type="text" name="patient_city" class="form-control" id="id_patient_city" placeholder="Enter City" value="{% if Patient %}{{ Patient.city }}{% endif %}">
                                                                       <span class="input-group-addon bg-custom b-0 text-white"><i class="fa ion-map"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>



                                                           <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>Zip Code:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <input type="text" name="patient_zipcode" class="form-control" id="exampleInputEmail1" placeholder="Zip Code" value="{% if Patient %}{{ Patient.zipcode }}{% endif %}">
                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa-map-marker"></i></span>
                                                                    </div>
                                                                </div>
                                                           </div>

                                                           <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>State:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                        <select id="id_patient_state" name="patient_state" class="selectpicker show-tick" data-style="btn-white">
                                                                                {% if states %}
                                                                                   {% for item in states %}
                                                                                     <option value="{{ item.code }}" {% if item.code == Patient.state %} selected{% endif %}>{{ item.name }}</option>
                                                                                   {% endfor %}
                                                                                {% endif %}
                                                                           </select>
                                                                    </div>
                                                                </div>
                                                           </div>


                                                            <div class="col-lg-3">
                                                                <div class="p-20">
                                                                    <h5><b>Gender:(*)</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                          <select id="id_patient_gender" required name="patient_gender" class="selectpicker show-tick" data-style="btn-white">
                                                                              <option value=""> Select Patient Gender</option>
                                                                              <option value="M" {% if Patient.gender == 'M' %} selected{% endif %}> Male</option>
                                                                              <option value="F" {% if Patient.gender == 'F'%} selected{% endif %}> Female</option>
                                                                           </select>
                                                                     </div>
                                                                </div>
                                                            </div>

                                                            <div class="col-lg-4">
                                                                <div class="p-20">
                                                                    <h5><b>Ethnicity:</b></h5>
                                                                    <div class="input-group m-t-15">
                                                                          <select id="id_patient_ethnicity" name="patient_ethnicity" class="selectpicker show-tick" data-style="btn-white">
                                                                              <option value="0"> Select Patient Ethnicty</option>
                                                                              <option value="1" {% if Patient.ethnicity == '1' %} selected{% endif %}> American Indian or Alaska Native</option>
                                                                              <option value="2" {% if Patient.ethnicity == '2' %} selected{% endif %}> Asian</option>
                                                                              <option value="3" {% if Patient.ethnicity == '3' %} selected{% endif %}> Black or African American</option>
                                                                              <option value="4" {% if Patient.ethnicity == '4' %} selected{% endif %}> Hispanic or Latino</option>
                                                                              <option value="5" {% if Patient.ethnicity == '5' %} selected{% endif %}> Native Hawaiian or Other Pacific Islander </option>
                                                                              <option value="6" {% if Patient.ethnicity == '6' %} selected{% endif %}> White</option>
                                                                              <option value="7" {% if Patient.ethnicity == '7' %} selected{% endif %}> Other</option>
                                                                           </select>
                                                                    </div>
                                                                </div>
                                                            </div>



                                                            <div class="col-lg-12">
                                                                <div class="form-group ">
                                                                    <p class="control-label"><strong>Enter payor information</strong></p>

                                                                        <div class="radio radio-custom radio-inline">
                                                                            <input type="radio" id="inlineRadio1" value="0" onclick="toggle(this)" name="billing_option" checked>
                                                                            <label for="inlineRadio1"> Client </label>
                                                                        </div>

                                                                        <div class="radio radio-custom radio-inline">
                                                                            <input type="radio" id="inlineRadio2" value="1" onclick="toggle(this)" name="billing_option">
                                                                            <label for="inlineRadio2"> Insurance </label>
                                                                        </div>

                                                                    <div id="uno" style="display:none">
                                                                        <p class="text-muted font-13 m-b-15 m-t-20">Insurance Options:.</p>
                                                                        <div class="col-sm-12">
                                                                            <div class="radio radio-custom radio-inline">
                                                                                <input type="radio" id="inlineRadio3" value="Medicare" name="insurance_name" checked>
                                                                                <label for="inlineRadio3"> Medicare </label>
                                                                            </div>

                                                                            <div class="radio radio-custom radio-inline">
                                                                                <input type="radio" id="inlineRadio4" value="Medicaid" name="insurance_name">
                                                                                <label for="inlineRadio4"> Medicaid </label>
                                                                            </div>

                                                                            <div class="radio radio-custom radio-inline">
                                                                                <input type="radio" id="inlineRadio6" value="Private"  name="insurance_name">
                                                                                <label for="inlineRadio6"> Private </label>
                                                                            </div>
                                                                        </div>
                                                                        <div class="col-sm-12">

                                                                            <div class="col-lg-3">
                                                                                <div class="p-1">
                                                                                    <h5><b>Subscriber No.</b></h5>
                                                                                    <div class="input-group m-t-15">
                                                                                        <input type="text" name="insurance_suscriber_number" class="form-control" id="exampleInputEmail1" value="">
                                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa-sort-numeric-asc"></i></span>
                                                                                    </div>
                                                                                </div>
                                                                            </div>

                                                                            <div class="col-lg-3">
                                                                                <div class="p-1">
                                                                                    <h5><b>DOB: mm/dd/yy (*)</b></h5>
                                                                                    <div class="input-group m-t-15">
                                                                                         <input type="text" class="form-control" name="insurance__dob" data-date-format="mm/dd/yyyy" placeholder="Date of Birth " id="datepicker-autoclose" value="{{ Patient.dob |date:"m/d/Y" }}">
                                                                                         <span class="input-group-addon bg-custom b-0 text-white"><i class="icon-calender"></i></span>
                                                                                    </div>
                                                                                </div>
                                                                           </div>

                                                                            <div class="col-lg-4">
                                                                                <div class="p-1">
                                                                                    <h5><b>ICD9 Diagnosis Code:</b></h5>
                                                                                    <div class="input-group m-t-15">
                                                                                          <select id="id_medicare_icd9" name="insurance_icd9" class="selectpicker show-tick" data-style="btn-white">
                                                                                                <option value="0"> Select ICD9 Diagnosis Code</option>
                                                                                                <option value="795.00">Nonspecific abnormal Papanicolaou smear of cervix - unspecified 795.00</option>
                                                                                                <option value="795.01">ASCUS favor benign 795.01</option>
                                                                                                <option value="795.02">ASCUS favor dysplasia 795.02</option>
                                                                                                <option value="795.09">Other nonspecific abnormal Papanicolaou smear of cervix 795.09</option>
                                                                                                <option value="627.3">Atrophic Vaginitis 627.3</option>
                                                                                                <option value="622.1">Dysplasia 622.1</option>
                                                                                                <option value="626.6">Metrorrhagia 626.6</option>
                                                                                                <option value="V22.0/V22.2">Pregnancy State V22.0/V22.2</option>
                                                                                                <option value="V24.2">Routine  Postpartum Follow Up V24.2</option>
                                                                                                <option value="616.10">Vaginitis 616.10</option>
                                                                                                <option value="627.2">Menopause 627.2</option>
                                                                                                <option value="616.0">Cervicitis 616.0</option>
                                                                                                <option value="V76.2" selected="selected">Routine V76.2</option>
                                                                                                <option value="S10.1">Oral Contraceptives-Eval Prior to Method S10.1</option>
                                                                                                <option value="S10.2">Oral Contraceptives-Maintain Adherence S10.2</option>
                                                                                                <option value="S20.1">Depo-Provera Injection-Eval prior to method S20.1</option>
                                                                                                <option value="S50.1">Barriers and spermicide-Eval prior to method S50.1</option>
                                                                                                <option value="S50.2">Barriers and spermicide-Maintain adherence S50.2</option>
                                                                                                <option value="">Other </option>
                                                                                           </select>
                                                                                    </div>
                                                                                </div>
                                                                            </div>

                                                                            <div class="col-lg-2">
                                                                                <div class="p-1">
                                                                                    <h5><b>UPIN:</b></h5>
                                                                                    <div class="input-group m-t-15">
                                                                                        <input type="text" name="insurance_upin" class="form-control" id="exampleInputEmail1" placeholder="UPIN" value="">
                                                                                        <span class="input-group-addon bg-custom b-0 text-white"><i class="fa fa-map-marker"></i></span>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>



                                                                    </div>
                                                            </div>


                                                            <div class="col-lg-12">
                                                                    <div class="col-lg-6">
                                                                            <div class="p-1">
                                                                                <h5><b>Responsible Party (if different from patient)</b></h5>
                                                                                <div class="input-group m-t-15">
                                                                                     <input type="text" name="responsible_party" class="form-control" id="id_patient_address2"  value="">
                                                                                     <span class="input-group-addon bg-custom b-0 text-white"><i class="fa ion-map "></i></span>
                                                                                </div>
                                                                            </div>
                                                                    </div>

                                                                    <div class="col-lg-6">
                                                                        <p class="text-muted font-13 m-b-15 m-t-20">Relationship To Patient:</p>
                                                                            <div class="col-sm-12">
                                                                                <div class="radio radio-custom radio-inline">
                                                                                    <input type="radio" id="inlineRadio7" value="Self" name="insurance_relationship" checked>
                                                                                    <label for="inlineRadio7"> Self </label>
                                                                                </div>

                                                                                <div class="radio radio-custom radio-inline">
                                                                                    <input type="radio" id="inlineRadio8" value="Child" name="insurance_relationship">
                                                                                    <label for="inlineRadio8"> Child </label>
                                                                                </div>

                                                                                <div class="radio radio-custom radio-inline">
                                                                                    <input type="radio" id="inlineRadio9" value="Spouse" name="insurance_relationship">
                                                                                    <label for="inlineRadio9"> Spouse </label>
                                                                                </div>

                                                                                <div class="radio radio-custom radio-inline">
                                                                                    <input type="radio" id="inlineRadio10" value="Other"  name="insurance_relationship">
                                                                                    <label for="inlineRadio10"> Other </label>
                                                                                </div>
                                                                            </div>
                                                                    </div>




                                                            </div>



                                                    </div>
                                                {% endif %}
                                            </section>



                                            <h3 class="title current">Select Examen</h3>
                                            <section >
                                                {% if Step == 1 %}
                                                <div>

                                                     <select multiple="multiple" class="multi-select" id="my_multi_select2" name="my_multi_select2[]" data-plugin="multiselect" data-selectable-optgroup="true">
                                                        {% for case in CaseTypes %}
                                                               <optgroup label="{{ case.case_type_name }}">
                                                                   {% for exam in Exams %}
                                                                       {% if case.case_type_name  == exam.exam_casetype.case_type_name %}
                                                                          <option value="{{ exam.exam_id }}" {% if multi_casetype %}{%  for case in multi_casetype %}{% if case.exam_id == exam.exam_id %}selected{% endif %}{% endfor %}{% endif %}>{{ exam.exam_name }}</option>
                                                                       {% endif %}
                                                                   {% endfor %}
                                                                </optgroup>
                                                        {% endfor %}
                                                     </select>


                                                     <div class="col-lg-8">
                                                                   <div class="col-lg-12">
                                                                       <div class="p-20">
                                                                            <p class="text-muted m-b-15 font-13">You can select <code>  Multiple</code> Exams.</p>
                                                                            <select  name="my_multi_select22[]" class="multi-select select2 select2-multiple"  multiple="multiple" multiple data-placeholder="Choose a Case Type" data-style="btn-white">
                                                                                {% for case in CaseTypes %}
                                                                                       <optgroup label="{{ case.case_type_name }}">
                                                                                           {% for exam in Exams %}
                                                                                               {% if case.case_type_name  == exam.exam_casetype.case_type_name %}
                                                                                                  <option value="{{ exam.exam_id }}" {% if multi_casetype %}{%  for case in multi_casetype %}{% if case.exam_id == exam.exam_id %}selected{% endif %}{% endfor %}{% endif %}>{{ exam.exam_name }}</option>
                                                                                               {% endif %}
                                                                                           {% endfor %}
                                                                                        </optgroup>
                                                                                {% endfor %}

                                                                            </select>
                                                                       </div>
                                                                   </div>
                                                    </div>

                                                </div>
                                                {% endif %}
                                            </section>

                                            <h3>Test Information2</h3>
                                            <section>
                                                 {% if Step == 2 %}
                                                    <div>

                                                    </div>
                                                {% endif %}
                                            </section>


                                            <h3>Confirmation</h3>
                                            <section>
                                                 {% if Step == 3 %}
                                                     <div>

                                                     </div>
                                                 {% endif %}
                                            </section>


                                            <div class="form-group m-b-0">
                                               <div class="col-sm-offset-5 col-sm-5">
                                                 {{ message }}
                                               </div>
                                            </div>


                                            <div class="form-group m-b-0">
                                                 <div class="col-sm-offset-9 col-sm-9">
                                                     {% if Step == 0 %}
                                                         <a href="/dashboard/new_entry/">
                                                             <button type="link" name="new_case" class="btn btn-default btn-custom waves-effect waves-light">Back to Search</button>
                                                         </a>
                                                             <button type="submit" name="save_step1" class="btn btn-default btn-custom waves-effect waves-light">Save & Continue</button>
                                                     {% endif %}
                                                     {% if Step == 1 %}
                                                         <a href="/dashboard/wizard/{{ Step-1 }}">
                                                             <button type="link" name="previus" class="btn btn-default btn-custom waves-effect waves-light">Previous</button>
                                                         </a>
                                                         <button type="submit" name="save_step2" class="btn btn-default btn-custom waves-effect waves-light">Save & Continue</button>

                                                     {% endif %}
                                                     {% if Step == 2 %}
                                                         <a href="/dashboard/wizard/{{ Step-1 }}">
                                                                 <button type="link" name="previus" class="btn btn-default btn-custom waves-effect waves-light">Previous</button>
                                                         </a>
                                                         <button type="submit" name="save_step3" class="btn btn-default btn-custom waves-effect waves-light">Save & Continue</button>

                                                     {% endif %}

                                                     {% if Step == 3 %}
                                                         <a href="/dashboard/wizard/{{ Step-1 }}">
                                                             <button type="link" name="previus" class="btn btn-default btn-custom waves-effect waves-light">Previous</button>
                                                         </a>
                                                         <button type="submit" name="save_step3" class="btn btn-default btn-custom waves-effect waves-light">Save & Continue</button>
                                                     {% endif %}
                                                </div>
                                            </div>
                                        </div>
                                    </form>
                            	</div>


                            <!-- End row -->

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

						<!-- end row -->



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

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




{% endblock %}