<?php

    $this->load->view('master/header');
    $this->load->view('master/sidebar');

?>  

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        Other Package List
        <!-- <small>it all starts here</small> -->
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li><a href="#">Packages</a></li>
        <li class="active">Add Pacakge</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">

      <?php if($this->session->flashdata('success')){ ?>

      <div class="alert alert-success alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <h4><i class="icon fa fa-check"></i> Alert!</h4>
        <?php echo $this->session->flashdata('success'); ?>.
      </div>

      <?php } ?>

      <?php if($this->session->flashdata('error')){ ?>

      <div class="alert alert-danger alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <h4><i class="icon fa fa-ban"></i> Alert!</h4>
        <?php echo $this->session->flashdata('error'); ?>.
      </div>

      <?php } ?>

      <!-- Default box -->
      <div class="box">
        <div class="box-header with-border">
          <h3 class="box-title">Packages</h3>

          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip"
                    title="Collapse">
              <i class="fa fa-minus"></i></button>
            <button type="button" class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="Remove">
              <i class="fa fa-times"></i></button>
          </div>
        </div>
        <div class="box-body">
            <table id="example1" class="table table-bordered table-striped">
              <thead>
              <tr>
                <th>Package Type</th>
                <th>Title</th>
                <th>Price</th>
                <th>Action</th>
              </tr>
              </thead>
                <tbody>
                  <?php 
                    foreach($results as $result){
                      if(
                        $result['type'] == 'shared_hosting' ||
                        $result['type'] == 'wordpress_hosting' ||
                        $result['type'] == 'email_marketing'
                      ){
                        $currency = "৳";
                      }
                      
                      else{
                        $currency = "$";
                      }




                      if($result['type'] == 'shared_hosting'){
                        $package_type = "Shared Hosting";
                      }
                      elseif($result['type'] == 'wordpress_hosting'){
                        $package_type = "WordPress Hosting";
                      }
                      elseif($result['type'] == 'email_marketing'){
                        $package_type = "Email Marketing";
                      }
                      elseif($result['type'] == 'fb_packages'){
                        $package_type = "Facebook Packages";
                      }
                      elseif($result['type'] == 'google_adwords'){
                        $package_type = "Google Adwords";
                      }

                  ?>
                  <tr>
                    <td><?= $package_type; ?></td>
                    <td><?= $result['title']; ?></td>
                    <td><?= $currency." ".$result['price']; ?></td>
                    
                    <td>
                      <a href="<?= site_url('user/HostingPackage/editHostingPackage?packageid='); echo $result['packageid']; ?>" class="btn btn-warning"><i class="fa fa-edit"></i></a>
                      <button data-toggle="modal" data-target="#delete<?php echo $result['packageid']; ?>" class="btn btn-danger"><i class="fa fa-trash"></i></button>
                    </td>
                    <!-- Modal -->
                    <div id="delete<?php echo $result['packageid']; ?>" class="modal fade" role="dialog">
                      <div class="modal-dialog">

                        <!-- Modal content-->
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                            <h4 class="modal-title">Are You Sure?</h4>
                          </div>
                          <div class="modal-body">
                            <button type="button" class="btn btn-danger" data-dismiss="modal">No</button>
                            <a href="<?= site_url('user/HostingPackage/deleteHostingPackage/'); echo $result['packageid']; ?>" class="btn btn-success">Yes</a>
                          </div>
                        </div>

                      </div>
                    </div>

                    <!-- End Modal -->
                  </tr>
                  <?php } ?>
                </tbody>
              <tfoot>
              <tr>
                <th>Package Type</th>
                <th>Title</th>
                <th>Price</th>
                <th>Action</th>
              </tr>
              </tfoot>
            </table>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->


<?php

    $this->load->view('master/footer');

?>  