<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Events
      </h1>
      <ol class="breadcrumb">
        <li><a href="<?php echo base_url().'admin';?>"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class=""><a href="<?php echo base_url().'admin/event';?>">Event</a></li>
        <li class="active">Guest List</li>
      </ol>
    </section>

    <section class="content">
      <div class="row">
        <?php echo $this->utility->showMsg();?>
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Guest List</h3>
                <a class="btn btn-primary margin-right pull-right" href="<?php echo base_url()?>admin/event/add">Add</a>
                <a class="btn btn-primary margin-right pull-right send" href="javascript:void(0)">Send Bulk SMS</a>
              </div>
               
              <div></div>
            <!-- /.box-header -->
            <div class="box-body table-responsive">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>#</th>
                  <th>Username</th>
                  <th>Email</th>
                  <th>Member status</th>
                  <th>Checkin date</th>
                  <th>Drink package</th>
                  <th>No. of cape</th>
                  <th>Ceremonial</th>
                  <th>Extra Wish</th>
                  <th>Total Amount</th>
                  <th>Total Booking Amount</th>
                  <th>Details Checked</th>
                  <th>Payment Status</th>
                   <th>Action</th>
                </tr>
                </thead>
                 <?php if(count($guestlist)>0)
                {?>
                <tbody>
               <?php
                $i=1;
                $url ='';
                foreach ($guestlist as $data) 
                {
                ?>
                <tr>
                    <td><?php echo $i;?></td>
                    <td><?php echo $data['username']; ?></td>
                    <td><?php echo $data['email']; ?></td>
                    <td><?php if($data['member_status']==4) { echo 'Premium'; } else { echo 'Basic';} ?></td>
                    <td><?php echo $data['confirmed']; ?></td>
                    <td><?php if($data['drinking_package']==1) { echo 'Basic'; } else { echo 'Premium';}?></td>
                    <td><?php echo $data['cape']; ?></td>
                    <td><?php if($data['ceremonial']==1) { echo 'Accepted'; } ?></td>
                    <td><?php echo $data['extra_wish']; ?></td>
                    <td><?php echo number_format($data['summury'],2,',','.'); ?></td>
                    <td><?php echo number_format($data['booking_total'],2,',','.'); ?></td>
                    <td><?php if($data['details_check']==1) { echo 'Yes'; } else { echo 'No';}?></td>
                    <td><?php if($data['payed']==1) { echo 'Paid'; }else{ echo 'Unpaid';} ?></td>
                    <td>
                      <a href="<?php echo base_url();?>admin/event/delete_guest/<?php echo base64_encode($data['order_id']);?>/<?php echo str_replace('/','-',uri_string()); ?>" title="Delete" onclick="return confirm('Are you sure to delete ?');"><span class="fa fa-ban"></span></a>
          					  <?php if($data['mobile_number']>0){ ?>
                      <a href="<?php echo base_url();?>admin/event/sendSMS/<?php echo base64_encode($data['user_id']);?>/<?php echo base64_encode($data['event_id']);?>/<?php echo str_replace('/','-',uri_string()); ?>" title="Send SMS" onclick="return confirm('Are you sure to send SMS ?');"><span class="fa fa-phone"></span></a>
          					  <?php }else{ ?>
                      <a href="<?php echo base_url();?>admin/event/sendReminder/<?php echo base64_encode($data['user_id']);?>/<?php echo base64_encode($data['event_id']);?>/<?php echo str_replace('/','-',uri_string()); ?>" title="Send reminder" onclick="return confirm('Are you sure to send reminder ?');"><span class="fa fa-check-circle"></span></a>
                      <?php } ?>
                    </td>
                </tr>
                  <?php if($data['mobile_number']>0){ $url .= '%0a%22'.$data['mobile_number'].'%22,%22'.str_replace('%C2%A0','+',urlencode(html_entity_decode(strip_tags($data['party_address']),ENT_QUOTES))).'%22'; } ?>
               <?php $i++; } ?>

                </tbody>
                <?php } ?>
                <tfoot>
               
                </tfoot>
              </table>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <form id="sms_frm" action="<?php echo base_url().'admin/event/sendBulkSMS';?>" method="post" style="display:none;">
      <input type="hidden" name="url" value="<?php echo 'https://bulksms.vsms.net/eapi/submission/send_batch/1/1.0?username=Sakrileg&password=ppp79111&batch_data=msisdn,message'.$url; ?>">
      <input type="hidden" name="uri" value="<?php echo str_replace('/','-',uri_string()); ?>">
    </form>

    
<script>
  $(function () {
    $("#example1").DataTable();
    $('.send').click(function(){
      $('#sms_frm').submit();
    })
  });
</script>