<?php
include getcwd() . "/codes/patient-details-by-get-id.php";
include getcwd() . "/codes/search-patient-by-post-uid.php";
?>
<!-- Main Content -->
<div class="container">

  <div class="row">
    <!-- Widget Item -->
    <div class="col-md-12">
      <div class="widget-area-2 proclinic-box-shadow">
        <h3 class="widget-title">Add Service</h3>
        <form name="add-patient-form" method="post" action="<?php echo path(); ?>codes/add-service-form.php"
              enctype="multipart/form-data">
          <div class="row justify-content-center">
            <div class="col-md-6">
              <div class="row">

                  <input name="patientId" type="hidden" class="form-control" value="<?php echo $patient['patientId']; ?> ">

                <div class="form-group col-md-12">
                  <label for="patientReferralLetter">Patient Name and Unique Identification No.</label>
                  <input type="text" class="form-control" value="<?php echo $patient['patientName'].' :: '.$patient['patientUId']; ?> " readonly="readonly">
                </div>
                <div class="form-group col-md-12">
                  <label for="typeId">Service</label>
                  <select name="serviceId" required class="form-control" id="serviceId">
                      <?php
                      $stmt = $conn->query("SELECT * FROM udut_services ORDER BY serviceName ASC");
                      while ($service = $stmt->fetch_array()) {
                          echo print "<option value='" . $service['serviceId'] . "'>" . $service['serviceName'] . "</option>";
                      }
                      ?>
                  </select>
                </div>
                <div class="form-group col-md-6">
                  <label for="typeId">Service Type</label>
                  <br>
                  <label class="container-radio">Adult
                    <input type="radio" name="typeId" value="Adult" required>
                    <span class="checkmark"></span>
                  </label>
                  <label class="container-radio">Child
                    <input type="radio" name="typeId" value="Child" required>
                    <span class="checkmark"></span>
                  </label>
                  <!--                  <label for="typeId">Service Type</label>-->
                  <!--                  <select name="typeId" required class="form-control" id="typeId">-->
                  <!--                      --><?php
                    //                      $stmt = $conn->query("SELECT * FROM udut_services_types ORDER BY typeName ASC");
                    //                      while ($type = $stmt->fetch_array()) {
                    //                          echo print "<option value='" . $type['typeId'] . "'>" . $type['typeName'] . "</option>";
                    //                      }
                    //                      ?>
                  <!--                  </select>-->
                </div>
                <div class="form-group col-md-6">
                  <label for="paymentTypeId">Payment Type</label>
                  <select name="paymentTypeId" required class="form-control" id="paymentTypeId">
                      <?php
                      $stmt = $query->getAll("SELECT * FROM udut_payments_types");
                      foreach ($stmt as $type) {
                          echo print "<option value='" . $type['paymentTypeId'] . "'>" . $type['paymentTypeName'] . "</option>";
                      }
                      ?>
                  </select>
                </div>
                <div class="form-group col-md-6">
                  <label for="paymentStatusId">Payment Status</label>
                  <select name="paymentStatusId" required class="form-control" id="paymentStatusId">
                      <?php
                      $stmt = $query->getAll("SELECT * FROM udut_payments_status");
                      foreach ($stmt as $status) {
                          echo print "<option value='" . $status['paymentStatusId'] . "'>" . $status['paymentStatusName'] . "</option>";
                      }
                      ?>
                  </select>
                </div>
                <div class="form-group col-md-6">
                  <label for="patientReferralLetter">Referral Letter</label>
                  <input name="patientReferralLetter" type="file" class="form-control" id="patientReferralLetter">
                </div>
                <div class="form-group col-md-6 mb-3">
                  <button type="submit" class="btn btn-primary btn-lg">Print Receipt</button>
                </div>
              </div>
            </div>
          </div>
        </form>
      <hr>
      </div>
    </div>
    <!-- /Widget Item -->
  </div>
</div>
<!-- /Main Content -->
