14 Commits

Author SHA1 Message Date
1d7b4da903 - added new line in file 2022-07-04 10:45:14 +02:00
94f433de6e #152 - added redirections 2022-07-04 10:16:40 +02:00
a9c476cb8e wip 2022-07-04 10:16:36 +02:00
5c3833d4cb - component renamed 2022-07-04 10:16:23 +02:00
6e627d11c8 #152 - added vacations 2022-07-04 10:16:19 +02:00
eb644fa494 #152 - added holidays 2022-07-04 10:16:08 +02:00
4392b666e1 #152 - small corrections 2022-07-01 14:57:38 +02:00
e7c1028da1 #152 - updated style 2022-07-01 14:56:55 +02:00
a7bc4695a7 #152 - final support for weeks 2022-06-24 11:20:18 +02:00
4e16f363ac #152 - optimization 2022-06-24 11:11:09 +02:00
7893282385 #152 - wip 2022-06-24 10:22:51 +02:00
db874d4395 #152 - wip 2022-06-24 10:08:48 +02:00
dcc3808428 #152 - wip 2022-06-24 10:00:36 +02:00
2a3e65ed5f #152 - calendar template added 2022-06-24 09:58:21 +02:00
11 changed files with 668 additions and 132 deletions

View File

@@ -31,7 +31,6 @@ class Resume extends Model
"technologies" => AsCollection::class,
"projects" => AsCollection::class,
];
protected $perPage = 50;
public function user(): BelongsTo
{

View File

@@ -46,7 +46,6 @@ class User extends Authenticatable implements NotifiableInterface
protected $with = [
"profile",
];
protected $perPage = 50;
public function profile(): HasOne
{

View File

@@ -49,7 +49,6 @@ class VacationRequest extends Model
"to" => "date",
"event_ids" => AsCollection::class,
];
protected $perPage = 50;
public function user(): BelongsTo
{

View File

@@ -12,8 +12,11 @@ use Toby\Domain\UserVacationStatsRetriever;
use Toby\Domain\VacationRequestStatesRetriever;
use Toby\Domain\VacationTypeConfigRetriever;
use Toby\Eloquent\Helpers\YearPeriodRetriever;
use Toby\Eloquent\Models\Holiday;
use Toby\Eloquent\Models\Vacation;
use Toby\Eloquent\Models\VacationRequest;
use Toby\Infrastructure\Http\Resources\HolidayResource;
use Toby\Infrastructure\Http\Resources\SimpleVacationRequestResource;
use Toby\Infrastructure\Http\Resources\VacationRequestResource;
use Toby\Infrastructure\Http\Resources\VacationResource;
@@ -54,6 +57,22 @@ class DashboardController extends Controller
->limit(3)
->get();
$allHolidays = $yearPeriod->holidays;
$approvedVacations = $request->user()
->vacations()
->with("vacationRequest.vacations")
->whereBelongsTo($yearPeriod)
->approved()
->get();
$pendingVacations = $request->user()
->vacations()
->with("vacationRequest.vacations")
->whereBelongsTo($yearPeriod)
->pending()
->get();
$limit = $vacationStatsRetriever->getVacationDaysLimit($user, $yearPeriod);
$used = $vacationStatsRetriever->getUsedVacationDays($user, $yearPeriod);
$pending = $vacationStatsRetriever->getPendingVacationDays($user, $yearPeriod);
@@ -66,6 +85,19 @@ class DashboardController extends Controller
"remoteDays" => VacationResource::collection($remoteDays),
"vacationRequests" => VacationRequestResource::collection($vacationRequests),
"holidays" => HolidayResource::collection($holidays),
"allHolidays" => $allHolidays->mapWithKeys(
fn(Holiday $holiday): array => [$holiday->date->toDateString() => $holiday->name],
),
"approvedVacations" => $approvedVacations->mapWithKeys(
fn(Vacation $vacation): array => [
$vacation->date->toDateString() => new SimpleVacationRequestResource($vacation->vacationRequest),
],
),
"pendingVacations" => $pendingVacations->mapWithKeys(
fn(Vacation $vacation): array => [
$vacation->date->toDateString() => new SimpleVacationRequestResource($vacation->vacationRequest),
],
),
"stats" => [
"limit" => $limit,
"remaining" => $remaining,

231
composer.lock generated
View File

@@ -589,16 +589,16 @@
},
{
"name": "egulias/email-validator",
"version": "3.2.1",
"version": "3.2",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "f88dcf4b14af14a98ad96b14b2b317969eab6715"
"reference": "a5ed8d58ed0c340a7c2109f587951b1c84cf6286"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/f88dcf4b14af14a98ad96b14b2b317969eab6715",
"reference": "f88dcf4b14af14a98ad96b14b2b317969eab6715",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/a5ed8d58ed0c340a7c2109f587951b1c84cf6286",
"reference": "a5ed8d58ed0c340a7c2109f587951b1c84cf6286",
"shasum": ""
},
"require": {
@@ -645,7 +645,7 @@
],
"support": {
"issues": "https://github.com/egulias/EmailValidator/issues",
"source": "https://github.com/egulias/EmailValidator/tree/3.2.1"
"source": "https://github.com/egulias/EmailValidator/tree/3.2"
},
"funding": [
{
@@ -653,7 +653,7 @@
"type": "github"
}
],
"time": "2022-06-18T20:57:19+00:00"
"time": "2022-05-28T22:19:18+00:00"
},
{
"name": "ezyang/htmlpurifier",
@@ -1745,16 +1745,16 @@
},
{
"name": "laravel/framework",
"version": "v9.19.0",
"version": "v9.16.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "bbce25bd823133f6a5a724f2d62680b711f1d0df"
"reference": "dbad869e737542734c48d36d4cb87ee90455c4b8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/bbce25bd823133f6a5a724f2d62680b711f1d0df",
"reference": "bbce25bd823133f6a5a724f2d62680b711f1d0df",
"url": "https://api.github.com/repos/laravel/framework/zipball/dbad869e737542734c48d36d4cb87ee90455c4b8",
"reference": "dbad869e737542734c48d36d4cb87ee90455c4b8",
"shasum": ""
},
"require": {
@@ -1766,7 +1766,7 @@
"fruitcake/php-cors": "^1.2",
"laravel/serializable-closure": "^1.0",
"league/commonmark": "^2.2",
"league/flysystem": "^3.0.16",
"league/flysystem": "^3.0",
"monolog/monolog": "^2.0",
"nesbot/carbon": "^2.53.1",
"php": "^8.0.2",
@@ -1842,7 +1842,7 @@
"pda/pheanstalk": "^4.0",
"phpstan/phpstan": "^1.4.7",
"phpunit/phpunit": "^9.5.8",
"predis/predis": "^1.1.9|^2.0",
"predis/predis": "^1.1.9",
"symfony/cache": "^6.0"
},
"suggest": {
@@ -1868,7 +1868,7 @@
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
"phpunit/phpunit": "Required to use assertions and run tests (^9.5.8).",
"predis/predis": "Required to use the predis connector (^1.1.9|^2.0).",
"predis/predis": "Required to use the predis connector (^1.1.9).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).",
"symfony/cache": "Required to PSR-6 cache bridge (^6.0).",
@@ -1920,7 +1920,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2022-06-28T14:33:19+00:00"
"time": "2022-06-02T18:13:11+00:00"
},
{
"name": "laravel/helpers",
@@ -2472,16 +2472,16 @@
},
{
"name": "league/commonmark",
"version": "2.3.3",
"version": "2.3.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "0da1dca5781dd3cfddbe328224d9a7a62571addc"
"reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/0da1dca5781dd3cfddbe328224d9a7a62571addc",
"reference": "0da1dca5781dd3cfddbe328224d9a7a62571addc",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/cb36fee279f7fca01d5d9399ddd1b37e48e2eca1",
"reference": "cb36fee279f7fca01d5d9399ddd1b37e48e2eca1",
"shasum": ""
},
"require": {
@@ -2574,7 +2574,7 @@
"type": "tidelift"
}
],
"time": "2022-06-07T21:28:26+00:00"
"time": "2022-05-14T15:37:39+00:00"
},
{
"name": "league/config",
@@ -2660,16 +2660,16 @@
},
{
"name": "league/flysystem",
"version": "3.1.0",
"version": "3.0.20",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "34a68067b7ae3b836ea5e57e1fc432478372a4f5"
"reference": "42a2f47dcf39944e2aee1b660ee55ab6ef69b535"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/34a68067b7ae3b836ea5e57e1fc432478372a4f5",
"reference": "34a68067b7ae3b836ea5e57e1fc432478372a4f5",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/42a2f47dcf39944e2aee1b660ee55ab6ef69b535",
"reference": "42a2f47dcf39944e2aee1b660ee55ab6ef69b535",
"shasum": ""
},
"require": {
@@ -2730,7 +2730,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.1.0"
"source": "https://github.com/thephpleague/flysystem/tree/3.0.20"
},
"funding": [
{
@@ -2746,7 +2746,7 @@
"type": "tidelift"
}
],
"time": "2022-06-29T17:29:54+00:00"
"time": "2022-05-25T19:18:39+00:00"
},
{
"name": "league/mime-type-detection",
@@ -3190,16 +3190,16 @@
},
{
"name": "monolog/monolog",
"version": "2.7.0",
"version": "2.6.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "5579edf28aee1190a798bfa5be8bc16c563bd524"
"reference": "247918972acd74356b0a91dfaa5adcaec069b6c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524",
"reference": "5579edf28aee1190a798bfa5be8bc16c563bd524",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0",
"reference": "247918972acd74356b0a91dfaa5adcaec069b6c0",
"shasum": ""
},
"require": {
@@ -3278,7 +3278,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.7.0"
"source": "https://github.com/Seldaek/monolog/tree/2.6.0"
},
"funding": [
{
@@ -3290,7 +3290,7 @@
"type": "tidelift"
}
],
"time": "2022-06-09T08:59:12+00:00"
"time": "2022-05-10T09:36:00+00:00"
},
{
"name": "myclabs/php-enum",
@@ -3354,16 +3354,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.59.1",
"version": "2.58.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5"
"reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a9000603ea337c8df16cc41f8b6be95a65f4d0f5",
"reference": "a9000603ea337c8df16cc41f8b6be95a65f4d0f5",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/97a34af22bde8d0ac20ab34b29d7bfe360902055",
"reference": "97a34af22bde8d0ac20ab34b29d7bfe360902055",
"shasum": ""
},
"require": {
@@ -3378,12 +3378,11 @@
"doctrine/orm": "^2.7",
"friendsofphp/php-cs-fixer": "^3.0",
"kylekatarnls/multi-tester": "^2.0",
"ondrejmirtes/better-reflection": "*",
"phpmd/phpmd": "^2.9",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.99 || ^1.7.14",
"phpunit/php-file-iterator": "^2.0.5 || ^3.0.6",
"phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20",
"phpstan/phpstan": "^0.12.54 || ^1.0",
"phpunit/php-file-iterator": "^2.0.5",
"phpunit/phpunit": "^7.5.20 || ^8.5.23",
"squizlabs/php_codesniffer": "^3.4"
},
"bin": [
@@ -3440,19 +3439,15 @@
},
"funding": [
{
"url": "https://github.com/sponsors/kylekatarnls",
"type": "github"
"url": "https://opencollective.com/Carbon",
"type": "open_collective"
},
{
"url": "https://opencollective.com/Carbon#sponsor",
"type": "opencollective"
},
{
"url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme",
"url": "https://tidelift.com/funding/github/packagist/nesbot/carbon",
"type": "tidelift"
}
],
"time": "2022-06-29T21:43:55+00:00"
"time": "2022-04-25T19:31:17+00:00"
},
{
"name": "nette/schema",
@@ -5431,16 +5426,16 @@
},
{
"name": "symfony/console",
"version": "v6.1.2",
"version": "v6.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "7a86c1c42fbcb69b59768504c7bca1d3767760b7"
"reference": "c9646197ef43b0e2ff44af61e7f0571526fd4170"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/7a86c1c42fbcb69b59768504c7bca1d3767760b7",
"reference": "7a86c1c42fbcb69b59768504c7bca1d3767760b7",
"url": "https://api.github.com/repos/symfony/console/zipball/c9646197ef43b0e2ff44af61e7f0571526fd4170",
"reference": "c9646197ef43b0e2ff44af61e7f0571526fd4170",
"shasum": ""
},
"require": {
@@ -5507,7 +5502,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v6.1.2"
"source": "https://github.com/symfony/console/tree/v6.1.0"
},
"funding": [
{
@@ -5523,7 +5518,7 @@
"type": "tidelift"
}
],
"time": "2022-06-26T13:01:30+00:00"
"time": "2022-05-27T06:34:22+00:00"
},
{
"name": "symfony/css-selector",
@@ -5592,7 +5587,7 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.1.1",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
@@ -5639,7 +5634,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.0"
},
"funding": [
{
@@ -5813,7 +5808,7 @@
},
{
"name": "symfony/event-dispatcher-contracts",
"version": "v3.1.1",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
@@ -5872,7 +5867,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.1.1"
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.1.0"
},
"funding": [
{
@@ -5956,16 +5951,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v6.1.2",
"version": "v6.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "86119d294e51afe4d8e07da96b63332bd1f3f52c"
"reference": "18f8a2a3ab703428143c27c055fd743ab7e7dcb1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/86119d294e51afe4d8e07da96b63332bd1f3f52c",
"reference": "86119d294e51afe4d8e07da96b63332bd1f3f52c",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/18f8a2a3ab703428143c27c055fd743ab7e7dcb1",
"reference": "18f8a2a3ab703428143c27c055fd743ab7e7dcb1",
"shasum": ""
},
"require": {
@@ -6008,7 +6003,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v6.1.2"
"source": "https://github.com/symfony/http-foundation/tree/v6.1.0"
},
"funding": [
{
@@ -6024,20 +6019,20 @@
"type": "tidelift"
}
],
"time": "2022-06-19T13:21:48+00:00"
"time": "2022-05-21T13:34:40+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v6.1.2",
"version": "v6.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "8aaede489900dda61aee208557f63bfa1bca0877"
"reference": "a57c7084bd0604d80d70c89c6662512c698352d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/8aaede489900dda61aee208557f63bfa1bca0877",
"reference": "8aaede489900dda61aee208557f63bfa1bca0877",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/a57c7084bd0604d80d70c89c6662512c698352d1",
"reference": "a57c7084bd0604d80d70c89c6662512c698352d1",
"shasum": ""
},
"require": {
@@ -6118,7 +6113,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v6.1.2"
"source": "https://github.com/symfony/http-kernel/tree/v6.1.0"
},
"funding": [
{
@@ -6134,20 +6129,20 @@
"type": "tidelift"
}
],
"time": "2022-06-26T17:06:14+00:00"
"time": "2022-05-27T07:21:03+00:00"
},
{
"name": "symfony/mailer",
"version": "v6.1.2",
"version": "v6.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/mailer.git",
"reference": "8fa150355115ea09238858ae3cfaf249fd1fd5ed"
"reference": "bc4338d7729aafaaac8559e1a4680ee97b8bfedb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mailer/zipball/8fa150355115ea09238858ae3cfaf249fd1fd5ed",
"reference": "8fa150355115ea09238858ae3cfaf249fd1fd5ed",
"url": "https://api.github.com/repos/symfony/mailer/zipball/bc4338d7729aafaaac8559e1a4680ee97b8bfedb",
"reference": "bc4338d7729aafaaac8559e1a4680ee97b8bfedb",
"shasum": ""
},
"require": {
@@ -6192,7 +6187,7 @@
"description": "Helps sending emails",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/mailer/tree/v6.1.2"
"source": "https://github.com/symfony/mailer/tree/v6.1.0"
},
"funding": [
{
@@ -6208,20 +6203,20 @@
"type": "tidelift"
}
],
"time": "2022-06-19T13:21:48+00:00"
"time": "2022-04-27T17:11:01+00:00"
},
{
"name": "symfony/mime",
"version": "v6.1.1",
"version": "v6.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "56508865dd883dce3c863af11b3e8053adab30d7"
"reference": "032e796edbf842bc4b4c81c42598b144b95ce56a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/56508865dd883dce3c863af11b3e8053adab30d7",
"reference": "56508865dd883dce3c863af11b3e8053adab30d7",
"url": "https://api.github.com/repos/symfony/mime/zipball/032e796edbf842bc4b4c81c42598b144b95ce56a",
"reference": "032e796edbf842bc4b4c81c42598b144b95ce56a",
"shasum": ""
},
"require": {
@@ -6273,7 +6268,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v6.1.1"
"source": "https://github.com/symfony/mime/tree/v6.1.0"
},
"funding": [
{
@@ -6289,7 +6284,7 @@
"type": "tidelift"
}
],
"time": "2022-06-09T12:51:38+00:00"
"time": "2022-05-21T13:34:40+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -7009,16 +7004,16 @@
},
{
"name": "symfony/routing",
"version": "v6.1.1",
"version": "v6.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "8f068b792e515b25e26855ac8dc7fe800399f3e5"
"reference": "03c13cbaefdec9fbb7a62ed18235d487686540dd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/8f068b792e515b25e26855ac8dc7fe800399f3e5",
"reference": "8f068b792e515b25e26855ac8dc7fe800399f3e5",
"url": "https://api.github.com/repos/symfony/routing/zipball/03c13cbaefdec9fbb7a62ed18235d487686540dd",
"reference": "03c13cbaefdec9fbb7a62ed18235d487686540dd",
"shasum": ""
},
"require": {
@@ -7077,7 +7072,7 @@
"url"
],
"support": {
"source": "https://github.com/symfony/routing/tree/v6.1.1"
"source": "https://github.com/symfony/routing/tree/v6.1.0"
},
"funding": [
{
@@ -7093,20 +7088,20 @@
"type": "tidelift"
}
],
"time": "2022-06-08T12:21:15+00:00"
"time": "2022-04-27T17:06:58+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v3.1.1",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "925e713fe8fcacf6bc05e936edd8dd5441a21239"
"reference": "d66cd8ab656780f62c4215b903a420eb86358957"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/925e713fe8fcacf6bc05e936edd8dd5441a21239",
"reference": "925e713fe8fcacf6bc05e936edd8dd5441a21239",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/d66cd8ab656780f62c4215b903a420eb86358957",
"reference": "d66cd8ab656780f62c4215b903a420eb86358957",
"shasum": ""
},
"require": {
@@ -7162,7 +7157,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.1.1"
"source": "https://github.com/symfony/service-contracts/tree/v3.1.0"
},
"funding": [
{
@@ -7178,20 +7173,20 @@
"type": "tidelift"
}
],
"time": "2022-05-30T19:18:58+00:00"
"time": "2022-05-07T08:07:09+00:00"
},
{
"name": "symfony/string",
"version": "v6.1.2",
"version": "v6.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "1903f2879875280c5af944625e8246d81c2f0604"
"reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/1903f2879875280c5af944625e8246d81c2f0604",
"reference": "1903f2879875280c5af944625e8246d81c2f0604",
"url": "https://api.github.com/repos/symfony/string/zipball/d3edc75baf9f1d4f94879764dda2e1ac33499529",
"reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529",
"shasum": ""
},
"require": {
@@ -7247,7 +7242,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v6.1.2"
"source": "https://github.com/symfony/string/tree/v6.1.0"
},
"funding": [
{
@@ -7263,7 +7258,7 @@
"type": "tidelift"
}
],
"time": "2022-06-26T16:35:04+00:00"
"time": "2022-04-22T08:18:23+00:00"
},
{
"name": "symfony/translation",
@@ -7363,16 +7358,16 @@
},
{
"name": "symfony/translation-contracts",
"version": "v3.1.1",
"version": "v3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
"reference": "606be0f48e05116baef052f7f3abdb345c8e02cc"
"reference": "bfddd2a1faa271b782b791c361cc16e2dd49dfaa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/606be0f48e05116baef052f7f3abdb345c8e02cc",
"reference": "606be0f48e05116baef052f7f3abdb345c8e02cc",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/bfddd2a1faa271b782b791c361cc16e2dd49dfaa",
"reference": "bfddd2a1faa271b782b791c361cc16e2dd49dfaa",
"shasum": ""
},
"require": {
@@ -7424,7 +7419,7 @@
"standards"
],
"support": {
"source": "https://github.com/symfony/translation-contracts/tree/v3.1.1"
"source": "https://github.com/symfony/translation-contracts/tree/v3.1.0"
},
"funding": [
{
@@ -7440,7 +7435,7 @@
"type": "tidelift"
}
],
"time": "2022-06-27T17:24:16+00:00"
"time": "2022-04-22T07:30:54+00:00"
},
{
"name": "symfony/var-dumper",
@@ -7739,21 +7734,21 @@
},
{
"name": "webmozart/assert",
"version": "1.11.0",
"version": "1.10.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991"
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25",
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"php": "^7.2 || ^8.0"
"php": "^7.2 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
@@ -7791,9 +7786,9 @@
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
"source": "https://github.com/webmozarts/assert/tree/1.10.0"
},
"time": "2022-06-03T18:03:27+00:00"
"time": "2021-03-09T10:59:23+00:00"
}
],
"packages-dev": [
@@ -10872,16 +10867,16 @@
},
{
"name": "spatie/laravel-ignition",
"version": "1.3.1",
"version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ignition.git",
"reference": "fe37a0eafe6ea040804255c70e9808af13314f87"
"reference": "51e5daaa7e43c154fe57f1ddfbba862f9fe57646"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/fe37a0eafe6ea040804255c70e9808af13314f87",
"reference": "fe37a0eafe6ea040804255c70e9808af13314f87",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/51e5daaa7e43c154fe57f1ddfbba862f9fe57646",
"reference": "51e5daaa7e43c154fe57f1ddfbba862f9fe57646",
"shasum": ""
},
"require": {
@@ -10958,7 +10953,7 @@
"type": "github"
}
],
"time": "2022-06-17T06:28:57+00:00"
"time": "2022-05-05T15:53:24+00:00"
},
{
"name": "symfony/filesystem",

View File

@@ -3,6 +3,11 @@
<div class="grid grid-cols-1 gap-4 items-start xl:grid-cols-3 xl:gap-8">
<div class="grid grid-cols-1 gap-4 xl:col-span-2">
<Welcome :user="auth.user" />
<VacationCalendar
:holidays="allHolidays"
:approved-vacations="approvedVacations"
:pending-vacations="pendingVacations"
/>
<VacationStats :stats="stats" />
</div>
<div class="grid grid-cols-1 gap-4">
@@ -38,6 +43,7 @@ import HomeOfficeList from '@/Shared/Widgets/HomeOfficeList'
import UpcomingHolidays from '@/Shared/Widgets/UpcomingHolidays'
import UserVacationRequests from '@/Shared/Widgets/UserVacationRequests'
import PendingVacationRequests from '@/Shared/Widgets/PendingVacationRequests'
import VacationCalendar from '@/Shared/Widgets/VacationCalendar'
defineProps({
auth: Object,
@@ -48,5 +54,8 @@ defineProps({
can: Object,
stats: Object,
years: Object,
allHolidays: Object,
approvedVacations: Object,
pendingVacations: Object,
})
</script>

View File

@@ -297,8 +297,8 @@
<button
type="submit"
class="inline-flex justify-center py-2 px-4 text-sm font-medium text-white bg-blumilk-600 rounded-md border border-transparent focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
:class="[form.processing || !isDirty ? 'disabled:opacity-60' : 'hover:bg-blumilk-700']"
:disabled="form.processing || !isDirty"
:class="[form.processing || !form.isDirty ? 'disabled:opacity-60' : 'hover:bg-blumilk-700']"
:disabled="form.processing || !form.isDirty"
>
Zapisz
</button>
@@ -359,13 +359,6 @@ const form = useForm({
flowSkipped: false,
})
let isDirty = ref(false)
watch(form, formData => {
const { from, to } = formData.data()
isDirty.value = formData.isDirty || from !== null || to !== null
}, { immediate: true, deep: true })
refreshEstimatedDays(form.from, form.to)
const estimatedDays = ref([])

View File

@@ -0,0 +1,104 @@
<template>
<div
:class="[ (day.isVacation || day.isPendingVacation) && `border-b-2 border-dashed ${getVacationBorder(day)}` ]"
>
<Popper
v-if="day.isHoliday"
as="div"
open-delay="200"
hover
offset-distance="0"
@mouseover.passive="onMouseover"
@mouseleave="onMouseleave"
>
<time
:datetime="day.date"
:class="[ day.isToday && 'flex h-6 w-6 items-center justify-center rounded-full bg-blumilk-500 font-semibold text-white', 'text-red-600' ]"
>
{{ day.dayNumber }}
</time>
<template #content>
<div class="py-2 px-6 text-sm font-semibold text-left text-gray-700 bg-white rounded-lg border border-gray-400">
{{ getHolidayDescription(day) }}
</div>
</template>
</Popper>
<Popper
v-else-if="day.isPendingVacation"
as="div"
open-delay="200"
hover
offset-distance="0"
@mouseover.passive="onMouseover"
@mouseleave="onMouseleave"
>
<time
:datetime="day.date"
:class="[ day.isToday && 'flex h-6 w-6 items-center justify-center rounded-full bg-blumilk-500 font-semibold text-white' ]"
>
{{ day.dayNumber }}
</time>
<template #content>
<VacationPopup :vacation="getVacationInfo(day)" />
</template>
</Popper>
<div
v-else-if="day.isWeekend"
>
<time
:datetime="day.date"
:class="{ 'flex h-6 w-6 items-center justify-center rounded-full bg-blumilk-500 font-semibold text-white': day.isToday }"
>
{{ day.dayNumber }}
</time>
</div>
<InertiaLink
v-else
href="/vacation/requests/create"
:data="{ 'from_date': day.date }"
@mouseover.passive="onMouseover"
@mouseleave="onMouseleave"
>
<time
:datetime="day.date"
:class="{ 'flex h-6 w-6 items-center justify-center rounded-full bg-blumilk-500 font-semibold text-white': day.isToday }"
>
{{ day.dayNumber }}
</time>
</InertiaLink>
</div>
</template>
<script setup>
import Popper from 'vue3-popper'
import { defineProps, ref } from 'vue'
import VacationPopup from '@/Shared/VacationPopup'
defineProps({
day: {
type: Object,
required: true,
},
getHolidayDescription: {
type: Function,
},
getVacationBorder: {
type: Function,
},
getVacationInfo: {
type: Function,
},
})
const isActive = ref(false)
function onMouseover() {
if (!isActive.value)
isActive.value = true
}
function onMouseleave() {
if (isActive.value)
isActive.value = false
}
</script>

View File

@@ -0,0 +1,12 @@
function isViewModeKey(key) {
return this.key === key.value
}
export const viewModes = [
{ key: 'week', name: 'Widok tygodnia', shortcut: 'Tydzień', is: isViewModeKey },
{ key: 'month', name: 'Widok miesiąca', shortcut: 'Miesiąc', is: isViewModeKey },
]
export function find(modeKey) {
return viewModes.find(mode => mode.key === modeKey)
}

View File

@@ -0,0 +1,394 @@
<template>
<section class="bg-white shadow-md">
<div class="grid grid-cols-3 grid-rows-1 items-center justify-center p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
{{ calendarState.monthName }} {{ !calendarState.isActualYear ? calendar.currents.year : undefined }}
</h2>
<div class="flex justify-center">
<div class="flex items-center rounded-md shadow-sm md:items-stretch">
<button
v-if="calendarState.isPrevious"
type="button"
class="flex items-center justify-center rounded-l-md border border-r-0 border-gray-300 bg-white py-2 pl-3 pr-4 text-gray-400 hover:text-gray-500 focus:relative md:w-9 md:px-2 md:hover:bg-gray-50"
@click="toLast"
>
<span class="sr-only">Poprzedni {{ calendarState.viewMode.details.shortcut }}</span>
<ChevronLeftIcon
class="h-5 w-5"
aria-hidden="true"
/>
</button>
<button
type="button"
class="hidden border-t border-b border-gray-300 bg-white px-3.5 text-sm font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-900 focus:relative md:block"
:class="{ 'rounded-l-md border border-r-0': !calendarState.isPrevious, 'rounded-r-md border border-l-0': !calendarState.isNext }"
@click="goToToday"
>
Dziś
</button>
<span class="relative -mx-px h-5 w-px bg-gray-300 md:hidden" />
<button
v-if="calendarState.isNext"
type="button"
class="flex items-center justify-center rounded-r-md border border-l-0 border-gray-300 bg-white py-2 pl-4 pr-3 text-gray-400 hover:text-gray-500 focus:relative md:w-9 md:px-2 md:hover:bg-gray-50"
@click="toNext"
>
<span class="sr-only">Następny {{ calendarState.viewMode.details.shortcut }}</span>
<ChevronRightIcon
class="h-5 w-5"
aria-hidden="true"
/>
</button>
</div>
</div>
<Menu
as="div"
class="flex justify-end relative"
>
<MenuButton
type="button"
class="flex items-center rounded-md border border-gray-300 bg-white py-2 pl-3 pr-2 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50"
>
{{ calendarState.viewMode.details.name }}
<ChevronDownIcon
class="ml-2 h-5 w-5 text-gray-400"
aria-hidden="true"
/>
</MenuButton>
<transition
class="z-10"
enter-active-class="transition ease-out duration-100"
enter-from-class="transform opacity-0 scale-95"
enter-to-class="transform opacity-100 scale-100"
leave-active-class="transition ease-in duration-75"
leave-from-class="transform opacity-100 scale-100"
leave-to-class="transform opacity-0 scale-95"
>
<MenuItems class="absolute right-0 mt-3 w-36 origin-top-right overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
<div class="py-1">
<MenuItem
v-for="option in viewModes"
:key="option.key"
v-slot="{ active }"
>
<button
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'flex px-4 py-2 text-sm text-left w-full']"
@click="updateViewMode(option.key)"
>
{{ option.shortcut }}
<CheckIcon
v-if="option.is(calendar.viewMode)"
class="ml-2 w-5 h-5 text-blumilk-500"
/>
</button>
</MenuItem>
</div>
</MenuItems>
</transition>
</Menu>
</div>
<div class="ring-1 ring-black ring-opacity-5 lg:flex lg:flex-auto lg:flex-col">
<div
v-if="calendarState.viewMode.isMonth"
class="grid grid-cols-7 gap-px border-b border-gray-300 bg-gray-200 text-center text-xs font-semibold leading-6 text-gray-700 lg:flex-none"
>
<div class="bg-white py-2">
Pn
</div>
<div class="bg-white py-2">
Wt
</div>
<div class="bg-white py-2">
Śr
</div>
<div class="bg-white py-2">
Cz
</div>
<div class="bg-white py-2">
Pt
</div>
<div class="bg-red-100 py-2">
Sb
</div>
<div class="bg-red-100 py-2">
Nd
</div>
</div>
<div class="flex bg-gray-200 text-xs leading-6 text-gray-700 lg:flex-auto">
<div
class="w-full grid grid-cols-7 gap-px"
:class="{ 'grid-rows-1': calendarState.viewMode.isWeek }"
>
<DayComponent
v-for="(day, index) in days"
:key="index"
:day="day"
class="flex flex-col relative py-2 px-3"
:class="[day.isCurrentMonth ? 'bg-white' : 'bg-gray-50 text-gray-500', { 'hover:bg-blumilk-25': day.isCurrentMonth && !day.isWeekend }, { 'day': calendarState.viewMode.isWeek }, { 'bg-red-100': day.isCurrentMonth && day.isWeekend }, { 'bg-red-50': !day.isCurrentMonth && day.isWeekend }, { 'text-red-800': day.isWeekend }]"
:get-holiday-description="getHolidayDescription"
:get-vacation-border="getVacationBorder"
:get-vacation-info="getVacationInfo"
/>
</div>
</div>
</div>
</section>
</template>
<script setup>
import { CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from '@heroicons/vue/solid'
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
import { ref, watch, computed, reactive } from 'vue'
import { DateTime } from 'luxon'
import useVacationTypeInfo from '@/Composables/vacationTypeInfo'
import useCurrentYearPeriodInfo from '@/Composables/yearPeriodInfo'
import { useMonthInfo } from '@/Composables/monthInfo'
import { viewModes, find as findViewMode } from '@/Shared/Widgets/Calendar/ViewModeOptions'
import DayComponent from '@/Shared/Widgets/Calendar/DayComponent'
const props = defineProps({
holidays: Object,
approvedVacations: Object,
pendingVacations: Object,
})
let days = ref([])
function getCurrentDate() {
const { year, month, weekNumber } = DateTime.now()
return { year, month, week: weekNumber }
}
const currentDate = getCurrentDate()
const months = useMonthInfo().getMonths()
const { findType } = useVacationTypeInfo()
const selectedYear = useCurrentYearPeriodInfo().year.value
const calendar = {
viewMode: ref('week'),
currents: reactive({
year: selectedYear,
month: selectedYear === currentDate.year ? currentDate.month : 1,
week: selectedYear === currentDate.year ? currentDate.week : 0,
}),
}
const calendarState = reactive({
viewMode: {
isWeek: computed(() => calendar.viewMode.value === 'week'),
isMonth: computed(() => calendar.viewMode.value === 'month'),
details: computed(() => findViewMode(calendar.viewMode.value)),
},
monthName: computed(() => months[calendar.currents.month - 1]?.name),
isActualYear: computed(() => calendar.currents.year === DateTime.now().year),
isPrevious: computed(() => calendarState.viewMode.isMonth ? calendar.currents.month !== 1 : calendar.currents.week > 0),
isNext: computed(() => calendarState.viewMode.isMonth ? calendar.currents.month !== 12 : calendar.currents.week < DateTime.fromObject({ year: selectedYear, month: 12, day: 31 }).weekNumber),
})
const customCalendar = {
loadCalendar() {
const date = DateTime.fromObject({
year: calendar.currents.year,
month: calendarState.viewMode.isMonth ? calendar.currents.month : 1,
day: 1,
})
days.value = this.generateCalendarData(date)
},
generateCalendarData(date) {
const firstMonthDay = date.startOf('month')
const lastMonthDay = date.endOf('month')
if (calendarState.viewMode.isWeek) {
return this.generateWeekData(firstMonthDay.startOf('week'))
} else if (calendarState.viewMode.isMonth) {
return this.generateMonthData(firstMonthDay.startOf('week'), lastMonthDay.endOf('week'))
}
return []
},
generateWeekData(start) {
let days = [], startWeek
if (calendar.currents.month === 1 && calendar.currents.week === 0)
startWeek = DateTime.fromObject({ year: calendar.currents.year, month: 1, day: 1 }).startOf('week')
else if (calendarState.isActualYear)
startWeek = DateTime.fromObject({ weekNumber: calendar.currents.week })
else
startWeek = start.plus({ week: calendar.currents.week })
const endWeek = startWeek.endOf('week')
for (let day = startWeek; day < endWeek; day = day.plus({ day: 1 })) {
days.push(this.prepareDay(day))
}
return days
},
generateMonthData(start, end) {
let days = []
for (let day = start; day < end; day = day.plus({ day: 1 })) {
days.push(this.prepareDay(day))
}
return days
},
prepareDay(day) {
const isCurrentMonth = isInCurrentMonth(day)
return {
date: day.toISODate(),
dayNumber: day.day,
isCurrentMonth: isCurrentMonth,
isToday: isToday(day),
isWeekend: isWeekend(day),
isHoliday: isHoliday(day),
isVacation: isCurrentMonth && isVacation(day),
isPendingVacation: isCurrentMonth && isPendingVacation(day),
}
},
}
watch([calendar.viewMode, calendar.currents], () => {
customCalendar.loadCalendar()
})
customCalendar.loadCalendar()
function toLast() {
if (calendar.viewMode.value === 'week')
minusWeek()
else
minusMonth()
}
function toNext() {
if (calendar.viewMode.value === 'week')
addWeek()
else
addMonth()
}
function resetCalendar(config = {}) {
const currentMonth = isUndefined(config.month) ? currentDate.month : config.month
const currentWeek = isUndefined(config.week) ? currentDate.week : config.week
calendar.currents.year = isUndefined(config.year) ? selectedYear : config.month
calendar.currents.month = calendarState.isActualYear || !isUndefined(config.year) ? currentMonth : 1
calendar.currents.week = calendarState.isActualYear || !isUndefined(config.week) ? currentWeek : 0
}
function isUndefined(value) {
return value === undefined
}
function addWeek(minus = false) {
const howMany = minus ? -1: 1
let nextMonth, date = DateTime.fromObject({
year: calendar.currents.year,
month: 1,
day: 1,
})
date = date.plus({ week: calendar.currents.week + howMany })
const startWeekDay = date.startOf('week'), endWeekDay = date.endOf('week')
nextMonth = howMany > 0 ? startWeekDay.month : endWeekDay.month
if (howMany < 0 && endWeekDay.day === endWeekDay.daysInMonth)
calendar.currents.week--
else if (howMany > 0 && startWeekDay.day === 1)
calendar.currents.week++
if (nextMonth !== calendar.currents.month) {
calendar.currents.month = calendar.currents.week > 1 ? nextMonth : 1
if (calendar.currents.week === 1)
calendar.currents.week = 0
return
}
calendar.currents.week += howMany
}
function minusWeek() {
addWeek(true)
}
function addMonth(minus = false) {
calendar.currents.month += minus ? -1 : 1
}
function minusMonth() {
addMonth(true)
}
function goToToday() {
resetCalendar({ year: currentDate.year, months: currentDate.month, week: currentDate.week })
}
function updateViewMode(type) {
if (type === 'month')
resetCalendar({ week: 0 })
else
resetCalendar()
calendar.viewMode.value = type
}
function isInCurrentMonth(date) {
return calendar.currents.month === date.month
}
function isWeekend(date) {
return date.weekday === 6 || date.weekday === 7
}
function isToday(date) {
return date.toISODate() === DateTime.local().toISODate()
}
function isHoliday(date) {
return props.holidays[date.toISODate()] !== undefined
}
function getHolidayDescription(day) {
return props.holidays[day.date]
}
function isVacation(date) {
return props.approvedVacations[date.toISODate()] !== undefined
}
function isPendingVacation(date) {
return props.pendingVacations[date.toISODate()] !== undefined
}
function getVacationBorder(day) {
return findType(getVacationInfo(day).type)?.border
}
function getVacationInfo(day) {
return day.isVacation ? props.approvedVacations[day.date] : props.pendingVacations[day.date]
}
</script>
<style lang="css">
.day:nth-of-type(7n - 6):before {
content: "Pn";
}
.day:nth-of-type(7n - 5):before {
content: "Wt";
}
.day:nth-of-type(7n - 4):before {
content: "Śr";
}
.day:nth-of-type(7n - 3):before {
content: "Cz";
}
.day:nth-of-type(7n - 2):before {
content: "Pt";
}
.day:nth-of-type(7n - 1):before {
content: "Sb";
}
.day:nth-of-type(7n):before {
content: "Nd";
}
</style>

View File

@@ -73,10 +73,10 @@ class UserTest extends FeatureTestCase
public function testUserListIsPaginated(): void
{
User::factory()->count(50)->create();
User::factory()->count(15)->create();
$admin = User::factory()->admin()->create();
$this->assertDatabaseCount("users", 51);
$this->assertDatabaseCount("users", 16);
$this->actingAs($admin)
->get("/users?page=2")