-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #479 - feat: added working hours for specific month on calendar view * #479 - fix: fixed user method * #479 - feat: added config for employment contract working hours
- Loading branch information
1 parent
d20d356
commit a0d1e48
Showing
5 changed files
with
81 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Toby\Domain; | ||
|
||
use Toby\Enums\VacationType; | ||
use Toby\Models\User; | ||
|
||
class MonthWorkingHoursCalculator | ||
{ | ||
public function calculateHours(array $calendar, User $user): int | ||
{ | ||
return collect($calendar) | ||
->filter( | ||
fn(array $day): bool => !$day["isWeekend"] | ||
&& !$day["isHoliday"] | ||
&& (( | ||
isset($day["vacations"][$user->id]) | ||
&& in_array($day["vacations"][$user->id]["type"]->value, [VacationType::RemoteWork->value, VacationType::Delegation->value], true) | ||
) || !isset($day["vacations"][$user->id])), | ||
) | ||
->count(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
"number_of_hours_on_employment_contract" => [ | ||
"full_time" => 8, | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters