#62 - fix
This commit is contained in:
parent
78d209dc3e
commit
069109c4b0
@ -36,7 +36,7 @@ class DashboardController extends Controller
|
|||||||
)
|
)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
if ($user->role !== Role::Employee) {
|
if ($user->can("listAll", VacationRequest::class)) {
|
||||||
$vacationRequests = VacationRequest::query()
|
$vacationRequests = VacationRequest::query()
|
||||||
->states(VacationRequestStatesRetriever::waitingForUserActionStates($user))
|
->states(VacationRequestStatesRetriever::waitingForUserActionStates($user))
|
||||||
->latest("updated_at")
|
->latest("updated_at")
|
||||||
@ -72,6 +72,9 @@ class DashboardController extends Controller
|
|||||||
"pending" => $pending,
|
"pending" => $pending,
|
||||||
"other" => $other,
|
"other" => $other,
|
||||||
],
|
],
|
||||||
|
"can" => [
|
||||||
|
"listAllVacationRequests" => $user->can("listAll", VacationRequest::class),
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,7 @@ class UserResource extends JsonResource
|
|||||||
"id" => $this->id,
|
"id" => $this->id,
|
||||||
"name" => $this->fullName,
|
"name" => $this->fullName,
|
||||||
"email" => $this->email,
|
"email" => $this->email,
|
||||||
"displayRole" => $this->role->label(),
|
"role" => $this->role->label(),
|
||||||
"role" => $this->role,
|
|
||||||
"position" => $this->position,
|
"position" => $this->position,
|
||||||
"avatar" => $this->getAvatar(),
|
"avatar" => $this->getAvatar(),
|
||||||
"deleted" => $this->trashed(),
|
"deleted" => $this->trashed(),
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
{{ user.name }}
|
{{ user.name }}
|
||||||
</p>
|
</p>
|
||||||
<p class="text-sm font-medium text-gray-600">
|
<p class="text-sm font-medium text-gray-600">
|
||||||
{{ user.displayRole }}
|
{{ user.role }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -97,54 +97,7 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 gap-4">
|
<div class="grid grid-cols-1 gap-4">
|
||||||
<section v-if="user.role === 'employee'">
|
<section v-if="can.listAllVacationRequests">
|
||||||
<div class="bg-white shadow-md">
|
|
||||||
<div class="p-4 sm:px-6">
|
|
||||||
<h2 class="text-lg leading-6 font-medium text-gray-900">
|
|
||||||
Twoje wnioski
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
<div class="border-t border-gray-200 pb-5 px-4 sm:px-6">
|
|
||||||
<div class="flow-root mt-6">
|
|
||||||
<ul class="-my-5 divide-y divide-gray-200">
|
|
||||||
<li
|
|
||||||
v-for="request in vacationRequests.data"
|
|
||||||
:key="request.id"
|
|
||||||
class="py-5"
|
|
||||||
>
|
|
||||||
<div class="relative focus-within:ring-2 focus-within:ring-cyan-500">
|
|
||||||
<h3 class="text-sm font-semibold text-blumilk-600 hover:text-blumilk-500">
|
|
||||||
<InertiaLink
|
|
||||||
:href="`/vacation-requests/${request.id}`"
|
|
||||||
class="hover:underline focus:outline-none"
|
|
||||||
>
|
|
||||||
<span class="absolute inset-0" />
|
|
||||||
Wniosek o {{ request.type.toLowerCase() }}
|
|
||||||
[{{ request.name }}]
|
|
||||||
</InertiaLink>
|
|
||||||
</h3>
|
|
||||||
<p class="mt-1 text-sm text-gray-600">
|
|
||||||
{{ request.from }} - {{ request.to }}
|
|
||||||
</p>
|
|
||||||
<p class="mt-2 text-sm text-gray-600">
|
|
||||||
<Status :status="request.state" />
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="mt-6">
|
|
||||||
<InertiaLink
|
|
||||||
href="/vacation-requests/me"
|
|
||||||
class="w-full flex justify-center items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50"
|
|
||||||
>
|
|
||||||
Zobacz wszystkie
|
|
||||||
</InertiaLink>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<section v-else>
|
|
||||||
<div class="bg-white shadow-md">
|
<div class="bg-white shadow-md">
|
||||||
<div class="p-4 sm:px-6">
|
<div class="p-4 sm:px-6">
|
||||||
<h2 class="text-lg leading-6 font-medium text-gray-900">
|
<h2 class="text-lg leading-6 font-medium text-gray-900">
|
||||||
@ -191,6 +144,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li v-if="! vacationRequests.data.length">
|
||||||
|
<p class="py-2">
|
||||||
|
Brak danych
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
@ -205,6 +163,58 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section v-else>
|
||||||
|
<div class="bg-white shadow-md">
|
||||||
|
<div class="p-4 sm:px-6">
|
||||||
|
<h2 class="text-lg leading-6 font-medium text-gray-900">
|
||||||
|
Twoje wnioski
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<div class="border-t border-gray-200 pb-5 px-4 sm:px-6">
|
||||||
|
<div class="flow-root mt-6">
|
||||||
|
<ul class="-my-5 divide-y divide-gray-200">
|
||||||
|
<li
|
||||||
|
v-for="request in vacationRequests.data"
|
||||||
|
:key="request.id"
|
||||||
|
class="py-5"
|
||||||
|
>
|
||||||
|
<div class="relative focus-within:ring-2 focus-within:ring-cyan-500">
|
||||||
|
<h3 class="text-sm font-semibold text-blumilk-600 hover:text-blumilk-500">
|
||||||
|
<InertiaLink
|
||||||
|
:href="`/vacation-requests/${request.id}`"
|
||||||
|
class="hover:underline focus:outline-none"
|
||||||
|
>
|
||||||
|
<span class="absolute inset-0" />
|
||||||
|
Wniosek o {{ request.type.toLowerCase() }}
|
||||||
|
[{{ request.name }}]
|
||||||
|
</InertiaLink>
|
||||||
|
</h3>
|
||||||
|
<p class="mt-1 text-sm text-gray-600">
|
||||||
|
{{ request.from }} - {{ request.to }}
|
||||||
|
</p>
|
||||||
|
<p class="mt-2 text-sm text-gray-600">
|
||||||
|
<Status :status="request.state" />
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li v-if="! vacationRequests.data.length">
|
||||||
|
<p class="py-2">
|
||||||
|
Brak danych
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="mt-6">
|
||||||
|
<InertiaLink
|
||||||
|
href="/vacation-requests/me"
|
||||||
|
class="w-full flex justify-center items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50"
|
||||||
|
>
|
||||||
|
Zobacz wszystkie
|
||||||
|
</InertiaLink>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<div class="bg-white shadow-md">
|
<div class="bg-white shadow-md">
|
||||||
<div class="p-4 sm:px-6">
|
<div class="p-4 sm:px-6">
|
||||||
@ -265,6 +275,11 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li v-if="! holidays.data.length">
|
||||||
|
<p class="py-2">
|
||||||
|
Brak danych
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
<InertiaLink
|
<InertiaLink
|
||||||
@ -304,6 +319,10 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
can: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
stats: {
|
stats: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({
|
default: () => ({
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
|
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||||
{{ user.displayRole }}
|
{{ user.role }}
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
|
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||||
{{ user.position }}
|
{{ user.position }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user