72 lines
2.3 KiB
Vue
72 lines
2.3 KiB
Vue
<script setup>
|
|
import { useForm } from '@inertiajs/inertia-vue3';
|
|
import Input from '../../Share/Components/Input.vue';
|
|
|
|
const form = useForm({
|
|
name: null,
|
|
slug: null,
|
|
priority: Number(0),
|
|
default: Boolean(false),
|
|
visible: Boolean(false),
|
|
});
|
|
|
|
function createCategory() {
|
|
form.post('/dashboard/category');
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<InertiaHead title="Nowa kategoria" />
|
|
<div class="p-4">
|
|
<header class="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">Nowa kategoria</h1>
|
|
</div>
|
|
</header>
|
|
<div>
|
|
<form class="flex flex-col gap-4" @submit.prevent="createCategory">
|
|
<Input
|
|
id="name"
|
|
label="Nazwa"
|
|
placeholder="Nazwa kategorii"
|
|
v-model="form.name"
|
|
:error="form.errors.name"
|
|
/>
|
|
<Input
|
|
id="slug"
|
|
label="Slug"
|
|
placeholder="Slug dla kategorii"
|
|
v-model="form.slug"
|
|
:error="form.errors.slug"
|
|
/>
|
|
<Input
|
|
id="priority"
|
|
label="Priorytet"
|
|
type="number"
|
|
placeholder="Priorytet dla danej kategorii"
|
|
v-model="form.priority"
|
|
:error="form.errors.priority"
|
|
/>
|
|
<Input
|
|
id="visible"
|
|
label="Widoczny"
|
|
type="checkbox"
|
|
v-model="form.visible"
|
|
/>
|
|
<Input
|
|
id="default"
|
|
label="Domyślny"
|
|
type="checkbox"
|
|
v-model="form.default"
|
|
/>
|
|
<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]">Dodaj kategorię</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</template>
|