<div class="collapse" id="collapseStatutory">
	<div class="card card-body">
	
    <h4 class="card-title">Statutory Details</h4>
    <hr>

    <div class="container">
        <?php if ($role == 'admin'): ?>
            <div class="row">
                <div class="btn-group ml-auto">
                    <a class="btn btn-info btn-sm" style="margin-bottom:15px; width: 200px;" href="<?php echo base_url('hr/StaffProfile/actionReport/'.$staff_id.'/12'); ?>" target="_blank">
                        <i class="fa fa-print"></i> Print
                    </a>
                </div>
            </div>
        <?php endif ?>
    </div>

	<div class="table-responsive">   
        <table id="table_date" class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th>Action type (effective date)</th>
                    <th>Details</th>
                    <th>Created At</th>
                    <!-- <th>Action</th> -->
                </tr>
                
            </thead>
            <tbody>
                <?php if($statutory_details) foreach ($statutory_details as $key => $statutory): ?> 
                    <tr class="link-row" data-id="" >
                        <td scope="row">
                            <?php
                                echo $statutory->action_type.'<br/><b>( '.date('d-F-Y',strtotime($statutory->action_efective_date)).' )</b>';
                            ?>
                        </td>
                        <td>
                            <b>Employee EPF Number : </b><?php echo (!empty($statutory->ee_epf_no))?$statutory->ee_epf_no:'N/A'; ?>
                            <br><b>Employee SOCSO No : </b><?php echo (!empty($statutory->ee_socso))?$statutory->ee_socso:'N/A'; ?>
                            <br><b>Income Tax No : </b><?php echo (!empty($statutory->ee_income_tax))?$statutory->ee_income_tax:'N/A'; ?>
                            <br><b>PCB Deduction (percentage) : </b><?php echo '('.($statutory->ee_pcb_deduction_percent).'%)'; ?>
                            <br><b>Zakat Deduction (percentage) : </b><?php echo '('.($statutory->ee_zakat_deduction_percent).'%)'; ?>
                            <br><b>Employer Rate (percentage) : </b>
                            <?php 
                                switch ($statutory->er_rate) {
                                    case 0:
                                        echo 'Statutory Rate - ('.$statutory->er_percent.'%)';
                                        break;
                                    case 1:
                                        echo 'Company Rate - ('.$statutory->er_percent.'%)';
                                        break;
                                    case 2:
                                        echo 'Personal Rate - ('.$statutory->er_percent.'%)';
                                        break;
                                    default:
                                        break;
                                }
                            ?>
                            <br><b>Employee Rate (percentage) : </b>
                            <?php 
                                switch ($statutory->ee_rate) {
                                    case 0:
                                        echo 'Statutory Rate - ('.$statutory->ee_percent.'%)';
                                        break;
                                    case 1:
                                        echo 'Company Rate - ('.$statutory->ee_percent.'%)';
                                        break;
                                    case 2:
                                        echo 'Personal Rate - ('.$statutory->ee_percent.'%)';
                                        break;
                                    default:
                                        break;
                                }
                            ?>
                            <br><b>Status : </b>
                            <?php echo (empty($statutory->status))?'INACTIVE':'ACTIVE'; ?>
                            <br><b>Year : </b>
                            <?php echo (!empty($statutory->year))?$statutory->year:'N/A'; ?>
                        </td>
                        <td><?php echo $statutory->created_at; ?></td>
                        <!-- <td>
                            <div class="text-center">
                                <div class="btn-group">
                                    <button class="btn btn-success btn-sm" data-toggle="modal" data-target="#mdl-view-statutory" onclick="populateModalStatutory(this);" data-content="<?php //echo base64_encode(json_encode($statutory));?>"><i class="fas fa-edit" ></i></button>
                                    <button class="btn btn-danger btn-sm" onclick="removeStatutoryDetails(<?php //echo $statutory->id; ?>)"><i class="fas fa-trash" ></i></button>
                                </div>
                            </div>
                        </td> -->
                    </tr>
                <?php endforeach ?>
            </tbody>
        </table>
    </div>
				
					
	</div><br>  
</div>

