#42 - global notifications (#50)

* change layout

* change layout

* #22 - wip

* wip

* wip

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - wip

* #22 - fix

* #22 - wip

* #22 - added some tests

* #22 - wip

* #22 - wip

* #22 - fix

* #42 - wip

* #42 - wip

* #42 - fix

* #42 - wip

Co-authored-by: Adrian Hopek <adrian.hopek@blumilk.pl>
This commit is contained in:
Ewelina Lasowy 2022-02-16 08:43:12 +01:00 committed by GitHub
parent 6c352b629c
commit f81c7ca8fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 97 additions and 25 deletions

View File

@ -35,7 +35,7 @@ class HolidayController extends Controller
return redirect()
->route("holidays.index")
->with("success", __("Holiday has been created"));
->with("success", __("Holiday has been created."));
}
public function edit(Holiday $holiday): Response
@ -51,7 +51,7 @@ class HolidayController extends Controller
return redirect()
->route("holidays.index")
->with("success", __("Holiday has been updated"));
->with("success", __("Holiday has been updated."));
}
public function destroy(Holiday $holiday): RedirectResponse
@ -60,6 +60,6 @@ class HolidayController extends Controller
return redirect()
->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()
->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()
->route("users.index")
->with("success", __("User has been created"));
->with("success", __("User has been created."));
}
public function edit(User $user): Response
@ -64,7 +64,7 @@ class UserController extends Controller
return redirect()
->route("users.index")
->with("success", __("User has been updated"));
->with("success", __("User has been updated."));
}
public function destroy(User $user): RedirectResponse
@ -73,7 +73,7 @@ class UserController extends Controller
return redirect()
->route("users.index")
->with("success", __("User has been deleted"));
->with("success", __("User has been deleted."));
}
public function restore(User $user): RedirectResponse
@ -82,6 +82,6 @@ class UserController extends Controller
return redirect()
->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()
->back()
->with("success", __("Vacation limits have been updated"));
->with("success", __("Vacation limits have been updated."));
}
}

View File

@ -95,7 +95,8 @@ class VacationRequestController extends Controller
$stateManager->markAsCreated($vacationRequest);
return redirect()
->route("vacation.requests.index");
->route("vacation.requests.show", $vacationRequest)
->with("success", __("Vacation request has been created."));
}
public function reject(
@ -104,7 +105,8 @@ class VacationRequestController extends Controller
): RedirectResponse {
$stateManager->reject($vacationRequest);
return redirect()->back();
return redirect()->back()
->with("success", __("Vacation request has been rejected."));
}
public function cancel(
@ -113,7 +115,8 @@ class VacationRequestController extends Controller
): RedirectResponse {
$stateManager->cancel($vacationRequest);
return redirect()->back();
return redirect()->back()
->with("success", __("Vacation request has been canceled."));
}
public function acceptAsTechnical(
@ -122,7 +125,8 @@ class VacationRequestController extends Controller
): RedirectResponse {
$stateManager->acceptAsTechnical($vacationRequest);
return redirect()->back();
return redirect()->back()
->with("success", __("Vacation request has been accepted."));
}
public function acceptAsAdministrative(
@ -131,6 +135,7 @@ class VacationRequestController extends Controller
): RedirectResponse {
$stateManager->acceptAsAdministrative($vacationRequest);
return redirect()->back();
return redirect()->back()
->with("success", __("Vacation request has been accepted."));
}
}

17
package-lock.json generated
View File

@ -25,7 +25,8 @@
"vue": "^3.2.26",
"vue-echarts": "^6.0.2",
"vue-flatpickr-component": "^9.0.5",
"vue-loader": "^17.0.0"
"vue-loader": "^17.0.0",
"vue-toastification": "^2.0.0-rc.5"
},
"devDependencies": {
"eslint": "^8.6.0",
@ -8943,6 +8944,14 @@
"resolved": "https://registry.npmjs.org/hash-sum/-/hash-sum-1.0.2.tgz",
"integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ="
},
"node_modules/vue-toastification": {
"version": "2.0.0-rc.5",
"resolved": "https://registry.npmjs.org/vue-toastification/-/vue-toastification-2.0.0-rc.5.tgz",
"integrity": "sha512-q73e5jy6gucEO/U+P48hqX+/qyXDozAGmaGgLFm5tXX4wJBcVsnGp4e/iJqlm9xzHETYOilUuwOUje2Qg1JdwA==",
"peerDependencies": {
"vue": "^3.0.2"
}
},
"node_modules/watchpack": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz",
@ -16100,6 +16109,12 @@
}
}
},
"vue-toastification": {
"version": "2.0.0-rc.5",
"resolved": "https://registry.npmjs.org/vue-toastification/-/vue-toastification-2.0.0-rc.5.tgz",
"integrity": "sha512-q73e5jy6gucEO/U+P48hqX+/qyXDozAGmaGgLFm5tXX4wJBcVsnGp4e/iJqlm9xzHETYOilUuwOUje2Qg1JdwA==",
"requires": {}
},
"watchpack": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz",

View File

@ -32,7 +32,8 @@
"vue": "^3.2.26",
"vue-echarts": "^6.0.2",
"vue-flatpickr-component": "^9.0.5",
"vue-loader": "^17.0.0"
"vue-loader": "^17.0.0",
"vue-toastification": "^2.0.0-rc.5"
},
"devDependencies": {
"eslint": "^8.6.0",

View File

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

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: '#'},

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

@ -30,5 +30,19 @@
"You have approved vacation request in this range.": "Masz zaakceptowany wniosek urlopowy w tym zakresie dat.",
"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."
"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."
}

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>