<div class="row">
                    <!-- Column -->
                    <div class="col-lg-4 col-xlg-3 col-md-5">
                        <div class="card 
    <?php 
        if ($staff->staff_status == '1') {echo'bg-info';}
        if ($staff->staff_status != '1') {echo'bg-danger';}
    ?>">

    <div class="card" style="margin-bottom:0px;"> 
        <img class="card-img" src="<?php echo base_url() ?>theme-items/images/background/login.jpg" alt="Card image">
        <div class="card-img-overlay card-inverse social-profile d-flex ">
            <div class="align-self-center" style="width: 100%;">
                <h4 class="card-title"><?php echo $staff->staff_name ?></h4>
                <h6 class="card-subtitle"><?php echo $staff->position ?></h6>
            </div>
        </div>
    </div>
    <div class="card-body"> 
        <small class="text-white">Contact Info</small>
        <hr class="p-0 m-t-5 m-b-5">
        <h6 class="text-white" >
            <i class="icon-phone"></i> <span class="pull-right"><?php echo phone_number_format_pakistani($staff->phone); ?>
        </h6> 
        <h6 class="text-white m-b-15" ><i class="icon-home"></i> <span class="pull-right"><?php echo $staff->address ?></h6>
        <small class="text-white">Personal Info</small>
        <hr class="p-0 m-t-5 m-b-5">
        <h6 class="text-white">Father Name: <span class="pull-right"><?php echo amount_format_pakistani($staff->father_name) ?></span></h6>
        <h6 class="text-white m-b-15">CNIC: <span class="pull-right"><?php echo cnic_format_pakistani($staff->cnic) ?></span></h6>
        <small class="text-white">Organizational Info</small>
        <hr class="p-0 m-t-5 m-b-5">
        <h6 class="text-white">Status: <span class="pull-right">
            <?php 
                if ($staff->staff_status == 1) {echo "Onboard";}
                 if ($staff->staff_status == 2) {echo "Left";}
                 if ($staff->staff_status == 3) {echo "Terminate";}
            ?></span>
        </h6>
        <h6 class="text-white">Salary: <span class="pull-right"><?php echo amount_format_pakistani($staff->salary) ?></span></h6>
        <h6 class="text-white">Note: <span class="pull-right"><?php echo ($staff->note) ?></span></h6>


        
        
            <hr>
    </div>
</div>
                        
                    </div>
                    <!-- Column -->
                    <!-- Column -->
                    <div class="col-lg-8 col-xlg-9 col-md-7">
                        <div class="card">
                            <!-- Nav tabs -->
                            <ul class="nav nav-tabs profile-tab" role="tablist">
                                <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#payments" role="tab">Payments</a> </li>
                                <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#settings" role="tab">Update</a> </li>
                            </ul>
                            <!-- Tab panes -->
                            <div class="tab-content">
                                <!--First tab-->
                                <div class="tab-pane active" id="payments" role="tabpanel">
                                    <div class="card-body">
                                        <h4 class="card-title">Payment Record</h4>
                                        <hr>
                                        <div class="table-responsive">
