Merge branch 'main' into #41-email-notifications

# Conflicts:
#	app/Domain/CalendarGenerator.php
#	app/Domain/Enums/VacationRequestState.php
#	app/Domain/VacationRequestStateManager.php
#	resources/js/Composables/statusInfo.js
#	resources/js/Pages/Calendar.vue
#	resources/js/Shared/MainMenu.vue
#	resources/lang/pl.json
#	tests/Feature/VacationRequestTest.php
#	tests/Unit/VacationRequestStatesTest.php
This commit is contained in:
EwelinaLasowy
2022-02-16 08:53:55 +01:00
31 changed files with 256 additions and 175 deletions

View File

@@ -1,4 +1,5 @@
@import 'flatpickr/dist/themes/light.css';
@import 'vue-toastification/dist/index.css';
@tailwind base;
@tailwind components;

View File

@@ -0,0 +1,60 @@
const months = [
{
'name': 'Styczeń',
'value': 'january',
},
{
'name': 'Luty',
'value': 'february',
},
{
'name': 'Marzec',
'value': 'march',
},
{
'name': 'Kwiecień',
'value': 'april',
},
{
'name': 'Maj',
'value': 'may',
},
{
'name': 'Czerwiec',
'value': 'june',
},
{
'name': 'Lipiec',
'value': 'july',
},
{
'name': 'Sierpień',
'value': 'august',
},
{
'name': 'Wrzesień',
'value': 'september',
},
{
'name': 'Październik',
'value': 'october',
},
{
'name': 'Listopad',
'value': 'november',
},
{
'name': 'Grudzień',
'value': 'december',
},
]
export function useMonthInfo() {
const getMonths = () => months
const findMonth = value => months.find(month => month.value === value)
return {
getMonths,
findMonth,
}
}

View File

