This commit is contained in:
8
frontend/package-lock.json
generated
8
frontend/package-lock.json
generated
@@ -7,7 +7,7 @@
|
||||
"name": "frontend",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@malio/layer-ui": "^1.4.5",
|
||||
"@malio/layer-ui": "^1.4.6",
|
||||
"@nuxt/icon": "^2.2.1",
|
||||
"@nuxtjs/i18n": "^10.2.1",
|
||||
"@pinia/nuxt": "^0.11.3",
|
||||
@@ -2222,9 +2222,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@malio/layer-ui": {
|
||||
"version": "1.4.5",
|
||||
"resolved": "https://gitea.malio.fr/api/packages/MALIO-DEV/npm/%40malio%2Flayer-ui/-/1.4.5/layer-ui-1.4.5.tgz",
|
||||
"integrity": "sha512-UfVkLJk3WWGoZE1eyei0pY45IUbZRzabJr2X6GNFabHd/8EmuXqwP+LxCl8wEAO4ODrNKsVLJdi0eL3Zekv4Dg==",
|
||||
"version": "1.4.6",
|
||||
"resolved": "https://gitea.malio.fr/api/packages/MALIO-DEV/npm/%40malio%2Flayer-ui/-/1.4.6/layer-ui-1.4.6.tgz",
|
||||
"integrity": "sha512-stHqUAJ8E6a62Ka7QXlE177GhkIsjtmYNa/tNk1TVpbJ099okfLLivrlofEl7CCAqDeMaIepnW4q0vxJT+EFEA==",
|
||||
"dependencies": {
|
||||
"@nuxt/icon": "^2.2.1",
|
||||
"@nuxtjs/tailwindcss": "^6.14.0",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"dependencies": {
|
||||
"@nuxt/icon": "^2.2.1",
|
||||
"@nuxtjs/i18n": "^10.2.1",
|
||||
"@malio/layer-ui": "^1.4.5",
|
||||
"@malio/layer-ui": "^1.4.6",
|
||||
"@pinia/nuxt": "^0.11.3",
|
||||
"nuxt": "^4.3.0",
|
||||
"nuxt-toast": "^1.4.0",
|
||||
|
||||
@@ -84,105 +84,53 @@
|
||||
</NuxtLink>
|
||||
</div>
|
||||
|
||||
<AppDrawer v-model="isDrawerOpen" :title="drawerTitle">
|
||||
<MalioDrawer v-model="isDrawerOpen" :title="drawerTitle">
|
||||
<form class="space-y-4" @submit.prevent="handleSubmit">
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="first-name">
|
||||
Prénom <span class="text-red-600">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="first-name"
|
||||
v-model="form.firstName"
|
||||
type="text"
|
||||
:class="firstNameFieldClass"
|
||||
/>
|
||||
<p v-if="showFirstNameError" class="mt-1 text-sm text-red-600">
|
||||
Le prénom est obligatoire.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="last-name">
|
||||
Nom <span class="text-red-600">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="last-name"
|
||||
v-model="form.lastName"
|
||||
type="text"
|
||||
:class="lastNameFieldClass"
|
||||
/>
|
||||
<p v-if="showLastNameError" class="mt-1 text-sm text-red-600">
|
||||
Le nom est obligatoire.
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="site">
|
||||
Site <span class="text-red-600">*</span>
|
||||
</label>
|
||||
<select
|
||||
id="site"
|
||||
v-model="form.siteId"
|
||||
:class="siteFieldClass"
|
||||
>
|
||||
<option value="">Aucun site</option>
|
||||
<option v-for="site in sites" :key="site.id" :value="site.id">
|
||||
{{ site.name }}
|
||||
</option>
|
||||
</select>
|
||||
<p v-if="showSiteError" class="mt-1 text-sm text-red-600">
|
||||
Le site est obligatoire.
|
||||
</p>
|
||||
</div>
|
||||
<MalioInputText
|
||||
v-model="form.firstName"
|
||||
label="Prénom *"
|
||||
group-class="mt-2"
|
||||
:error="showFirstNameError ? 'Le prénom est obligatoire.' : ''"
|
||||
/>
|
||||
<MalioInputText
|
||||
v-model="form.lastName"
|
||||
label="Nom *"
|
||||
group-class="mt-2"
|
||||
:error="showLastNameError ? 'Le nom est obligatoire.' : ''"
|
||||
/>
|
||||
<MalioSelect
|
||||
:model-value="form.siteId === '' ? null : form.siteId"
|
||||
:options="formSiteOptions"
|
||||
label="Site *"
|
||||
min-width=""
|
||||
:error="showSiteError ? 'Le site est obligatoire.' : ''"
|
||||
@update:model-value="(v) => { form.siteId = v === null ? '' : Number(v) }"
|
||||
/>
|
||||
<template v-if="!editingEmployee">
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="contract-nature">
|
||||
Type de contrat <span class="text-red-600">*</span>
|
||||
</label>
|
||||
<select
|
||||
id="contract-nature"
|
||||
v-model="form.contractNature"
|
||||
:class="contractNatureFieldClass"
|
||||
>
|
||||
<option value="CDI">CDI</option>
|
||||
<option value="CDD">CDD</option>
|
||||
<option value="INTERIM">Intérim</option>
|
||||
</select>
|
||||
<p v-if="showContractNatureError" class="mt-1 text-sm text-red-600">
|
||||
Le type de contrat est obligatoire.
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="form.contractNature === 'INTERIM'">
|
||||
<label class="text-md font-semibold text-neutral-700" for="interim-agency">
|
||||
Agence d'intérim
|
||||
</label>
|
||||
<select
|
||||
id="interim-agency"
|
||||
v-model="form.interimAgencyId"
|
||||
class="mt-2 w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-md text-neutral-900"
|
||||
>
|
||||
<option value="">Aucune</option>
|
||||
<option v-for="agency in interimAgencies" :key="agency.id" :value="agency.id">
|
||||
{{ agency.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="contract">
|
||||
Temps de travail <span class="text-red-600">*</span>
|
||||
</label>
|
||||
<select
|
||||
id="contract"
|
||||
v-model="form.contractId"
|
||||
:class="contractFieldClass"
|
||||
>
|
||||
<option value="">Sélectionner un contrat</option>
|
||||
<option v-for="contract in contracts" :key="contract.id" :value="contract.id">
|
||||
{{ contract.name }}
|
||||
</option>
|
||||
</select>
|
||||
<p v-if="showContractError" class="mt-1 text-sm text-red-600">
|
||||
Le temps de travail est obligatoire.
|
||||
</p>
|
||||
</div>
|
||||
<MalioSelect
|
||||
:model-value="form.contractNature"
|
||||
:options="contractNatureFormOptions"
|
||||
label="Type de contrat *"
|
||||
min-width=""
|
||||
:error="showContractNatureError ? 'Le type de contrat est obligatoire.' : ''"
|
||||
@update:model-value="(v) => { if (v !== null) form.contractNature = v as 'CDI' | 'CDD' | 'INTERIM' }"
|
||||
/>
|
||||
<MalioSelect
|
||||
v-if="form.contractNature === 'INTERIM'"
|
||||
:model-value="form.interimAgencyId === '' ? null : form.interimAgencyId"
|
||||
:options="interimAgencyOptions"
|
||||
label="Agence d'intérim"
|
||||
min-width=""
|
||||
@update:model-value="(v) => { form.interimAgencyId = v === null ? '' : Number(v) }"
|
||||
/>
|
||||
<MalioSelect
|
||||
:model-value="form.contractId === '' ? null : form.contractId"
|
||||
:options="contractFormOptions"
|
||||
label="Temps de travail *"
|
||||
min-width=""
|
||||
:error="showContractError ? 'Le temps de travail est obligatoire.' : ''"
|
||||
@update:model-value="(v) => { form.contractId = v === null ? '' : Number(v) }"
|
||||
/>
|
||||
<div>
|
||||
<label class="text-md font-semibold text-neutral-700" for="contract-start-date">
|
||||
Début contrat <span class="text-red-600">*</span>
|
||||
@@ -191,7 +139,7 @@
|
||||
id="contract-start-date"
|
||||
v-model="form.contractStartDate"
|
||||
type="date"
|
||||
:class="contractStartDateFieldClass"
|
||||
:class="[dateInputBaseClass, form.contractStartDate ? 'border-black' : 'border-m-muted', showContractStartDateError ? '!border-m-danger' : '']"
|
||||
/>
|
||||
<p v-if="showContractStartDateError" class="mt-1 text-sm text-red-600">
|
||||
La date de début est obligatoire.
|
||||
@@ -206,22 +154,18 @@
|
||||
id="contract-end-date"
|
||||
v-model="form.contractEndDate"
|
||||
type="date"
|
||||
:class="contractEndDateFieldClass"
|
||||
:class="[dateInputBaseClass, form.contractEndDate ? 'border-black' : 'border-m-muted', showContractEndDateError ? '!border-m-danger' : '']"
|
||||
/>
|
||||
<p v-if="showContractEndDateError" class="mt-1 text-sm text-red-600">
|
||||
La date de fin est obligatoire pour un CDD ou un Intérim.
|
||||
</p>
|
||||
</div>
|
||||
<div class="rounded-md border border-neutral-200 bg-neutral-50 p-3">
|
||||
<label class="inline-flex items-center gap-2 text-md font-semibold text-neutral-700" for="is-driver">
|
||||
<input
|
||||
id="is-driver"
|
||||
v-model="form.isDriver"
|
||||
type="checkbox"
|
||||
class="h-4 w-4 rounded border-neutral-300 text-primary-500 focus:ring-primary-500"
|
||||
/>
|
||||
Chauffeur
|
||||
</label>
|
||||
<div class="flex h-10 items-center rounded-md border border-neutral-200 bg-neutral-50 px-3">
|
||||
<MalioCheckbox
|
||||
v-model="form.isDriver"
|
||||
label="Chauffeur"
|
||||
group-class="flex items-center"
|
||||
/>
|
||||
</div>
|
||||
<WorkDaysHoursInput
|
||||
v-if="requiresSchedule"
|
||||
@@ -230,23 +174,19 @@
|
||||
/>
|
||||
</template>
|
||||
<div class="flex justify-end gap-3 pt-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-neutral-200 px-4 py-2 text-md font-semibold text-neutral-700 hover:bg-neutral-100"
|
||||
<MalioButton
|
||||
label="Annuler"
|
||||
variant="tertiary"
|
||||
@click="isDrawerOpen = false"
|
||||
>
|
||||
Annuler
|
||||
</button>
|
||||
<button
|
||||
/>
|
||||
<MalioButton
|
||||
type="submit"
|
||||
class="rounded-lg bg-primary-500 px-4 py-2 text-md font-semibold text-white hover:bg-secondary-500"
|
||||
:class="submitButtonClass"
|
||||
>
|
||||
Enregistrer
|
||||
</button>
|
||||
label="Enregistrer"
|
||||
:disabled="isSubmitting || !isFormValid"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</AppDrawer>
|
||||
</MalioDrawer>
|
||||
|
||||
<MalioDrawer v-model="isExportDrawerOpen" title="Export">
|
||||
<div class="space-y-4">
|
||||
@@ -492,63 +432,23 @@ const showContractEndDateError = computed(
|
||||
() => !editingEmployee.value && validationTouched.contractEndDate && !isContractEndDateValid.value
|
||||
)
|
||||
|
||||
const baseInputClass =
|
||||
'mt-2 w-full rounded-md border px-3 py-2 text-base text-neutral-900 focus:border-primary-500 focus:outline-none focus:ring-2 focus:ring-secondary-500/20'
|
||||
const firstNameFieldClass = computed(() => {
|
||||
if (showFirstNameError.value) {
|
||||
return `${baseInputClass} border-red-500`
|
||||
}
|
||||
return `${baseInputClass} border-neutral-300`
|
||||
})
|
||||
const lastNameFieldClass = computed(() => {
|
||||
if (showLastNameError.value) {
|
||||
return `${baseInputClass} border-red-500`
|
||||
}
|
||||
return `${baseInputClass} border-neutral-300`
|
||||
})
|
||||
const siteFieldClass = computed(() => {
|
||||
const baseSelectClass =
|
||||
'mt-2 w-full rounded-md border bg-white px-3 py-2 text-md text-neutral-900'
|
||||
if (showSiteError.value) {
|
||||
return `${baseSelectClass} border-red-500`
|
||||
}
|
||||
return `${baseSelectClass} border-neutral-300`
|
||||
})
|
||||
const contractFieldClass = computed(() => {
|
||||
const baseClass =
|
||||
'mt-2 w-full rounded-md border bg-white px-3 py-2 text-md text-neutral-900'
|
||||
if (showContractError.value) {
|
||||
return `${baseClass} border-red-500`
|
||||
}
|
||||
return `${baseClass} border-neutral-300`
|
||||
})
|
||||
const contractNatureFieldClass = computed(() => {
|
||||
const baseClass =
|
||||
'mt-2 w-full rounded-md border bg-white px-3 py-2 text-md text-neutral-900'
|
||||
if (showContractNatureError.value) {
|
||||
return `${baseClass} border-red-500`
|
||||
}
|
||||
return `${baseClass} border-neutral-300`
|
||||
})
|
||||
const contractStartDateFieldClass = computed(() => {
|
||||
if (showContractStartDateError.value) {
|
||||
return `${baseInputClass} border-red-500`
|
||||
}
|
||||
return `${baseInputClass} border-neutral-300`
|
||||
})
|
||||
const contractEndDateFieldClass = computed(() => {
|
||||
if (showContractEndDateError.value) {
|
||||
return `${baseInputClass} border-red-500`
|
||||
}
|
||||
return `${baseInputClass} border-neutral-300`
|
||||
})
|
||||
const dateInputBaseClass =
|
||||
'mt-2 h-10 w-full rounded-md border px-3 text-md text-black outline-none focus:border-2 focus:border-m-primary'
|
||||
|
||||
const submitButtonClass = computed(() => {
|
||||
if (isSubmitting.value || !isFormValid.value) {
|
||||
return 'opacity-50 cursor-not-allowed'
|
||||
}
|
||||
return ''
|
||||
})
|
||||
const formSiteOptions = computed(() =>
|
||||
sites.value.map((site) => ({ label: site.name, value: site.id }))
|
||||
)
|
||||
const interimAgencyOptions = computed(() =>
|
||||
interimAgencies.value.map((agency) => ({ label: agency.name, value: agency.id }))
|
||||
)
|
||||
const contractFormOptions = computed(() =>
|
||||
contracts.value.map((contract) => ({ label: contract.name, value: contract.id }))
|
||||
)
|
||||
const contractNatureFormOptions = [
|
||||
{ label: 'CDI', value: 'CDI' },
|
||||
{ label: 'CDD', value: 'CDD' },
|
||||
{ label: 'Intérim', value: 'INTERIM' }
|
||||
]
|
||||
|
||||
const loadEmployees = async () => {
|
||||
isLoading.value = true
|
||||
|
||||
Reference in New Issue
Block a user