<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>
