This commit is contained in:
EwelinaLasowy 2022-01-18 10:54:34 +01:00
parent e883b8c9b7
commit f9c9c7b873

View File

@ -59,35 +59,59 @@
</p> </p>
</div> </div>
</div> </div>
<div class="sm:grid sm:grid-cols-3 py-4 items-center"> <div>
<label <Listbox
for="employment_form" v-model="form.employmentForm"
class="block text-sm font-medium text-gray-700 sm:mt-px" as="div"
class="sm:grid sm:grid-cols-3 py-4 items-center"
> >
Forma zatrudnienia <ListboxLabel class="block text-sm font-medium text-gray-700">
</label> Forma zatrudnienia
<div class="mt-1 sm:mt-0 sm:col-span-2"> </ListboxLabel>
<select <div class="mt-1 relative sm:mt-0 sm:col-span-2">
id="employment_form" <ListboxButton class="bg-white relative w-full max-w-lg border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm">
v-model="form.employmentForm" <span class="block truncate">{{ form.employmentForm }}</span>
class="block w-full max-w-lg shadow-sm rounded-md sm:text-sm" <span class="absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none">
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors.employmentForm, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors.employmentForm }" <SelectorIcon
> class="h-5 w-5 text-gray-400"
<option aria-hidden="true"
v-for="employmentForm in employmentForms" />
:key="employmentForm.value" </span>
:value="employmentForm.value" </ListboxButton>
<transition
leave-active-class="transition ease-in duration-100"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
> >
{{ employmentForm.label }} <ListboxOptions class="absolute z-10 mt-1 w-full max-w-lg bg-white shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm">
</option> <ListboxOption
</select> v-for="employmentForm in employmentForms"
<p :key="employmentForm.value"
v-if="form.errors.employmentForm" v-slot="{ active, selected }"
class="mt-2 text-sm text-red-600" as="template"
> :value="employmentForm.value"
{{ form.errors.employmentForm }} >
</p> <li :class="[active ? 'text-white bg-blumilk-600' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']">
</div> <span :class="[selected ? 'font-semibold' : 'font-normal', 'block truncate']">
{{ employmentForm.label }}
</span>
<span
v-if="selected"
:class="[active ? 'text-white' : 'text-blumilk-600', 'absolute inset-y-0 right-0 flex items-center pr-4']"
>
<CheckIcon
class="h-5 w-5"
aria-hidden="true"
/>
</span>
</li>
</ListboxOption>
</ListboxOptions>
</transition>
</div>
</Listbox>
</div> </div>
<div class="sm:grid sm:grid-cols-3 py-4 items-center"> <div class="sm:grid sm:grid-cols-3 py-4 items-center">
<label <label
@ -134,13 +158,22 @@
</template> </template>
<script> <script>
import {useForm} from '@inertiajs/inertia-vue3'; import { useForm } from '@inertiajs/inertia-vue3';
import FlatPickr from 'vue-flatpickr-component'; import FlatPickr from 'vue-flatpickr-component';
import { Listbox, ListboxButton, ListboxLabel, ListboxOption, ListboxOptions } from '@headlessui/vue';
import { CheckIcon, SelectorIcon } from '@heroicons/vue/solid';
export default { export default {
employmentDate: 'UserCreate', employmentDate: 'UserCreate',
components: { components: {
FlatPickr, FlatPickr,
Listbox,
ListboxButton,
ListboxLabel,
ListboxOption,
ListboxOptions,
CheckIcon,
SelectorIcon,
}, },
props: { props: {
employmentForms: { employmentForms: {