This commit is contained in:
EwelinaLasowy 2022-02-10 11:22:07 +01:00
parent d026d41715
commit d4c2f80eec
12 changed files with 146 additions and 72 deletions

View File

@ -29,9 +29,7 @@ class GoogleController extends Controller
} catch (ModelNotFoundException) { } catch (ModelNotFoundException) {
return redirect() return redirect()
->route("login") ->route("login")
->withErrors([ ->with("error", __("User does not exist."));
"oauth" => __("User does not exist."),
]);
} }
$auth->guard()->login($user, true); $auth->guard()->login($user, true);

View File

@ -35,7 +35,7 @@ class HolidayController extends Controller
return redirect() return redirect()
->route("holidays.index") ->route("holidays.index")
->with("success", __("Holiday has been created")); ->with("success", __("Holiday has been created."));
} }
public function edit(Holiday $holiday): Response public function edit(Holiday $holiday): Response
@ -51,7 +51,7 @@ class HolidayController extends Controller
return redirect() return redirect()
->route("holidays.index") ->route("holidays.index")
->with("success", __("Holiday has been updated")); ->with("success", __("Holiday has been updated."));
} }
public function destroy(Holiday $holiday): RedirectResponse public function destroy(Holiday $holiday): RedirectResponse
@ -60,6 +60,6 @@ class HolidayController extends Controller
return redirect() return redirect()
->route("holidays.index") ->route("holidays.index")
->with("success", __("Holiday has been deleted")); ->with("success", __("Holiday has been deleted."));
} }
} }

View File

@ -17,6 +17,6 @@ class SelectYearPeriodController extends Controller
return redirect() return redirect()
->back() ->back()
->with("success", __("Selected year period has been changed")); ->with("success", __("Selected year period has been changed."));
} }
} }

View File

@ -46,7 +46,7 @@ class UserController extends Controller
return redirect() return redirect()
->route("users.index") ->route("users.index")
->with("success", __("User has been created")); ->with("success", __("User has been created."));
} }
public function edit(User $user): Response public function edit(User $user): Response
@ -64,7 +64,7 @@ class UserController extends Controller
return redirect() return redirect()
->route("users.index") ->route("users.index")
->with("success", __("User has been updated")); ->with("success", __("User has been updated."));
} }
public function destroy(User $user): RedirectResponse public function destroy(User $user): RedirectResponse
@ -73,7 +73,7 @@ class UserController extends Controller
return redirect() return redirect()
->route("users.index") ->route("users.index")
->with("success", __("User has been deleted")); ->with("success", __("User has been deleted."));
} }
public function restore(User $user): RedirectResponse public function restore(User $user): RedirectResponse
@ -82,6 +82,6 @@ class UserController extends Controller
return redirect() return redirect()
->route("users.index") ->route("users.index")
->with("success", __("User has been restored")); ->with("success", __("User has been restored."));
} }
} }

View File

@ -35,6 +35,6 @@ class VacationLimitController extends Controller
return redirect() return redirect()
->back() ->back()
->with("success", __("Vacation limits have been updated")); ->with("success", __("Vacation limits have been updated."));
} }
} }

View File

