base commit

This commit is contained in:
Mekan1206
2026-07-30 17:24:40 +05:00
commit a794dacd39
345 changed files with 29597 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace App\Exports;
use App\Models\Bonus;
use Illuminate\Database\Eloquent\Builder;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class BonusesExport implements FromQuery, WithHeadings, WithMapping
{
/**
* @param array<int, int>|null $ids
*/
public function __construct(
private readonly ?array $ids = null,
) {}
public function query(): Builder
{
$query = Bonus::query()->with('employee');
if ($this->ids !== null) {
$query->whereIn('id', $this->ids);
}
return $query->orderByDesc('bonus_date');
}
/**
* @return array<int, string>
*/
public function headings(): array
{
return [
'Employee Number',
'Employee Name',
'Bonus Date',
'Bonus Type',
'Amount',
'Reason',
];
}
/**
* @param Bonus $bonus
* @return array<int, mixed>
*/
public function map($bonus): array
{
return [
$bonus->employee?->employee_number,
$bonus->employee?->full_name,
$bonus->bonus_date?->toDateString(),
$bonus->bonus_type?->value,
$bonus->amount,
$bonus->reason,
];
}
}

View File

@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
namespace App\Exports;
use App\Models\Employee;
use Illuminate\Database\Eloquent\Builder;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class EmployeesExport implements FromQuery, WithHeadings, WithMapping
{
/**
* @param array<int, int>|null $ids
*/
public function __construct(
private readonly ?array $ids = null,
) {}
public function query(): Builder
{
$query = Employee::query()
->with(['department', 'position', 'shift']);
if ($this->ids !== null) {
$query->whereIn('id', $this->ids);
}
return $query->orderBy('employee_number');
}
/**
* @return array<int, string>
*/
public function headings(): array
{
return [
'Employee Number',
'Full Name',
'National ID',
'Gender',
'Birth Date',
'Phone',
'Address',
'Department',
'Position',
'Shift',
'Employment Status',
'Hire Date',
'Termination Date',
'Notes',
];
}
/**
* @param Employee $employee
* @return array<int, mixed>
*/
public function map($employee): array
{
return [
$employee->employee_number,
$employee->full_name,
$employee->national_id,
$employee->gender?->value,
$employee->birth_date?->toDateString(),
$employee->phone,
$employee->address,
$employee->department?->name,
$employee->position?->name,
$employee->shift?->name,
$employee->employment_status?->value,
$employee->hire_date?->toDateString(),
$employee->termination_date?->toDateString(),
$employee->notes,
];
}
}

View File

@@ -0,0 +1,65 @@
<?php
declare(strict_types=1);
namespace App\Exports;
use App\Models\DisciplinaryReport;
use Illuminate\Database\Eloquent\Builder;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class ReportsExport implements FromQuery, WithHeadings, WithMapping
{
/**
* @param array<int, int>|null $ids
*/
public function __construct(
private readonly ?array $ids = null,
) {}
public function query(): Builder
{
$query = DisciplinaryReport::query()->with(['employee', 'creator']);
if ($this->ids !== null) {
$query->whereIn('id', $this->ids);
}
return $query->orderByDesc('report_date');
}
/**
* @return array<int, string>
*/
public function headings(): array
{
return [
'Employee Number',
'Employee Name',
'Report Date',
'Title',
'Description',
'Severity',
'Created By',
];
}
/**
* @param DisciplinaryReport $report
* @return array<int, mixed>
*/
public function map($report): array
{
return [
$report->employee?->employee_number,
$report->employee?->full_name,
$report->report_date?->toDateString(),
$report->title,
$report->description,
$report->severity?->value,
$report->creator?->name,
];
}
}

View File

@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace App\Exports;
use App\Models\Vacation;
use Illuminate\Database\Eloquent\Builder;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
class VacationsExport implements FromQuery, WithHeadings, WithMapping
{
/**
* @param array<int, int>|null $ids
*/
public function __construct(
private readonly ?array $ids = null,
) {}
public function query(): Builder
{
$query = Vacation::query()->with(['employee', 'approver']);
if ($this->ids !== null) {
$query->whereIn('id', $this->ids);
}
return $query->orderByDesc('start_date');
}
/**
* @return array<int, string>
*/
public function headings(): array
{
return [
'Employee Number',
'Employee Name',
'Type',
'Start Date',
'End Date',
'Return Date',
'Days',
'Status',
'Reason',
'Approved By',
'Approved At',
];
}
/**
* @param Vacation $vacation
* @return array<int, mixed>
*/
public function map($vacation): array
{
return [
$vacation->employee?->employee_number,
$vacation->employee?->full_name,
$vacation->type?->value,
$vacation->start_date?->toDateString(),
$vacation->end_date?->toDateString(),
$vacation->return_date?->toDateString(),
$vacation->days,
$vacation->status?->value,
$vacation->reason,
$vacation->approver?->name,
$vacation->approved_at?->toDateTimeString(),
];
}
}