201 lines
7.1 KiB
Vue
201 lines
7.1 KiB
Vue
<script setup>
|
|
import Drawer from '@/Components/Drawer.vue';
|
|
import PrimaryButton from '@/Components/PrimaryButton.vue';
|
|
import InputLabel from '@/Components/InputLabel.vue';
|
|
import TextInput from '@/Components/TextInput.vue';
|
|
import { useForm } from '@inertiajs/vue3';
|
|
import SectionTitle from '@/Components/SectionTitle.vue';
|
|
import ActionMessage from '@/Components/ActionMessage.vue';
|
|
|
|
const props = defineProps({
|
|
show: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
clientUuid: String
|
|
});
|
|
|
|
const emit = defineEmits(['close']);
|
|
|
|
const close = () => {
|
|
emit('close');
|
|
}
|
|
|
|
const Address = {
|
|
address: '',
|
|
country: '',
|
|
type_id: 1
|
|
}
|
|
|
|
const Phone = {
|
|
nu: '',
|
|
country_code: '00386',
|
|
type_id: 1
|
|
}
|
|
|
|
const Person = {
|
|
first_name: '',
|
|
last_name: '',
|
|
full_name: '',
|
|
tax_number: '',
|
|
social_security_number: '',
|
|
description: '',
|
|
address: Address,
|
|
phone: Phone
|
|
}
|
|
|
|
const formCreateCase = useForm({
|
|
client_uuid: props.clientUuid,
|
|
person: Person
|
|
});
|
|
|
|
const storeCase = () => {
|
|
formCreateCase.post(route('clientCase.store'), {
|
|
onSuccess: () => {
|
|
close();
|
|
formCreateCase.reset();
|
|
}
|
|
});
|
|
};
|
|
|
|
|
|
</script>
|
|
<template>
|
|
<Drawer
|
|
:show="show"
|
|
@close="close">
|
|
|
|
<template #title>Nova primer</template>
|
|
<template #content>
|
|
<form @submit.prevent="storeCase">
|
|
<SectionTitle class="border-b mb-4">
|
|
<template #title>
|
|
Oseba
|
|
</template>
|
|
</SectionTitle>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="fullname" value="Naziv"/>
|
|
<TextInput
|
|
id="fullname"
|
|
ref="fullnameInput"
|
|
v-model="formCreateCase.person.full_name"
|
|
type="text"
|
|
class="mt-1 block w-full"
|
|
autocomplete="full-name"
|
|
/>
|
|
</div>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="taxnumber" value="Davčna"/>
|
|
<TextInput
|
|
id="taxnumber"
|
|
ref="taxnumberInput"
|
|
v-model="formCreateCase.tax_number"
|
|
type="text"
|
|
class="mt-1 block w-full"
|
|
autocomplete="tax-number"
|
|
/>
|
|
</div>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="socialSecurityNumber" value="Matična / Emšo"/>
|
|
<TextInput
|
|
id="socialSecurityNumber"
|
|
ref="socialSecurityNumberInput"
|
|
v-model="formCreateCase.social_security_number"
|
|
type="text"
|
|
class="mt-1 block w-full"
|
|
autocomplete="social-security-number"
|
|
/>
|
|
</div>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="address" value="Naslov"/>
|
|
<TextInput
|
|
id="address"
|
|
ref="addressInput"
|
|
v-model="formCreateCase.person.address.address"
|
|
type="text"
|
|
class="mt-1 block w-full"
|
|
autocomplete="address"
|
|
/>
|
|
</div>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="addressCountry" value="Država"/>
|
|
<TextInput
|
|
id="addressCountry"
|
|
ref="addressCountryInput"
|
|
v-model="formCreateCase.person.address.country"
|
|
type="text"
|
|
class="mt-1 block w-full"
|
|
autocomplete="address-country"
|
|
/>
|
|
</div>
|
|
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="addressType" value="Vrsta naslova"/>
|
|
<select
|
|
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
|
|
id="addressType"
|
|
v-model="formCreateCase.person.address.type_id"
|
|
>
|
|
<option value="1">Stalni</option>
|
|
<option value="2">Začasni</option>
|
|
<!-- ... -->
|
|
</select>
|
|
</div>
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="phoneCountyCode" value="Koda države tel."/>
|
|
<select
|
|
class="block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm"
|
|
id="phoneCountyCode"
|
|
v-model="formCreateCase.person.phone.country_code"
|
|
>
|
|
<option value="00386">+386 (Slovenija)</option>
|
|
<option value="00385">+385 (Hrvaška)</option>
|
|
<option value="0039">+39 (Italija)</option>
|
|
<option value="0036">+39 (Madžarska)</option>
|
|
<option value="0043">+43 (Avstrija)</option>
|
|
<option value="00381">+381 (Srbija)</option>
|
|
<option value="00387">+387 (Bosna in Hercegovina)</option>
|
|
<option value="00382">+382 (Črna gora)</option>
|
|
<!-- ... -->
|
|
</select>
|
|
</div>
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="phoneNu" value="Telefonska št."/>
|
|
<TextInput
|
|
id="phoneNu"
|
|
ref="phoneNuInput"
|
|
v-model="formCreateCase.person.phone.nu"
|
|
type="text"
|
|
class="mt-1 block w-full"
|
|
autocomplete="phone-nu"
|
|
/>
|
|
</div>
|
|
<div class="col-span-6 sm:col-span-4">
|
|
<InputLabel for="description" value="Opis"/>
|
|
<TextInput
|
|
id="description"
|
|
ref="descriptionInput"
|
|
v-model="formCreateCase.description"
|
|
type="text"
|
|
class="mt-1 block w-full"
|
|
autocomplete="description"
|
|
/>
|
|
</div>
|
|
<div class="flex justify-end mt-4">
|
|
<ActionMessage :on="formCreateCase.recentlySuccessful" class="me-3">
|
|
Shranjeno.
|
|
</ActionMessage>
|
|
|
|
<PrimaryButton :class="{ 'opacity-25': formCreateCase.processing }" :disabled="formCreateCase.processing">
|
|
Shrani
|
|
</PrimaryButton>
|
|
</div>
|
|
</form>
|
|
</template>
|
|
</Drawer>
|
|
</template> |