<div class="row">
    <!--  table area -->
    <div class="col-sm-12">

        <div class="panel panel-bd"> 

            <div class="panel-heading panel-aligner" >

                <div class="panel-title">
                    <h4><?php echo display('courses') ?></h4>
                </div>

                <div class="mr-25">
                 <?php if($this->permission->method('courses','create')->access()): ?>
                <button type="button" class="btn btn-primary btn-md" data-target="#add" data-toggle="modal"  ><i class="fa fa-plus-circle" aria-hidden="true"></i>
                <?php echo "Add New Course" ?></button>
                <?php endif; ?>
                 <?php if($this->permission->method('certificate','view')->access()): ?>
                <a href="<?php echo base_url();?>courses/Courses_controller/courses_view" class="btn btn-primary"><?php echo "Manage Courses" ?></a>
                <?php endif; ?>
                </div>

            </div>

            <div class="panel-body">
                <div class="table-responsive">
                <table width="100%" class="datatable table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th><?php echo "SL No" ?></th>
                            <th><?php echo "Course Name" ?></th>
                            <th><?php echo "Course Description" ?></th>
                            <th><?php echo display('date') ?></th>
                            <th><?php echo "Assign Course" ?></th>
                           
                           
                          
                        </tr>
                    </thead>
                    <tbody>
                        <?php if (!empty($mang)) { ?>
                            <?php $sl = 1; ?>
                            <?php foreach ($mang as $row) { ?>
                                <tr class="<?php echo ($sl & 1)?"odd gradeX":"even gradeC" ?>">
                                    <td><?php echo $sl; ?></td>
                                    <td><?php echo $row->courses_name; ?></td>
                                <td><?php   $text=$row->cr_description;

                    $pieces = substr($text, 0, 20);
                    $ps = substr($pieces, 0, 16)."...";
                    $cn=strlen($text);
                    if ($cn>20) {
                      echo $ps;
                    }else
                    {
                    echo $text;
                    }
                                ?></td>
                                
                                <td><?php echo $row->date; ?></td>
                                <td><?php echo $row->first_name.' '.$row->last_name; ?></td>
                                
                                                           
                                   
                                </tr>
                                <?php $sl++; ?>
                            <?php } ?> 
                        <?php } ?> 
                    </tbody>
                </table>  <!-- /.table-responsive -->
            </div>
            </div>
        </div>
    </div>
</div>
 
 
 <div id="add" class="modal fade" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <center><strong><h4><i class='fa fa-book' aria-hidden='true'></i>Course Form</h4></strong></center>
            </div>
            <div class="modal-body">
               
    
   <div class="row">
        <div class="col-sm-12 col-md-12">
            <div class="panel">
                <div class="panel-heading">
                    <div class="panel-title">
                       
                    </div>
                </div>
                <div class="panel-body">

                    <?php echo  form_open_multipart('courses/Courses_controller/create_courses') ?>
                   
                       <div class="form-group row">
                           
                            <label for="courses_name" class="col-sm-3 col-form-label">
                            <?php echo "Course Name" ?></label>
                            <div class="col-sm-9">
                           <input type="text" name="courses_name" placeholder="<?php echo "Course Name" ?>" class=" form-control">
                               
                            </div>
                           
                        </div>
                        <div class="form-group row">
                           
                            <label for="cr_description" class="col-sm-3 col-form-label">
                            <?php echo "Description" ?></label>
                            <div class="col-sm-9">
                           <textarea  name="cr_description" placeholder="<?php echo "Course Description" ?>" class=" form-control"></textarea>
                               
                            </div>
                           
                        </div>
                     
                         <div class="form-group row">
                            <label for="date" class="col-sm-3 col-form-label">
                            <?php echo display('date') ?></label>
                            <div class="col-sm-9">
                           <input type="text" name="date" placeholder=" <?php echo display('date') ?>" id="date" class="datepicker form-control">
                               
                            </div>
                            </div>
                         <div class="form-group row">
                           
                            <label for="employee_id" class="col-sm-3 col-form-label">
                            <?php echo "Assign Course" ?></label>
                            <div class="col-sm-9">
                            <?php echo form_dropdown('employee_id',$dropdown,null,'class="form-control codeigniterselect"') ?>
                               
                            </div>
                           
                        </div>
                    
     
             
                        <div class="form-group form-group-margin text-right">
                            <button type="reset" class="btn btn-primary w-md m-b-5"><?php echo display('reset') ?></button>
                            <button type="submit" class="btn btn-success w-md m-b-5"><?php echo display('save') ?></button>
                        </div>
                    <?php echo form_close() ?>

                </div>  
            </div>
        </div>
    </div>
    </div>
     
            </div>
            <div class="modal-footer">

            </div>

        </div>

    </div>

