* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * lint fixes * missing empty lines * translations * fix vue version * #134 - fixes * fix * fix * #134 - fix * fix * fix * #134 - added tests * #134 - fix to translations * #134 - tests * #134 - fix * Update database/factories/ResumeFactory.php Co-authored-by: Krzysztof Rewak <krzysztof.rewak@gmail.com> * #134 - fix * #134 - fix Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl> Co-authored-by: Krzysztof Rewak <krzysztof.rewak@gmail.com>
This commit is contained in:
647
resources/js/Pages/Resumes/Create.vue
Normal file
647
resources/js/Pages/Resumes/Create.vue
Normal file
@@ -0,0 +1,647 @@
|
||||
<template>
|
||||
<InertiaHead title="Dodawanie CV" />
|
||||
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
|
||||
<div class="p-4 sm:px-6">
|
||||
<h2 class="text-lg font-medium leading-6 text-gray-900">
|
||||
Dodaj CV
|
||||
</h2>
|
||||
</div>
|
||||
<form
|
||||
class="flex flex-col justify-center py-8 px-6 space-y-8 border-t border-gray-200"
|
||||
@submit.prevent="submitResume"
|
||||
>
|
||||
<div class="space-y-8 sm:space-y-5">
|
||||
<div>
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900">
|
||||
Dane podstawowe
|
||||
</h3>
|
||||
<div class="grid grid-cols-2 gap-8 py-4">
|
||||
<Listbox
|
||||
v-model="form.user"
|
||||
as="div"
|
||||
>
|
||||
<ListboxLabel class="block text-sm font-medium text-gray-700">
|
||||
Użytkownik
|
||||
</ListboxLabel>
|
||||
<div class="relative mt-2">
|
||||
<ListboxButton
|
||||
class="relative py-2 pr-10 pl-3 w-full max-w-md h-10 text-left bg-white rounded-md border border-gray-300 focus:border-blumilk-500 focus:outline-none focus:ring-1 focus:ring-blumilk-500 shadow-sm cursor-default sm:text-sm"
|
||||
>
|
||||
<span v-if="form.user === null">
|
||||
Nie istnieje w bazie
|
||||
</span>
|
||||
<span
|
||||
v-else
|
||||
class="flex items-center"
|
||||
>
|
||||
<img
|
||||
:src="form.user.avatar"
|
||||
class="shrink-0 w-6 h-6 rounded-full"
|
||||
>
|
||||
<span class="block ml-3 truncate">{{ form.user.name }}</span>
|
||||
</span>
|
||||
<span class="flex absolute inset-y-0 right-0 items-center pr-2 pointer-events-none">
|
||||
<SelectorIcon class="w-5 h-5 text-gray-400" />
|
||||
</span>
|
||||
</ListboxButton>
|
||||
|
||||
<transition
|
||||
leave-active-class="transition ease-in duration-100"
|
||||
leave-from-class="opacity-100"
|
||||
leave-to-class="opacity-0"
|
||||
>
|
||||
<ListboxOptions
|
||||
class="overflow-auto absolute z-10 py-1 mt-1 w-full max-w-lg max-h-60 text-base bg-white rounded-md focus:outline-none ring-1 ring-black ring-opacity-5 shadow-lg sm:text-sm"
|
||||
>
|
||||
<ListboxOption
|
||||
v-slot="{ active }"
|
||||
as="template"
|
||||
:value="null"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
Nie istnieje w bazie
|
||||
</div>
|
||||
|
||||
<span
|
||||
v-if="form.user === null"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
</li>
|
||||
</ListboxOption>
|
||||
<ListboxOption
|
||||
v-for="user in users.data"
|
||||
:key="user.id"
|
||||
v-slot="{ active }"
|
||||
as="template"
|
||||
:value="user"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<img
|
||||
:src="user.avatar"
|
||||
class="shrink-0 w-6 h-6 rounded-full"
|
||||
>
|
||||
<span
|
||||
:class="[form.user?.id === user.id ? 'font-semibold' : 'font-normal', 'ml-3 block truncate']"
|
||||
>
|
||||
{{ user.name }}
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
v-if="form.user?.id === user.id"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
</li>
|
||||
</ListboxOption>
|
||||
</ListboxOptions>
|
||||
</transition>
|
||||
</div>
|
||||
</Listbox>
|
||||
<div v-if="form.user === null">
|
||||
<label
|
||||
for="name"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Imię i nazwisko
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<input
|
||||
id="name"
|
||||
v-model="form.name"
|
||||
type="text"
|
||||
class="block w-full max-w-md rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors.name, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors.name }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors.name"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DynamicSection
|
||||
v-model="form.educations"
|
||||
header="Edukacja"
|
||||
add-label="Dodaj szkołę"
|
||||
@add-item="addEducation"
|
||||
@remove-item="(index) => form.educations.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('education', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
{{ element.school ? element.school : '(Nieokreślony)' }}
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Szkoła
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<input
|
||||
v-model="element.school"
|
||||
type="text"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.school`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.school`] }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.school`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.school`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Stopień
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<input
|
||||
v-model="element.degree"
|
||||
type="text"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.degree`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.degree`] }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.degree`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.degree`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Kierunek/Specjalizacja
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<input
|
||||
v-model="element.fieldOfStudy"
|
||||
type="text"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.fieldOfStudy`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.fieldOfStudy`] }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.fieldOfStudy`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.fieldOfStudy`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Data rozpoczęcia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<MonthPicker
|
||||
v-model="element.startDate"
|
||||
placeholder="Wybierz datę"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.startDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.startDate`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.startDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.startDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Data zakończenia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<div class="space-y-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
<input
|
||||
v-model="element.current"
|
||||
type="checkbox"
|
||||
class="focus:ring-blumilk-500 h-4 w-4 text-blumilk-600 border-gray-300 rounded mr-1"
|
||||
>
|
||||
W trakcie
|
||||
</label>
|
||||
<MonthPicker
|
||||
v-model="element.endDate"
|
||||
placeholder="Wybierz datę"
|
||||
:disabled="element.current"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm disabled:bg-gray-100"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.endDate`] }"
|
||||
/>
|
||||
</div>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.endDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.endDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<DynamicSection
|
||||
v-model="form.languages"
|
||||
header="Języki"
|
||||
add-label="Dodaj język"
|
||||
@add-item="addLanguage"
|
||||
@remove-item="(index) => form.languages.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('languages', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
<template v-if="element.name">
|
||||
{{ element.name }} - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
(Nieokreślony)
|
||||
</template>
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="gap-4 md:grid md:grid-cols-2 ">
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`language-${index}-level`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Język
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<Combobox
|
||||
:id="`language-${index}-level`"
|
||||
v-model="element.name"
|
||||
:items="languages"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`languages.${index}.name`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`languages.${index}.name`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`language-level-${index}`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Poziom - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<LevelPicker
|
||||
v-model.number="element.level"
|
||||
:levels="languageLevels"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`languages.${index}.level`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`languages.${index}.level`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<DynamicSection
|
||||
v-model="form.technologies"
|
||||
header="Technologie"
|
||||
add-label="Dodaj technologię"
|
||||
@add-item="addTechnology"
|
||||
@remove-item="(index) => form.technologies.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('technologies', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
<template v-if="element.name">
|
||||
{{ element.name }} - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
(Nieokreślony)
|
||||
</template>
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="gap-4 md:grid md:grid-cols-2 ">
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`technology-${index}-level`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Technologia
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<Combobox
|
||||
:id="`technology-${index}-level`"
|
||||
v-model="element.name"
|
||||
:items="technologies"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`technologies.${index}.name`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`technologies.${index}.name`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`technology-level-${index}`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Poziom - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<LevelPicker
|
||||
v-model.number="element.level"
|
||||
:levels="technologyLevels"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`technologies.${index}.level`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`technologies.${index}.level`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<DynamicSection
|
||||
v-model="form.projects"
|
||||
header="Projekty"
|
||||
add-label="Dodaj projekt"
|
||||
@add-item="addProject"
|
||||
@remove-item="(index) => form.projects.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('projects', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
{{ element.description ? element.description : '(Nieokreślony)' }}
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-description-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Opis projektu
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<textarea
|
||||
:id="`project-description-${index}`"
|
||||
v-model="element.description"
|
||||
rows="5"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.description`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.description`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.description`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.description`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-technologies-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Technologie
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<MultipleCombobox
|
||||
:id="`project-technologies-${index}`"
|
||||
v-model="element.technologies"
|
||||
:items="technologies"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.technologies`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.technologies`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-startDate-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Data rozpoczęcia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<MonthPicker
|
||||
:id="`project-startDate-${index}`"
|
||||
v-model="element.startDate"
|
||||
placeholder="Wybierz datę"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.startDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.startDate`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.startDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.startDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-endDate-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Data zakończenia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<div class="space-y-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
<input
|
||||
v-model="element.current"
|
||||
type="checkbox"
|
||||
class="focus:ring-blumilk-500 h-4 w-4 text-blumilk-600 border-gray-300 rounded mr-1"
|
||||
>
|
||||
W trakcie
|
||||
</label>
|
||||
<MonthPicker
|
||||
:id="`project-endDate-${index}`"
|
||||
v-model="element.endDate"
|
||||
placeholder="Wybierz datę"
|
||||
:disabled="element.current"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm disabled:bg-gray-100"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.endDate`] }"
|
||||
/>
|
||||
</div>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.endDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.endDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-tasks-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Zadania
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<textarea
|
||||
:id="`project-tasks-${index}`"
|
||||
v-model="element.tasks"
|
||||
rows="5"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.tasks`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.tasks`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.tasks`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.tasks`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<div class="pt-5">
|
||||
<div class="flex justify-end">
|
||||
<InertiaLink
|
||||
href="/resumes"
|
||||
class="py-2 px-4 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 rounded-md border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
|
||||
>
|
||||
Anuluj
|
||||
</InertiaLink>
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex justify-center py-2 px-4 ml-3 text-sm font-medium text-white bg-blumilk-600 hover:bg-blumilk-700 rounded-md border border-transparent focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
|
||||
>
|
||||
Zapisz
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Listbox, ListboxOption, ListboxOptions, ListboxLabel, ListboxButton } from '@headlessui/vue'
|
||||
import { SelectorIcon, CheckIcon } from '@heroicons/vue/outline'
|
||||
import { ExclamationCircleIcon } from '@heroicons/vue/solid'
|
||||
import { useForm } from '@inertiajs/inertia-vue3'
|
||||
import MonthPicker from '@/Shared/Forms/MonthPicker'
|
||||
import DynamicSection from '@/Shared/Forms/DynamicSection'
|
||||
import Combobox from '@/Shared/Forms/Combobox'
|
||||
import MultipleCombobox from '@/Shared/Forms/MultipleCombobox'
|
||||
import LevelPicker from '@/Shared/Forms/LevelPicker'
|
||||
import useLevels from '@/Composables/useLevels'
|
||||
|
||||
const props = defineProps({
|
||||
users: Object,
|
||||
technologies: Array,
|
||||
})
|
||||
|
||||
const { technologyLevels, languageLevels } = useLevels()
|
||||
|
||||
const languages = [
|
||||
'Polish',
|
||||
'English',
|
||||
'German',
|
||||
]
|
||||
|
||||
const form = useForm('createResume',{
|
||||
user: props.users.data[0],
|
||||
name: null,
|
||||
educations: [],
|
||||
projects: [],
|
||||
technologies: [],
|
||||
languages: [],
|
||||
})
|
||||
|
||||
function addProject() {
|
||||
form.projects.push({
|
||||
description: null,
|
||||
technologies: [],
|
||||
tasks: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
current: false,
|
||||
})
|
||||
}
|
||||
|
||||
function addTechnology() {
|
||||
form.technologies.push({
|
||||
name: null,
|
||||
level: technologyLevels[0],
|
||||
})
|
||||
}
|
||||
|
||||
function addEducation() {
|
||||
form.educations.push({
|
||||
school: null,
|
||||
degree: null,
|
||||
fieldOfStudy: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
current: false,
|
||||
})
|
||||
}
|
||||
|
||||
function addLanguage() {
|
||||
form.languages.push({
|
||||
name: null,
|
||||
level: languageLevels[0],
|
||||
})
|
||||
}
|
||||
|
||||
function hasAnyErrorInSection(section, index) {
|
||||
return Object
|
||||
.keys(form.errors)
|
||||
.some((error) => error.startsWith(`${section}.${index}.`))
|
||||
}
|
||||
|
||||
function submitResume() {
|
||||
form
|
||||
.transform((data) => ({
|
||||
user: data.user?.id,
|
||||
name: data.name,
|
||||
education: data.educations.map(education => ({
|
||||
...education,
|
||||
current: !!education.current,
|
||||
endDate: education.current ? null: education.endDate,
|
||||
})),
|
||||
languages: data.languages.map(language => ({
|
||||
name: language.name,
|
||||
level: language.level.level,
|
||||
})),
|
||||
technologies: data.technologies.map(technology => ({
|
||||
name: technology.name,
|
||||
level: technology.level.level,
|
||||
})),
|
||||
projects: data.projects.map(project => ({
|
||||
...project,
|
||||
current: !!project.current,
|
||||
endDate: project.current ? null : project.endDate,
|
||||
})),
|
||||
}))
|
||||
.post('/resumes')
|
||||
}
|
||||
</script>
|
654
resources/js/Pages/Resumes/Edit.vue
Normal file
654
resources/js/Pages/Resumes/Edit.vue
Normal file
@@ -0,0 +1,654 @@
|
||||
<template>
|
||||
<InertiaHead title="Edycja CV" />
|
||||
<div class="mx-auto w-full max-w-7xl bg-white shadow-md">
|
||||
<div class="p-4 sm:px-6">
|
||||
<h2 class="text-lg font-medium leading-6 text-gray-900">
|
||||
Edytuj CV
|
||||
</h2>
|
||||
</div>
|
||||
<form
|
||||
class="flex flex-col justify-center py-8 px-6 space-y-8 border-t border-gray-200"
|
||||
@submit.prevent="submitResume"
|
||||
>
|
||||
<div class="space-y-8 sm:space-y-5">
|
||||
<div>
|
||||
<h3 class="text-lg font-medium leading-6 text-gray-900">
|
||||
Dane podstawowe
|
||||
</h3>
|
||||
<div class="grid grid-cols-2 gap-8 py-4">
|
||||
<Listbox
|
||||
v-model="form.user"
|
||||
as="div"
|
||||
>
|
||||
<ListboxLabel class="block text-sm font-medium text-gray-700">
|
||||
Użytkownik
|
||||
</ListboxLabel>
|
||||
<div class="relative mt-2">
|
||||
<ListboxButton
|
||||
class="relative py-2 pr-10 pl-3 w-full max-w-md h-10 text-left bg-white rounded-md border border-gray-300 focus:border-blumilk-500 focus:outline-none focus:ring-1 focus:ring-blumilk-500 shadow-sm cursor-default sm:text-sm"
|
||||
>
|
||||
<span v-if="form.user === null">
|
||||
Nie istnieje w bazie
|
||||
</span>
|
||||
<span
|
||||
v-else
|
||||
class="flex items-center"
|
||||
>
|
||||
<img
|
||||
:src="form.user.avatar"
|
||||
class="shrink-0 w-6 h-6 rounded-full"
|
||||
>
|
||||
<span class="block ml-3 truncate">{{ form.user.name }}</span>
|
||||
</span>
|
||||
<span class="flex absolute inset-y-0 right-0 items-center pr-2 pointer-events-none">
|
||||
<SelectorIcon class="w-5 h-5 text-gray-400" />
|
||||
</span>
|
||||
</ListboxButton>
|
||||
|
||||
<transition
|
||||
leave-active-class="transition ease-in duration-100"
|
||||
leave-from-class="opacity-100"
|
||||
leave-to-class="opacity-0"
|
||||
>
|
||||
<ListboxOptions
|
||||
class="overflow-auto absolute z-10 py-1 mt-1 w-full max-w-lg max-h-60 text-base bg-white rounded-md focus:outline-none ring-1 ring-black ring-opacity-5 shadow-lg sm:text-sm"
|
||||
>
|
||||
<ListboxOption
|
||||
v-slot="{ active }"
|
||||
as="template"
|
||||
:value="null"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
Nie istnieje w bazie
|
||||
</div>
|
||||
|
||||
<span
|
||||
v-if="form.user === null"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
</li>
|
||||
</ListboxOption>
|
||||
<ListboxOption
|
||||
v-for="user in users.data"
|
||||
:key="user.id"
|
||||
v-slot="{ active }"
|
||||
as="template"
|
||||
:value="user"
|
||||
>
|
||||
<li
|
||||
:class="[active ? 'bg-gray-100' : 'text-gray-900', 'cursor-default select-none relative py-2 pl-3 pr-9']"
|
||||
>
|
||||
<div class="flex items-center">
|
||||
<img
|
||||
:src="user.avatar"
|
||||
class="shrink-0 w-6 h-6 rounded-full"
|
||||
>
|
||||
<span
|
||||
:class="[form.user?.id === user.id ? 'font-semibold' : 'font-normal', 'ml-3 block truncate']"
|
||||
>
|
||||
{{ user.name }}
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
v-if="form.user?.id === user.id"
|
||||
:class="['text-blumilk-600 absolute inset-y-0 right-0 flex items-center pr-4']"
|
||||
>
|
||||
<CheckIcon class="w-5 h-5" />
|
||||
</span>
|
||||
</li>
|
||||
</ListboxOption>
|
||||
</ListboxOptions>
|
||||
</transition>
|
||||
</div>
|
||||
</Listbox>
|
||||
<div v-if="form.user === null">
|
||||
<label
|
||||
for="name"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Imię i nazwisko
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<input
|
||||
id="name"
|
||||
v-model="form.name"
|
||||
type="text"
|
||||
class="block w-full max-w-md rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors.name, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors.name }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors.name"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DynamicSection
|
||||
v-model="form.educations"
|
||||
header="Edukacja"
|
||||
add-label="Dodaj szkołę"
|
||||
@add-item="addEducation"
|
||||
@remove-item="(index) => form.educations.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('education', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
{{ element.school ? element.school : '(Nieokreślony)' }}
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Szkoła
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<input
|
||||
v-model="element.school"
|
||||
type="text"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.school`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.school`] }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.school`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.school`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Stopień
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<input
|
||||
v-model="element.degree"
|
||||
type="text"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.degree`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.degree`] }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.degree`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.degree`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Kierunek/Specjalizacja
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<input
|
||||
v-model="element.fieldOfStudy"
|
||||
type="text"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.fieldOfStudy`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.fieldOfStudy`] }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.fieldOfStudy`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.fieldOfStudy`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Data rozpoczęcia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<MonthPicker
|
||||
v-model="element.startDate"
|
||||
placeholder="Wybierz datę"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.startDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.startDate`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.startDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.startDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
Data zakończenia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<div class="space-y-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
<input
|
||||
v-model="element.current"
|
||||
type="checkbox"
|
||||
class="focus:ring-blumilk-500 h-4 w-4 text-blumilk-600 border-gray-300 rounded mr-1"
|
||||
>
|
||||
W trakcie
|
||||
</label>
|
||||
<MonthPicker
|
||||
v-model="element.endDate"
|
||||
placeholder="Wybierz datę"
|
||||
:disabled="element.current"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm disabled:bg-gray-100"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`education.${index}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.endDate`] }"
|
||||
/>
|
||||
</div>
|
||||
<p
|
||||
v-if="form.errors[`education.${index}.endDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`education.${index}.endDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<DynamicSection
|
||||
v-model="form.languages"
|
||||
header="Języki"
|
||||
add-label="Dodaj język"
|
||||
@add-item="addLanguage"
|
||||
@remove-item="(index) => form.languages.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('languages', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
<template v-if="element.name">
|
||||
{{ element.name }} - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
(Nieokreślony)
|
||||
</template>
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="gap-4 md:grid md:grid-cols-2 ">
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`language-${index}-level`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Język
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<Combobox
|
||||
:id="`language-${index}-level`"
|
||||
v-model="element.name"
|
||||
:items="languages"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`languages.${index}.name`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`languages.${index}.name`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`language-level-${index}`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Poziom - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<LevelPicker
|
||||
v-model.number="element.level"
|
||||
:levels="languageLevels"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`languages.${index}.level`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`languages.${index}.level`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<DynamicSection
|
||||
v-model="form.technologies"
|
||||
header="Technologie"
|
||||
add-label="Dodaj technologię"
|
||||
@add-item="addTechnology"
|
||||
@remove-item="(index) => form.technologies.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('technologies', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
<template v-if="element.name">
|
||||
{{ element.name }} - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</template>
|
||||
<template v-else>
|
||||
(Nieokreślony)
|
||||
</template>
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="gap-4 md:grid md:grid-cols-2 ">
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`technology-${index}-level`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Technologia
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<Combobox
|
||||
:id="`technology-${index}-level`"
|
||||
v-model="element.name"
|
||||
:items="technologies"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`technologies.${index}.name`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`technologies.${index}.name`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-4">
|
||||
<label
|
||||
:for="`technology-level-${index}`"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>
|
||||
Poziom - <span :class="element.level.textColor">{{ element.level.name }}</span>
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<LevelPicker
|
||||
v-model.number="element.level"
|
||||
:levels="technologyLevels"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`technologies.${index}.level`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`technologies.${index}.level`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<DynamicSection
|
||||
v-model="form.projects"
|
||||
header="Projekty"
|
||||
add-label="Dodaj projekt"
|
||||
@add-item="addProject"
|
||||
@remove-item="(index) => form.projects.splice(index, 1)"
|
||||
>
|
||||
<template #itemHeader="{ element, index }">
|
||||
<template v-if="hasAnyErrorInSection('projects', index)">
|
||||
<ExclamationCircleIcon class="h-6 w-6 mr-2 text-red-600 inline-block" />
|
||||
</template>
|
||||
{{ element.description ? element.description : '(Nieokreślony)' }}
|
||||
</template>
|
||||
<template #form="{ element, index }">
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-description-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Opis projektu
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<textarea
|
||||
:id="`project-description-${index}`"
|
||||
v-model="element.description"
|
||||
rows="5"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.description`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.description`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.description`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.description`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-technologies-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Technologie
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<MultipleCombobox
|
||||
:id="`project-technologies-${index}`"
|
||||
v-model="element.technologies"
|
||||
:items="technologies"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.technologies`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.technologies`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-startDate-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Data rozpoczęcia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<MonthPicker
|
||||
:id="`project-startDate-${index}`"
|
||||
v-model="element.startDate"
|
||||
placeholder="Wybierz datę"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.startDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.startDate`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.startDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.startDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-endDate-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Data zakończenia
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<div class="space-y-2">
|
||||
<label class="block text-sm font-medium text-gray-700 sm:mt-px">
|
||||
<input
|
||||
v-model="element.current"
|
||||
type="checkbox"
|
||||
class="focus:ring-blumilk-500 h-4 w-4 text-blumilk-600 border-gray-300 rounded mr-1"
|
||||
>
|
||||
W trakcie
|
||||
</label>
|
||||
<MonthPicker
|
||||
:id="`project-endDate-${index}`"
|
||||
v-model="element.endDate"
|
||||
placeholder="Wybierz datę"
|
||||
:disabled="element.current"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm disabled:bg-gray-100"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.endDate`] }"
|
||||
/>
|
||||
</div>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.endDate`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.endDate`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="items-center py-4 sm:grid sm:grid-cols-2">
|
||||
<label
|
||||
:for="`project-tasks-${index}`"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Zadania
|
||||
</label>
|
||||
<div class="mt-1 sm:mt-0">
|
||||
<textarea
|
||||
:id="`project-tasks-${index}`"
|
||||
v-model="element.tasks"
|
||||
rows="5"
|
||||
class="block w-full rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors[`projects.${index}.tasks`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.tasks`] }"
|
||||
/>
|
||||
<p
|
||||
v-if="form.errors[`projects.${index}.tasks`]"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors[`projects.${index}.tasks`] }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</DynamicSection>
|
||||
<div class="pt-5">
|
||||
<div class="flex justify-end">
|
||||
<InertiaLink
|
||||
href="/resumes"
|
||||
class="py-2 px-4 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 rounded-md border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
|
||||
>
|
||||
Anuluj
|
||||
</InertiaLink>
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex justify-center py-2 px-4 ml-3 text-sm font-medium text-white bg-blumilk-600 hover:bg-blumilk-700 rounded-md border border-transparent focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
|
||||
>
|
||||
Zapisz
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Listbox, ListboxOption, ListboxOptions, ListboxLabel, ListboxButton } from '@headlessui/vue'
|
||||
import { SelectorIcon, CheckIcon } from '@heroicons/vue/outline'
|
||||
import { ExclamationCircleIcon } from '@heroicons/vue/solid'
|
||||
import { useForm } from '@inertiajs/inertia-vue3'
|
||||
import MonthPicker from '@/Shared/Forms/MonthPicker'
|
||||
import DynamicSection from '@/Shared/Forms/DynamicSection'
|
||||
import Combobox from '@/Shared/Forms/Combobox'
|
||||
import MultipleCombobox from '@/Shared/Forms/MultipleCombobox'
|
||||
import LevelPicker from '@/Shared/Forms/LevelPicker'
|
||||
import useLevels from '@/Composables/useLevels'
|
||||
|
||||
const props = defineProps({
|
||||
users: Object,
|
||||
technologies: Array,
|
||||
resume: Object,
|
||||
})
|
||||
|
||||
const { technologyLevels, languageLevels } = useLevels()
|
||||
|
||||
const languages = [
|
||||
'Polish',
|
||||
'English',
|
||||
'German',
|
||||
]
|
||||
|
||||
const form = useForm(`EditResume:${props.resume.id}`,{
|
||||
user: props.users.data.find((user) => user.id === props.resume.user) ?? null,
|
||||
name: props.resume.name ?? null ,
|
||||
educations: props.resume.education ?? [],
|
||||
projects: props.resume.projects ?? [],
|
||||
technologies: props.resume.technologies.map((technology) => ({
|
||||
name: technology.name,
|
||||
level: technologyLevels.find((level) => level.level === technology.level),
|
||||
})) ?? [],
|
||||
languages: props.resume.languages.map((language) => ({
|
||||
name: language.name,
|
||||
level: languageLevels.find((level) => level.level === language.level),
|
||||
})) ?? [],
|
||||
})
|
||||
|
||||
function addProject() {
|
||||
form.projects.push({
|
||||
description: null,
|
||||
technologies: [],
|
||||
tasks: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
current: false,
|
||||
})
|
||||
}
|
||||
|
||||
function addTechnology() {
|
||||
form.technologies.push({
|
||||
name: null,
|
||||
level: technologyLevels[0],
|
||||
})
|
||||
}
|
||||
|
||||
function addEducation() {
|
||||
form.educations.push({
|
||||
school: null,
|
||||
degree: null,
|
||||
fieldOfStudy: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
current: false,
|
||||
})
|
||||
}
|
||||
|
||||
function addLanguage() {
|
||||
form.languages.push({
|
||||
name: null,
|
||||
level: languageLevels[0],
|
||||
})
|
||||
}
|
||||
|
||||
function hasAnyErrorInSection(section, index) {
|
||||
return Object
|
||||
.keys(form.errors)
|
||||
.some((error) => error.startsWith(`${section}.${index}.`))
|
||||
}
|
||||
|
||||
function submitResume() {
|
||||
form
|
||||
.transform((data) => ({
|
||||
user: data.user?.id,
|
||||
name: data.name,
|
||||
education: data.educations.map(education => ({
|
||||
...education,
|
||||
current: !!education.current,
|
||||
endDate: education.current ? null: education.endDate,
|
||||
})),
|
||||
languages: data.languages.map(language => ({
|
||||
name: language.name,
|
||||
level: language.level.level,
|
||||
})),
|
||||
technologies: data.technologies.map(technology => ({
|
||||
name: technology.name,
|
||||
level: technology.level.level,
|
||||
})),
|
||||
projects: data.projects.map(project => ({
|
||||
...project,
|
||||
current: !!project.current,
|
||||
endDate: project.current ? null : project.endDate,
|
||||
})),
|
||||
}))
|
||||
.put(`/resumes/${props.resume.id}`)
|
||||
}
|
||||
</script>
|
199
resources/js/Pages/Resumes/Index.vue
Normal file
199
resources/js/Pages/Resumes/Index.vue
Normal file
@@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<InertiaHead title="CV" />
|
||||
<div class="bg-white shadow-md">
|
||||
<div class="flex justify-between items-center p-4 sm:px-6">
|
||||
<h2 class="text-lg font-medium leading-6 text-gray-900">
|
||||
Lista CV
|
||||
</h2>
|
||||
<div>
|
||||
<InertiaLink
|
||||
href="resumes/create"
|
||||
class="inline-flex items-center py-3 px-4 text-sm font-medium leading-4 text-white bg-blumilk-600 hover:bg-blumilk-700 rounded-md border border-transparent focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
|
||||
>
|
||||
Dodaj CV
|
||||
</InertiaLink>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-t border-gray-200">
|
||||
<div class="overflow-auto xl:overflow-visible">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Użytkownik
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Data utworzenia
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Data aktualizacji
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Szkoły
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Języki
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Technologie
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Projekty
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
/>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-100">
|
||||
<tr
|
||||
v-for="resume in resumes.data"
|
||||
:key="resume.id"
|
||||
class="hover:bg-blumilk-25"
|
||||
>
|
||||
<td class="p-4 text-sm text-gray-500 whitespace-nowrap">
|
||||
<div
|
||||
v-if="resume.user"
|
||||
class="flex"
|
||||
>
|
||||
<span class="inline-flex justify-center items-center w-10 h-10 rounded-full">
|
||||
<img
|
||||
class="w-10 h-10 rounded-full"
|
||||
:src="resume.user.avatar"
|
||||
>
|
||||
</span>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm font-medium text-gray-900 break-all">
|
||||
{{ resume.user.name }}
|
||||
</p>
|
||||
<p class="text-sm text-gray-500 break-all">
|
||||
{{ resume.user.email }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<template v-else>
|
||||
<span class="text-sm font-medium text-gray-900 break-all">{{ resume.name }}</span>
|
||||
</template>
|
||||
</td>
|
||||
<td class="p-4 text-sm text-gray-500 whitespace-nowrap">
|
||||
{{ resume.createdAt }}
|
||||
</td>
|
||||
<td class="p-4 text-sm text-gray-500 whitespace-nowrap">
|
||||
{{ resume.updatedAt }}
|
||||
</td>
|
||||
<td class="p-4 text-sm text-gray-500 whitespace-nowrap">
|
||||
{{ resume.educationCount }}
|
||||
</td>
|
||||
<td class="p-4 text-sm text-gray-500 whitespace-nowrap">
|
||||
{{ resume.languageCount }}
|
||||
</td>
|
||||
<td class="p-4 text-sm text-gray-500 whitespace-nowrap">
|
||||
{{ resume.technologyCount }}
|
||||
</td>
|
||||
<td class="p-4 text-sm text-gray-500 whitespace-nowrap">
|
||||
{{ resume.projectCount }}
|
||||
</td>
|
||||
<td class="p-4 text-sm text-right text-gray-500 whitespace-nowrap">
|
||||
<Menu
|
||||
as="div"
|
||||
class="inline-block relative text-left"
|
||||
>
|
||||
<MenuButton class="flex items-center text-gray-400 hover:text-gray-600 rounded-full focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 focus:ring-offset-gray-100">
|
||||
<DotsVerticalIcon class="w-5 h-5" />
|
||||
</MenuButton>
|
||||
|
||||
<transition
|
||||
enter-active-class="transition ease-out duration-100"
|
||||
enter-from-class="transform opacity-0 scale-95"
|
||||
enter-to-class="transform opacity-100 scale-100"
|
||||
leave-active-class="transition ease-in duration-75"
|
||||
leave-from-class="transform opacity-100 scale-100"
|
||||
leave-to-class="transform opacity-0 scale-95"
|
||||
>
|
||||
<MenuItems class="absolute right-0 z-10 mt-2 w-56 bg-white rounded-md focus:outline-none ring-1 ring-black ring-opacity-5 shadow-lg origin-top-right">
|
||||
<div class="py-1">
|
||||
<MenuItem v-slot="{ active }">
|
||||
<InertiaLink
|
||||
:href="`/resumes/${resume.id}/edit`"
|
||||
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'font-medium block px-4 py-2 flex text-sm']"
|
||||
>
|
||||
<PencilIcon class="mr-2 w-5 h-5 text-blue-500" /> Edytuj
|
||||
</InertiaLink>
|
||||
</MenuItem>
|
||||
<MenuItem v-slot="{ active }">
|
||||
<a
|
||||
:href="`/resumes/${resume.id}`"
|
||||
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left font-medium px-4 py-2 flex text-sm']"
|
||||
>
|
||||
<DownloadIcon class="mr-2 w-5 h-5 text-blumilk-500" /> Pobierz
|
||||
</a>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
v-slot="{ active }"
|
||||
class="flex"
|
||||
>
|
||||
<InertiaLink
|
||||
as="button"
|
||||
method="delete"
|
||||
:preserve-scroll="true"
|
||||
:href="`/resumes/${resume.id}`"
|
||||
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left font-medium px-4 py-2 text-sm']"
|
||||
>
|
||||
<TrashIcon class="mr-2 w-5 h-5 text-red-500" /> Usuń
|
||||
</InertiaLink>
|
||||
</MenuItem>
|
||||
</div>
|
||||
</MenuItems>
|
||||
</transition>
|
||||
</Menu>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!resumes.data.length">
|
||||
<td
|
||||
colspan="100%"
|
||||
class="py-4 text-xl leading-5 text-center text-gray-700"
|
||||
>
|
||||
Brak danych
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<Pagination :pagination="resumes.meta" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { DotsVerticalIcon } from '@heroicons/vue/outline'
|
||||
import { DownloadIcon, PencilIcon, TrashIcon } from '@heroicons/vue/solid'
|
||||
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
|
||||
import Pagination from '@/Shared/Pagination'
|
||||
|
||||
defineProps({
|
||||
resumes: Object,
|
||||
can: Object,
|
||||
})
|
||||
</script>
|
222
resources/js/Pages/Technologies.vue
Normal file
222
resources/js/Pages/Technologies.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<InertiaHead title="Klucze" />
|
||||
<div class="bg-white shadow-md">
|
||||
<div class="flex justify-between items-center p-4 sm:px-6">
|
||||
<div>
|
||||
<h2 class="text-lg font-medium leading-6 text-gray-900">
|
||||
Technologie
|
||||
</h2>
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center py-3 px-4 text-sm font-medium leading-4 text-white bg-blumilk-600 hover:bg-blumilk-700 rounded-md border border-transparent focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
|
||||
@click="creating = true"
|
||||
>
|
||||
Dodaj technologię
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="border-t border-gray-200">
|
||||
<div class="overflow-auto xl:overflow-visible">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
>
|
||||
Technologia
|
||||
</th>
|
||||
<th
|
||||
scope="col"
|
||||
class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap"
|
||||
/>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-100">
|
||||
<tr
|
||||
v-for="technology in technologies.data"
|
||||
:key="technology.id"
|
||||
class="hover:bg-blumilk-25"
|
||||
>
|
||||
<td class="px-4 py-2 text-sm text-gray-500 whitespace-nowrap">
|
||||
{{ technology.name }}
|
||||
</td>
|
||||
<td class="px-4 py-2 text-sm text-right text-gray-500 whitespace-nowrap">
|
||||
<Menu
|
||||
as="div"
|
||||
class="inline-block relative text-left"
|
||||
>
|
||||
<MenuButton
|
||||
class="flex items-center text-gray-400 hover:text-gray-600 rounded-full focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 focus:ring-offset-gray-100"
|
||||
>
|
||||
<DotsVerticalIcon class="w-5 h-5" />
|
||||
</MenuButton>
|
||||
|
||||
<transition
|
||||
enter-active-class="transition ease-out duration-100"
|
||||
enter-from-class="transform opacity-0 scale-95"
|
||||
enter-to-class="transform opacity-100 scale-100"
|
||||
leave-active-class="transition ease-in duration-75"
|
||||
leave-from-class="transform opacity-100 scale-100"
|
||||
leave-to-class="transform opacity-0 scale-95"
|
||||
>
|
||||
<MenuItems
|
||||
class="absolute right-0 z-10 mt-2 w-56 bg-white rounded-md focus:outline-none ring-1 ring-black ring-opacity-5 shadow-lg origin-top-right"
|
||||
>
|
||||
<div class="py-1">
|
||||
<MenuItem
|
||||
v-slot="{ active }"
|
||||
class="flex"
|
||||
>
|
||||
<InertiaLink
|
||||
as="button"
|
||||
method="delete"
|
||||
preserve-scroll
|
||||
:href="`/technologies/${technology.id}`"
|
||||
:class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'block w-full text-left font-medium px-4 py-2 text-sm']"
|
||||
>
|
||||
<TrashIcon class="mr-2 w-5 h-5 text-red-500" />
|
||||
Usuń
|
||||
</InertiaLink>
|
||||
</MenuItem>
|
||||
</div>
|
||||
</MenuItems>
|
||||
</transition>
|
||||
</Menu>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!technologies.data.length">
|
||||
<td
|
||||
colspan="100%"
|
||||
class="py-4 text-xl leading-5 text-center text-gray-700"
|
||||
>
|
||||
Brak danych
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TransitionRoot
|
||||
as="template"
|
||||
:show="creating"
|
||||
>
|
||||
<Dialog
|
||||
is="div"
|
||||
class="overflow-y-auto fixed inset-0 z-10"
|
||||
@close="creating = false"
|
||||
>
|
||||
<div class="flex justify-center items-end px-4 pt-4 pb-20 min-h-screen text-center sm:block sm:p-0">
|
||||
<TransitionChild
|
||||
as="template"
|
||||
enter="ease-out duration-300"
|
||||
enter-from="opacity-0"
|
||||
enter-to="opacity-100"
|
||||
leave="ease-in duration-200"
|
||||
leave-from="opacity-100"
|
||||
leave-to="opacity-0"
|
||||
>
|
||||
<DialogOverlay class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
|
||||
</TransitionChild>
|
||||
|
||||
<span class="hidden sm:inline-block sm:h-screen sm:align-middle">​</span>
|
||||
<TransitionChild
|
||||
as="template"
|
||||
enter="ease-out duration-300"
|
||||
enter-from="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
enter-to="opacity-100 translate-y-0 sm:scale-100"
|
||||
leave="ease-in duration-200"
|
||||
leave-from="opacity-100 translate-y-0 sm:scale-100"
|
||||
leave-to="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
>
|
||||
<form
|
||||
class="inline-block relative px-4 pt-5 pb-4 text-left align-bottom bg-white rounded-lg shadow-xl transition-all transform sm:p-6 sm:my-8 sm:w-full sm:max-w-sm sm:align-middle"
|
||||
@submit.prevent="submitCreateTechnology"
|
||||
>
|
||||
<div>
|
||||
<div>
|
||||
<DialogTitle
|
||||
as="h3"
|
||||
class="text-lg font-medium leading-6 text-center text-gray-900 font-sembiold"
|
||||
>
|
||||
Dodaj technologię
|
||||
</DialogTitle>
|
||||
<div class="mt-5">
|
||||
<label
|
||||
for="name"
|
||||
class="block text-sm font-medium text-gray-700 sm:mt-px"
|
||||
>
|
||||
Nazwa
|
||||
</label>
|
||||
<div class="mt-2">
|
||||
<input
|
||||
id="name"
|
||||
v-model="form.name"
|
||||
type="text"
|
||||
class="block w-full max-w-lg rounded-md shadow-sm sm:text-sm"
|
||||
:class="{ 'border-red-300 text-red-900 focus:outline-none focus:ring-red-500 focus:border-red-500': form.errors.name, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors.name }"
|
||||
>
|
||||
<p
|
||||
v-if="form.errors.name"
|
||||
class="mt-2 text-sm text-red-600"
|
||||
>
|
||||
{{ form.errors.name }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 sm:mt-6">
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button
|
||||
type="button"
|
||||
class="py-2 px-4 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 rounded-md border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm"
|
||||
@click="creating = false"
|
||||
>
|
||||
Anuluj
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
:disabled="form.processing"
|
||||
class="inline-flex justify-center py-2 px-4 text-base font-medium text-white bg-blumilk-600 hover:bg-blumilk-700 rounded-md border border-transparent focus:outline-none focus:ring-2 focus:ring-blumilk-500 focus:ring-offset-2 shadow-sm sm:text-sm"
|
||||
>
|
||||
Dodaj
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</TransitionChild>
|
||||
</div>
|
||||
</Dialog>
|
||||
</TransitionRoot>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { DotsVerticalIcon, TrashIcon } from '@heroicons/vue/solid'
|
||||
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
|
||||
import { ref } from 'vue'
|
||||
import { Dialog, DialogOverlay, DialogTitle, TransitionChild, TransitionRoot } from '@headlessui/vue'
|
||||
import { useForm } from '@inertiajs/inertia-vue3'
|
||||
|
||||
defineProps({
|
||||
technologies: Object,
|
||||
})
|
||||
|
||||
const creating = ref(false)
|
||||
|
||||
const form = useForm({
|
||||
name: null,
|
||||
})
|
||||
|
||||
function submitCreateTechnology() {
|
||||
form.post('technologies', {
|
||||
preserveState: (page) => Object.keys(page.props.errors).length,
|
||||
preserveScroll: true,
|
||||
onSuccess: () => form.reset(),
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user