<div class="modal fade" id="mdl-view-statutory" tabindex="-1" role="dialog" >
  <div class="modal-dialog" role="document" style="max-width:60%;">
    <div class="modal-content">
        <form action="<?php echo base_url('hr/StaffProfile/updateStatutory'); ?>" method="post" id="updateStatutoryForm">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel">Statutory Details</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true">&times;</span>
                </button>
            </div>

            <div class="modal-body">
                <input type="hidden" class="form-control" value="<?php echo current_url(); ?>" name="url">
                <input type="hidden" class="form-control" name="id" id="idUpdateStatutory">

                <div class="row">
                	<div class="col">
                		<label><b>Employee EPF NO</b></label>
                		<input type="text" class="form-control" name="epf_no" id="epfUpdateStatutory" >
                	</div>
                </div>

                <div class="row">
                	<div class="col">
                		<label><b>Employer Rate</b></label>

                		<div class="row">
                            <div class="col">
                                Statutory Rate
                                <input type="radio" class="form-control" name="er_rate" value="0">
                            </div>
                            <div class="col">
                                Company Rate
                                <input type="radio" class="form-control" name="er_rate" value="1">
                            </div>
                            <div class="col">
                                Personal Rate
                                <input type="radio" class="form-control" name="er_rate" value="2">
                            </div>
                        </div>
                	</div>
                	<div class="col">
                		<label><b>Amount Percentage</b></label>
                		<input type="text" class="form-control" id="erPercentUpdateStatutory" name="er_percent">
                	</div>
                </div>

                <div class="row">
                	<div class="col">
                		<label><b>Employee Rate</b></label>
                        <div class="row">
                            <div class="col">
                                Statutory Rate
                                <input type="radio" class="form-control" name="ee_rate" value="0">
                            </div>
                            <div class="col">
                                Company Rate
                                <input type="radio" class="form-control" name="ee_rate" value="1">
                            </div>
                            <div class="col">
                                Personal Rate
                                <input type="radio" class="form-control" name="ee_rate" value="2">
                            </div>
                        </div>
                	</div>
                	<div class="col">
                		<label><b>Amount Percentage</b></label>
                		<input type="text" class="form-control" id="eePercentUpdateStatutory" name="ee_percent">
                	</div>
                </div>

                <div class="row">
                	<div class="col">
                		<label><b>Employee SOCSO No</b></label>
                		<input type="text" class="form-control" id="socsoUpdateStatutory" name="socso">
                	</div>
                    <div class="col">
                        <label><b>Income Tax No</b></label>
                        <input type="text" class="form-control" id="incomeTaxUpadateStatutory" name="income_tax">
                    </div>
                </div>

                <div class="row">
                	<div class="col">
                		<label><b>PCB Deduduction</b></label>
                        <div class="input-group mb-3">
                          <div class="input-group-prepend">
                            <button class="btn btn-default btn-sm" type="button" disabled>RM</button>
                          </div>
                        <input type="text" class="form-control" id="pcbUpdateStatutory" name="pcb_deduction">
                        </div>
                	</div>
                    <div class="col">
                        <label><b>Zakat Deduction</b></label>
                        <div class="input-group mb-3">
                          <div class="input-group-prepend">
                            <button class="btn btn-default btn-sm" type="button" disabled>RM</button>
                          </div>
                            <input type="text" class="form-control" id="zakatUpdateStatutory" name="zakat_deduction">
                        </div>                        
                    </div>
                </div>

                <div class="row">
                    <div class="col"> 
                        <label><b>Status</b></label>
                        <select name="status" id="idUpdateStatus" class="form-control">
                            <option value="1">Active</option>
                            <option value="0">Inactive</option>
                        </select>
                    </div>
                    <div class="col">
                        <label><b>Year</b></label>
                        <input type="text" name="year" id="idUpdateYear" class="form-control">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger btn-sm" style="margin-bottom:15px; width: 200px;" data-dismiss="modal"><i class="fa fa-ban"></i> Cancel</button>
                <button type="submit" class="btn btn-success btn-sm" style="margin-bottom:15px; width: 200px;"><i class="fa fa-save"></i> Submit</button>
            </div>
        </form>
    </div>
  </div>
</div>