Skip to content

Commit

Permalink
cs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Baakoma committed Oct 24, 2024
1 parent f999ed2 commit 1771761
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 135 deletions.
74 changes: 37 additions & 37 deletions app/Domain/OvertimeTimesheetPerUserSheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,43 @@ public function __construct(
protected Carbon $month,
) {}

public static function afterSheet(AfterSheet $event): void
{
$sheet = $event->getSheet();
$lastRow = $sheet->getDelegate()->getHighestRow();

$sheet->append([
__("Sum:"),
null,
null,
null,
"=SUM(E2:E{$lastRow})",
]);

$lastRow++;

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_RIGHT);

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getFont()
->setBold(true);

$sheet->getDelegate()->getStyle("E{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);

$sheet->getDelegate()->mergeCells("A{$lastRow}:D{$lastRow}");

$sheet->getDelegate()->getStyle("A{$lastRow}:E{$lastRow}")
->getBorders()
->getAllBorders()
->setBorderStyle(Border::BORDER_THIN)
->getColor()
->setRGB("B7B7B7");
}

public function title(): string
{
return $this->user->profile->full_name;
Expand Down Expand Up @@ -141,43 +178,6 @@ public function styles(Worksheet $sheet): void
->setRGB("B7B7B7");
}

public static function afterSheet(AfterSheet $event): void
{
$sheet = $event->getSheet();
$lastRow = $sheet->getDelegate()->getHighestRow();

$sheet->append([
__("Sum:"),
null,
null,
null,
"=SUM(E2:E{$lastRow})",
]);

$lastRow++;

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_RIGHT);

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getFont()
->setBold(true);

$sheet->getDelegate()->getStyle("E{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);

$sheet->getDelegate()->mergeCells("A{$lastRow}:D{$lastRow}");

$sheet->getDelegate()->getStyle("A{$lastRow}:E{$lastRow}")
->getBorders()
->getAllBorders()
->setBorderStyle(Border::BORDER_THIN)
->getColor()
->setRGB("B7B7B7");
}

protected function getOvertimeForPeriod(User $user, CarbonPeriod $period): Collection
{
return $user->overtimeRequests()
Expand Down
74 changes: 37 additions & 37 deletions app/Domain/TimesheetPerUserSheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,43 @@ public function __construct(
protected Collection $types,
) {}

public static function afterSheet(AfterSheet $event): void
{
$sheet = $event->getSheet();
$lastRow = $sheet->getDelegate()->getHighestRow();

$sheet->append([
__("Sum:"),
null,
null,
null,
"=SUM(E2:E{$lastRow})",
]);

$lastRow++;

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_RIGHT);

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getFont()
->setBold(true);

$sheet->getDelegate()->getStyle("E{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);

$sheet->getDelegate()->mergeCells("A{$lastRow}:D{$lastRow}");

$sheet->getDelegate()->getStyle("A{$lastRow}:E{$lastRow}")
->getBorders()
->getAllBorders()
->setBorderStyle(Border::BORDER_THIN)
->getColor()
->setRGB("B7B7B7");
}

public function title(): string
{
return $this->user->profile->full_name;
Expand Down Expand Up @@ -146,43 +183,6 @@ public function styles(Worksheet $sheet): void
->setRGB("B7B7B7");
}

public static function afterSheet(AfterSheet $event): void
{
$sheet = $event->getSheet();
$lastRow = $sheet->getDelegate()->getHighestRow();

$sheet->append([
__("Sum:"),
null,
null,
null,
"=SUM(E2:E{$lastRow})",
]);

$lastRow++;

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_RIGHT);

$sheet->getDelegate()->getStyle("A{$lastRow}")
->getFont()
->setBold(true);

$sheet->getDelegate()->getStyle("E{$lastRow}")
->getAlignment()
->setHorizontal(Alignment::HORIZONTAL_CENTER);

$sheet->getDelegate()->mergeCells("A{$lastRow}:D{$lastRow}");

$sheet->getDelegate()->getStyle("A{$lastRow}:E{$lastRow}")
->getBorders()
->getAllBorders()
->setBorderStyle(Border::BORDER_THIN)
->getColor()
->setRGB("B7B7B7");
}

protected function getVacationsForPeriod(User $user, CarbonPeriod $period): Collection
{
return $user->vacations()
Expand Down
10 changes: 5 additions & 5 deletions app/Enums/EmploymentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ enum EmploymentForm: string
case B2bContract = "b2b_contract";
case BoardMemberContract = "board_member_contract";

public function label(): string
{
return __($this->value);
}

public static function casesToSelect(): array
{
$cases = collect(EmploymentForm::cases());
Expand All @@ -27,4 +22,9 @@ public static function casesToSelect(): array
],
)->toArray();
}

