2019-03-18 08:53:00 -03:00
|
|
|
<template>
|
2019-09-28 08:30:44 -03:00
|
|
|
<div>
|
2021-12-08 12:15:39 -03:00
|
|
|
<Head title="Create User" />
|
2021-12-08 14:52:56 -03:00
|
|
|
<h1 class="mb-8 text-3xl font-bold">
|
2021-12-08 12:15:39 -03:00
|
|
|
<Link class="text-indigo-400 hover:text-indigo-600" href="/users">Users</Link>
|
2019-05-19 00:11:22 -03:00
|
|
|
<span class="text-indigo-400 font-medium">/</span> Create
|
2019-03-18 08:53:00 -03:00
|
|
|
</h1>
|
2021-12-08 14:52:56 -03:00
|
|
|
<div class="max-w-3xl bg-white rounded-md shadow overflow-hidden">
|
2021-02-27 09:58:58 -03:00
|
|
|
<form @submit.prevent="store">
|
2021-12-08 14:52:56 -03:00
|
|
|
<div class="flex flex-wrap -mb-8 -mr-6 p-8">
|
|
|
|
<text-input v-model="form.first_name" :error="form.errors.first_name" class="pb-8 pr-6 w-full lg:w-1/2" label="First name" />
|
|
|
|
<text-input v-model="form.last_name" :error="form.errors.last_name" class="pb-8 pr-6 w-full lg:w-1/2" label="Last name" />
|
|
|
|
<text-input v-model="form.email" :error="form.errors.email" class="pb-8 pr-6 w-full lg:w-1/2" label="Email" />
|
|
|
|
<text-input v-model="form.password" :error="form.errors.password" class="pb-8 pr-6 w-full lg:w-1/2" type="password" autocomplete="new-password" label="Password" />
|
|
|
|
<select-input v-model="form.owner" :error="form.errors.owner" class="pb-8 pr-6 w-full lg:w-1/2" label="Owner">
|
2019-03-18 08:53:00 -03:00
|
|
|
<option :value="true">Yes</option>
|
|
|
|
<option :value="false">No</option>
|
|
|
|
</select-input>
|
2021-12-08 14:52:56 -03:00
|
|
|
<file-input v-model="form.photo" :error="form.errors.photo" class="pb-8 pr-6 w-full lg:w-1/2" type="file" accept="image/*" label="Photo" />
|
2019-03-18 08:53:00 -03:00
|
|
|
</div>
|
2021-12-08 14:52:56 -03:00
|
|
|
<div class="flex items-center justify-end px-8 py-4 bg-gray-50 border-t border-gray-100">
|
2020-12-22 15:37:51 -03:00
|
|
|
<loading-button :loading="form.processing" class="btn-indigo" type="submit">Create User</loading-button>
|
2019-03-18 08:53:00 -03:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2019-09-28 08:30:44 -03:00
|
|
|
</div>
|
2019-03-18 08:53:00 -03:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-12-08 12:15:39 -03:00
|
|
|
import { Head, Link } from '@inertiajs/inertia-vue3'
|
2019-03-18 08:53:00 -03:00
|
|
|
import Layout from '@/Shared/Layout'
|
2019-08-09 12:33:47 -03:00
|
|
|
import FileInput from '@/Shared/FileInput'
|
2021-02-27 11:00:09 -03:00
|
|
|
import TextInput from '@/Shared/TextInput'
|
|
|
|
import SelectInput from '@/Shared/SelectInput'
|
|
|
|
import LoadingButton from '@/Shared/LoadingButton'
|
2019-03-18 08:53:00 -03:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2021-02-27 11:00:09 -03:00
|
|
|
FileInput,
|
2021-12-08 12:15:39 -03:00
|
|
|
Head,
|
|
|
|
Link,
|
2019-03-18 08:53:00 -03:00
|
|
|
LoadingButton,
|
|
|
|
SelectInput,
|
|
|
|
TextInput,
|
|
|
|
},
|
2021-02-27 11:00:09 -03:00
|
|
|
layout: Layout,
|
2019-04-24 15:45:13 -03:00
|
|
|
remember: 'form',
|
2019-03-18 08:53:00 -03:00
|
|
|
data() {
|
|
|
|
return {
|
2020-12-22 15:37:51 -03:00
|
|
|
form: this.$inertia.form({
|
2021-12-08 14:40:19 -03:00
|
|
|
first_name: '',
|
|
|
|
last_name: '',
|
|
|
|
email: '',
|
|
|
|
password: '',
|
2019-04-22 12:07:35 -03:00
|
|
|
owner: false,
|
2019-08-09 13:50:45 -03:00
|
|
|
photo: null,
|
2020-12-22 15:37:51 -03:00
|
|
|
}),
|
2019-03-18 08:53:00 -03:00
|
|
|
}
|
|
|
|
},
|
2021-02-27 09:58:58 -03:00
|
|
|
methods: {
|
|
|
|
store() {
|
2021-12-08 12:15:39 -03:00
|
|
|
this.form.post('/users')
|
2021-02-27 09:58:58 -03:00
|
|
|
},
|
|
|
|
},
|
2019-03-18 08:53:00 -03:00
|
|
|
}
|
|
|
|
</script>
|