<?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>
        Software 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="#">Software</a></li>
        <li class="active">Software List</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">Client's</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>Title</th>
                <th>Image</th>
                <th>Action</th>
              </tr>
              </thead>
                <tbody>
                <?php
                  foreach($results as $result){ 
                ?>
                <tr>
                  <td><?php echo $result['title'] ;?></td>
                  <td><img src="<?php echo base_url(); echo $result['picture_path'] ;?>" alt="" width="250px"></td>
                  <td>
                    <a href="<?= site_url('user/Software/editSoftware?softwareid=').$result['softwareid']; ?>" class="btn btn-warning"><i class="fa fa-edit"></i></a>
                    <button data-toggle="modal" data-target="#delete<?php echo $result['softwareid']; ?>" class="btn btn-danger"><i class="fa fa-trash"></i></button>
                  </td>
                  <!-- Modal -->
                  <div id="delete<?php echo $result['softwareid']; ?>" 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/Software/deleteSoftware?softwareid='); echo $result['softwareid']; ?>&picture_path=<?php echo $result['picture_path']; ?>" class="btn btn-success">Yes</a>
                        </div>
                      </div>

                    </div>
                  </div>

                  <!-- End Modal -->
                  </tr>

                <?php } ?>
                </tbody>
              <tfoot>
              <tr>
                <th>Title</th>
                <th>Image</th>
                <th>Action</th>
              </tr>
              </tfoot>
            </table>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->

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


<?php

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

?>  