public function label(): string
{
return __($this->value);
}
}
20 changes: 10 additions & 10 deletions app/Enums/Month.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ enum Month: string
case November = "november";
case December = "december";

public static function current(): Month
{
return Month::from(Str::lower(Carbon::now()->englishMonth));
}

public static function fromNameOrCurrent(string $name): Month
{
return Month::tryFrom($name) ?? Month::current();
}

public function toCarbonNumber(): int
{
return match ($this) {
Expand All @@ -40,14 +50,4 @@ public function toCarbonNumber(): int
self::December => CarbonInterface::DECEMBER,
};
}

public static function current(): Month
{
return Month::from(Str::lower(Carbon::now()->englishMonth));
}

public static function fromNameOrCurrent(string $name): Month
{
return Month::tryFrom($name) ?? Month::current();
}
}
10 changes: 5 additions & 5 deletions app/Enums/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ enum Role: string
case TechnicalApprover = "technical_approver";
case AdministrativeApprover = "administrative_approver";

public function label(): string
{
return __($this->value);
}

public static function casesToSelect(): array
{
$cases = collect(Role::cases());
Expand All @@ -28,6 +23,11 @@ public static function casesToSelect(): array
)->toArray();
}

public function label(): string
{
return __($this->value);
}

public function permissions(): array
{
return config("permission.permission_roles")[$this->value];
Expand Down
10 changes: 5 additions & 5 deletions app/Enums/SettlementType.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ enum SettlementType: string
case Hours = "hours";
case Money = "money";

public function label(): string
{
return __($this->value);
}

public static function casesToSelect(): array
{
return array_map(
Expand All @@ -24,4 +19,9 @@ public static function casesToSelect(): array
SettlementType::cases(),
);
}

public function label(): string
{
return __($this->value);
}
}
10 changes: 5 additions & 5 deletions app/Enums/UserHistoryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ enum UserHistoryType: string
case MedicalExam = "medical_exam";
case OhsTraining = "ohs_training";

public function label(): string
{
return __($this->value);
}

public static function casesToSelect(): array
{
$cases = collect(UserHistoryType::cases());
Expand All @@ -26,4 +21,9 @@ public static function casesToSelect(): array
],
)->toArray();
}

public function label(): string
{
return __($this->value);
}
}
10 changes: 5 additions & 5 deletions app/Enums/VacationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ enum VacationType: string
case RemoteWork = "remote_work";
case Delegation = "delegation";

public function label(): string
{
return __($this->value);
}

public static function casesToSelect(): array
{
$cases = VacationType::all();
Expand All @@ -42,4 +37,9 @@ public static function all(): Collection
{
return new Collection(VacationType::cases());
}

public function label(): string
{
return __($this->value);
}
}
3 changes: 2 additions & 1 deletion app/Http/Resources/DashboardVacationRequestResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

class DashboardVacationRequestResource extends JsonResource
{
public static $wrap = null;
protected VacationTypeConfigRetriever $configRetriever;

public function __construct($resource)
Expand All @@ -20,6 +19,8 @@ public function __construct($resource)
$this->configRetriever = app(VacationTypeConfigRetriever::class);
}

public static $wrap = null;

public function toArray($request): array
{
return [
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Resources/VacationRequestResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class VacationRequestResource extends JsonResource
{
public static $wrap = null;
protected VacationTypeConfigRetriever $configRetriever;

public function __construct($resource)
Expand All @@ -23,6 +22,8 @@ public function __construct($resource)
$this->configRetriever = app(VacationTypeConfigRetriever::class);
}

public static $wrap = null;

public function toArray($request): array
{
$user = $request->user();
Expand Down
10 changes: 5 additions & 5 deletions tests/DuskTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public static function prepare(): void
}
}

protected static function runningInDocker(): bool
{
return isset($_ENV["DUSK_IN_DOCKER"]) && $_ENV["DUSK_IN_DOCKER"] === "true";
}

protected function driver(): RemoteWebDriver
{
$options = (new ChromeOptions())->addArguments(
Expand Down Expand Up @@ -54,9 +59,4 @@ protected function hasHeadlessDisabled(): bool
return isset($_SERVER["DUSK_HEADLESS_DISABLED"]) ||
isset($_ENV["DUSK_HEADLESS_DISABLED"]);
}

protected static function runningInDocker(): bool
{
return isset($_ENV["DUSK_IN_DOCKER"]) && $_ENV["DUSK_IN_DOCKER"] === "true";
}
}
Loading

0 comments on commit 1771761

Please sign in to comment.