#157 - added a privilege check

This commit is contained in:
Kamil Niemczycki 2022-06-03 14:04:16 +02:00
parent c154c51ef4
commit 48ef40e8ff
2 changed files with 5 additions and 2 deletions

View File

@ -44,6 +44,7 @@ class VacationCalendarController extends Controller
"users" => SimpleUserResource::collection($users), "users" => SimpleUserResource::collection($users),
"can" => [ "can" => [
"generateTimesheet" => $request->user()->can("generateTimesheet"), "generateTimesheet" => $request->user()->can("generateTimesheet"),
"createOnBehalfOfEmployee" => $request->user()->can("createOnBehalfOfEmployee"),
], ],
]); ]);
} }

View File

@ -101,7 +101,7 @@
:key="day.dayOfMonth" :key="day.dayOfMonth"
class="border border-gray-300" class="border border-gray-300"
:class="{ 'bg-blumilk-25': day.isToday, 'bg-red-100': day.isWeekend || day.isHoliday }" :class="{ 'bg-blumilk-25': day.isToday, 'bg-red-100': day.isWeekend || day.isHoliday }"
@mouseover="setActiveBtn(user.id.toString() + '' + day.date)" @mouseover="setActiveBtn(user.id + '+' + day.date)"
@mouseleave="unsetActiveBtn" @mouseleave="unsetActiveBtn"
> >
<div <div
@ -111,7 +111,7 @@
<VacationTypeCalendarIcon :type="day.vacationTypes[user.id]" /> <VacationTypeCalendarIcon :type="day.vacationTypes[user.id]" />
</div> </div>
<InertiaLink <InertiaLink
v-else-if="isActiveBtn(user.id.toString() + '' + day.date) && !day.isWeekend && !day.isHoliday && day.isFuture" v-else-if="isActiveBtn(user.id + '+' + day.date) && !day.isWeekend && !day.isHoliday && day.isFuture && (auth.user.id === user.id || can.createOnBehalfOfEmployee)"
href="/vacation/requests/create" href="/vacation/requests/create"
:data="{ 'start_date': day.date }" :data="{ 'start_date': day.date }"
> >
@ -146,6 +146,8 @@ const props = defineProps({
can: Object, can: Object,
}) })
console.log(props.auth.user)
let activeElement = ref(undefined) let activeElement = ref(undefined)
const { getMonths, findMonth } = useMonthInfo() const { getMonths, findMonth } = useMonthInfo()