This commit is contained in:
EwelinaLasowy 2022-02-28 07:46:18 +01:00
parent e442da9303
commit 22fc753c73
5 changed files with 221 additions and 242 deletions

View File

@ -66,16 +66,6 @@ class DashboardController extends Controller
) )
->count(); ->count();
$onRequest = $request->user()
->vacations()
->whereRelation(
"vacationRequest",
fn(Builder $query) => $query
->where("type", VacationType::OnRequest)
->states(VacationRequestState::successStates()),
)
->count();
$pending = $request->user() $pending = $request->user()
->vacations() ->vacations()
->whereRelation( ->whereRelation(
@ -106,7 +96,6 @@ class DashboardController extends Controller
"used" => $used, "used" => $used,
"pending" => $pending, "pending" => $pending,
"other" => $other, "other" => $other,
"onRequest" => 4 - $onRequest,
], ],
]); ]);
} }

View File

@ -12,7 +12,7 @@
:href="`/timesheet/${selectedMonth.value}`" :href="`/timesheet/${selectedMonth.value}`"
class="inline-flex items-center px-4 py-3 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-blumilk-600 hover:bg-blumilk-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500" class="inline-flex items-center px-4 py-3 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-blumilk-600 hover:bg-blumilk-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500"
> >
Pobierz plik excel Pobierz plik Excel
</a> </a>
</div> </div>
</div> </div>

View File

@ -67,7 +67,7 @@
Rozpatrywane Rozpatrywane
</dd> </dd>
<dt class="text-sm font-medium text-gray-500 mt-2"> <dt class="text-sm font-medium text-gray-500 mt-2">
Dni czekające na akceptację przełożonych Dni czekające na akceptację przełożonych.
</dt> </dt>
</div> </div>
<div class="px-4 py-5 bg-white shadow-md sm:p-6"> <div class="px-4 py-5 bg-white shadow-md sm:p-6">
@ -81,18 +81,7 @@
Twój roczny limit urlopu wypoczynkowego. Twój roczny limit urlopu wypoczynkowego.
</dt> </dt>
</div> </div>
<div class="px-4 py-5 bg-white shadow-md sm:p-6"> <div class="px-4 py-5 bg-white shadow-md sm:p-6 col-span-2">
<dt class="mt-1 text-4xl font-semibold text-gray-900">
{{ stats.onRequest }}
</dt>
<dd class="text-md font-medium text-gray-500 truncate">
Urlop na żądanie
</dd>
<dt class="text-sm font-medium text-gray-500 mt-2">
Ilość dni urlopu na żądanie, który wlicza się w limit urlopu wypoczynkowego.
</dt>
</div>
<div class="px-4 py-5 bg-white shadow-md sm:p-6">
<dt class="mt-1 text-4xl font-semibold text-gray-900"> <dt class="mt-1 text-4xl font-semibold text-gray-900">
{{ stats.other }} {{ stats.other }}
</dt> </dt>
@ -183,6 +172,11 @@
</p> </p>
</div> </div>
</li> </li>
<li v-if="! absences.data.length">
<p class="py-2">
Brak danych
</p>
</li>
</ul> </ul>
</div> </div>
</div> </div>

View File

