Compare commits
8 Commits
62c3c11ebf
...
#152-dashb
| Author | SHA1 | Date | |
|---|---|---|---|
|
3bea1f41b2
|
|||
|
d2d753640c
|
|||
|
40e74be394
|
|||
|
0e06c6ec54
|
|||
|
5db97ebd0c
|
|||
|
d863422103
|
|||
|
61add6b1e8
|
|||
|
cbe70315eb
|
@@ -103,6 +103,14 @@ class UserVacationStatsRetriever
|
|||||||
return $limit ?? 0;
|
return $limit ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasVacationDaysLimit(User $user, YearPeriod $yearPeriod): bool
|
||||||
|
{
|
||||||
|
return $user->vacationLimits()
|
||||||
|
->whereBelongsTo($yearPeriod)
|
||||||
|
->first()
|
||||||
|
?->hasVacation() ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getLimitableVacationTypes(): Collection
|
protected function getLimitableVacationTypes(): Collection
|
||||||
{
|
{
|
||||||
$types = VacationType::all();
|
$types = VacationType::all();
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class DashboardController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
$limit = $vacationStatsRetriever->getVacationDaysLimit($user, $yearPeriod);
|
$limit = $vacationStatsRetriever->getVacationDaysLimit($user, $yearPeriod);
|
||||||
|
$hasLimit = $vacationStatsRetriever->hasVacationDaysLimit($user, $yearPeriod);
|
||||||
$used = $vacationStatsRetriever->getUsedVacationDays($user, $yearPeriod);
|
$used = $vacationStatsRetriever->getUsedVacationDays($user, $yearPeriod);
|
||||||
$pending = $vacationStatsRetriever->getPendingVacationDays($user, $yearPeriod);
|
$pending = $vacationStatsRetriever->getPendingVacationDays($user, $yearPeriod);
|
||||||
$homeOffice = $vacationStatsRetriever->getHomeOfficeDays($user, $yearPeriod);
|
$homeOffice = $vacationStatsRetriever->getHomeOfficeDays($user, $yearPeriod);
|
||||||
@@ -99,6 +100,7 @@ class DashboardController extends Controller
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
"stats" => [
|
"stats" => [
|
||||||
|
"hasLimit" => $hasLimit,
|
||||||
"limit" => $limit,
|
"limit" => $limit,
|
||||||
"remaining" => $remaining,
|
"remaining" => $remaining,
|
||||||
"used" => $used,
|
"used" => $used,
|
||||||
|
|||||||
@@ -20,11 +20,9 @@
|
|||||||
<div class="grid grid-cols-1 gap-4">
|
<div class="grid grid-cols-1 gap-4">
|
||||||
<VacationStats :stats="stats" />
|
<VacationStats :stats="stats" />
|
||||||
<AbsenceList
|
<AbsenceList
|
||||||
v-if="years.current.year === years.selected.year && absences.data.length"
|
|
||||||
:absences="absences.data"
|
:absences="absences.data"
|
||||||
/>
|
/>
|
||||||
<HomeOfficeList
|
<HomeOfficeList
|
||||||
v-if="years.current.year === years.selected.year && remoteDays.data.length"
|
|
||||||
:remote-days="remoteDays.data"
|
:remote-days="remoteDays.data"
|
||||||
/>
|
/>
|
||||||
<UpcomingHolidays
|
<UpcomingHolidays
|
||||||
|
|||||||
@@ -8,7 +8,10 @@
|
|||||||
No search result
|
No search result
|
||||||
</slot>
|
</slot>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="text-sm">
|
<p
|
||||||
|
v-if="showDescription"
|
||||||
|
class="text-sm"
|
||||||
|
>
|
||||||
<slot name="text">
|
<slot name="text">
|
||||||
Try a different search query
|
Try a different search query
|
||||||
</slot>
|
</slot>
|
||||||
@@ -18,4 +21,11 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { SearchIcon } from '@heroicons/vue/solid'
|
import { SearchIcon } from '@heroicons/vue/solid'
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
showDescription: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -6,7 +6,10 @@
|
|||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="px-4 border-t border-gray-200 sm:px-6">
|
<div class="px-4 border-t border-gray-200 sm:px-6">
|
||||||
<ul class="divide-y divide-gray-200">
|
<ul
|
||||||
|
v-if="absences.length"
|
||||||
|
class="divide-y divide-gray-200"
|
||||||
|
>
|
||||||
<li
|
<li
|
||||||
v-for="absence in absences"
|
v-for="absence in absences"
|
||||||
:key="absence.user.id"
|
:key="absence.user.id"
|
||||||
@@ -26,11 +29,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<EmptyState
|
||||||
|
v-else
|
||||||
|
:show-description="false"
|
||||||
|
>
|
||||||
|
<template #head>
|
||||||
|
<SunIcon class="mx-auto w-12 h-12" />
|
||||||
|
</template>
|
||||||
|
<template #title>
|
||||||
|
Brak nieobecności
|
||||||
|
</template>
|
||||||
|
</EmptyState>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import EmptyState from '@/Shared/Feedbacks/EmptyState'
|
||||||
|
import { SunIcon } from '@heroicons/vue/solid'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
absences: Object,
|
absences: Object,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
day.isHoliday && 'font-bold cursor-default',
|
day.isHoliday && 'font-bold cursor-default',
|
||||||
(day.isPendingVacation) && `border-b-4 border-dashed ${day.getVacationType.border}`,
|
(day.isPendingVacation) && `pb-0 border-b-[3px] border-dashed ${day.getVacationType.border}`,
|
||||||
(day.isVacation) && `border-b-4 ${day.getVacationType.border}`
|
(day.isVacation) && `pb-0 border-b-[3px] ${day.getVacationType.border}`
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<Popper
|
<Popper
|
||||||
|
|||||||
@@ -6,7 +6,10 @@
|
|||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="px-4 border-t border-gray-200 sm:px-6">
|
<div class="px-4 border-t border-gray-200 sm:px-6">
|
||||||
<ul class="divide-y divide-gray-200">
|
<ul
|
||||||
|
v-if="remoteDays.length"
|
||||||
|
class="divide-y divide-gray-200"
|
||||||
|
>
|
||||||
<li
|
<li
|
||||||
v-for="day in remoteDays"
|
v-for="day in remoteDays"
|
||||||
:key="day.user.id"
|
:key="day.user.id"
|
||||||
@@ -26,11 +29,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<EmptyState
|
||||||
|
v-else
|
||||||
|
:show-description="false"
|
||||||
|
>
|
||||||
|
<template #head>
|
||||||
|
<HomeCityIcon
|
||||||
|
class="flex justify-center"
|
||||||
|
size="48"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template #title>
|
||||||
|
Nikt nie pracuje z domu
|
||||||
|
</template>
|
||||||
|
</EmptyState>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import EmptyState from '@/Shared/Feedbacks/EmptyState'
|
||||||
|
import HomeCityIcon from 'vue-material-design-icons/HomeCity'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
remoteDays: Object,
|
remoteDays: Object,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -91,13 +91,13 @@
|
|||||||
</transition>
|
</transition>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="ring-1 ring-black ring-opacity-5 lg:flex lg:flex-auto lg:flex-col">
|
<div class="border border-gray-300 lg:flex lg:flex-auto lg:flex-col">
|
||||||
<div
|
<div
|
||||||
v-if="calendarState.viewMode.isMonth"
|
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"
|
class="grid grid-cols-7 gap-px border-b border-gray-300 bg-gray-300 text-center text-xs font-semibold leading-6 text-gray-700 lg:flex-none"
|
||||||
>
|
>
|
||||||
<div class="py-2 bg-white">
|
<div class="py-2 bg-white">
|
||||||
Pn
|
Pon
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 bg-white">
|
<div class="py-2 bg-white">
|
||||||
Wt
|
Wt
|
||||||
@@ -106,19 +106,19 @@
|
|||||||
Śr
|
Śr
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 bg-white">
|
<div class="py-2 bg-white">
|
||||||
Cz
|
Czw
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 bg-white">
|
<div class="py-2 bg-white">
|
||||||
Pt
|
Pt
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 bg-red-100 text-red-800">
|
<div class="py-2 bg-red-100 text-red-800">
|
||||||
Sb
|
Sob
|
||||||
</div>
|
</div>
|
||||||
<div class="py-2 bg-red-100 text-red-800">
|
<div class="py-2 bg-red-100 text-red-800">
|
||||||
Nd
|
Ndz
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex bg-gray-200 text-xs leading-6 text-gray-700 lg:flex-auto">
|
<div class="flex bg-gray-300 text-xs leading-6 text-gray-700 lg:flex-auto">
|
||||||
<div
|
<div
|
||||||
class="w-full grid grid-cols-7 gap-px"
|
class="w-full grid grid-cols-7 gap-px"
|
||||||
:class="{ 'grid-rows-1': calendarState.viewMode.isWeek }"
|
:class="{ 'grid-rows-1': calendarState.viewMode.isWeek }"
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
v-for="(day, index) in days"
|
v-for="(day, index) in days"
|
||||||
:key="index"
|
:key="index"
|
||||||
:day="day"
|
:day="day"
|
||||||
class="flex flex-col relative py-2 px-3"
|
class="flex flex-col relative py-3 px-3"
|
||||||
:class="{ 'day': calendarState.viewMode.isWeek }"
|
:class="{ 'day': calendarState.viewMode.isWeek }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -167,7 +167,7 @@ const selectedYear = useCurrentYearPeriodInfo().year.value
|
|||||||
const weeksInYear = DateTime.fromObject({ year: selectedYear, month: 12, day: 31 }).weekNumber
|
const weeksInYear = DateTime.fromObject({ year: selectedYear, month: 12, day: 31 }).weekNumber
|
||||||
|
|
||||||
const calendar = {
|
const calendar = {
|
||||||
viewMode: ref('week'),
|
viewMode: ref(localStorage.getItem('calendarViewMode') ?? 'week'),
|
||||||
currents: reactive({
|
currents: reactive({
|
||||||
year: selectedYear,
|
year: selectedYear,
|
||||||
month: selectedYear === currentDate.year ? currentDate.month : 1,
|
month: selectedYear === currentDate.year ? currentDate.month : 1,
|
||||||
@@ -336,6 +336,7 @@ function updateViewMode(type) {
|
|||||||
else
|
else
|
||||||
resetCalendar()
|
resetCalendar()
|
||||||
calendar.viewMode.value = type
|
calendar.viewMode.value = type
|
||||||
|
localStorage.setItem('calendarViewMode', type)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isInCurrentMonth(date) {
|
function isInCurrentMonth(date) {
|
||||||
@@ -377,7 +378,7 @@ function getVacationInfo(day) {
|
|||||||
|
|
||||||
<style lang="css">
|
<style lang="css">
|
||||||
.day:nth-of-type(7n - 6):before {
|
.day:nth-of-type(7n - 6):before {
|
||||||
content: "Pn";
|
content: "Pon";
|
||||||
}
|
}
|
||||||
|
|
||||||
.day:nth-of-type(7n - 5):before {
|
.day:nth-of-type(7n - 5):before {
|
||||||
@@ -389,7 +390,7 @@ function getVacationInfo(day) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.day:nth-of-type(7n - 3):before {
|
.day:nth-of-type(7n - 3):before {
|
||||||
content: "Cz";
|
content: "Czw";
|
||||||
}
|
}
|
||||||
|
|
||||||
.day:nth-of-type(7n - 2):before {
|
.day:nth-of-type(7n - 2):before {
|
||||||
@@ -397,10 +398,10 @@ function getVacationInfo(day) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.day:nth-of-type(7n - 1):before {
|
.day:nth-of-type(7n - 1):before {
|
||||||
content: "Sb";
|
content: "Sob";
|
||||||
}
|
}
|
||||||
|
|
||||||
.day:nth-of-type(7n):before {
|
.day:nth-of-type(7n):before {
|
||||||
content: "Nd";
|
content: "Ndz";
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="grid grid-cols-1 gap-4 md:grid-cols-1">
|
<section>
|
||||||
<div class="h-full">
|
<div
|
||||||
<div class="grid grid-cols-2 gap-4 h-full">
|
v-if="stats.hasLimit"
|
||||||
|
class="grid grid-cols-2 gap-2 h-full"
|
||||||
|
>
|
||||||
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
||||||
<dd class="mt-1 text-4xl font-semibold text-blumilk-500">
|
<dd class="mt-1 text-4xl font-semibold text-blumilk-500">
|
||||||
{{ stats.remaining }}
|
{{ stats.remaining }}
|
||||||
@@ -46,6 +48,11 @@
|
|||||||
Twój roczny limit urlopu wypoczynkowego.
|
Twój roczny limit urlopu wypoczynkowego.
|
||||||
</dt>
|
</dt>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="h-full grid grid-cols-2 gap-2 h-full"
|
||||||
|
>
|
||||||
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
<div class="py-5 px-4 bg-white shadow-md sm:p-6">
|
||||||
<dt class="mt-1 text-4xl font-semibold text-gray-500">
|
<dt class="mt-1 text-4xl font-semibold text-gray-500">
|
||||||
{{ stats.other }}
|
{{ stats.other }}
|
||||||
@@ -69,7 +76,6 @@
|
|||||||
</dt>
|
</dt>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user