Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#484 - user page navigation #500

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/Controllers/PermissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function update(PermissionRequest $request, UpdateUserPermissionsAction $
$action->execute($user, $request->input("permissions"));

return redirect()
->route("users.index")
->back()
->with("success", __("Permissions updated."));
}
}
5 changes: 3 additions & 2 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public function edit(User $user): Response
$this->authorize("manageUsers");

return inertia("Users/Edit", [
"user" => new UserFormDataResource($user),
"user" => new UserResource($user),
"form" => new UserFormDataResource($user),
"employmentForms" => EmploymentForm::casesToSelect(),
"roles" => Role::casesToSelect(),
]);
Expand All @@ -120,7 +121,7 @@ public function update(
}

return redirect()
->route("users.index")
->back()
->with("success", __("User updated."));
}

Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/UserHistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Toby\Enums\UserHistoryType;
use Toby\Http\Requests\UserHistoryRequest;
use Toby\Http\Resources\UserHistoryResource;
use Toby\Http\Resources\UserResource;
use Toby\Models\User;
use Toby\Models\UserHistory;

Expand All @@ -25,7 +26,7 @@ public function index(User $user): Response

return inertia("UserHistory/Index", [
"history" => UserHistoryResource::collection($history),
"userId" => $user->id,
"user" => new UserResource($user),
]);
}

Expand Down Expand Up @@ -80,7 +81,7 @@ public function destroy(UserHistory $history): RedirectResponse
$history->delete();

