This commit is contained in:
Adrian Hopek
2022-05-17 11:38:16 +02:00
parent 45510a898b
commit d2babab7a0
17 changed files with 596 additions and 110 deletions

View File

@@ -207,7 +207,7 @@
Data rozpoczęcia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
<MonthPicker
v-model="element.startDate"
placeholder="Wybierz datę"
class="block w-full rounded-md shadow-sm sm:text-sm"
@@ -226,12 +226,23 @@
Data zakończenia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
v-model="element.endDate"
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}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.endDate`] }"
/>
<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"
@@ -436,12 +447,12 @@
Data rozpoczęcia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
<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[`educations.${index}.startDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`educations.${index}.startDate`] }"
: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`]"
@@ -459,13 +470,24 @@
Data zakończenia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
:id="`project-endDate-${index}`"
v-model="element.endDate"
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[`educations.${index}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`educations.${index}.endDate`] }"
/>
<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"
@@ -525,7 +547,7 @@ import { Listbox, ListboxOption, ListboxOptions, ListboxLabel, ListboxButton } f
import { SelectorIcon, CheckIcon } from '@heroicons/vue/outline'
import { ExclamationCircleIcon } from '@heroicons/vue/solid'
import { useForm } from '@inertiajs/inertia-vue3'
import FlatPickr from 'vue-flatpickr-component'
import MonthPicker from '@/Shared/Forms/MonthPicker'
import DynamicSection from '@/Shared/Forms/DynamicSection'
import Combobox from '@/Shared/Forms/Combobox'
import MultipleCombobox from '@/Shared/Forms/MultipleCombobox'

View File

@@ -207,7 +207,7 @@
Data rozpoczęcia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
<MonthPicker
v-model="element.startDate"
placeholder="Wybierz datę"
class="block w-full rounded-md shadow-sm sm:text-sm"
@@ -226,12 +226,23 @@
Data zakończenia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
v-model="element.endDate"
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}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`education.${index}.endDate`] }"
/>
<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"
@@ -436,12 +447,12 @@
Data rozpoczęcia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
<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[`educations.${index}.startDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`educations.${index}.startDate`] }"
: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`]"
@@ -459,13 +470,24 @@
Data zakończenia
</label>
<div class="mt-1 sm:mt-0">
<FlatPickr
:id="`project-endDate-${index}`"
v-model="element.endDate"
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[`educations.${index}.endDate`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`educations.${index}.endDate`] }"
/>
<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"
@@ -525,7 +547,7 @@ import { Listbox, ListboxOption, ListboxOptions, ListboxLabel, ListboxButton } f
import { SelectorIcon, CheckIcon } from '@heroicons/vue/outline'
import { ExclamationCircleIcon } from '@heroicons/vue/solid'
import { useForm } from '@inertiajs/inertia-vue3'
import FlatPickr from 'vue-flatpickr-component'
import MonthPicker from '@/Shared/Forms/MonthPicker'
import DynamicSection from '@/Shared/Forms/DynamicSection'
import Combobox from '@/Shared/Forms/Combobox'
import MultipleCombobox from '@/Shared/Forms/MultipleCombobox'
@@ -552,11 +574,11 @@ const form = useForm(`EditResume:${props.resume.id}`,{
educations: props.resume.education ?? [],
projects: props.resume.projects ?? [],
technologies: props.resume.technologies.map((technology) => ({
name: props.technologies.find((tech) => tech === technology.name),
name: technology.name,
level: technologyLevels.find((level) => level.level === technology.level),
})) ?? [],
languages: props.resume.languages.map((language) => ({
name: languages.find((lang) => lang === language.name),
name: language.name,
level: languageLevels.find((level) => level.level === language.level),
})) ?? [],
})
@@ -606,7 +628,10 @@ function submitResume() {
.transform((data) => ({
user: data.user?.id,
name: data.name,
education: data.educations,
education: data.educations.map(education => ({
...education,
endDate: education.current ? null: education.endDate,
})),
languages: data.languages.map(language => ({
name: language.name,
level: language.level.level,
@@ -615,7 +640,10 @@ function submitResume() {
name: technology.name,
level: technology.level.level,
})),
projects: data.projects,
projects: data.projects.map(project => ({
...project,
endDate: project.current ? null : project.endDate,
})),
}))
.put(`/resumes/${props.resume.id}`)
}