<table class="table table-bordered">
    <thead>
        <tr>
            <th>ID</th>
            <th>Date</th>
            <th>Pay For</th>
            <th>Amount</th>
            <th>Received By</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach($payments as $row): ?>
            <?php
                $Date = date("d-m-Y", strtotime($row->pay_date));
                $purpose = 'Not Set';
                if ($row->module_id == 1) $purpose = 'Advance';
                elseif ($row->module_id == 2) $purpose = 'Loan';
                elseif ($row->module_id == 3) $purpose = 'Salary';
                $amount = $row->credit > 0 ? $row->credit : $row->debit;
            ?>
            <tr>
                <td><?= $row->id ?></td>
                <td><?= $Date ?></td>
                <td><?= $purpose ?></td>
                <td>Rs. <?= number_format($amount) ?></td>
                <td><?= $this->user->getNameBy($row->user_id) ?></td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>

                                        </div>
                                    </div>
                                </div>
                                <!--Third tab-->
                                <div class="tab-pane" id="settings" role="tabpanel">
                                    <?php if (isset($message)) : ?>
                                        <div class="alert alert-success"><?php echo $message; ?></div>
                                    <?php endif ?>
                                    <?php if (isset($error)) : ?>
                                        <div class="alert alert-danger"><?php echo $error; ?></div>
                                    <?php endif ?>
                                    <div class="card-body">
                                        <?php $attributes = array('name' => 'formView', 'id' => 'formView', 'class' => 'form-validation');
                                            echo form_open_multipart('', $attributes);
                                        ?>
                                        <div class="form-horizontal form-material">
                                            <div class="row">
                                                <div class="form-group col-md-6">
                                                    <label class="col-md-12">Full Name</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="staff_name" value="<?php echo $staff->staff_name ?>" class="form-control form-control-line">
                                                    </div>
                                                </div>
                                                <div class="form-group col-md-6">
                                                    <label class="col-md-12">Father Name</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="father_name" value="<?php echo $staff->father_name ?>" class="form-control form-control-line">
                                                    </div>
                                                </div> 
                                            </div>
                                            <div class="row">
                                                <div class="form-group col-md-6">
                                                    <label class="col-md-12">Contact</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="phone" value="<?php echo $staff->phone ?>" class="form-control form-control-line">
                                                    </div>
                                                </div>
                                                <div class="form-group col-md-6">
                                                    <label class="col-md-12">CNIC</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="cnic" value="<?php echo $staff->cnic ?>" class="form-control form-control-line">
                                                    </div>
                                                </div> 
                                            </div>
                                            <div class="row">
                                                <div class="form-group col-md-12">
                                                    <label class="col-md-12">Address</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="address" value="<?php echo $staff->address ?>" class="form-control form-control-line">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="form-group col-md-4">
                                                    <label class="col-md-12">Salary</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="salary" value="<?php echo ($staff->salary) ?>" class="form-control form-control-line">
                                                    </div>
                                                </div>
                                                <div class="form-group col-md-4">
                                                    <label class="col-md-12">Position</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="position" value="<?php echo $staff->position ?>" class="form-control form-control-line">
                                                    </div>
                                                </div> 
                                                <div class="form-group col-md-4">
                                                    <label class="col-md-12">Status</label>
                                                    <div class="col-md-12">
                                                        <select class="form-control custom-select" name="staff_status" id="staff_status" style="width: 100%;">
                                                            <option value="<?php echo $staff->staff_status ?>"><?php if ($staff->staff_status == 1) {
                                                                    echo "Onboard";
                                                                    }
                                                                if ($staff->staff_status == 2) {
                                                                    echo "Leave";
                                                                    }
                                                                if ($staff->staff_status == 3) {
                                                                    echo "Left";
                                                                    }
                                                                    if ($staff->staff_status == 4) {
                                                                    echo "Terminate";
                                                                    }
                                                                ?>
                                                            </option>
                                                            <option value="1">Onboard</option>
                                                            <option value="2">Left</option>
                                                            <option value="3">Terminate</option>
                                                        </select> 
                                                    </div>
                                                </div> 
                                            </div>
                                            <div class="row">
                                                <div class="form-group col-md-12">
                                                    <label class="col-md-12">Additional Note</label>
                                                    <div class="col-md-12">
                                                        <input type="text" name="note" value="<?php echo $staff->note ?>" class="form-control form-control-line">
                                                    </div>
                                                </div>
                                            </diV>
                                            <div class="form-group">
                                                <div class="col-sm-12">
                                                    <button class="btn btn-success">Update Profile</button>
                                                </div>
                                            </div>
                                        </div>
                                        <?php echo form_close(); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- Column -->
                </div>
<script src="<?php echo base_url(); ?>theme-items/plugins/jquery/jquery.min.js"></script>
<!-- jQuery peity -->
<script src="<?php echo base_url(); ?>theme-items/plugins/tablesaw-master/dist/tablesaw.js"></script>
<script src="<?php echo base_url(); ?>theme-items/plugins/tablesaw-master/dist/tablesaw-init.js"></script>

<script language="javascript" type="text/javascript">
    //For Total Amount of Deliveries
    var tds = document.getElementById('invoice_table').getElementsByTagName('td');
    var sum = 0;
        for(var i = 0; i < tds.length; i ++) {
            if(tds[i].className == 'count-me') {
                sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
                }
            }
document.getElementById('invoice_table').innerHTML += '<tr><td colspan="5">Total</td><td></td><td colspan="3">' + sum + '</td></tr>'
</script>