@ -93,7 +93,8 @@ class VacationRequestController extends Controller
$stateManager->markAsCreated($vacationRequest); $stateManager->markAsCreated($vacationRequest);
return redirect() return redirect()
->route("vacation.requests.index"); ->route("vacation.requests.show", $vacationRequest)
->with("success", __("Vacation request has been created."));
} }
public function reject( public function reject(
@ -102,7 +103,8 @@ class VacationRequestController extends Controller
): RedirectResponse { ): RedirectResponse {
$stateManager->reject($vacationRequest); $stateManager->reject($vacationRequest);
return redirect()->back(); return redirect()->back()
->with("success", __("Vacation request has been rejected."));
} }
public function cancel( public function cancel(
@ -111,7 +113,8 @@ class VacationRequestController extends Controller
): RedirectResponse { ): RedirectResponse {
$stateManager->cancel($vacationRequest); $stateManager->cancel($vacationRequest);
return redirect()->back(); return redirect()->back()
->with("success", __("Vacation request has been canceled."));
} }
public function acceptAsTechnical( public function acceptAsTechnical(
@ -120,7 +123,8 @@ class VacationRequestController extends Controller
): RedirectResponse { ): RedirectResponse {
$stateManager->acceptAsTechnical($vacationRequest); $stateManager->acceptAsTechnical($vacationRequest);
return redirect()->back(); return redirect()->back()
->with("success", __("Vacation request has been accepted."));
} }
public function acceptAsAdministrative( public function acceptAsAdministrative(
@ -129,6 +133,7 @@ class VacationRequestController extends Controller
): RedirectResponse { ): RedirectResponse {
$stateManager->acceptAsAdministrative($vacationRequest); $stateManager->acceptAsAdministrative($vacationRequest);
return redirect()->back(); return redirect()->back()
->with("success", __("Vacation request has been accepted."));
} }
} }

View File

@ -1,41 +1,5 @@
<template> <template>
<InertiaHead title="Zaloguj się" /> <InertiaHead title="Zaloguj się" />
<transition
enter-active-class="transform ease-out duration-300 transition"
enter-from-class="translate-y-2 opacity-0 sm:translate-y-0 sm:translate-x-2"
enter-to-class="translate-y-0 opacity-100 sm:translate-x-0"
leave-active-class="transition ease-in duration-100"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<div
v-if="errors.oauth"
class="absolute inset-x-2 top-2 sm:mx-auto sm:w-full sm:max-w-md bg-red-500 shadow-lg rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden"
>
<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" />
<p class="w-0 flex-1 text-sm font-medium text-white">
{{ errors.oauth }}
</p>
</div>
<div class="ml-4 flex-shrink-0 flex">
<button
class="bg-red-500 rounded-md inline-flex text-red-100 hover:text-red-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-600"
@click="delete errors.oauth"
>
<span class="sr-only">Close</span>
<XIcon
class="h-5 w-5"
aria-hidden="true"
/>
</button>
</div>
</div>
</div>
</div>
</transition>
<div <div
class="sm:mx-auto sm:w-full sm:max-w-md text-white space-y-4 flex flex-col items-center rounded-lg px-4 py-8" class="sm:mx-auto sm:w-full sm:max-w-md text-white space-y-4 flex flex-col items-center rounded-lg px-4 py-8"
dusk="login-link" dusk="login-link"
@ -66,21 +30,10 @@
<script> <script>
import GuestLayout from '@/Shared/Layout/GuestLayout' import GuestLayout from '@/Shared/Layout/GuestLayout'
import {XIcon} from '@heroicons/vue/solid'
import {ExclamationIcon} from '@heroicons/vue/solid'
export default { export default {
name: 'LoginPage', name: 'LoginPage',
components: {
XIcon,
ExclamationIcon,
},
layout: GuestLayout, layout: GuestLayout,
props: {
errors: {
type: Object,
default: () => ({oauth: null}),
},
},
} }
</script> </script>

View File

