#39 - generate timesheet #56
@@ -29,7 +29,7 @@ class CalendarGenerator
|
||||
return $this->generateCalendar($period, $holidays);
|
||||
}
|
||||
|
||||
protected function monthNameToNumber($name): int
|
||||
protected function monthNameToNumber(string $name): int
|
||||
{
|
||||
return match ($name) {
|
||||
default => CarbonInterface::JANUARY,
|
||||
|
||||
40
app/Domain/TimesheetExport.php
Normal file
@@ -0,0 +1,40 @@
|
||||
|
|
||||
<?php
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
declare(strict_types=1);
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
namespace Toby\Domain;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
use Illuminate\Support\Carbon;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
class TimesheetExport implements WithMultipleSheets
|
||||
|
Why not to use Why not to use `map()`?
|
||||
{
|
||||
|
Why not to use Why not to use `map()`?
|
||||
protected Collection $users;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
protected Carbon $month;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
public function sheets(): array
|
||||
|
Why not to use Why not to use `map()`?
|
||||
{
|
||||
|
Why not to use Why not to use `map()`?
|
||||
$sheets = [];
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
foreach ($this->users as $user) {
|
||||
|
Why not to use Why not to use `map()`?
|
||||
$sheets[] = new TimesheetPerUserSheet($user, $this->month);
|
||||
|
Why not to use Why not to use `map()`?
|
||||
}
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
return $sheets;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
}
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
public function forUsers(Collection $users): static
|
||||
|
Why not to use Why not to use `map()`?
|
||||
{
|
||||
|
Why not to use Why not to use `map()`?
|
||||
$this->users = $users;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
return $this;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
}
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
public function forMonth(Carbon $month): static
|
||||
|
Why not to use Why not to use `map()`?
|
||||
{
|
||||
|
Why not to use Why not to use `map()`?
|
||||
$this->month = $month;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
|
||||
|
Why not to use Why not to use `map()`?
|
||||
return $this;
|
||||
|
Why not to use Why not to use `map()`?
|
||||
}
|
||||
|
Why not to use Why not to use `map()`?
|
||||
}
|
||||
|
Why not to use Why not to use `map()`?
|
||||
216
app/Domain/TimesheetPerUserSheet.php
Normal file
@@ -0,0 +1,216 @@
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
<?php
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
declare(strict_types=1);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
namespace Toby\Domain;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Carbon\CarbonInterface;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Carbon\CarbonPeriod;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Generator;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Illuminate\Support\Carbon;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Illuminate\Support\Collection;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\FromGenerator;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\RegistersEventListeners;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\WithEvents;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\WithStrictNullComparison;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Maatwebsite\Excel\Events\AfterSheet;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use PhpOffice\PhpSpreadsheet\Shared\Date;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Toby\Domain\Enums\VacationRequestState;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Toby\Domain\Enums\VacationType;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Toby\Eloquent\Models\Holiday;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Toby\Eloquent\Models\User;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use Toby\Eloquent\Models\Vacation;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
class TimesheetPerUserSheet implements WithTitle, WithHeadings, WithEvents, WithStyles, WithStrictNullComparison, ShouldAutoSize, FromGenerator
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
use RegistersEventListeners;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
protected const HOURS_PER_DAY = 8;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
public function __construct(
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
protected User $user,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
protected Carbon $month,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
) {
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
public function title(): string
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
return $this->user->fullName;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
public function headings(): array
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$types = VacationType::cases();
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$headings = [
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
__("Date"),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
__("Day of week"),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
__("Start date"),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
__("End date"),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
__("Worked hours"),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
];
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
foreach ($types as $type) {
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$headings[] = $type->label();
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
return $headings;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
public function generator(): Generator
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$period = CarbonPeriod::create($this->month->copy()->startOfMonth(), $this->month->copy()->endOfMonth());
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$vacations = $this->getVacationsForPeriod($this->user, $period);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$holidays = $this->getHolidaysForPeriod($period);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
foreach ($period as $day) {
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$vacationsForDay = $vacations->get($day->toDateString(), new Collection());
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$workedThisDay = $this->checkIfWorkedThisDay($day, $holidays, $vacationsForDay);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$row = [
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
Date::dateTimeToExcel($day),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$day->translatedFormat("l"),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$workedThisDay ? $this->toExcelTime(Carbon::createFromTime(8)) : null,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$workedThisDay ? $this->toExcelTime(Carbon::createFromTime(16)) : null,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$workedThisDay ? static::HOURS_PER_DAY : null,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
];
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
foreach (VacationType::cases() as $type) {
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$row[] = $vacationsForDay->has($type->value) ? static::HOURS_PER_DAY : null;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
yield $row;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
public function styles(Worksheet $sheet): void
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$lastRow = $sheet->getHighestRow();
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$lastColumn = $sheet->getHighestColumn();
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("A1:{$lastColumn}1")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getFont()->setBold(true);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("A1:{$lastColumn}1")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getAlignment()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setVertical(Alignment::VERTICAL_CENTER);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("A1:{$lastColumn}1")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getFill()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setFillType(Fill::FILL_SOLID)
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getStartColor()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setRGB("D9D9D9");
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("C1:{$lastColumn}{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getAlignment()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("A2:A{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getNumberFormat()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setFormatCode(NumberFormat::FORMAT_DATE_DDMMYYYY);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("C1:D{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getNumberFormat()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setFormatCode(NumberFormat::FORMAT_DATE_TIME3);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("A2:A{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getFont()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setBold(true);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
for ($i = 2; $i < $lastRow; $i++) {
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$date = Date::excelToDateTimeObject($sheet->getCell("A{$i}")->getValue());
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
if (Carbon::createFromInterface($date)->isWeekend()) {
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("A{$i}:{$lastColumn}{$i}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getFill()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setFillType(Fill::FILL_SOLID)
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getStartColor()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setRGB("FEE2E2");
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getStyle("A1:{$lastColumn}{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getBorders()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getAllBorders()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setBorderStyle(Border::BORDER_THIN);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
public static function afterSheet(AfterSheet $event): void
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet = $event->getSheet();
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$lastRow = $sheet->getDelegate()->getHighestRow();
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->append([
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
__("Sum:"),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
null,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
null,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
null,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
"=SUM(E2:E{$lastRow})",
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
]);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$lastRow++;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getDelegate()->getStyle("A{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getAlignment()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setHorizontal(Alignment::HORIZONTAL_RIGHT);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getDelegate()->getStyle("A{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getFont()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setBold(true);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getDelegate()->getStyle("E{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getAlignment()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getDelegate()->mergeCells("A{$lastRow}:D{$lastRow}");
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$sheet->getDelegate()->getStyle("A{$lastRow}:E{$lastRow}")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getBorders()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->getAllBorders()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->setBorderStyle(Border::BORDER_THIN);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
protected function getVacationsForPeriod(User $user, CarbonPeriod $period): Collection
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
return $user->vacations()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->with("vacationRequest")
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->whereBetween("date", [$period->start, $period->end])
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->whereRelation("vacationRequest", "state", VacationRequestState::Approved->value)
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->get()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->groupBy(
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
[
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
fn(Vacation $vacation) => $vacation->date->toDateString(),
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
fn(Vacation $vacation) => $vacation->vacationRequest->type->value,
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
],
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
protected function getHolidaysForPeriod(CarbonPeriod $period): Collection
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
return Holiday::query()
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->whereBetween("date", [$period->start, $period->end])
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
->pluck("date");
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
protected function toExcelTime(Carbon $time): float
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$excelTimestamp = Date::dateTimeToExcel($time);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
$excelDate = floor($excelTimestamp);
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
return $excelTimestamp - $excelDate;
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
protected function checkIfWorkedThisDay(CarbonInterface $day, Collection $holidays, Collection $vacations): bool
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
{
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
return $day->isWeekday() && $holidays->doesntContain($day) && $vacations->isEmpty();
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
}
|
||||
|
Maybe move these hours to consts as start hour and end hour? Maybe move these hours to consts as start hour and end hour?
|
||||
57
app/Infrastructure/Http/Controllers/TimesheetController.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Infrastructure\Http\Controllers;
|
||||
|
||||
use Carbon\CarbonInterface;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Toby\Domain\TimesheetExport;
|
||||
use Toby\Eloquent\Helpers\YearPeriodRetriever;
|
||||
use Toby\Eloquent\Models\User;
|
||||
|
||||
class TimesheetController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, YearPeriodRetriever $yearPeriodRetriever): BinaryFileResponse
|
||||
{
|
||||
$yearPeriod = $yearPeriodRetriever->selected();
|
||||
$month = Str::lower($request->query("month", Carbon::now()->englishMonth));
|
||||
|
||||
$month = Carbon::create($yearPeriod->year, $this->monthNameToNumber($month));
|
||||
|
||||
$users = User::query()
|
||||
->orderBy("last_name")
|
||||
->orderBy("first_name")
|
||||
->get();
|
||||
|
||||
$filename = "{$month->translatedFormat("F Y")}.xlsx";
|
||||
|
||||
$timesheet = (new TimesheetExport())
|
||||
->forMonth($month)
|
||||
->forUsers($users);
|
||||
|
||||
return Excel::download($timesheet, $filename);
|
||||
}
|
||||
|
||||
protected function monthNameToNumber(string $name): int
|
||||
{
|
||||
return match ($name) {
|
||||
default => CarbonInterface::JANUARY,
|
||||
"february" => CarbonInterface::FEBRUARY,
|
||||
"march" => CarbonInterface::MARCH,
|
||||
"april" => CarbonInterface::APRIL,
|
||||
"may" => CarbonInterface::MAY,
|
||||
"june" => CarbonInterface::JUNE,
|
||||
"july" => CarbonInterface::JULY,
|
||||
"august" => CarbonInterface::AUGUST,
|
||||
"september" => CarbonInterface::SEPTEMBER,
|
||||
"october" => CarbonInterface::OCTOBER,
|
||||
"november" => CarbonInterface::NOVEMBER,
|
||||
"december" => CarbonInterface::DECEMBER,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
"laravel/telescope": "^4.6",
|
||||
"laravel/tinker": "^2.5",
|
||||
"lasserafn/php-initial-avatar-generator": "^4.2",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"spatie/laravel-google-calendar": "^3.5"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
823
composer.lock
generated
103
config/excel.php
Normal file
@@ -0,0 +1,103 @@
|
||||
|
I would import that too. I would import that too.
I would import that too. I would import that too.
|
||||
<?php
|
||||
|
I would import that too. I would import that too.
|
||||
|
||||
|
I would import that too. I would import that too.
|
||||
declare(strict_types=1);
|
||||
|
I would import that too. I would import that too.
|
||||
|
||||
|
I would import that too. I would import that too.
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
I would import that too. I would import that too.
|
||||
|
||||
|
I would import that too. I would import that too.
|
||||
return [
|
||||
|
I would import that too. I would import that too.
|
||||
"exports" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"chunk_size" => 1000,
|
||||
|
I would import that too. I would import that too.
|
||||
"pre_calculate_formulas" => false,
|
||||
|
I would import that too. I would import that too.
|
||||
"strict_null_comparison" => false,
|
||||
|
I would import that too. I would import that too.
|
||||
"csv" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"delimiter" => ",",
|
||||
|
I would import that too. I would import that too.
|
||||
"enclosure" => '"',
|
||||
|
I would import that too. I would import that too.
|
||||
"line_ending" => PHP_EOL,
|
||||
|
I would import that too. I would import that too.
|
||||
"use_bom" => false,
|
||||
|
I would import that too. I would import that too.
|
||||
"include_separator_line" => false,
|
||||
|
I would import that too. I would import that too.
|
||||
"excel_compatibility" => false,
|
||||
|
I would import that too. I would import that too.
|
||||
"output_encoding" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
"properties" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"creator" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"lastModifiedBy" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"title" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"description" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"subject" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"keywords" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"category" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"manager" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"company" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
|
||||
|
I would import that too. I would import that too.
|
||||
"imports" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"read_only" => true,
|
||||
|
I would import that too. I would import that too.
|
||||
"ignore_empty" => false,
|
||||
|
I would import that too. I would import that too.
|
||||
"heading_row" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"formatter" => "slug",
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
"csv" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"delimiter" => ",",
|
||||
|
I would import that too. I would import that too.
|
||||
"enclosure" => '"',
|
||||
|
I would import that too. I would import that too.
|
||||
"escape_character" => "\\",
|
||||
|
I would import that too. I would import that too.
|
||||
"contiguous" => false,
|
||||
|
I would import that too. I would import that too.
|
||||
"input_encoding" => "UTF-8",
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
"properties" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"creator" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"lastModifiedBy" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"title" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"description" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"subject" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"keywords" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"category" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"manager" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
"company" => "",
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
"extension_detector" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"xlsx" => Excel::XLSX,
|
||||
|
I would import that too. I would import that too.
|
||||
"xlsm" => Excel::XLSX,
|
||||
|
I would import that too. I would import that too.
|
||||
"xltx" => Excel::XLSX,
|
||||
|
I would import that too. I would import that too.
|
||||
"xltm" => Excel::XLSX,
|
||||
|
I would import that too. I would import that too.
|
||||
"xls" => Excel::XLS,
|
||||
|
I would import that too. I would import that too.
|
||||
"xlt" => Excel::XLS,
|
||||
|
I would import that too. I would import that too.
|
||||
"ods" => Excel::ODS,
|
||||
|
I would import that too. I would import that too.
|
||||
"ots" => Excel::ODS,
|
||||
|
I would import that too. I would import that too.
|
||||
"slk" => Excel::SLK,
|
||||
|
I would import that too. I would import that too.
|
||||
"xml" => Excel::XML,
|
||||
|
I would import that too. I would import that too.
|
||||
"gnumeric" => Excel::GNUMERIC,
|
||||
|
I would import that too. I would import that too.
|
||||
"htm" => Excel::HTML,
|
||||
|
I would import that too. I would import that too.
|
||||
"html" => Excel::HTML,
|
||||
|
I would import that too. I would import that too.
|
||||
"csv" => Excel::CSV,
|
||||
|
I would import that too. I would import that too.
|
||||
"tsv" => Excel::TSV,
|
||||
|
I would import that too. I would import that too.
|
||||
"pdf" => Excel::DOMPDF,
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
"value_binder" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"default" => Maatwebsite\Excel\DefaultValueBinder::class,
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
|
||||
|
I would import that too. I would import that too.
|
||||
"cache" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"driver" => "memory",
|
||||
|
I would import that too. I would import that too.
|
||||
"batch" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"memory_limit" => 60000,
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
"illuminate" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"store" => null,
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
"transactions" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"handler" => "db",
|
||||
|
I would import that too. I would import that too.
|
||||
"db" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"connection" => null,
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
|
||||
|
I would import that too. I would import that too.
|
||||
"temporary_files" => [
|
||||
|
I would import that too. I would import that too.
|
||||
"local_path" => storage_path("framework/cache/laravel-excel"),
|
||||
|
I would import that too. I would import that too.
|
||||
"remote_disk" => null,
|
||||
|
I would import that too. I would import that too.
|
||||
"remote_prefix" => null,
|
||||
|
I would import that too. I would import that too.
|
||||
"force_resync_remote" => null,
|
||||
|
I would import that too. I would import that too.
|
||||
],
|
||||
|
I would import that too. I would import that too.
|
||||
];
|
||||
|
I would import that too. I would import that too.
|
||||
@@ -1,11 +1,21 @@
|
||||
<template>
|
||||
<InertiaHead title="Kalendarz urlopów" />
|
||||
<div class="bg-white shadow-md">
|
||||
<div class="p-4 sm:px-6">
|
||||
<div class="flex justify-between items-center p-4 sm:px-6">
|
||||
<div>
|
||||
<h2 class="text-lg leading-6 font-medium text-gray-900">
|
||||
Kalendarz urlopów
|
||||
</h2>
|
||||
</div>
|
||||
<div>
|
||||
<a
|
||||
:href="`timesheet?month=${currentMonth}`"
|
||||
class="inline-flex items-center px-4 py-3 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-blumilk-600 hover:bg-blumilk-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500"
|
||||
>
|
||||
Pobierz plik excel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-center table-fixed text-sm border border-gray-300">
|
||||
<thead>
|
||||
|
||||
@@ -43,6 +43,11 @@
|
||||
"Vacation request has been created.": "Wniosek urlopowy został utworzony.",
|
||||
"Vacation request has been accepted.": "Wniosek urlopowy został zaakceptowany.",
|
||||
"Vacation request has been rejected.": "Wniosek urlopowy został odrzucony.",
|
||||
"Vacation request has been canceled.": "Wniosek urlopowy został anulowany."
|
||||
|
||||
"Vacation request has been canceled.": "Wniosek urlopowy został anulowany.",
|
||||
"Sum:": "Suma:",
|
||||
"Date": "Data",
|
||||
"Day of week": "Dzień tygodnia",
|
||||
"Start date": "Data rozpoczecia",
|
||||
"End date": "Data zakończenia",
|
||||
"Worked hours": "Ilość godzin"
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use Toby\Infrastructure\Http\Controllers\GoogleController;
|
||||
use Toby\Infrastructure\Http\Controllers\HolidayController;
|
||||
use Toby\Infrastructure\Http\Controllers\LogoutController;
|
||||
use Toby\Infrastructure\Http\Controllers\SelectYearPeriodController;
|
||||
use Toby\Infrastructure\Http\Controllers\TimesheetController;
|
||||
use Toby\Infrastructure\Http\Controllers\UserController;
|
||||
use Toby\Infrastructure\Http\Controllers\VacationCalendarController;
|
||||
use Toby\Infrastructure\Http\Controllers\VacationLimitController;
|
||||
@@ -26,6 +27,8 @@ Route::middleware("auth")->group(function (): void {
|
||||
->name("vacation.limits");
|
||||
Route::get("/vacation-calendar", [VacationCalendarController::class, "index"])
|
||||
->name("vacation.calendar");
|
||||
Route::get("/timesheet", TimesheetController::class)
|
||||
->name("timesheet");
|
||||
|
||||
Route::get("/vacation-limits", [VacationLimitController::class, "edit"])->name("vacation.limits");
|
||||
Route::put("/vacation-limits", [VacationLimitController::class, "update"]);
|
||||
|
||||
Why not to use
map()?Why not to use
map()?