@ -19,122 +19,120 @@
</InertiaLink> </InertiaLink>
</div> </div>
</div> </div>
<div class="border-t border-gray-200"> <div class="overflow-x-auto xl:overflow-x-visible overflow-y-auto xl:overflow-y-visible">
<div class="overflow-x-auto xl:overflow-x-visible overflow-y-auto xl:overflow-y-visible"> <table class="min-w-full divide-y divide-gray-200">
<table class="min-w-full divide-y divide-gray-200"> <thead class="bg-gray-50">
<thead class="bg-gray-100"> <tr>
<tr> <th
<th scope="col"
scope="col" class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
>
Nazwa
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
>
Data
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
>
Dzień tygodnia
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
/>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-100">
<tr
v-for="holiday in holidays.data"
:key="holiday.id"
class="hover:bg-blumilk-25"
> >
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500 font-semibold capitalize"> Nazwa
{{ holiday.name }} </th>
</td> <th
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500"> scope="col"
{{ holiday.displayDate }} class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
</td> >
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500"> Data
{{ holiday.dayOfWeek }} </th>
</td> <th
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500 text-right"> scope="col"
<Menu class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
as="div" >
class="relative inline-block text-left" Dzień tygodnia
> </th>
<MenuButton class="rounded-full flex items-center text-gray-400 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-blumilk-500"> <th
<DotsVerticalIcon scope="col"
class="h-5 w-5" class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
aria-hidden="true" />
/> </tr>
</MenuButton> </thead>
<tbody class="bg-white divide-y divide-gray-100">
<tr
v-for="holiday in holidays.data"
:key="holiday.id"
class="hover:bg-blumilk-25"
>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500 font-semibold capitalize">
{{ holiday.name }}
</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
{{ holiday.displayDate }}
</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
{{ holiday.dayOfWeek }}
</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500 text-right">
<Menu
as="div"
class="relative inline-block text-left"
>
<MenuButton class="rounded-full flex items-center text-gray-400 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-blumilk-500">
<DotsVerticalIcon
class="h-5 w-5"
aria-hidden="true"
/>
</MenuButton>
<transition <transition
enter-active-class="transition ease-out duration-100" enter-active-class="transition ease-out duration-100"
enter-from-class="transform opacity-0 scale-95" enter-from-class="transform opacity-0 scale-95"
enter-to-class="transform opacity-100 scale-100" enter-to-class="transform opacity-100 scale-100"
leave-active-class="transition ease-in duration-75" leave-active-class="transition ease-in duration-75"
leave-from-class="transform opacity-100 scale-100" leave-from-class="transform opacity-100 scale-100"
leave-to-class="transform opacity-0 scale-95" leave-to-class="transform opacity-0 scale-95"
> >
<MenuItems class="origin-top-right absolute right-0 mt-2 w-56 z-10 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none"> <MenuItems class="origin-top-right absolute right-0 mt-2 w-56 z-10 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none">
<div class="py-1"> <div class="py-1">
<MenuItem <MenuItem
v-slot="{ active }" v-slot="{ active }"
class="flex" class="flex"
>
<InertiaLink
:href="`/holidays/${holiday.id}/edit`"
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'font-medium block px-4 py-2 text-sm']"
> >
<InertiaLink <PencilIcon
:href="`/holidays/${holiday.id}/edit`" class="mr-2 h-5 w-5 text-blue-500"
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'font-medium block px-4 py-2 text-sm']" aria-hidden="true"
> /> Edytuj
<PencilIcon </InertiaLink>
class="mr-2 h-5 w-5 text-blue-500" </MenuItem>
aria-hidden="true" <MenuItem
/> Edytuj v-slot="{ active }"
</InertiaLink> class="flex"
</MenuItem> >
<MenuItem <InertiaLink
v-slot="{ active }" as="button"
class="flex" method="delete"
:preserve-scroll="true"
:href="`/holidays/${holiday.id}`"
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left font-medium px-4 py-2 text-sm']"
> >
<InertiaLink <TrashIcon
as="button" class="mr-2 h-5 w-5 text-red-500"
method="delete" aria-hidden="true"
:preserve-scroll="true" /> Usuń
:href="`/holidays/${holiday.id}`" </InertiaLink>
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left font-medium px-4 py-2 text-sm']" </MenuItem>
> </div>
<TrashIcon </MenuItems>
class="mr-2 h-5 w-5 text-red-500" </transition>
aria-hidden="true" </Menu>
/> Usuń </td>
</InertiaLink> </tr>
</MenuItem> <tr
</div> v-if="!holidays.data.length"
</MenuItems> >
</transition> <td
</Menu> colspan="100%"
</td> class="text-center py-4 text-xl leading-5 text-gray-700"
</tr>
<tr
v-if="!holidays.data.length"
> >
<td Brak danych
colspan="100%" </td>
class="text-center py-4 text-xl leading-5 text-gray-700" </tr>
> </tbody>
Brak danych </table>
</td>
</tr>
</tbody>
</table>
</div>
</div> </div>
</div> </div>
</template> </template>

View File

