This commit is contained in:
EwelinaLasowy 2022-01-18 09:05:19 +01:00
parent 55eb288e23
commit 4ef131021c
3 changed files with 37 additions and 15 deletions

View File

@ -13,8 +13,9 @@ use Toby\Models\User;
class UserAvatarGenerator class UserAvatarGenerator
{ {
public function __construct(protected InitialAvatar $generator) public function __construct(
{ protected InitialAvatar $generator,
) {
} }
public function generateFor(User $user): string public function generateFor(User $user): string

View File

@ -128,23 +128,35 @@
v-if="!user.trashed" v-if="!user.trashed"
class="py-1" class="py-1"
> >
<MenuItem v-slot="{ active }"> <MenuItem
v-slot="{ active }"
class="flex"
>
<InertiaLink <InertiaLink
:href="`/users/${user.id}/edit`" :href="`/users/${user.id}/edit`"
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block px-4 py-2 text-sm']" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'font-medium block px-4 py-2 text-sm']"
> >
Edytuj <PencilIcon
class="mr-2 h-5 w-5 text-blue-500"
aria-hidden="true"
/> Edytuj
</InertiaLink> </InertiaLink>
</MenuItem> </MenuItem>
<MenuItem v-slot="{ active }"> <MenuItem
v-slot="{ active }"
class="flex"
>
<InertiaLink <InertiaLink
as="button" as="button"
method="delete" method="delete"
:preserve-scroll="true" :preserve-scroll="true"
:href="`/users/${user.id}`" :href="`/users/${user.id}`"
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left px-4 py-2 text-sm']" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left font-medium px-4 py-2 text-sm']"
> >
Usuń <TrashIcon
class="mr-2 h-5 w-5 text-red-500"
aria-hidden="true"
/> Usuń
</InertiaLink> </InertiaLink>
</MenuItem> </MenuItem>
</div> </div>
@ -152,15 +164,21 @@
v-else v-else
class="py-1" class="py-1"
> >
<MenuItem v-slot="{ active }"> <MenuItem
v-slot="{ active }"
class="flex"
>
<InertiaLink <InertiaLink
as="button" as="button"
method="post" method="post"
:preserve-scroll="true" :preserve-scroll="true"
:href="`/users/${user.id}/restore`" :href="`/users/${user.id}/restore`"
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left px-4 py-2 text-sm']" :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left font-medium px-4 py-2 text-sm']"
> >
Przywróć <RefreshIcon
class="mr-2 h-5 w-5 text-green-500"
aria-hidden="true"
/> Przywróć
</InertiaLink> </InertiaLink>
</MenuItem> </MenuItem>
</div> </div>
@ -238,14 +256,17 @@ import { ref, watch } from 'vue';
import { Inertia } from '@inertiajs/inertia'; import { Inertia } from '@inertiajs/inertia';
import { debounce } from 'lodash'; import { debounce } from 'lodash';
import { SearchIcon } from '@heroicons/vue/outline'; import { SearchIcon } from '@heroicons/vue/outline';
import {DotsVerticalIcon} from '@heroicons/vue/solid'; import { DotsVerticalIcon, PencilIcon, TrashIcon, RefreshIcon } from '@heroicons/vue/solid';
import {Menu, MenuButton, MenuItem, MenuItems} from '@headlessui/vue'; import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue';
export default { export default {
name: 'UserIndex', name: 'UserIndex',
components: { components: {
SearchIcon, SearchIcon,
DotsVerticalIcon, DotsVerticalIcon,
PencilIcon,
TrashIcon,
RefreshIcon,
Menu, Menu,
MenuButton, MenuButton,
MenuItem, MenuItem,