return redirect()
->back()
->route("users.history", $history->user_id)
->with("success", __("User history deleted."));
}
}
2 changes: 2 additions & 0 deletions app/Http/Resources/UserFormDataResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public function toArray($request): array
"id" => $this->id,
"firstName" => $this->profile->first_name,
"lastName" => $this->profile->last_name,
"name" => $this->profile->full_name,
"avatar" => $this->profile->getAvatar(),
"email" => $this->email,
"role" => $this->role,
"position" => $this->profile->position,
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/AnnualSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ watch(selectedYear, (value, oldValue) => {
</script>

<template>
<AppLayout>
<template #title>Podsumowanie roczne</template>
<AppLayout title="Podsumowanie roczne">
<div class="bg-white shadow-md">
<div class="p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/AssignedBenefits/AssignedBenefits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ function isBenefitHasCompanion(benefitId) {
</script>

<template>
<AppLayout>
<template #title>Aktualne benefity</template>
<AppLayout title="Aktualne benefity">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Benefits/Benefits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ function submitCreateBenefit() {
</script>

<template>
<AppLayout>
<template #title>Benefity</template>
<AppLayout title="Benefity">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/BenefitsReport/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ watch(form, debounce(() => {
</script>

<template>
<AppLayout>
<template #title>Raporty benefitowe</template>
<AppLayout title="Raporty benefitowe">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/BenefitsReport/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ function generateUrl() {
</script>

<template>
<AppLayout>
<template #title>`Raport benefitowy - ${benefitsReport.name}`</template>
<AppLayout :title="`Raport benefitowy - ${benefitsReport.name}`">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ function toggleHighlight(id) {
</script>

<template>
<AppLayout>
<template #title>Kalendarz</template>
<AppLayout title="Kalendarz">
<div class="bg-white shadow-md">
<div class="flex-row sm:flex justify-between items-center p-4 sm:px-6">
<div class="flex-row sm:flex items-center">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const { auth } = useGlobalProps()
</script>

<template>
<AppLayout>
<template #title>Strona główna</template>
<AppLayout title="Strona główna">
<div class="grid grid-cols-1 gap-4 items-start xl:grid-cols-3 xl:gap-8">
<div class="grid grid-cols-1 gap-4 xl:col-span-2">
<Welcome :user="auth.user" />
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/EmployeesMilestones.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ watch(form, debounce(() => {
</script>

<template>
<AppLayout>
<template #title>Jubileusze</template>
<AppLayout title="Jubileusze">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Equipment/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ function createEquipmentItem() {
</script>

<template>
<AppLayout>
<template #title>Dodawanie sprzętu</template>
<AppLayout title="Dodawanie sprzętu">
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
<div class="p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Equipment/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ function editEquipmentItem() {
</script>

<template>
<AppLayout>
<template #title>Edytowanie sprzętu</template>
<AppLayout title="Edytowanie sprzętu">
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
<div class="p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Equipment/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ watch(form, debounce(() => {
</script>

<template>
<AppLayout>
<template #title>Sprzęt</template>
<AppLayout title="Sprzęt">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Equipment/IndexForEmployee.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ watch(form, debounce(() => {
</script>

<template>
<AppLayout>
<template #title>Sprzęt</template>
<AppLayout title="Sprzęt">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/EquipmentLabels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ function submitCreateLabel() {
</script>

<template>
<AppLayout>
<template #title>Etykiety</template>
<AppLayout title="Etykiety">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Holidays/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ function createHoliday() {
</script>

<template>
<AppLayout>
<template #title>Dodaj dzień wolny</template>
<AppLayout title="Dodaj dzień wolny">
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
<div class="p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Holidays/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ function editHoliday() {
</script>

<template>
<AppLayout>
<template #title>Edytuj dzień wolny</template>
<AppLayout title="Edytuj dzień wolny">
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
<div class="p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Holidays/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ watch(selectedYear, (value, oldValue) => {
</script>

<template>
<AppLayout>
<template #title>Dni wolne od pracy</template>
<AppLayout title="Dni wolne od pracy">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Keys.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ function submitGiveKey() {
</script>

<template>
<AppLayout>
<template #title>Klucze</template>
<AppLayout title="Klucze">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/MonthlyUsage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ watch(selectedYear, (value, oldValue) => {
</script>

<template>
<AppLayout>
<template #title>Wykorzystanie miesięczne urlopu</template>
<AppLayout title="Wykorzystanie miesięczne urlopu">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div class="flex items-center">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/OvertimeRequest/ApproversIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ watch(form, debounce(() => {
</script>

<template>
<AppLayout>
<template #title>Wnioski</template>
<AppLayout title="Wnioski">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<div>
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/OvertimeRequest/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ async function refreshEstimatedHours(from, to) {
</script>

<template>
<AppLayout>
<template #title>Dodaj nadgodziny</template>
<AppLayout title="Dodaj nadgodziny">
<div class="mx-auto w-full max-w-7xl">
<div class="flex flex-col h-full bg-white shadow-md xl:col-span-2">
<div class="p-4 sm:px-6">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/OvertimeRequest/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ watch(form, debounce(() => {
</script>

<template>
<AppLayout>
<template #title>Moje nadgodziny</template>
<AppLayout title="Moje nadgodziny">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/OvertimeRequest/IndexForApprovers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ watch(form, debounce(() => {
</script>

<template>
<AppLayout>
<template #title>Nadgodziny</template>
<AppLayout title="Nadgodziny">
<div class="bg-white shadow-md">
<div class="flex justify-between items-center p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/OvertimeRequest/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ defineProps({
</script>

<template>
<AppLayout>
<template #title>`Nadgodziny ${request.name}`</template>
<AppLayout :title="`Nadgodziny ${request.name}`">
<div class="grid grid-cols-1 gap-6 xl:grid-cols-3 xl:grid-flow-col-dense">
<div class="space-y-6 xl:col-span-2 xl:col-start-1">
<div class="bg-white shadow-md">
Expand Down
44 changes: 5 additions & 39 deletions resources/js/Pages/Permissions/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Switch } from '@headlessui/vue'
import { usePermissionInfo } from '@/Composables/permissionInfo.js'
import { useForm } from '@inertiajs/vue3'
import InertiaLink from '@/Shared/InertiaLink.vue'
import AppLayout from '@/Shared/Layout/AppLayout.vue'
import UserLayout from '@/Shared/Layout/UserLayout.vue'

const props = defineProps({
user: Object,
Expand All @@ -23,43 +23,9 @@ function editPermissions() {
</script>

<template>
<AppLayout>
<template #title>Edycja uprawnień</template>
<UserLayout title="Edycja uprawnień" :user="user">
<div class="bg-white shadow-md">
<div class="p-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Edytuj uprawnienia
</h2>
</div>
<div
class="bg-gray-50 w-full py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase"
>
Użytkownik
</div>
<div class="items-center p-4 flex">
<div class="flex">
<img
class="size-14 mt-1 rounded-full"
:src="user.avatar"
>
<div class="ml-3">
<p class="text-md font-medium text-gray-900">
{{ user.name }}
</p>
<p class="text-sm text-gray-500">
{{ user.role }}
</p>
<p class="text-sm text-gray-500">
{{ user.email }}
</p>
</div>
</div>
</div>
<div class="bg-gray-50 w-full py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase">
Uprawnienia
</div>
<form
class="w-full py-2 px-4"
@submit.prevent="editPermissions"
>
<template
Expand All @@ -68,7 +34,7 @@ function editPermissions() {
>
<div
v-if="sectionPermissions.length > 0"
class="w-full my-4 border border-gray-200 items-start"
class="w-full my-4 border-t border-gray-200 items-start"
>
<div
class="group w-full max-w-full overflow-hidden flex items-center justify-between p-4 font-semibold text-gray-500"
Expand Down Expand Up @@ -120,7 +86,7 @@ function editPermissions() {
</div>
</template>
<div class="flex justify-end py-3">
<div class="space-x-3">
<div class="space-x-3 px-4 py-2">
<InertiaLink
href="/users"
class="py-2 px-4 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 rounded-md border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
Expand All @@ -139,5 +105,5 @@ function editPermissions() {
</div>
</form>
</div>
</AppLayout>
</UserLayout>
</template>
3 changes: 1 addition & 2 deletions resources/js/Pages/Resumes/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ function submitResume() {
</script>

<template>
<AppLayout>
<template #title>Dodawanie CV</template>
<AppLayout title="Dodawanie CV">
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
<div class="p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
3 changes: 1 addition & 2 deletions resources/js/Pages/Resumes/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ function submitResume() {
</script>

<template>
<AppLayout>
<template #title>Edycja CV</template>
<AppLayout title="Edycja CV">
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
<div class="p-4 sm:px-6">
<h2 class="text-lg font-medium leading-6 text-gray-900">
Expand Down
Loading
Loading