0
0
Fork 0

refactor: refs #6273 replace QBtnGroup with QRadio for worker type selection

This commit is contained in:
Jorge Penadés 2024-06-04 09:33:51 +02:00
parent de4ea6271b
commit 0b0754f76e
2 changed files with 47 additions and 61 deletions

View File

@ -93,23 +93,8 @@ onMounted(async () => {
<QPage>
<VnSubToolbar>
<template #st-data>
<QBtnGroup>
<QBtn
:label="`${t('globals.worker')}`"
:title="`${t('globals.worker')}`"
color="primary"
icon="vn:worker"
@click="isFreelancer = false"
/>
<QBtn
:label="`${t('Freelancer')}`"
:title="`${t('Freelancer')}`"
flat
color="primary"
icon="person"
@click="isFreelancer = true"
/>
</QBtnGroup>
<QRadio v-model="isFreelancer" :val="false" :label="`${t('Internal')}`" />
<QRadio v-model="isFreelancer" :val="true" :label="`${t('External')}`" />
</template>
</VnSubToolbar>
<FormModel
@ -130,52 +115,10 @@ onMounted(async () => {
:rules="validate('Worker.lastNames')"
/>
<VnInput
v-show="isFreelancer"
v-model="data.code"
:label="t('worker.create.code')"
:rules="validate('Worker.code')"
/>
<VnInputDate
v-show="!isFreelancer"
v-model="data.birth"
:label="t('worker.create.birth')"
:rules="validate('Worker.birth')"
/>
</VnRow>
<VnRow v-show="!isFreelancer">
<VnInput
v-model="data.fi"
:label="t('worker.create.fi')"
:rules="validate('Worker.fi')"
/>
<VnInput
v-model="data.code"
:label="t('worker.create.code')"
:rules="validate('Worker.code')"
/>
<VnInput
v-model="data.phone"
:label="t('worker.create.phone')"
:rules="validate('Worker.phone')"
/>
</VnRow>
<VnRow v-show="!isFreelancer">
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
@update:model-value="(location) => handleLocation(data, location)"
>
</VnLocation>
</VnRow>
<VnRow>
<VnInput
v-show="!isFreelancer"
:label="t('worker.create.street')"
v-model="data.street"
:rules="validate('Worker.street')"
/>
</VnRow>
<VnRow>
<VnInput
@ -221,7 +164,46 @@ onMounted(async () => {
</template>
</VnSelect>
</VnRow>
<VnRow v-show="!isFreelancer">
<VnRow>
<VnInput
v-model="data.fi"
:label="t('worker.create.fi')"
:rules="validate('Worker.fi')"
:disable="isFreelancer"
/>
<VnInputDate
v-model="data.birth"
:label="t('worker.create.birth')"
:rules="validate('Worker.birth')"
:disable="isFreelancer"
/>
<VnInput
v-model="data.phone"
:label="t('worker.create.phone')"
:rules="validate('Worker.phone')"
:disable="isFreelancer"
/>
</VnRow>
<VnRow>
<VnLocation
:rules="validate('Worker.postcode')"
:roles-allowed-to-create="['deliveryAssistant']"
:options="postcodesOptions"
v-model="data.location"
@update:model-value="(location) => handleLocation(data, location)"
:disable="isFreelancer"
>
</VnLocation>
</VnRow>
<VnRow>
<VnInput
:label="t('worker.create.street')"
v-model="data.street"
:rules="validate('Worker.street')"
:disable="isFreelancer"
/>
</VnRow>
<VnRow>
<VnSelect
:label="t('worker.create.payMethods')"
v-model="data.payMethodFk"
@ -231,11 +213,13 @@ onMounted(async () => {
map-options
hide-selected
:rules="validate('Worker.payMethodFk')"
:disable="isFreelancer"
/>
<VnInput
v-model="data.iban"
:label="t('worker.create.iban')"
:rules="validate('Worker.iban')"
:disable="isFreelancer"
>
<template #append>
<QIcon name="info" class="cursor-info">
@ -252,6 +236,7 @@ onMounted(async () => {
hide-selected
:roles-allowed-to-create="['salesAssistant', 'hr']"
:rules="validate('Worker.bankEntity')"
:disable="isFreelancer"
>
<template #form>
<CreateBankEntityForm

View File

@ -1,4 +1,5 @@
Search worker: Buscar trabajador
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
Freelancer: Autónomo
Locker: Taquilla
Internal: Interno
External: Externo