diff --git a/app/Infrastructure/Http/Controllers/AnnualSummaryController.php b/app/Infrastructure/Http/Controllers/AnnualSummaryController.php index bc2a2d7..6df14a4 100644 --- a/app/Infrastructure/Http/Controllers/AnnualSummaryController.php +++ b/app/Infrastructure/Http/Controllers/AnnualSummaryController.php @@ -10,6 +10,7 @@ use Inertia\Response; use Toby\Eloquent\Helpers\YearPeriodRetriever; use Toby\Eloquent\Models\Holiday; use Toby\Eloquent\Models\Vacation; +use Toby\Infrastructure\Http\Resources\SimpleVacationRequestResource; class AnnualSummaryController extends Controller { @@ -25,22 +26,22 @@ class AnnualSummaryController extends Controller $vacations = $request->user() ->vacations() - ->with("vacationRequest") + ->with("vacationRequest.vacations") ->whereBetween("date", [$startDate, $endDate]) ->approved() ->get(); $pendingVacations = $request->user() ->vacations() - ->with("vacationRequest") + ->with("vacationRequest.vacations") ->whereBetween("date", [$startDate, $endDate]) ->pending() ->get(); return inertia("AnnualSummary", [ "holidays" => $holidays->mapWithKeys(fn(Holiday $holiday) => [$holiday->date->toDateString() => $holiday->name]), - "vacations" => $vacations->mapWithKeys(fn(Vacation $vacation) => [$vacation->date->toDateString() => $vacation->vacationRequest->type]), - "pendingVacations" => $pendingVacations->mapWithKeys(fn(Vacation $vacation) => [$vacation->date->toDateString() => $vacation->vacationRequest->type]), + "vacations" => $vacations->mapWithKeys(fn(Vacation $vacation) => [$vacation->date->toDateString() => new SimpleVacationRequestResource($vacation->vacationRequest)]), + "pendingVacations" => $pendingVacations->mapWithKeys(fn(Vacation $vacation) => [$vacation->date->toDateString() => new SimpleVacationRequestResource($vacation->vacationRequest)]), ]); } } diff --git a/app/Infrastructure/Http/Resources/SimpleVacationRequestResource.php b/app/Infrastructure/Http/Resources/SimpleVacationRequestResource.php new file mode 100644 index 0000000..3cb9c52 --- /dev/null +++ b/app/Infrastructure/Http/Resources/SimpleVacationRequestResource.php @@ -0,0 +1,25 @@ + $this->id, + "name" => $this->name, + "type" => $this->type, + "state" => $this->state, + "from" => $this->from->toDisplayString(), + "to" => $this->to->toDisplayString(), + "days" => $this->vacations->count(), + ]; + } +} diff --git a/package-lock.json b/package-lock.json index c4ca458..958c116 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "echarts": "^5.3.2", "eslit": "^6.0.0", "flatpickr": "^4.6.11", + "floating-vue": "^2.0.0-beta.13", "laravel-mix": "^6.0.43", "lodash": "^4.17.21", "luxon": "^2.3.1", @@ -1681,6 +1682,19 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@floating-ui/core": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-0.3.1.tgz", + "integrity": "sha512-ensKY7Ub59u16qsVIFEo2hwTCqZ/r9oZZFh51ivcLGHfUwTn8l1Xzng8RJUe91H/UP8PeqeBronAGx0qmzwk2g==" + }, + "node_modules/@floating-ui/dom": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-0.1.10.tgz", + "integrity": "sha512-4kAVoogvQm2N0XE0G6APQJuCNuErjOfPW8Ux7DFxh8+AfugWflwVJ5LDlHOwrwut7z/30NUvdtHzQ3zSip4EzQ==", + "dependencies": { + "@floating-ui/core": "^0.3.0" + } + }, "node_modules/@headlessui/vue": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@headlessui/vue/-/vue-1.5.0.tgz", @@ -4866,6 +4880,18 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, + "node_modules/floating-vue": { + "version": "2.0.0-beta.13", + "resolved": "https://registry.npmjs.org/floating-vue/-/floating-vue-2.0.0-beta.13.tgz", + "integrity": "sha512-C2bGEtdbOXm+2rmkn8W6dTQeh3xJT7YbdHnrbanYDS3vK/1lumdXhYA6j2Qs+9shViNjoVUUND1EhLxLDP2OZA==", + "dependencies": { + "@floating-ui/dom": "^0.1.10", + "vue-resize": "^2.0.0-alpha.1" + }, + "peerDependencies": { + "vue": "^3.2.0" + } + }, "node_modules/follow-redirects": { "version": "1.14.9", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", @@ -9029,6 +9055,14 @@ "resolved": "https://registry.npmjs.org/vue-material-design-icons/-/vue-material-design-icons-5.0.0.tgz", "integrity": "sha512-lYSJFW/TyQqmg7MvUbEB8ua1mwWy/v8qve7QJuA/UWUAXC4/yVUdAm4pg/sM9+k5n7VLckBv6ucOROuGBsGPDQ==" }, + "node_modules/vue-resize": { + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-2.0.0-alpha.1.tgz", + "integrity": "sha512-7+iqOueLU7uc9NrMfrzbG8hwMqchfVfSzpVlCMeJQe4pyibqyoifDNbKTZvwxZKDvGkB+PdFeKvnGZMoEb8esg==", + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", @@ -10755,6 +10789,19 @@ "strip-json-comments": "^3.1.1" } }, + "@floating-ui/core": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-0.3.1.tgz", + "integrity": "sha512-ensKY7Ub59u16qsVIFEo2hwTCqZ/r9oZZFh51ivcLGHfUwTn8l1Xzng8RJUe91H/UP8PeqeBronAGx0qmzwk2g==" + }, + "@floating-ui/dom": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-0.1.10.tgz", + "integrity": "sha512-4kAVoogvQm2N0XE0G6APQJuCNuErjOfPW8Ux7DFxh8+AfugWflwVJ5LDlHOwrwut7z/30NUvdtHzQ3zSip4EzQ==", + "requires": { + "@floating-ui/core": "^0.3.0" + } + }, "@headlessui/vue": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@headlessui/vue/-/vue-1.5.0.tgz", @@ -13304,6 +13351,15 @@ "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", "dev": true }, + "floating-vue": { + "version": "2.0.0-beta.13", + "resolved": "https://registry.npmjs.org/floating-vue/-/floating-vue-2.0.0-beta.13.tgz", + "integrity": "sha512-C2bGEtdbOXm+2rmkn8W6dTQeh3xJT7YbdHnrbanYDS3vK/1lumdXhYA6j2Qs+9shViNjoVUUND1EhLxLDP2OZA==", + "requires": { + "@floating-ui/dom": "^0.1.10", + "vue-resize": "^2.0.0-alpha.1" + } + }, "follow-redirects": { "version": "1.14.9", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", @@ -16265,6 +16321,12 @@ "resolved": "https://registry.npmjs.org/vue-material-design-icons/-/vue-material-design-icons-5.0.0.tgz", "integrity": "sha512-lYSJFW/TyQqmg7MvUbEB8ua1mwWy/v8qve7QJuA/UWUAXC4/yVUdAm4pg/sM9+k5n7VLckBv6ucOROuGBsGPDQ==" }, + "vue-resize": { + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-2.0.0-alpha.1.tgz", + "integrity": "sha512-7+iqOueLU7uc9NrMfrzbG8hwMqchfVfSzpVlCMeJQe4pyibqyoifDNbKTZvwxZKDvGkB+PdFeKvnGZMoEb8esg==", + "requires": {} + }, "vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", diff --git a/package.json b/package.json index 8896792..715ab69 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "echarts": "^5.3.2", "eslit": "^6.0.0", "flatpickr": "^4.6.11", + "floating-vue": "^2.0.0-beta.13", "laravel-mix": "^6.0.43", "lodash": "^4.17.21", "luxon": "^2.3.1", diff --git a/resources/css/app.css b/resources/css/app.css index 858c5e9..e578feb 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,5 +1,6 @@ @import 'flatpickr/dist/themes/light.css'; @import 'vue-toastification/dist/index.css'; +@import 'floating-vue/dist/style.css'; @tailwind base; @tailwind components; @@ -68,3 +69,16 @@ ::-webkit-scrollbar-thumb:hover { background: #dadce0; } + +.v-popper--theme-tooltip .v-popper__inner { + padding: 0; + background: transparent; +} + +.v-popper--theme-tooltip .v-popper__arrow-outer { + border-color: #527ABA; +} + +.v-popper--theme-tooltip:focus-visible { + outline: none; +} diff --git a/resources/js/Pages/AnnualSummary.vue b/resources/js/Pages/AnnualSummary.vue index 552846a..896f235 100644 --- a/resources/js/Pages/AnnualSummary.vue +++ b/resources/js/Pages/AnnualSummary.vue @@ -1,10 +1,12 @@