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

                <div class="mr-25">
                 <?php if($this->permission->method('certificate','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 Certificate" ?></button>
                <?php endif; ?>
                 <?php if($this->permission->method('certificate','view')->access()): ?>
                <a href="<?php echo base_url();?>/certificate/Certificate_controller/certificate_view" class="btn btn-primary"><?php echo "Manage Certificates" ?></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 "Certificate Name" ?></th>
                            <th><?php echo "Certificate Number" ?></th>
                            <th><?php echo "Description" ?></th>
                            <th><?php echo "Start Date" ?></th>
                            <th><?php echo "End Date" ?></th>
                            <th><?php echo "Comments" ?></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->certificate_name; ?></td>
                                    <td><?php echo $row->certificate_number; ?></td>
                                    <td><?php   $text=$row->ct_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->start_date; ?></td>
                                    <td><?php echo $row->end_date; ?></td>
                                    <td><?php echo $row->certificate_comments; ?></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-certificate' aria-hidden='true'></i>Certificate 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('certificate/certificate_controller/create_certificate') ?>
                   
                       <div class="form-group row">
                           
                            <label for="certificate_name" class="col-sm-3 col-form-label">
                            <?php echo "Certificate Name" ?></label>
                            <div class="col-sm-9">
                           <input type="text" name="certificate_name" placeholder="<?php echo "Certificate Name" ?>" class=" form-control">
                               
                            </div>
                           
                        </div>
                        <div class="form-group row">

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

                            </div>

                        </div>
                        <div class="form-group row">
                           
                            <label for="ct_description" class="col-sm-3 col-form-label">
                            <?php echo "Description" ?></label>
                            <div class="col-sm-9">
                           <textarea  name="ct_description" placeholder="<?php echo "Certificate Description" ?>" class=" form-control"></textarea>
                               
                            </div>
                           
                        </div>
                     
                         <div class="form-group row">
                            <label for="start_date" class="col-sm-3 col-form-label">
                            <?php echo "Start Date" ?></label>
                            <div class="col-sm-9">
                           <input type="text" name="start_date" placeholder=" <?php echo "Start Date" ?>" id="start_date" class="datepicker form-control">
                               
                            </div>
                         </div>
                        <div class="form-group row">
                            <label for="end_date" class="col-sm-3 col-form-label">
                                <?php echo "End Date" ?></label>
                            <div class="col-sm-9">
                                <input type="text" name="end_date" placeholder=" <?php echo "End Date" ?>" id="end_date" class="datepicker form-control">

                            </div>
                        </div>
                        <div class="form-group row">

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

                            </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>

