

<main id="main" class="main">

<section class="section">
  <div class="row">
    <div class="col-lg-12">

      <div class="card">
          <div class="card-header mb-4">
            <div class="row">
              <div class="col-sm-6">
                <h4 class="text-dark"><?= $title; ?></h4>
              </div>
             </div>

        </div>
        <div class="card-body">
          <div>
            <table class="table table-striped table-hover" id="mytable">
                <thead>
                  <tr>
                    <th scope="col">S.No.</th>
                    <?php if($this->session->userdata('usertype') !== 'staff'){ ?>
                    <th scope="col">Staff</th>
                    <?php } ?>
                    <th scope="col">View offering</th>
                    <th scope="col">Created</th>
                  </tr>
                </thead>
                <tbody>
                  <?php $i=1; foreach($list as $val) { ?>
                    <tr>
                      <th scope="row"><?= $val['id']; ?></th>
                      <?php if($this->session->userdata('usertype') !== 'staff'){ ?>
                      <td><?= $val['fullname']; ?></td>
                      <?php } ?>
                      <td>
                        <a href="javascript:void(0)" class="btn btn-info btn-sm edit-btn" onclick="calculatorOfferingData(<?= $val['id']; ?>)" data-bs-toggle="modal" data-bs-target="#editModal">View</a>
                      </td>
                      <td><?= date('d-m-Y',strtotime($val['created']));?></td>
                    </tr>
                  <?php } ?>
                </tbody>
            </table>
          </div>
        </div>
      </div>

    </div>
  </div>
</section>

</main><!-- End #main -->

<!-- Offerings Modal -->
<div class="modal fade modal-bookmark" id="viewOfferingsModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Offerings</h5>
        <button class="btn-close" type="button" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        <div>
        <table class="table table-striped table-hover">
            <thead>
              <tr>
                  <th>Offering</th>
                  <th>Currency</th>
                  <th>Ticket Type</th>
                  <th>No. of hours</th>
                  <th>Ticket Price</th>
                  <th>Total Price</th>
              </tr>
            </thead>
            <tbody id="calculator-offering-details">
              
            </tbody>
        </table>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
function calculatorOfferingData(calculator_id)
{
  $.ajax({
      url: "<?= base_url('calculator/calculatorOfferingData'); ?>",
      method: "POST",
      data: {
        calculator_id:calculator_id
      },
      success:function(res){
        $('#viewOfferingsModal').modal('toggle'); 
        $('#calculator-offering-details').html(res);
      }
  });
};

</script>