<?php
    $errors = $this->session->userdata('errors');
    if (isset($errors)) {
        ?>
        <script>
            swal ( "Oops" ,  "<?php echo $errors ?>" ,  "error" )
        </script>
        <?php echo $errors ?>
        <?php
        $this->session->unset_userdata('errors');
    }
    $error = $this->session->userdata('error');
    if (isset($error)) {
        ?>
         <script>
            swal ( "Oops" ,  "<?php echo $error ?>" ,  "error" )
        </script>
        <?php
        $this->session->unset_userdata('error');
    }
    $success = $this->session->userdata('success');
    if (isset($success)) {
        ?>
         <script>
            swal({
          title: "Done!",
          text: "<?php echo $success ?>",
          icon: "success",
        });
        </script>
        <?php
        $this->session->unset_userdata('success');
    }
    ?>
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>View All Event</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?php echo admin_url() ?>admin">Home</a></li>
              <li class="breadcrumb-item active">View All Event</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">

          <div class="col-sm-12">
            <div class="card card-default">
              <div class="card-header">
                <h4>View All Widget</h4>
                
              </div>
                <div class="card-body">
                  <table id="example" class="table table-bordered table-striped">
                    <thead>
                    <tr>
                      <th>id</th>
                      <th>Title</th>
                      <th>Slug</th>
                      
                      <th>Build Mode</th>
                      <th>Edit Main</th>
                      <th></th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php $i=1; foreach ($get_all_event as $key => $event):?>
                    <tr>
                      <td><?php echo $i ?></td>
                      <td><?php echo $event->title ?></td>
                      <td><a href="<?php echo base_url() ?>event-details/<?php echo $event->link ?>">Go to Event</a></td>
                      <td>
                        <?php if($event->event_build_mode == 1): ?>
                          <span class="badge badge-success">Page Builder</span>
                        <?php else: ?>
                          <span class="badge badge-warning">Landing Page</span>
                        <?php endif;?>

                      </td>
                      <td><a href="<?php echo base_url() ?>admin/event/edit_main_page/<?php echo $event->id ?>" class="btn btn-info btn-sm"><i class="fa fa-edit" aria-hidden="true"></i></a></td>
                      <?php if($event->event_build_mode == 1): ?>
                        <td>
                          <a target="_blank" href="<?php echo base_url() ?>admin/editor/view_editor?id=<?php echo $event->id ?>" class="btn btn-primary btn-sm"><i class="fa fa-cog" aria-hidden="true"></i></a>
                          <a class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?')" href="<?php echo base_url() ?>admin/editor/delete_page/<?php echo $event->id ?>"><i class="fa fa-trash" aria-hidden="true"></i></a>
                        </td>
                      <?php else: ?>
                        <td>
                          <a class="btn btn-primary btn-sm" href="<?php echo base_url() ?>admin/event/edit/<?php echo $event->id ?>"><i class="fa fa-edit" aria-hidden="true"></i></a>
                          <a class="btn btn-danger btn-sm" onclick="return confirm('Are you sure?')" href="<?php echo base_url() ?>admin/editor/delete_page/<?php echo $event->id ?>"><i class="fa fa-trash" aria-hidden="true"></i></a>
                        </td>
                      <?php endif;?>
                    </tr>
                    <?php $i++; ?>
                    <?php endforeach; ?>
                    </tbody>
                    
                  </table>
                </div>
              </div>
            </div>
          </div>
      </div>
    </section>
    <!-- /.content -->
  </div>
