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 Contact" />
|
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="/contacts">Contacts</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" />
|
|
|
|
<select-input v-model="form.organization_id" :error="form.errors.organization_id" class="pb-8 pr-6 w-full lg:w-1/2" label="Organization">
|
2019-03-18 08:53:00 -03:00
|
|
|
<option :value="null" />
|
|
|
|
<option v-for="organization in organizations" :key="organization.id" :value="organization.id">{{ organization.name }}</option>
|
|
|
|
</select-input>
|
2021-12-08 14:52:56 -03:00
|
|
|
<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.phone" :error="form.errors.phone" class="pb-8 pr-6 w-full lg:w-1/2" label="Phone" />
|
|
|
|
<text-input v-model="form.address" :error="form.errors.address" class="pb-8 pr-6 w-full lg:w-1/2" label="Address" />
|
|
|
|
<text-input v-model="form.city" :error="form.errors.city" class="pb-8 pr-6 w-full lg:w-1/2" label="City" />
|
|
|
|
<text-input v-model="form.region" :error="form.errors.region" class="pb-8 pr-6 w-full lg:w-1/2" label="Province/State" />
|
|
|
|
<select-input v-model="form.country" :error="form.errors.country" class="pb-8 pr-6 w-full lg:w-1/2" label="Country">
|
2019-03-18 08:53:00 -03:00
|
|
|
<option :value="null" />
|
|
|
|
<option value="CA">Canada</option>
|
|
|
|
<option value="US">United States</option>
|
|
|
|
</select-input>
|
2021-12-08 14:52:56 -03:00
|
|
|
<text-input v-model="form.postal_code" :error="form.errors.postal_code" class="pb-8 pr-6 w-full lg:w-1/2" label="Postal code" />
|
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:22:30 -03:00
|
|
|
<loading-button :loading="form.processing" class="btn-indigo" type="submit">Create Contact</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'
|
|
|
|
import TextInput from '@/Shared/TextInput'
|
2021-02-27 11:00:09 -03:00
|
|
|
import SelectInput from '@/Shared/SelectInput'
|
|
|
|
import LoadingButton from '@/Shared/LoadingButton'
|
2019-03-18 08:53:00 -03:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
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-03-18 08:53:00 -03:00
|
|
|
props: {
|
|
|
|
organizations: Array,
|
|
|
|
},
|
2019-04-24 15:45:13 -03:00
|
|
|
remember: 'form',
|
2019-03-18 08:53:00 -03:00
|
|
|
data() {
|
|
|
|
return {
|
2020-12-22 15:22:30 -03:00
|
|
|
form: this.$inertia.form({
|
2021-12-08 14:40:19 -03:00
|
|
|
first_name: '',
|
|
|
|
last_name: '',
|
2019-03-18 08:53:00 -03:00
|
|
|
organization_id: null,
|
2021-12-08 14:40:19 -03:00
|
|
|
email: '',
|
|
|
|
phone: '',
|
|
|
|
address: '',
|
|
|
|
city: '',
|
|
|
|
region: '',
|
|
|
|
country: '',
|
|
|
|
postal_code: '',
|
2020-12-22 15:22:30 -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('/contacts')
|
2021-02-27 09:58:58 -03:00
|
|
|
},
|
|
|
|
},
|
2019-03-18 08:53:00 -03:00
|
|
|
}
|
|
|
|
</script>
|