improve income deduction table and added delete

improve income deduction table and added delete
pull/39/head
paulcortez 2 months ago
parent f21aaad22a
commit 65238effae

@ -43,6 +43,7 @@ $routes->get('payroll/inded', 'PayrollController::incomeDeduction');
$routes->get('payroll/indedtransupdate/(:num)', 'PayrollController::incomeDeductionTransUpdate/$1');
$routes->get('payroll/indedtransapplyupdate/(:num)/(:num)', 'PayrollController::incomeDeductionTransApplyUpdate/$1/$2');
$routes->post('payroll/saveinded', 'PayrollController::saveIncomeDeduction');
$routes->get('payroll/delinded/(:num)', 'PayrollController::deleteIncomeDeduction/$1');
$routes->get('payroll/paytype', 'PayrollController::payrollType');
$routes->post('payroll/addpaytype', 'PayrollController::addPayrollType');

@ -154,7 +154,7 @@ class PayrollController extends BaseController
$incomeDeductions = (new IncomeDeductionModel())->findAll();
$inDedHTMLTable = new \CodeIgniter\View\Table();
$inDedHTMLTable->setTemplate(MiscLib::adminLTETableTemplate());
$inDedHTMLTable->setTemplate(MiscLib::adminLTEDataTable1Template("tblIncomeDeduction"));
if ($incomeDeductions == null)
$data['tblIncomeDeduction'] = '<p>No income and deduction found.</p>';
@ -173,7 +173,7 @@ class PayrollController extends BaseController
$iconView = '<a href="/payroll/indedtransupdate/'.$incomeDeduction->inded_id.'" class="ml-3" data-toggle="tooltip" title="View Affected Transactions"><i class="fas fa-eye "></i></a>';
$iconEdit = '<a href="#" class="ml-3" ' . $indedHTMLData . ' onclick="editIncomeDeduction(this)" data-toggle="tooltip" title="Edit Deduction Information"><i class="fas fa-edit"></i></a>';
$iconDelete = '<a href="#" class="ml-3" data-toggle="tooltip" title="Delete Deduction Information"><i class="fas fa-trash"></i></a>';
$iconDelete = '<a href="/payroll/delinded/'.$incomeDeduction->inded_id.'" onclick="return confirm(\'Are you sure you want to delete this Income or Deduction?\')" class="ml-3" data-toggle="tooltip" title="Delete Deduction Information"><i class="fas fa-trash"></i></a>';
$inDedHTMLTable->addRow($incomeDeduction->inded_id, $incomeDeduction->payslip_display, $incomeDeduction->inded_name, ($incomeDeduction->is_income) ? 'Yes' : 'No', ($incomeDeduction->is_taxable) ? 'Yes' : 'No', ($incomeDeduction->include_in_gross) ? 'Yes' : 'No', $iconView . ' ' . $iconEdit . ' ' . $iconDelete);
}
@ -256,6 +256,16 @@ class PayrollController extends BaseController
return redirect()->back()->with('message', $updateCount . ' items in Income or Deduction was Successfully Updated');
}
public function deleteIncomeDeduction($indedid)
{
$incomeDeductionModel = new IncomeDeductionModel();
if ($incomeDeductionModel->delete($indedid))
return redirect()->back()->with('message', 'Income or Deduction Successfully Deleted');
else
return redirect()->back()->with('error', 'Failed to delete income or deduction');
}
public function payrollType()
{
$payrollTypes = (new PayrollTypeModel())->findAll();

@ -8,6 +8,11 @@
<!-- CSS of the page -->
<?= $this->section('css') ?>
<!-- DataTables -->
<link rel="stylesheet" href="<?= base_url() ?>adminlte/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="<?= base_url() ?>adminlte/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
<?= $this->endSection() ?>
<!-- .CSS -->
@ -180,9 +185,24 @@
<?= $this->section('js') ?>
<!-- DataTables & Plugins -->
<script src="<?= base_url() ?>adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?= base_url() ?>adminlte/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="<?= base_url() ?>adminlte/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="<?= base_url() ?>adminlte/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script>
$(document).ready(function() {
$('#tblIncomeDeduction').DataTable({
"paging": true,
"lengthChange": false,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
});

Loading…
Cancel
Save