<?php
declare(strict_types=1);
ini_set('display_errors','0');
header('Cache-Control: private, no-store, max-age=0');
require_once __DIR__.'/../includes/console_shell.php';
require_login();
$pageLink='salary-config/gross-salary-report.php';
$acl=require_acl('can_view',$pageLink);
require_once __DIR__.'/gross-salary-report-common.php';
$errors=[];$access=gsr_access($con);
[$filters,$payrolls,$categories,$months,$years,$salaryTypes,$employees]=gsr_filters($con,$access,$errors);
console_header('Employee Gross Salary Filters',$pageLink);
$select='mt-2 w-full rounded-xl border border-slate-200 bg-white px-3 py-3 text-sm font-semibold text-slate-700 outline-none focus:border-brand-500 focus:ring-4 focus:ring-brand-100';
?>
<div class="mb-6"><div class="mb-2 flex items-center gap-2 text-xs font-semibold text-slate-500"><a href="/dashboard.php">Dashboard</a><i class="fa-solid fa-chevron-right text-[9px]"></i><span>Salary Config</span><i class="fa-solid fa-chevron-right text-[9px]"></i><a href="/salary-config/gross-salary-report.php">Employee Gross Salary</a><i class="fa-solid fa-chevron-right text-[9px]"></i><span class="text-brand-600">Filters</span></div><h1 class="text-2xl font-bold text-slate-900">Employee Gross Salary</h1><p class="mt-1 text-sm text-slate-500">Select report filters, then open the salary results.</p></div>
<?php if($errors):?><div class="mb-5 rounded-xl border border-red-100 bg-red-50 px-5 py-4 text-sm font-semibold text-red-700"><?=h(implode(' ',$errors))?></div><?php endif;?>
<section class="overflow-hidden rounded-2xl border border-slate-100 bg-white shadow-sm"><div class="border-b border-slate-100 px-5 py-4"><h2 class="text-lg font-bold text-slate-800">Employee Gross Salary</h2><p class="mt-1 text-sm font-medium text-slate-400">Results open on a separate report page.</p></div><form method="get" action="/salary-config/gross-salary-report.php" class="grid gap-4 p-5 md:grid-cols-2 xl:grid-cols-6">
<label class="text-sm font-bold text-slate-700">Employee Name<select name="filter_emp" class="<?=$select?>"><option value="">Select Employee</option><?php foreach($employees as $r):?><option value="<?=(int)$r['id']?>"><?=h($r['name'])?></option><?php endforeach;?></select></label>
<label class="text-sm font-bold text-slate-700">Payroll Location<select name="filter_orglocation" class="<?=$select?>"><option value="">Select Payroll Location</option><?php foreach($payrolls as $r):?><option value="<?=(int)$r['id']?>"><?=h($r['name'])?></option><?php endforeach;?></select></label>
<?php if($categories):?><label class="text-sm font-bold text-slate-700">Category<select name="filt_cat" class="<?=$select?>"><option value="">Select Category</option><?php foreach($categories as $r):?><option value="<?=(int)$r['id']?>"><?=h($r['name'])?></option><?php endforeach;?></select></label><?php endif;?>
<label class="text-sm font-bold text-slate-700">Month<select name="filt_month" class="<?=$select?>"><option value="">Select Month</option><?php foreach($months as $r):?><option value="<?=(int)$r['id']?>"><?=h($r['name'])?></option><?php endforeach;?></select></label>
<label class="text-sm font-bold text-slate-700">Year<select name="filt_year" class="<?=$select?>"><option value="">Select Year</option><?php foreach($years as $r):?><option value="<?=(int)$r['id']?>"><?=h($r['name'])?></option><?php endforeach;?></select></label>
<label class="text-sm font-bold text-slate-700">Salary Type<select name="filt_salary" class="<?=$select?>"><option value="">Select Type</option><?php foreach($salaryTypes as $r):?><option value="<?=(int)$r['id']?>"><?=h($r['name'])?></option><?php endforeach;?></select></label>
<div class="flex flex-wrap gap-2 md:col-span-2 xl:col-span-6"><button class="rounded-xl bg-brand-600 px-6 py-3 text-sm font-bold text-white"><i class="fa-solid fa-floppy-disk mr-2"></i>Save</button><a href="/salary-config/gross-salary-report-filters.php" class="rounded-xl border border-slate-200 px-6 py-3 text-sm font-bold text-slate-600">Reset</a></div></form></section>
<?php console_footer();
