#63 - permissions (#67)

* wip

* fix

* wip

* #63 - permissions

Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
Adrian Hopek
2022-03-02 09:52:50 +01:00
committed by GitHub
parent 5cb46d2fc4
commit d825dd727f
47 changed files with 1027 additions and 411 deletions

View File

@@ -7,7 +7,7 @@
Kalendarz urlopów
</h2>
</div>
<div>
<div v-if="can.generateTimesheet">
<a
: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"
@@ -164,6 +164,10 @@ export default {
type: Object,
default: () => null,
},
can: {
type: Object,
default: () => null,
},
},
setup(props) {
const {getMonths, findMonth} = useMonthInfo()

View File

@@ -10,7 +10,7 @@
Lista dni wolnych od pracy w danym roku
</p>
</div>
<div>
<div v-if="can.manageHolidays">
<InertiaLink
href="holidays/create"
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"
@@ -65,6 +65,7 @@
</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500 text-right">
<Menu
v-if="can.manageHolidays"
as="div"
class="relative inline-block text-left"
>
@@ -159,6 +160,10 @@ export default {
type: Object,
default: () => null,
},
can: {
type: Object,
default: () => null,
},
},
setup() {
return {}

View File

@@ -29,6 +29,7 @@
</div>
</div>
<Listbox
v-if="can.createOnBehalfOfEmployee"
v-model="form.user"
as="div"
class="sm:grid sm:grid-cols-3 py-4 items-center"
@@ -231,7 +232,10 @@
/>
</div>
</div>
<div class="sm:grid sm:grid-cols-3 py-4 items-center">
<div
v-if="can.skipFlow"
class="sm:grid sm:grid-cols-3 py-4 items-center"
>
<label
for="flowSkipped"
class="block text-sm font-medium text-gray-700"
@@ -311,10 +315,16 @@ export default {
type: Object,
default: () => null,
},
can: {
type: Object,
default: () => null,
},
},
setup(props) {
const form = useForm({
user: props.users.data.find(user => user.id === props.auth.user.id),
user: props.can.createOnBehalfOfEmployee
? props.users.data.find(user => user.id === props.auth.user.id)
: props.auth.user,
from: null,
to: null,
type: props.vacationTypes[0],

View File

@@ -110,7 +110,10 @@
</dl>
</div>
</div>
<div class="bg-white shadow">
<div
v-if="can.acceptAsTechnical"
class="bg-white shadow"
>
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Zaakceptuj wniosek jako osoba techniczna
@@ -134,7 +137,10 @@
</div>
</div>
</div>
<div class="bg-white shadow">
<div
v-if="can.acceptAsAdministrative"
class="bg-white shadow"
>
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Zaakceptuj wniosek jako osoba administracyjna
@@ -157,7 +163,10 @@
</div>
</div>
</div>
<div class="bg-white shadow">
<div
v-if="can.reject"
class="bg-white shadow"
>
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Odrzuć wniosek
@@ -180,7 +189,10 @@
</div>
</div>
</div>
<div class="bg-white shadow border border-red-500">
<div
v-if="can.cancel"
class="bg-white shadow border border-red-500"
>
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Anuluj wniosek
@@ -246,6 +258,10 @@ export default {
type: Object,
default: () => null,
},
can: {
type: Object,
default: () => null,
},
activities: {
type: Object,
default: () => null,

View File

@@ -213,12 +213,12 @@
>
<img
class="h-8 w-8 rounded-full"
:src="user.avatar"
:src="auth.user.avatar"
alt="Avatar"
>
<span class="hidden ml-3 text-gray-700 text-sm font-medium lg:block">
<span class="sr-only">Open user menu for </span>
{{ user.name }}
{{ auth.user.name }}
</span>
<ChevronDownIcon
class="hidden flex-shrink-0 ml-1 h-5 w-5 text-gray-400 lg:block"
@@ -324,16 +324,17 @@ export default {
setup() {
const sidebarOpen = ref(false)
const user = computed(() => usePage().props.value.auth.user)
const auth = computed(() => usePage().props.value.auth)
const years = computed(() => usePage().props.value.years)
const navigation = [
{name: 'Wnioski urlopowe', href: '/vacation-requests', icon: CollectionIcon},
{name: 'Kalendarz urlopów', href: '/vacation-calendar', icon: CalendarIcon},
{name: 'Dni wolne', href: '/holidays', icon: StarIcon},
{name: 'Limity urlopów', href: '/vacation-limits', icon: SunIcon},
{name: 'Użytkownicy', href: '/users', icon: UserGroupIcon},
]
const navigation = computed(() =>
[
{name: 'Wnioski urlopowe', href: '/vacation-requests', icon: CollectionIcon, can: true},
{name: 'Kalendarz urlopów', href: '/vacation-calendar', icon: CalendarIcon, can: true},
{name: 'Dni wolne', href: '/holidays', icon: StarIcon, can: true},
{name: 'Limity urlopów', href: '/vacation-limits', icon: SunIcon, can: auth.value.can.manageVacationLimits},
{name: 'Użytkownicy', href: '/users', icon: UserGroupIcon, can: auth.value.can.manageUsers},
].filter(item => item.can))
const userNavigation = [
{name: 'Your Profile', href: '#'},
@@ -342,7 +343,7 @@ export default {
]
return {
user,
auth,
years,
navigation,
userNavigation,