@ -0,0 +1,97 @@
<template>
<transition
enter-active-class="transform ease-out duration-300 transition"
enter-from-class="opacity-0"
enter-to-class="opacity-100"
leave-active-class="transition ease-in duration-100"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<div
v-if="$page.props.flash.success && show"
class="fixed bottom-4 right-0 mx-auto w-full max-w-md bg-green-500 shadow-lg rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden z-50 sm:mr-4"
>
<div class="p-4">
<div class="flex items-center">
<div class="w-0 flex-1 flex justify-between">
<CheckCircleIcon class="h-5 w-5 text-white mr-2" />
<p class="w-0 flex-1 text-sm font-medium text-white">
{{ $page.props.flash.success }}
</p>
</div>
<div class="ml-4 flex-shrink-0 flex">
<button
class="bg-green-500 rounded-md inline-flex text-green-100 hover:text-green-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-600"
@click="show = false"
>
<span class="sr-only">Close</span>
<XIcon
class="h-5 w-5"
aria-hidden="true"
/>
</button>
</div>
</div>
</div>
</div>
</transition>
<div
v-if="($page.props.flash.error) && show"
class="fixed bottom-4 right-0 mx-auto w-full max-w-md bg-red-500 shadow-lg rounded-lg pointer-events-auto ring-1 ring-black ring-opacity-5 overflow-hidden z-50 sm:mr-4"
>
<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 mr-2" />
<p class="w-0 flex-1 text-sm font-medium text-white">
{{ $page.props.flash.error }}
</p>
</div>
<div class="ml-4 flex-shrink-0 flex">
<button
class="bg-red-500 rounded-md inline-flex text-red-100 hover:text-red-400 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-600"
@click="show = false"
>
<span class="sr-only">Close</span>
<XIcon
class="h-5 w-5"
aria-hidden="true"
/>
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {XIcon} from '@heroicons/vue/outline'
import {ExclamationIcon, CheckCircleIcon} from '@heroicons/vue/solid'
export default {
name: 'FlashMessage',
components: {
CheckCircleIcon,
ExclamationIcon,
XIcon,
},
props: {
flash: Object,
default: () => ({success: null, error: null}),
},
data() {
return {
show:true,
}
},
watch: {
'$page.props.flash': {
handler() {
this.show = true
setTimeout(() => this.show = false, 6000)
},
},
deep: true,
},
}
</script>

View File

@ -2,6 +2,7 @@
<div class="min-h-full"> <div class="min-h-full">
<MainMenu /> <MainMenu />
<main class="lg:ml-64 flex flex-col flex-1 py-8"> <main class="lg:ml-64 flex flex-col flex-1 py-8">
<FlashMessage />
<div> <div>
<slot /> <slot />
</div> </div>
@ -11,9 +12,13 @@
<script> <script>
import MainMenu from '@/Shared/MainMenu' import MainMenu from '@/Shared/MainMenu'
import FlashMessage from '@/Shared/FlashMessage'
export default { export default {
name: 'AppLayout', name: 'AppLayout',
components: {MainMenu}, components: {
FlashMessage,
MainMenu,
},
} }
</script> </script>

View File

@ -1,12 +1,14 @@
<template> <template>
<div class="min-h-screen flex flex-col justify-center py-12 sm:px-6 lg:px-8 bg-blumilk-25"> <div class="min-h-screen flex flex-col justify-center py-12 sm:px-6 lg:px-8 bg-blumilk-25">
<FlashMessage />
<slot /> <slot />
</div> </div>
</template> </template>
<script> <script>
import FlashMessage from '@/Shared/FlashMessage'
export default { export default {
name: 'GuestLayout', name: 'GuestLayout',
components: {FlashMessage},
} }
</script> </script>

View File

@ -363,11 +363,11 @@ export default {
const navigation = [ const navigation = [
{name: 'Strona główna', href: '/', icon: HomeIcon, current: true}, {name: 'Strona główna', href: '/', icon: HomeIcon, current: true},
{name: 'Użytkownicy', href: '/users', icon: UserGroupIcon, current: false}, {name: 'Wnioski urlopowe', href: '/vacation-requests', icon: CollectionIcon, 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: 'Kalendarz urlopów', href: '/vacation-calendar', icon: CalendarIcon, 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 = [ const userNavigation = [
{name: 'Your Profile', href: '#'}, {name: 'Your Profile', href: '#'},

View File

@ -30,5 +30,19 @@
"You have approved vacation request in this range.": "Masz zaakceptowany wniosek urlopowy w tym zakresie dat.", "You have approved vacation request in this range.": "Masz zaakceptowany wniosek urlopowy w tym zakresie dat.",
"You have exceeded your vacation limit.": "Przekroczyłeś/aś limit urlopu.", "You have exceeded your vacation limit.": "Przekroczyłeś/aś limit urlopu.",
"Vacation needs minimum one day.": "Urlop musi być co najmniej na jeden dzień.", "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." "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."
} }