@ -11,119 +11,117 @@
</p> </p>
</div> </div>
</div> </div>
<div class="border-t border-gray-200"> <div class="overflow-x-auto xl:overflow-x-visible overflow-y-auto xl:overflow-y-visible">
<div class="overflow-x-auto xl:overflow-x-visible overflow-y-auto xl:overflow-y-visible"> <form @submit.prevent="submitVacationDays">
<form @submit.prevent="submitVacationDays"> <table class="min-w-full divide-y divide-gray-200">
<table class="min-w-full divide-y divide-gray-200"> <thead class="bg-gray-50">
<thead class="bg-gray-50"> <tr>
<tr> <th
<th scope="col"
scope="col" class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
>
Imię i nazwisko
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
>
Forma zatrudnienia
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
>
Posiada urlop?
</th>
<th
scope="col"
class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
>
Dostępne dni w roku
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-100">
<tr
v-for="(item, index) in form.items"
:key="item.id"
class="hover:bg-blumilk-25"
> >
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500"> Imię i nazwisko
<div class="flex"> </th>
<span <th
class="inline-flex items-center justify-center h-10 w-10 rounded-full" scope="col"
> class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
<img >
class="h-10 w-10 rounded-full" Forma zatrudnienia
:src="item.user.avatar" </th>
alt="" <th
> scope="col"
</span> class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
<div class="ml-3"> >
<p class="text-sm font-medium break-all text-gray-900"> Posiada urlop?
{{ item.user.name }} </th>
</p> <th
<p class="text-sm break-all text-gray-500"> scope="col"
{{ item.user.email }} class="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"
</p> >
</div> Dostępne dni w roku
</div> </th>
</td> </tr>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500"> </thead>
{{ item.user.employmentForm }} <tbody class="bg-white divide-y divide-gray-100">
</td> <tr
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500"> v-for="(item, index) in form.items"
<Switch :key="item.id"
v-model="item.hasVacation" class="hover:bg-blumilk-25"
:class="[item.hasVacation ? 'bg-blumilk-500' : 'bg-gray-200', 'relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500']" >
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
<div class="flex">
<span
class="inline-flex items-center justify-center h-10 w-10 rounded-full"
> >
<span <img
:class="[item.hasVacation ? 'translate-x-5' : 'translate-x-0', 'pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200']" class="h-10 w-10 rounded-full"
/> :src="item.user.avatar"
</Switch> alt=""
</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
<div class="mt-1 sm:mt-0 sm:col-span-2">
<input
v-model="item.days"
type="number"
min="0"
class="block w-full shadow-sm rounded-md sm:text-sm disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none disabled:cursor-not-allowed"
:disabled="!item.hasVacation"
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`items.${index}.days`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`items.${index}.days`] }"
> >
<p </span>
v-if="form.errors[`items.${index}.days`]" <div class="ml-3">
class="mt-2 text-sm text-red-600" <p class="text-sm font-medium break-all text-gray-900">
> {{ item.user.name }}
{{ form.errors[`items.${index}.days`] }} </p>
<p class="text-sm break-all text-gray-500">
{{ item.user.email }}
</p> </p>
</div> </div>
</td> </div>
</tr> </td>
<tr <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
v-if="!form.items.length" {{ item.user.employmentForm }}
> </td>
<td <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
colspan="100%" <Switch
class="text-center py-4 text-xl leading-5 text-gray-700" v-model="item.hasVacation"
:class="[item.hasVacation ? 'bg-blumilk-500' : 'bg-gray-200', 'relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500']"
> >
Brak danych <span
</td> :class="[item.hasVacation ? 'translate-x-5' : 'translate-x-0', 'pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200']"
</tr> />
</tbody> </Switch>
</table> </td>
<div class="flex justify-end py-3 px-4"> <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
<button <div class="mt-1 sm:mt-0 sm:col-span-2">
type="submit" <input
class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blumilk-600 hover:bg-blumilk-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500" v-model="item.days"
type="number"
min="0"
class="block w-full shadow-sm rounded-md sm:text-sm disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none disabled:cursor-not-allowed"
:disabled="!item.hasVacation"
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`items.${index}.days`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`items.${index}.days`] }"
>
<p
v-if="form.errors[`items.${index}.days`]"
class="mt-2 text-sm text-red-600"
>
{{ form.errors[`items.${index}.days`] }}
</p>
</div>
</td>
</tr>
<tr
v-if="!form.items.length"
> >
Zapisz <td
</button> colspan="100%"
</div> class="text-center py-4 text-xl leading-5 text-gray-700"
</form> >
</div> Brak danych
</td>
</tr>
</tbody>
</table>
<div class="flex justify-end py-3 px-4">
<button
type="submit"
class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blumilk-600 hover:bg-blumilk-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500"
>
Zapisz
</button>
</div>
</form>
</div> </div>
</div> </div>
</template> </template>