@@ -31,7 +31,7 @@ const statuses = [
},
},
{
text: 'Czeka na akceptację od technicznego',
text: 'Czeka na akceptację od przełożonego technicznego',
value: 'waiting_for_technical',
outline: {
icon: OutlineClockIcon,
@@ -44,7 +44,7 @@ const statuses = [
},
},
{
text: 'Czeka na akceptację od administracyjnego',
text: 'Czeka na akceptację od przełożonego administracyjnego',
value: 'waiting_for_administrative',
outline: {
icon: OutlineClockIcon,
@@ -70,7 +70,7 @@ const statuses = [
},
},
{
text: 'Zaakceptowany przez technicznego',
text: 'Zaakceptowany przez przełożonego technicznego',
value: 'accepted_by_technical',
outline: {
icon: OutlineThumbUpIcon,
@@ -83,7 +83,7 @@ const statuses = [
},
},
{
text: 'Zaakceptowany przez administracyjnego',
text: 'Zaakceptowany przez przełożonego administracyjnego',
value: 'accepted_by_administrative',
outline: {
icon: OutlineThumbUpIcon,

View File

@@ -126,6 +126,7 @@
import {Menu, MenuButton, MenuItem, MenuItems} from '@headlessui/vue'
import {CheckIcon, ChevronDownIcon} from '@heroicons/vue/solid'
import {computed} from 'vue'
import {useMonthInfo} from '@/Composables/monthInfo'
export default {
name: 'VacationCalendar',
@@ -152,58 +153,10 @@ export default {
},
},
setup(props) {
const months = [
{
'name': 'Styczeń',
'value': 'january',
},
{
'name': 'Luty',
'value': 'february',
},
{
'name': 'Marzec',
'value': 'march',
},
{
'name': 'Kwiecień',
'value': 'april',
},
{
'name': 'Maj',
'value': 'may',
},
{
'name': 'Czerwiec',
'value': 'june',
},
{
'name': 'Lipiec',
'value': 'july',
},
{
'name': 'Sierpień',
'value': 'august',
},
{
'name': 'Wrzesień',
'value': 'september',
},
{
'name': 'Październik',
'value': 'october',
},
{
'name': 'Listopad',
'value': 'november',
},
{
'name': 'Grudzień',
'value': 'december',
},
]
const {getMonths, findMonth} = useMonthInfo()
const months = getMonths()
const selectedMonth = computed(() => months.find(month => month.value === props.currentMonth))
const selectedMonth = computed(() => findMonth(props.currentMonth))
return {
months,

View File

@@ -15,7 +15,7 @@
<div class="p-4">
<div class="flex items-center">
<div class="w-0 flex-1 flex justify-between">
<ExclamationIcon class="h-5 w-5 text-white" />
<ExclamationIcon class="h-5 w-5 mr-1 text-white" />
<p class="w-0 flex-1 text-sm font-medium text-white">
{{ errors.oauth }}
</p>

View File

@@ -126,6 +126,7 @@
:href="`/vacation-requests/${request.id}/accept-as-technical`"
method="post"
as="button"
preserve-scroll
class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blumilk-600 hover:bg-blumilk-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500"
>
Zaakceptuj wniosek
@@ -148,6 +149,7 @@
:href="`/vacation-requests/${request.id}/accept-as-administrative`"
method="post"
as="button"
preserve-scroll
class="inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blumilk-600 hover:bg-blumilk-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blumilk-500"
>
Zaakceptuj wniosek
@@ -170,6 +172,7 @@
:href="`/vacation-requests/${request.id}/reject`"
method="post"
as="button"
preserve-scroll
class="inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md text-red-700 bg-red-100 hover:bg-red-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:text-sm"
>
Odrzuć wniosek
@@ -192,6 +195,7 @@
:href="`/vacation-requests/${request.id}/cancel`"
method="post"
as="button"
preserve-scroll
class="inline-flex items-center justify-center px-4 py-2 border border-transparent font-medium rounded-md text-red-700 bg-red-100 hover:bg-red-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:text-sm"
>
Anuluj wniosek

View File

@@ -11,9 +11,36 @@
<script>
import MainMenu from '@/Shared/MainMenu'
import {useToast} from 'vue-toastification'
import {watch} from 'vue'
export default {
name: 'AppLayout',
components: {MainMenu},
components: {
MainMenu,
},
props: {
flash: {
type: Object,
default: () => null,
},
},
setup(props) {
const toast = useToast()
watch(() => props.flash, flash => {
if (flash.success) {
toast.success(flash.success)
}
if (flash.error) {
toast.error(flash.error)
}
}, {immediate:true})
return {
toast,
}
},
}
</script>

View File

@@ -1,4 +1,3 @@
<template>
<div class="min-h-screen flex flex-col justify-center py-12 sm:px-6 lg:px-8 bg-blumilk-25">
<slot />

View File

@@ -363,11 +363,11 @@ export default {
const navigation = [
{name: 'Strona główna', href: '/', icon: HomeIcon, current: true},
{name: 'Użytkownicy', href: '/users', icon: UserGroupIcon, current: false},
{name: 'Dostępne urlopy', href: '/vacation-limits', icon: SunIcon, current: false},
{name: 'Twoje wnioski', href: '/vacation-requests', icon: CollectionIcon, current: false},
{name: 'Dni wolne', href: '/holidays', icon: StarIcon, current: false},
{name: 'Wnioski urlopowe', href: '/vacation-requests', icon: CollectionIcon, current: false},
{name: 'Kalendarz urlopów', href: '/vacation-calendar', icon: CalendarIcon, current: false},
{name: 'Dni wolne', href: '/holidays', icon: StarIcon, current: false},
{name: 'Limity urlopów', href: '/vacation-limits', icon: SunIcon, current: false},
{name: 'Użytkownicy', href: '/users', icon: UserGroupIcon, current: false},
]
const userNavigation = [
{name: 'Your Profile', href: '#'},
@@ -390,4 +390,4 @@ export default {
}
},
}
</script>
</script>

View File

@@ -4,6 +4,7 @@ import {InertiaProgress} from '@inertiajs/progress'
import AppLayout from '@/Shared/Layout/AppLayout'
import Flatpickr from 'flatpickr'
import { Polish } from 'flatpickr/dist/l10n/pl.js'
import Toast from 'vue-toastification'
createInertiaApp({
resolve: name => {
@@ -16,6 +17,11 @@ createInertiaApp({
setup({el, App, props, plugin}) {
createApp({render: () => h(App, props)})
.use(plugin)
.use(Toast, {
position: 'bottom-right',
maxToast: 5,
})
.component('InertiaLink', Link)
.component('InertiaHead', Head)
.mount(el)

View File

@@ -31,6 +31,19 @@
"Vacation limit has been exceeded.": "Limit urlopu został przekroczony.",
"Vacation needs minimum one day.": "Urlop musi być co najmniej na jeden dzień.",
"The vacation request cannot be created at the turn of the year.": "Wniosek urlopowy nie może zostać złożony na przełomie roku.",
"User has been created.": "Użytkownik został utworzony.",
"User has been updated.": "Użytkownik został zaktualizowany.",
"User has been deleted.": "Użytkownik został usunięty.",
"User has been restored.": "Użytkownik został przywrócony.",
"Holiday has been created.": "Dzień wolny został utworzony.",
"Holiday has been updated.": "Dzień wolny został zaktualizowany.",
"Holiday has been deleted.": "Dzień wolny został usunięty.",
"Selected year period has been changed.": "Wybrany rok został zmieniony.",
"Vacation limits have been updated.": "Limity urlopów zostały zaktualizowane.",
"Vacation request has been created.": "Wniosek urlopowy został utworzony.",
"Vacation request has been accepted.": "Wniosek urlopowy został zaakceptowany.",
"Vacation request has been rejected.": "Wniosek urlopowy został odrzucony.",
"Vacation request has been canceled.": "Wniosek urlopowy został anulowany.",
"Hi :user!": "Cześć :user!",
"The vacation request :title has changed state to :state.": "Wniosek urlopowy :title zmienił status na :state.",
"Vacation request :title": "Wniosek urlopowy :title",

View File

@@ -74,7 +74,7 @@
<h2>Wniosek o urlop</h2>
<p class="content">
Proszę o {{ mb_strtolower($vacationRequest->type->label()) }} w okresie od dnia {{ $vacationRequest->from->format("d.m.Y") }}
do dnia {{ $vacationRequest->to->format("d.m.Y") }} włącznie tj. {{ $vacationRequest->estimated_days }} dni roboczych za rok {{ $vacationRequest->yearPeriod->year }}.
do dnia {{ $vacationRequest->to->format("d.m.Y") }} włącznie tj. {{ $vacationRequest->vacations()->count() }} dni roboczych za rok {{ $vacationRequest->yearPeriod->year }}.
</p>
</div>