Co-authored-by: Juan Felipe Zapata Moreno <zapata_pipe@hotmail.com> Reviewed-on: #2 Co-authored-by: Juan Felipe Zapata Moreno <juan.zapata@golsystems.com.mx> Co-committed-by: Juan Felipe Zapata Moreno <juan.zapata@golsystems.com.mx>
74 lines
2.1 KiB
Vue
74 lines
2.1 KiB
Vue
<script setup>
|
|
import { goTo, transl } from './Component';
|
|
import { Link, useForm } from '@inertiajs/vue3';
|
|
|
|
import PrimaryButton from '@/Components/Dashboard/Button/Primary.vue';
|
|
import Input from '@/Components/Dashboard/Form/Input.vue';
|
|
import PageHeader from '@/Components/Dashboard/PageHeader.vue';
|
|
import GoogleIcon from '@/Components/Shared/GoogleIcon.vue';
|
|
import DashboardLayout from '@/Layouts/DashboardLayout.vue';
|
|
|
|
defineProps({
|
|
name: String,
|
|
description: String
|
|
});
|
|
|
|
const form = useForm({
|
|
name: '',
|
|
description: '',
|
|
});
|
|
|
|
const submit = () => form.post(route(goTo('store')), {
|
|
onSuccess: () => Notify.success(transl('create.onSuccess')),
|
|
onError: () => Notify.error(transl('create.onError')),
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<DashboardLayout :title="transl('create.title')">
|
|
<PageHeader>
|
|
<Link :href="route(goTo('index'))">
|
|
<GoogleIcon
|
|
:title="$t('return')"
|
|
class="btn-icon-primary"
|
|
name="arrow_back"
|
|
outline
|
|
/>
|
|
</Link>
|
|
</PageHeader>
|
|
<div class="w-full pb-8">
|
|
<div class="mt-8">
|
|
<p
|
|
v-text="transl('create.description')"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="w-full">
|
|
<form @submit.prevent="submit" class="grid gap-4 grid-cols-6">
|
|
<Input
|
|
id="Nombre"
|
|
class="col-span-2"
|
|
v-model="form.name"
|
|
:onError="form.errors.name"
|
|
autofocus
|
|
required
|
|
/>
|
|
<Input
|
|
id="Descripción"
|
|
class="col-span-2"
|
|
v-model="form.description"
|
|
:onError="form.errors.description"
|
|
autofocus
|
|
/>
|
|
<div class="col-span-6 flex flex-col items-center justify-end space-y-4 mt-4">
|
|
<PrimaryButton
|
|
:class="{ 'opacity-25': form.processing }"
|
|
:disabled="form.processing"
|
|
v-text="transl('create.title')"
|
|
/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</DashboardLayout>
|
|
</template>
|