Compare commits
6 Commits
ffee3b257d
...
45fbdd2759
Author | SHA1 | Date | |
---|---|---|---|
45fbdd2759 | |||
7c2f888702 | |||
2f112db339 | |||
a08c6c9529 | |||
2d1d51f777 | |||
fcf422678c |
@ -90,12 +90,12 @@ class CVController extends Controller
|
|||||||
if ($cv->sended && ! $request->boolean('sended')) {
|
if ($cv->sended && ! $request->boolean('sended')) {
|
||||||
$toUpdate = array_merge($toUpdate, [
|
$toUpdate = array_merge($toUpdate, [
|
||||||
'sended' => false,
|
'sended' => false,
|
||||||
'sended_timestamp' => null,
|
'sended_timestamp' => null,
|
||||||
]);
|
]);
|
||||||
} else if (! $cv->sended && $request->boolean('sended')) {
|
} else if (! $cv->sended && $request->boolean('sended')) {
|
||||||
$toUpdate = array_merge($toUpdate, [
|
$toUpdate = array_merge($toUpdate, [
|
||||||
'sended' => true,
|
'sended' => true,
|
||||||
'sended_timestamp' => now(),
|
'sended_timestamp' => now(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +117,6 @@ class CVController extends Controller
|
|||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('admin.cv.index')
|
->route('admin.cv.index')
|
||||||
->with('info', 'Usunięto CV dla firmy "'. $name .'"');
|
->with('info', 'Usunięto CV dla firmy '. $name .'.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,6 @@ class MessageController extends Controller
|
|||||||
|
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('admin.message.index')
|
->route('admin.message.index')
|
||||||
->with(['success' => 'Wiadomość od '. $sender .' została usunięta']);
|
->with('info', 'Wiadomość od '. $sender .' została usunięta.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
84
app/Http/Controllers/Dashboard/NoteController.php
Normal file
84
app/Http/Controllers/Dashboard/NoteController.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Dashboard;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\NoteRequest;
|
||||||
|
use App\Http\Resources\NoteCollection;
|
||||||
|
use App\Http\Resources\NoteResource;
|
||||||
|
use App\Models\Note;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Inertia\Response as InertiaResponse;
|
||||||
|
|
||||||
|
class NoteController extends Controller
|
||||||
|
{
|
||||||
|
public function index(): InertiaResponse
|
||||||
|
{
|
||||||
|
return inertia(
|
||||||
|
'Notes/Index',
|
||||||
|
[
|
||||||
|
'notes' => new NoteCollection(
|
||||||
|
Note::query()
|
||||||
|
->orderByDesc('id')
|
||||||
|
->get()
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(): InertiaResponse
|
||||||
|
{
|
||||||
|
return inertia('Notes/Create');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(NoteRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$note = Note::query()->create([
|
||||||
|
'title' => $request->get('title'),
|
||||||
|
'note' => $request->get('note'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.note.show', compact('note'))
|
||||||
|
->with('success', 'Utworzono nową notatkę.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Note $note): InertiaResponse
|
||||||
|
{
|
||||||
|
return inertia('Notes/Show', ['note' => new NoteResource($note)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(Note $note): InertiaResponse
|
||||||
|
{
|
||||||
|
return inertia('Notes/Edit', ['note' => new NoteResource($note)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(NoteRequest $request, Note $note): RedirectResponse
|
||||||
|
{
|
||||||
|
$note->update([
|
||||||
|
'title' => $request->get('title'),
|
||||||
|
'note' => $request->get('note'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.note.show', compact('note'))
|
||||||
|
->with('success', 'Notatka ' . $request->get('title') . ' została zaktualizowana.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete(Note $note): InertiaResponse
|
||||||
|
{
|
||||||
|
return inertia('Notes/ConfirmDelete', ['note' => new NoteResource($note)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Note $note): RedirectResponse
|
||||||
|
{
|
||||||
|
$title = $note->title;
|
||||||
|
$note->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.note.index')
|
||||||
|
->with('info', 'Notatka ' . $title . ' została usunięta.');
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ class HandleInertiaRequests extends Middleware
|
|||||||
public function share(Request $request): array
|
public function share(Request $request): array
|
||||||
{
|
{
|
||||||
return array_merge(parent::share($request), [
|
return array_merge(parent::share($request), [
|
||||||
'messages' => $this->getFlashData($request),
|
'responseMessages' => $this->getFlashData($request),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
app/Http/Requests/NoteRequest.php
Normal file
18
app/Http/Requests/NoteRequest.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class NoteRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => 'required|string|min:3|max:250',
|
||||||
|
'note' => 'required|string|min:3|max:1000',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
17
app/Http/Resources/NoteCollection.php
Normal file
17
app/Http/Resources/NoteCollection.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||||
|
|
||||||
|
class NoteCollection extends ResourceCollection
|
||||||
|
{
|
||||||
|
public function toArray($request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'data' => $this->collection,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
25
app/Http/Resources/NoteResource.php
Normal file
25
app/Http/Resources/NoteResource.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use App\Models\Note;
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property Note $resource
|
||||||
|
*/
|
||||||
|
class NoteResource extends JsonResource
|
||||||
|
{
|
||||||
|
public static $wrap = null;
|
||||||
|
|
||||||
|
public function toArray($request): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => $this->resource->id,
|
||||||
|
'title' => $this->resource->title,
|
||||||
|
'note' => $this->resource->note,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@ -9,10 +9,10 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $id
|
* @property int $id
|
||||||
* @param string $message
|
* @property string $message
|
||||||
* @param string $email
|
* @property string $email
|
||||||
* @param string $sender
|
* @property string $sender
|
||||||
*/
|
*/
|
||||||
class Message extends Model
|
class Message extends Model
|
||||||
{
|
{
|
||||||
|
20
app/Models/Note.php
Normal file
20
app/Models/Note.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property int $id
|
||||||
|
* @property string $title
|
||||||
|
* @property string $note
|
||||||
|
*/
|
||||||
|
class Note extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
25
database/migrations/2023_08_06_205551_create_notes_table.php
Normal file
25
database/migrations/2023_08_06_205551_create_notes_table.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('notes', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('title', 250);
|
||||||
|
$table->text('note');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('notes');
|
||||||
|
}
|
||||||
|
};
|
37
resources/js/Pages/Notes/ConfirmDelete.vue
Normal file
37
resources/js/Pages/Notes/ConfirmDelete.vue
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<script setup>
|
||||||
|
import { router } from '@inertiajs/vue3';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
note: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
function confirmDelete() {
|
||||||
|
router.delete(`/dashboard/note/${props.note.id}/delete`);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<InertiaHead title="Usuwanie notatki" />
|
||||||
|
<div class="p-4">
|
||||||
|
<header class="pb-4">
|
||||||
|
<h1 class="text-3xl font-roboto font-light">Usuwanie notatki</h1>
|
||||||
|
</header>
|
||||||
|
<div class="max-w-[600px]">
|
||||||
|
<p class="mb-4">Na pewno usunąć notatkę {{ note.title }}?</p>
|
||||||
|
<div class="grid grid-cols-3 gap-2">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
:href="`/dashboard/note/${note.id}`"
|
||||||
|
class="col-span-1 flex justify-center items-center gap-3 w-full px-2 py-1 border-t-4 border-b-4 border-transparent hover:border-b-black"
|
||||||
|
><FontAwesomeIcon :icon="['fas', 'backward']" />Anuluj</InertiaLink>
|
||||||
|
<button
|
||||||
|
@click.prevent="confirmDelete"
|
||||||
|
class="col-span-2 flex justify-center items-center gap-3 w-full px-2 py-1 rounded-md bg-red-600 border-4 border-red-600 text-white text-lg hover:bg-transparent hover:text-red-600"
|
||||||
|
><FontAwesomeIcon :icon="['fas', 'trash']" /><span class="whitespace-nowrap overflow-hidden overflow-ellipsis">Usuń notatkę {{ note.title }}</span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
49
resources/js/Pages/Notes/Create.vue
Normal file
49
resources/js/Pages/Notes/Create.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useForm } from '@inertiajs/inertia-vue3';
|
||||||
|
import Input from '../../Share/Components/Input.vue';
|
||||||
|
|
||||||
|
const form = useForm({
|
||||||
|
title: null,
|
||||||
|
note: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
function createNote() {
|
||||||
|
form.post('/dashboard/note');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<InertiaHead title="Nowe dane do CV" />
|
||||||
|
<div class="p-4">
|
||||||
|
<header class="pb-4">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
href="/dashboard/note"
|
||||||
|
class="px-2 text-xl text-gray-700 hover:text-black"
|
||||||
|
title="Wróć do listy notatek"><FontAwesomeIcon :icon="['fas', 'caret-left']" /></InertiaLink>
|
||||||
|
<h1 class="text-3xl font-roboto font-light">Nowe dane do CV</h1>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div>
|
||||||
|
<form class="flex flex-col gap-4" @submit.prevent="createNote">
|
||||||
|
<Input
|
||||||
|
id="title"
|
||||||
|
label="Tytuł notatki"
|
||||||
|
placeholder="np. Witaj świecie!"
|
||||||
|
v-model="form.title"
|
||||||
|
:error="form.errors.title"
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
id="note"
|
||||||
|
type="textarea"
|
||||||
|
label="Treść notatki"
|
||||||
|
placeholder="Treść"
|
||||||
|
v-model="form.note"
|
||||||
|
:error="form.errors.note"
|
||||||
|
/>
|
||||||
|
<button class="px-0.5 py-1 rounded-lg bg-[#436da7] border-4 border-[#436da7] text-white text-lg hover:bg-transparent hover:text-[#436da7]">Utwórz notatkę</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
69
resources/js/Pages/Notes/Edit.vue
Normal file
69
resources/js/Pages/Notes/Edit.vue
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useForm } from '@inertiajs/inertia-vue3';
|
||||||
|
import Input from '../../Share/Components/Input.vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
note: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const form = useForm({
|
||||||
|
title: props.note.title,
|
||||||
|
note: props.note.note,
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateNote() {
|
||||||
|
form.put(`/dashboard/note/${props.note.id}`);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<InertiaHead title="Edycja notatki" />
|
||||||
|
<div class="p-4">
|
||||||
|
<header class="flex items-center justify-between pb-4">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
:href="`/dashboard/note/${note.id}`"
|
||||||
|
class="px-2 text-xl text-gray-700 hover:text-black"
|
||||||
|
title="Wróć do listy notatek"><FontAwesomeIcon :icon="['fas', 'caret-left']" /></InertiaLink>
|
||||||
|
<h1 class="text-3xl font-roboto font-light">Edycja notatki</h1>
|
||||||
|
</div>
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
:href="`/dashboard/note/${note.id}/delete`"
|
||||||
|
class="flex items-center gap-2 px-2 py-1 text-red-600 hover:text-white hover:bg-red-600 rounded-md"
|
||||||
|
title="Usuń notatkę"
|
||||||
|
><FontAwesomeIcon :icon="['fas', 'trash']" />Usuń</InertiaLink>
|
||||||
|
</header>
|
||||||
|
<div>
|
||||||
|
<form class="flex flex-col gap-4" @submit.prevent="updateNote">
|
||||||
|
<Input
|
||||||
|
id="title"
|
||||||
|
label="Tytuł notatki"
|
||||||
|
placeholder="np. Witaj świecie!"
|
||||||
|
v-model="form.title"
|
||||||
|
:error="form.errors.title"
|
||||||
|
/>
|
||||||
|
<Input
|
||||||
|
id="note"
|
||||||
|
type="textarea"
|
||||||
|
label="Treść notatki"
|
||||||
|
placeholder="Treść"
|
||||||
|
v-model="form.note"
|
||||||
|
:error="form.errors.note"
|
||||||
|
/>
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-3 sm:gap-2 items-center">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
:href="`/dashboard/note/${note.id}`"
|
||||||
|
class="col-span-1 flex justify-center items-center gap-3 w-full px-2 py-1 border-t-4 border-b-4 border-transparent hover:border-b-black"
|
||||||
|
><FontAwesomeIcon :icon="['fas', 'backward']" />Anuluj</InertiaLink>
|
||||||
|
<button class="col-span-1 md:col-span-2 px-0.5 py-1 rounded-lg bg-[#436da7] border-4 border-[#436da7] text-white text-lg hover:bg-transparent hover:text-[#436da7]">Edytuj notatkę</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
57
resources/js/Pages/Notes/Index.vue
Normal file
57
resources/js/Pages/Notes/Index.vue
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<script setup>
|
||||||
|
import EmptyState from '@/Share/Components/EmptyState.vue';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
notes: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<InertiaHead title="Lista notatek" />
|
||||||
|
<div class="p-4">
|
||||||
|
<header class="flex justify-between items-center pb-4">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
href="/dashboard"
|
||||||
|
class="px-2 text-xl text-gray-700 hover:text-black"
|
||||||
|
title="Wróc do dashboard"><FontAwesomeIcon :icon="['fas', 'caret-left']" /></InertiaLink>
|
||||||
|
<h1 class="text-3xl font-roboto font-light">Lista notatek</h1>
|
||||||
|
</div>
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
href="/dashboard/note/create"
|
||||||
|
class="bg-blue-400 hover:bg-blue-500 text-white px-2.5 py-1 rounded-full"
|
||||||
|
title="Dodaj nowe dane dla CV"
|
||||||
|
><FontAwesomeIcon :icon="['fas', 'plus']" /></InertiaLink>
|
||||||
|
</header>
|
||||||
|
<ul v-if="notes.data.length" class="flex flex-col gap-2">
|
||||||
|
<li
|
||||||
|
v-for="(note, key) in notes.data"
|
||||||
|
:key="key"
|
||||||
|
class="flex items-center justify-between px-3 py-2 bg-white hover:bg-neutral-200"
|
||||||
|
>
|
||||||
|
<InertiaLink :href="`/dashboard/note/${note.id}`">{{ note.title }}</InertiaLink>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
class="px-2 py-1 text-lime-600 hover:text-lime-800 border-t-2 border-b-2 border-transparent hover:border-b-lime-600"
|
||||||
|
:href="`/dashboard/note/${note.id}/edit`"
|
||||||
|
title="Edytuj notatkę"><FontAwesomeIcon :icon="['fas', 'pen-to-square']" /></InertiaLink>
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
class="px-2 py-1 text-red-600 hover:text-red-800"
|
||||||
|
:href="`/dashboard/note/${note.id}/delete`"
|
||||||
|
title="Usuń notatkę z listy"><FontAwesomeIcon :icon="['fas', 'trash']" /></InertiaLink>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<EmptyState v-else>
|
||||||
|
<template #title>Nie znaleziono notatek</template>
|
||||||
|
<template #text>Nie dodano jeszcze notatek do listy.</template>
|
||||||
|
</EmptyState>
|
||||||
|
</div>
|
||||||
|
</template>
|
64
resources/js/Pages/Notes/Show.vue
Normal file
64
resources/js/Pages/Notes/Show.vue
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
note: {
|
||||||
|
type: Object,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const noteLines = computed(() => props.note.note.split("\n"));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<InertiaHead title="Szczegóły notatki" />
|
||||||
|
<div class="p-4">
|
||||||
|
<header class="flex justify-between items-center pb-4">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
href="/dashboard/note"
|
||||||
|
class="px-2 text-xl text-gray-700 hover:text-black"
|
||||||
|
title="Wróć do listy notatek"><FontAwesomeIcon :icon="['fas', 'caret-left']" /></InertiaLink>
|
||||||
|
<h1 class="text-3xl font-roboto font-light">Szczegóły notatki</h1>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-3 sm:gap-2">
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
:href="`/dashboard/note/${note.id}/edit`"
|
||||||
|
class="flex items-center gap-2 px-2 py-1 text-lime-600 hover:text-white hover:bg-lime-600 rounded-md"
|
||||||
|
title="Edytuj notatkę"
|
||||||
|
><FontAwesomeIcon :icon="['fas', 'pen-to-square']" /><span class="hidden sm:inline-block">Edytuj</span></InertiaLink>
|
||||||
|
<InertiaLink
|
||||||
|
as="button"
|
||||||
|
:href="`/dashboard/note/${note.id}/delete`"
|
||||||
|
class="flex items-center gap-2 px-2 py-1 text-red-600 hover:text-white hover:bg-red-600 rounded-md"
|
||||||
|
title="Usuń notatkę"
|
||||||
|
><FontAwesomeIcon :icon="['fas', 'trash']" /><span class="hidden sm:inline-block">Usuń</span></InertiaLink>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="mb-4">
|
||||||
|
<header>
|
||||||
|
<h2 class="text-2xl font-roboto font-light pb-3">Podstawowe informacje</h2>
|
||||||
|
</header>
|
||||||
|
<div class="flex flex-col gap-4">
|
||||||
|
<div>
|
||||||
|
<div class="text-gray-500 pb-0.5">Tytuł</div>
|
||||||
|
<p
|
||||||
|
class="w-full min-w-full max-w-full px-2.5 py-2 border-b-2 rounded-md bg-white whitespace-nowrap overflow-hidden overflow-ellipsis"
|
||||||
|
>{{ note.title }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-span-2">
|
||||||
|
<div class="text-gray-500 pb-0.5">Notatka</div>
|
||||||
|
<div class="w-full min-w-full max-w-full px-2.5 py-2 border-b-2 rounded-md bg-white">
|
||||||
|
<p
|
||||||
|
v-for="(noteLine, key) in noteLines"
|
||||||
|
:key="key"
|
||||||
|
>{{ noteLine }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
@ -1,8 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
defineProps({
|
defineProps({
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: Array,
|
||||||
defaut: ['far', 'folder-open'],
|
default: ['far', 'folder-open'],
|
||||||
},
|
},
|
||||||
showDescription: {
|
showDescription: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
defineProps({
|
defineProps({
|
||||||
messages: {
|
responseMessages: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {},
|
default: {},
|
||||||
}
|
}
|
||||||
@ -29,18 +29,19 @@ defineProps({
|
|||||||
<ul class="flex gap-3 items-center font-bold">
|
<ul class="flex gap-3 items-center font-bold">
|
||||||
<li><InertiaLink class="text-white active:text-kamilcraft-green hover:text-black hover:underline" href="/dashboard/cv">CV</InertiaLink></li>
|
<li><InertiaLink class="text-white active:text-kamilcraft-green hover:text-black hover:underline" href="/dashboard/cv">CV</InertiaLink></li>
|
||||||
<li><InertiaLink class="text-white active:text-kamilcraft-green hover:text-black hover:underline" href="/dashboard/message">Msg</InertiaLink></li>
|
<li><InertiaLink class="text-white active:text-kamilcraft-green hover:text-black hover:underline" href="/dashboard/message">Msg</InertiaLink></li>
|
||||||
|
<li><InertiaLink class="text-white active:text-kamilcraft-green hover:text-black hover:underline" href="/dashboard/note">Notes</InertiaLink></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div v-if="messages?.info" class="max-w-screen-lg mx-2 lg:mx-auto mt-2 px-2 py-3 rounded-md bg-yellow-100 text-yellow-600 text-center">
|
<div v-if="responseMessages?.info" class="max-w-screen-lg mx-2 lg:mx-auto mt-2 px-2 py-3 rounded-md bg-yellow-100 text-yellow-600 text-center">
|
||||||
{{ messages.info }}
|
{{ responseMessages.info }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="messages?.error" class="max-w-screen-lg mx-2 lg:mx-auto mt-2 px-2 py-3 rounded-md bg-red-100 text-red-600 text-center">
|
<div v-if="responseMessages?.error" class="max-w-screen-lg mx-2 lg:mx-auto mt-2 px-2 py-3 rounded-md bg-red-100 text-red-600 text-center">
|
||||||
{{ messages.error }}
|
{{ responseMessages.error }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="messages?.success" class="max-w-screen-lg mx-2 lg:mx-auto mt-2 px-2 py-3 rounded-md bg-green-100 text-green-600 text-center">
|
<div v-if="responseMessages?.success" class="max-w-screen-lg mx-2 lg:mx-auto mt-2 px-2 py-3 rounded-md bg-green-100 text-green-600 text-center">
|
||||||
{{ messages?.success }}
|
{{ responseMessages.success }}
|
||||||
</div>
|
</div>
|
||||||
<main class="max-w-screen-lg mx-2 lg:mx-auto mt-2 rounded-md bg-gray-50">
|
<main class="max-w-screen-lg mx-2 lg:mx-auto mt-2 rounded-md bg-gray-50">
|
||||||
<slot />
|
<slot />
|
||||||
|
@ -7,6 +7,26 @@ use Illuminate\Support\Facades\Route;
|
|||||||
Route::name('admin.')->group(function () {
|
Route::name('admin.')->group(function () {
|
||||||
Route::namespace('Dashboard')->middleware('auth')->group(function (): void {
|
Route::namespace('Dashboard')->middleware('auth')->group(function (): void {
|
||||||
Route::get('', 'AdminPanelController')->name('home');
|
Route::get('', 'AdminPanelController')->name('home');
|
||||||
|
|
||||||
|
Route::name('note.')->prefix('note')->group(function (): void {
|
||||||
|
Route::get('', 'NoteController@index')
|
||||||
|
->name('index');
|
||||||
|
Route::get('create', 'NoteController@create')
|
||||||
|
->name('create');
|
||||||
|
Route::post('', 'NoteController@store')
|
||||||
|
->name('store');
|
||||||
|
Route::get('{note}', 'NoteController@show')
|
||||||
|
->name('show');
|
||||||
|
Route::get('{note}/edit', 'NoteController@edit')
|
||||||
|
->name('edit');
|
||||||
|
Route::put('{note}', 'NoteController@update')
|
||||||
|
->name('update');
|
||||||
|
Route::get('{note}/delete', 'NoteController@delete')
|
||||||
|
->name('delete');
|
||||||
|
Route::delete('{note}/delete', 'NoteController@destroy')
|
||||||
|
->name('destroy');
|
||||||
|
});
|
||||||
|
|
||||||
Route::name('message.')->prefix('message')->group(function (): void {
|
Route::name('message.')->prefix('message')->group(function (): void {
|
||||||
Route::get('', 'MessageController@index')
|
Route::get('', 'MessageController@index')
|
||||||
->name('index');
|
->name('index');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user