Merge remote-tracking branch 'origin/generate-cv' into generate-cv
# Conflicts: # resources/js/Pages/Resumes/Create.vue
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										637
									
								
								resources/js/Pages/Resumes/Edit.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										637
									
								
								resources/js/Pages/Resumes/Edit.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,637 @@ | ||||
| <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"> | ||||
|         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 }"> | ||||
|             {{ element.school ? element.school : '(Nieokreślony)' }} | ||||
|           </template> | ||||
|           <template #form="{ element }"> | ||||
|             <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': false, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': true }" | ||||
|                 > | ||||
|               </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': false, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': true }" | ||||
|                 > | ||||
|               </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': false, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': true }" | ||||
|                 > | ||||
|               </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"> | ||||
|                 <FlatPickr | ||||
|                   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': false, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': true }" | ||||
|                 /> | ||||
|               </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"> | ||||
|                 <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': false, 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': true }" | ||||
|                 /> | ||||
|               </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 }"> | ||||
|             <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"> | ||||
|                 <Combobox | ||||
|                   v-model="element.name" | ||||
|                   label="Język" | ||||
|                   :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 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 technologie" | ||||
|           @add-item="addTechnology" | ||||
|           @remove-item="(index) => form.technologies.splice(index, 1)" | ||||
|         > | ||||
|           <template #itemHeader="{ element }"> | ||||
|             <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"> | ||||
|                 <Combobox | ||||
|                   v-model="element.name" | ||||
|                   label="Technologia" | ||||
|                   :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 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 }"> | ||||
|             {{ 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" | ||||
|                   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"> | ||||
|                 <input | ||||
|                   :id="`project-technologies-${index}`" | ||||
|                   v-model="element.technologies" | ||||
|                   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[`projects.${index}.technologies`], 'focus:ring-blumilk-500 focus:border-blumilk-500 sm:text-sm border-gray-300': !form.errors[`projects.${index}.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"> | ||||
|                 <FlatPickr | ||||
|                   :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`] }" | ||||
|                 /> | ||||
|                 <p | ||||
|                   v-if="form.errors[`educations.${index}.startDate`]" | ||||
|                   class="mt-2 text-sm text-red-600" | ||||
|                 > | ||||
|                   {{ form.errors[`educations.${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"> | ||||
|                 <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`] }" | ||||
|                 /> | ||||
|                 <p | ||||
|                   v-if="form.errors[`educations.${index}.endDate`]" | ||||
|                   class="mt-2 text-sm text-red-600" | ||||
|                 > | ||||
|                   {{ form.errors[`educations.${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"> | ||||
|                 <input | ||||
|                   :id="`project-tasks-${index}`" | ||||
|                   v-model="element.tasks" | ||||
|                   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[`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 { useForm } from '@inertiajs/inertia-vue3' | ||||
| import FlatPickr from 'vue-flatpickr-component' | ||||
| import DynamicSection from '@/Shared/Forms/DynamicSection' | ||||
| import Combobox from '@/Shared/Forms/Combobox' | ||||
| import LevelPicker from '@/Shared/Forms/LevelPicker' | ||||
|  | ||||
| const props = defineProps({ | ||||
|   users: Object, | ||||
|   technologies: Array, | ||||
|   resume: Object, | ||||
| }) | ||||
|  | ||||
| const technologyLevels = [ | ||||
|   { | ||||
|     level: 1, | ||||
|     name: 'Poczatkujący', | ||||
|     activeColor: 'bg-rose-400', | ||||
|     backgroundColor: 'bg-rose-100', | ||||
|     textColor: 'text-rose-400', | ||||
|   }, | ||||
|   { | ||||
|     level: 2, | ||||
|     name: 'Zaawansowany', | ||||
|     activeColor: 'bg-orange-400', | ||||
|     backgroundColor: 'bg-orange-100', | ||||
|     textColor: 'text-orange-400', | ||||
|   }, | ||||
|   { | ||||
|     level: 3, | ||||
|     name: 'Doświadczony', | ||||
|     activeColor: 'bg-amber-400', | ||||
|     backgroundColor: 'bg-amber-100', | ||||
|     textColor: 'text-yellow-500', | ||||
|   }, | ||||
|   { | ||||
|     level: 4, | ||||
|     name: 'Ekspert', | ||||
|     activeColor: 'bg-emerald-400', | ||||
|     backgroundColor: 'bg-emerald-100', | ||||
|     textColor: 'text-emerald-400', | ||||
|   }, | ||||
|   { | ||||
|     level: 5, | ||||
|     name: 'Chad', | ||||
|     activeColor: 'bg-blumilk-400', | ||||
|     backgroundColor: 'bg-blumilk-100', | ||||
|     textColor: 'text-blumilk-400', | ||||
|   }, | ||||
| ] | ||||
|  | ||||
| const languageLevels = [ | ||||
|   { | ||||
|     level: 1, | ||||
|     name: 'A1', | ||||
|     activeColor: 'bg-rose-400', | ||||
|     backgroundColor: 'bg-rose-100', | ||||
|     textColor: 'text-rose-400', | ||||
|   }, | ||||
|   { | ||||
|     level: 2, | ||||
|     name: 'A2', | ||||
|     activeColor: 'bg-orange-400', | ||||
|     backgroundColor: 'bg-orange-100', | ||||
|     textColor: 'text-orange-400', | ||||
|   }, | ||||
|   { | ||||
|     level: 3, | ||||
|     name: 'B1', | ||||
|     activeColor: 'bg-amber-400', | ||||
|     backgroundColor: 'bg-amber-100', | ||||
|     textColor: 'text-yellow-500', | ||||
|   }, | ||||
|   { | ||||
|     level: 4, | ||||
|     name: 'B2', | ||||
|     activeColor: 'bg-emerald-400', | ||||
|     backgroundColor: 'bg-emerald-100', | ||||
|     textColor: 'text-emerald-400', | ||||
|   }, | ||||
|   { | ||||
|     level: 5, | ||||
|     name: 'C1', | ||||
|     activeColor: 'bg-blumilk-400', | ||||
|     backgroundColor: 'bg-blumilk-100', | ||||
|     textColor: 'text-blumilk-400', | ||||
|   }, | ||||
|   { | ||||
|     level: 6, | ||||
|     name: 'C2', | ||||
|     activeColor: 'bg-blumilk-600', | ||||
|     backgroundColor: 'bg-blumilk-200', | ||||
|     textColor: 'text-blumilk-600', | ||||
|   }, | ||||
| ] | ||||
|  | ||||
| const languages = [ | ||||
|   'Język polski', | ||||
|   'Język angielski', | ||||
|   'Język niemiecki', | ||||
| ] | ||||
|  | ||||
| const form = useForm({ | ||||
|   user: props.users.data.find((user) => user.id === props.resume.user), | ||||
|   name: props.resume.name, | ||||
|   educations: props.resume.educations ?? [], | ||||
|   projects: props.resume.projects ?? [], | ||||
|   technologies: props.resume.technologies.map((technology) => ({ | ||||
|     name: props.technologies.find((tech) => tech === technology.name), | ||||
|     level: technologyLevels.find((level) => level.level === technology.level), | ||||
|   })) ?? [], | ||||
|   languages: props.resume.languages.map((language) => ({ | ||||
|     name: languages.find((lang) => lang.name === language.name), | ||||
|     level: languageLevels.find((level) => level.level === language.level), | ||||
|   })) ?? [], | ||||
| }) | ||||
|  | ||||
| function addProject() { | ||||
|   form.projects.push({ | ||||
|     description: null, | ||||
|     technologies: null, | ||||
|     tasks: null, | ||||
|     startDate: null, | ||||
|     endDate: null, | ||||
|   }) | ||||
| } | ||||
|  | ||||
| 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, | ||||
|   }) | ||||
| } | ||||
|  | ||||
| function addLanguage() { | ||||
|   form.languages.push({ | ||||
|     name: null, | ||||
|     level: languageLevels[0], | ||||
|   }) | ||||
| } | ||||
|  | ||||
| function submitResume() { | ||||
|   form | ||||
|     .transform((data) => ({ | ||||
|       user: data.user.id, | ||||
|       name: data.name, | ||||
|       education: data.educations, | ||||
|       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, | ||||
|     })) | ||||
|     .put(`/resumes/${props.resume.id}`) | ||||
| } | ||||
| </script> | ||||
| @@ -2,12 +2,10 @@ | ||||
|   <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> | ||||
|         <h2 class="text-lg font-medium leading-6 text-gray-900"> | ||||
|           CV | ||||
|         </h2> | ||||
|       </div> | ||||
|       <div v-if="true"> | ||||
|         <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" | ||||
| @@ -25,19 +23,25 @@ | ||||
|                 scope="col" | ||||
|                 class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap" | ||||
|               > | ||||
|                 Pracownik | ||||
|                 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 | ||||
|                 Opis | ||||
|               </th> | ||||
|               <th | ||||
|                 scope="col" | ||||
|                 class="py-3 px-4 text-xs font-semibold tracking-wider text-left text-gray-500 uppercase whitespace-nowrap" | ||||
|               > | ||||
|                 Dzień tygodnia | ||||
|                 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" | ||||
| @@ -46,74 +50,100 @@ | ||||
|             </tr> | ||||
|           </thead> | ||||
|           <tbody class="bg-white divide-y divide-gray-100"> | ||||
|             <tr> | ||||
|               <!--              v-for="holiday in holidays.data"--> | ||||
|               <!--              :key="holiday.id"--> | ||||
|               <!--              :class="[holiday.isPast ? 'bg-gray-100' : 'hover:bg-blumilk-25']"--> | ||||
|               <td class="p-4 text-sm font-semibold text-gray-700 capitalize whitespace-nowrap"> | ||||
|                 Jan Kowalski | ||||
|             <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> | ||||
|                   {{ resume.name }} | ||||
|                 </template> | ||||
|               </td> | ||||
|               <td class="p-4 text-sm text-gray-500 whitespace-nowrap"> | ||||
|                 xd | ||||
|                 {{ resume.description ?? '-' }} | ||||
|               </td> | ||||
|               <td class="p-4 text-sm text-gray-500 whitespace-nowrap"> | ||||
|                 xd | ||||
|                 {{ resume.createdAt }} | ||||
|               </td> | ||||
|               <td class="p-4 text-sm text-gray-500 whitespace-nowrap"> | ||||
|                 {{ resume.updatedAt }} | ||||
|               </td> | ||||
|               <td class="p-4 text-sm text-right text-gray-500 whitespace-nowrap"> | ||||
|               <!--                <Menu--> | ||||
|               <!--                  v-if="true"--> | ||||
|               <!--                  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"--> | ||||
|               <!--                      aria-hidden="true"--> | ||||
|               <!--                    />--> | ||||
|               <!--                  </MenuButton>--> | ||||
|                 <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--> | ||||
|               <!--                            :href="`/resumes/${holiday.id}/edit`"--> | ||||
|               <!--                            :class="[active ? 'bg-gray-100 text-gray-900' : 'text-gray-700', 'font-medium block px-4 py-2 text-sm']"--> | ||||
|               <!--                          >--> | ||||
|               <!--                            <PencilIcon class="mr-2 w-5 h-5 text-blue-500" /> Edytuj--> | ||||
|               <!--                          </InertiaLink>--> | ||||
|               <!--                        </MenuItem>--> | ||||
|               <!--                        <MenuItem--> | ||||
|               <!--                          v-slot="{ active }"--> | ||||
|               <!--                          class="flex"--> | ||||
|               <!--                        >--> | ||||
|               <!--                          <InertiaLink--> | ||||
|               <!--                            as="button"--> | ||||
|               <!--                            method="delete"--> | ||||
|               <!--                            :preserve-scroll="true"--> | ||||
|               <!--                            :href="`/holidays/${holiday.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>--> | ||||
|                   <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="!true"> | ||||
|             <tr v-if="!resumes.data.length"> | ||||
|               <td | ||||
|                 colspan="100%" | ||||
|                 class="py-4 text-xl leading-5 text-center text-gray-700" | ||||
| @@ -124,16 +154,19 @@ | ||||
|           </tbody> | ||||
|         </table> | ||||
|       </div> | ||||
|       <Pagination :pagination="resumes.meta" /> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
|  | ||||
| <script setup> | ||||
| import { DotsVerticalIcon, PencilIcon, TrashIcon } from '@heroicons/vue/solid' | ||||
| 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({ | ||||
|   holidays: Object, | ||||
|   resumes: Object, | ||||
|   can: Object, | ||||
| }) | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user