<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('training') ?></h4>
                </div>

                <div class="mr-25">
                 <?php if($this->permission->method('training','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 Training" ?></button>
                <?php endif; ?>
                 <?php if($this->permission->method('training','view')->access()): ?>
                <a href="<?php echo base_url();?>/training/Training_controller/training_view" class="btn btn-primary"><?php echo "Manage Trainings" ?></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 display('cid') ?></th>
                            <th><?php echo "Course Name" ?></th>
                            <th><?php echo "Training Date" ?></th>
                            <th><?php echo "Session Info" ?></th>
                            <th><?php echo "Comments" ?></th>
                            <th><?php echo "Expiration Date" ?></th>
                            <th>Employee Name</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->course_name; ?></td>
                                    <td><?php echo $row->training_date; ?></td>
                                    <td><?php echo $row->session_info; ?></td>
                                    <td><?php   $text=$row->comments;
                                        $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->expiration_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-briefcase' aria-hidden='true'></i>Training 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('training/Training_controller/create_training') ?>
                   
                       <div class="form-group row">
                           
                            <label for="course_name" class="col-sm-3 col-form-label">
                            <?php echo "Course Name" ?></label>
                            <div class="col-sm-9">
                           <input type="text" name="course_name" placeholder="<?php echo "Course Name" ?>" class=" form-control">
                            </div>
                           
                        </div>

                        <div class="form-group row">
                            <label for="training_date" class="col-sm-3 col-form-label">
                                <?php echo "Training Date" ?></label>
                            <div class="col-sm-9">
                                <input type="text" name="training_date" placeholder=" <?php echo "Training Date" ?>" id="training_date" class="datepicker form-control">

                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="session_info" class="col-sm-3 col-form-label">
                                <?php echo "Training Number" ?></label>
                            <div class="col-sm-9">
                                <input type="text" name="session_info" placeholder="<?php echo "Training Number" ?>" class=" form-control">

                            </div>

                        </div>
                        <div class="form-group row">
                           
                            <label for="comments" class="col-sm-3 col-form-label">
                            <?php echo "Comments" ?></label>
                            <div class="col-sm-9">
                           <textarea  name="comments" placeholder="<?php echo "Comments" ?>" class=" form-control"></textarea>
                               
                            </div>
                           
                        </div>

                        <div class="form-group row">
                            <label for="expiration_date" class="col-sm-3 col-form-label">
                                <?php echo "Expiration Date" ?></label>
                            <div class="col-sm-9">
                                <input type="text" name="expiration_date" placeholder=" <?php echo "Expiration Date" ?>" id="expiration_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 display('employee_name') ?></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>

