From 11663576894ce9cdfd139f643f8e494221a2c7d8 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Thu, 31 Mar 2022 13:20:10 +0200 Subject: [PATCH 01/13] wip --- package-lock.json | 14 +++++ package.json | 1 + resources/js/Pages/Test.vue | 105 ++++++++++++++++++++++++++++++++++++ routes/web.php | 3 ++ 4 files changed, 123 insertions(+) create mode 100644 resources/js/Pages/Test.vue diff --git a/package-lock.json b/package-lock.json index 6e6fd67..d06e55e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "flatpickr": "^4.6.11", "laravel-mix": "^6.0.43", "lodash": "^4.17.21", + "luxon": "^2.3.1", "postcss": "^8.4.12", "tailwindcss": "^3.0.23", "vue": "^3.2.31", @@ -6115,6 +6116,14 @@ "node": ">=10" } }, + "node_modules/luxon": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-2.3.1.tgz", + "integrity": "sha512-I8vnjOmhXsMSlNMZlMkSOvgrxKJl0uOsEzdGgGNZuZPaS9KlefpE9KV95QFftlJSC+1UyCC9/I69R02cz/zcCA==", + "engines": { + "node": ">=12" + } + }, "node_modules/magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", @@ -14182,6 +14191,11 @@ "yallist": "^4.0.0" } }, + "luxon": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-2.3.1.tgz", + "integrity": "sha512-I8vnjOmhXsMSlNMZlMkSOvgrxKJl0uOsEzdGgGNZuZPaS9KlefpE9KV95QFftlJSC+1UyCC9/I69R02cz/zcCA==" + }, "magic-string": { "version": "0.25.7", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", diff --git a/package.json b/package.json index decb2c6..8e5320e 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "flatpickr": "^4.6.11", "laravel-mix": "^6.0.43", "lodash": "^4.17.21", + "luxon": "^2.3.1", "postcss": "^8.4.12", "tailwindcss": "^3.0.23", "vue": "^3.2.31", diff --git a/resources/js/Pages/Test.vue b/resources/js/Pages/Test.vue new file mode 100644 index 0000000..4ba6969 --- /dev/null +++ b/resources/js/Pages/Test.vue @@ -0,0 +1,105 @@ + + + \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 7eedd7a..778b90c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -64,6 +64,9 @@ Route::middleware("auth")->group(function (): void { Route::get("/monthly-usage", MonthlyUsageController::class) ->name("vacation.monthly-usage"); }); + + Route::get("/test", fn() => inertia("Test")); + }); Route::middleware("guest")->group(function (): void { -- 2.52.0 From 74dfd9fbf31927bbb252acce0ac205b3db12ef08 Mon Sep 17 00:00:00 2001 From: Adrian Hopek Date: Wed, 6 Apr 2022 08:14:37 +0200 Subject: [PATCH 02/13] wip --- app/Eloquent/Models/Vacation.php | 8 ++ resources/js/Composables/vacationTypeInfo.js | 36 ++++++ resources/js/Composables/yearPeriodInfo.js | 2 + resources/js/Pages/Test.vue | 111 +++++++++++-------- resources/js/Shared/VacationBar.vue | 2 +- routes/web.php | 35 +++++- 6 files changed, 146 insertions(+), 48 deletions(-) diff --git a/app/Eloquent/Models/Vacation.php b/app/Eloquent/Models/Vacation.php index 65ac662..6313d07 100644 --- a/app/Eloquent/Models/Vacation.php +++ b/app/Eloquent/Models/Vacation.php @@ -50,4 +50,12 @@ class Vacation extends Model fn(Builder $query) => $query->states(VacationRequestStatesRetriever::successStates()), ); } + + public function scopePending(Builder $query): Builder + { + return $query->whereRelation( + "vacationRequest", + fn(Builder $query) => $query->states(VacationRequestStatesRetriever::pendingStates()), + ); + } } diff --git a/resources/js/Composables/vacationTypeInfo.js b/resources/js/Composables/vacationTypeInfo.js index 6594ab7..c19730e 100644 --- a/resources/js/Composables/vacationTypeInfo.js +++ b/resources/js/Composables/vacationTypeInfo.js @@ -14,54 +14,90 @@ const types = [ value: 'vacation', icon: WhiteBalanceSunnyIcon, color: 'text-amber-500', + border: { + approved: 'border-amber-500', + pending: 'border-amber-300', + }, }, { text: 'Urlop na żądanie', value: 'vacation_on_request', icon: CommentAlertIcon, color: 'text-slate-500', + border: { + approved: 'border-slate-500', + pending: 'border-slate-300', + }, }, { text: 'Urlop okolicznościowy', value: 'special_vacation', icon: StarShootingIcon, color: 'text-orange-500', + border: { + approved: 'border-orange-500', + pending: 'border-orange-300', + }, }, { text: 'Opieka nad dzieckiem art 188 kp', value: 'childcare_vacation', icon: BabyCarriageIcon, color: 'text-purple-500', + border: { + approved: 'border-purple-500', + pending: 'border-purple-300', + }, }, { text: 'Urlop szkoleniowy', value: 'training_vacation', icon: HumanMaleBoardIcon, color: 'text-blumilk-500', + border: { + approved: 'border-blumilk-500', + pending: 'border-blumilk-300', + }, }, { text: 'Urlop bezpłatny', value: 'unpaid_vacation', icon: CurrencyUsdOffIcon, color: 'text-emerald-500', + border: { + approved: 'border-emerald-500', + pending: 'border-emerald-300', + }, }, { text: 'Wolontariat', value: 'volunteering_vacation', icon: HandHeartOutlineIcon, color: 'text-pink-500', + border: { + approved: 'border-pink-500', + pending: 'border-pink-300', + }, }, { text: 'Odbiór za święto', value: 'time_in_lieu', icon: CalendarCheckIcon, color: 'text-stone-500', + border: { + approved: 'border-stone-500', + pending: 'border-stone-300', + }, }, { text: 'Zwolnienie lekarskie', value: 'sick_vacation', icon: MedicalBagIcon, color: 'text-rose-500', + border: { + approved: 'border-rose-500', + pending: 'border-rose-300', + }, }, ] diff --git a/resources/js/Composables/yearPeriodInfo.js b/resources/js/Composables/yearPeriodInfo.js index b62eb05..ede213c 100644 --- a/resources/js/Composables/yearPeriodInfo.js +++ b/resources/js/Composables/yearPeriodInfo.js @@ -4,9 +4,11 @@ import { usePage } from '@inertiajs/inertia-vue3' export default function useCurrentYearPeriodInfo() { const minDate = computed(() => new Date(usePage().props.value.years.selected.year, 0, 1)) const maxDate = computed(() => new Date(usePage().props.value.years.selected.year, 11, 31)) + const year = computed(() => usePage().props.value.years.selected.year) return { minDate, maxDate, + year, } } diff --git a/resources/js/Pages/Test.vue b/resources/js/Pages/Test.vue index 4ba6969..eb7c03d 100644 --- a/resources/js/Pages/Test.vue +++ b/resources/js/Pages/Test.vue @@ -1,11 +1,9 @@