#44 - vacation summary of all employees (#92)

* #44 - ui for summary

* #44 - vacation monthly usage

* #44 - fix

* #44 - fix

Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
Adrian Hopek
2022-03-24 10:33:34 +01:00
committed by GitHub
parent dcda8c6255
commit 957b07b3eb
18 changed files with 710 additions and 1019 deletions

View File

@@ -15,7 +15,7 @@
<script setup>
import MainMenu from '@/Shared/MainMenu'
import { useToast } from 'vue-toastification'
import { defineProps, watch } from 'vue'
import { watch } from 'vue'
const props = defineProps({
flash: Object,
@@ -30,6 +30,10 @@ watch(() => props.flash, flash => {
toast.success(flash.success)
}
if (flash.info) {
toast.info(flash.info)
}
if (flash.error) {
toast.error(flash.error)
}

View File

@@ -268,7 +268,9 @@ import {
XIcon,
SunIcon,
StarIcon,
CalendarIcon, DocumentTextIcon,
CalendarIcon,
DocumentTextIcon,
AdjustmentsIcon,
} from '@heroicons/vue/outline'
import { CheckIcon, ChevronDownIcon } from '@heroicons/vue/solid'
@@ -302,6 +304,13 @@ const navigation = computed(() =>
icon: CalendarIcon,
can: true,
},
{
name: 'Wykorzystanie urlopu',
href: '/monthly-usage',
component: 'MonthlyUsage',
icon: AdjustmentsIcon,
can: props.auth.can.listMonthlyUsage,
},
{
name: 'Dni wolne',
href: '/holidays',

View File

@@ -0,0 +1,84 @@
<template>
<Popper
hover
class="h-full w-full"
>
<div class="flex bg-white text-white">
<div
v-show="stats.used > 0"
:style="`background-color: ${colors.used}; flex-basis: ${calculatePercent(stats.used)}%;`"
class="flex items-center justify-center py-2 px-0.5"
>
<strong>{{ stats.used }}</strong>
</div>
<div
v-show="stats.pending > 0"
:style="`background-color: ${colors.pending}; flex-basis: ${calculatePercent(stats.pending)}%;`"
class="flex items-center justify-center py-2 px-0.5"
>
<strong>{{ stats.pending }}</strong>
</div>
<div
v-show="stats.remaining > 0"
:style="`background-color: ${colors.remaining}; flex-basis: ${calculatePercent(stats.remaining)}%;`"
class="flex items-center justify-center py-2 px-0.5"
>
<strong>{{ stats.remaining }}</strong>
</div>
</div>
<template #content>
<div class="px-4 py-2 bg-white text-md text-gray-900 rounded-md shadow-md flext">
<div class="flex items-center font-normal">
<i
class="inline-block w-5 h-3 mr-3"
:style="`background-color: ${colors.used}`"
/>
Wykorzystane:
<span class="font-semibold ml-1">{{ stats.used }}</span>
</div>
<div class="flex items-center font-normal">
<i
class="inline-block w-5 h-3 mr-3"
:style="`background-color: ${colors.pending}`"
/>
Rozpatrywane:
<span class="font-semibold ml-1">{{ stats.pending }}</span>
</div>
<div class="flex items-center font-normal">
<i
class="inline-block w-5 h-3 mr-3"
:style="`background-color: ${colors.remaining}`"
/>
Pozostałe:
<span class="font-semibold ml-1">{{ stats.remaining }}</span>
</div>
</div>
</template>
</Popper>
</template>
<script setup>
import Popper from 'vue3-popper'
const props = defineProps({
stats: {
type: Object,
default: () => ({
used: 0,
pending: 0,
remaining: 0,
}),
},
})
const colors = {
used: '#2C466F',
pending: '#AABDDD',
remaining: '#527ABA',
}
function calculatePercent(value) {
return value / (props.stats.used + props.stats.pending + props.stats.remaining) * 100
}
</script>