refactor: refs #8194 requested changes
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jon Elias 2024-12-05 13:31:39 +01:00
parent c7115f4781
commit accf61517a
9 changed files with 24 additions and 14 deletions

View File

@ -31,23 +31,28 @@ const value = computed({
emit('update:modelValue', val);
},
});
const url = computed(() => {
let url = 'Workers/search';
const { departmentCodes } = $props.params ?? {};
if (!departmentCodes) return url;
const params = new URLSearchParams({
departmentCodes: JSON.stringify(departmentCodes),
});
return url.concat(`?${params.toString()}`);
});
</script>
<template>
<VnSelect
:label="$t('globals.worker')"
v-bind="$attrs"
v-model="value"
:url="
$props.params
? `Workers/search?departmentCodes=${JSON.stringify(
$props.params.departmentCodes
)}`
: 'Workers/search'
"
:url="url"
option-value="id"
option-label="nickname"
:fields="['id', 'name', 'nickname', 'code']"
sort-by="name ASC"
sort-by="nickname ASC"
:params="$props.params"
>
<template #prepend v-if="$props.hasAvatar">
@ -55,9 +60,10 @@ const value = computed({
</template>
<template #append v-if="$props.hasInfo">
<QIcon name="info" class="cursor-pointer">
<QTooltip>{{ $t('Responsible for approving invoices') }}</QTooltip>
<QTooltip>{{ $t($props.hasInfo) }}</QTooltip>
</QIcon>
</template>
<slot name="more-options" />
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>

View File

@ -431,7 +431,6 @@ function handleLocation(data, location) {
:id-value="data.salesPersonFk"
emit-value
auto-load
option-label="nickname"
/>
<VnLocation
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"

View File

@ -150,7 +150,9 @@ const decrement = (paramsObj, key) => {
:label="t('params.requesterFk')"
v-model="params.requesterFk"
@update:model-value="searchFn()"
:fields="['id', 'name']"
:params="{ departmentCodes: ['VT'] }"
hide-selected
dense
outlined
rounded

View File

@ -65,6 +65,9 @@ const sourceList = ref([]);
<VnSelectWorker
:label="t('globals.salesPerson')"
v-model="params.workerFk"
:params="{
departmentCodes: ['VT'],
}"
dense
outlined
rounded

View File

@ -33,7 +33,6 @@ const emit = defineEmits(['search']);
<QItem class="q-my-sm">
<QItemSection>
<VnSelectWorker
:label="t('Worker')"
v-model="params.workerFk"
dense
outlined

View File

@ -95,7 +95,7 @@ const onSave = (data, response) => {
>
<template #form="{ data }">
<VnRow>
<VnSelectWorker :label="t('worker')" v-model="data.workerFk" />
<VnSelectWorker v-model="data.workerFk" />
<VnSelect
:label="t('Vehicle')"
v-model="data.vehicleFk"

View File

@ -34,7 +34,7 @@ const companySizes = [
<VnSelectWorker
:label="t('supplier.basicData.workerFk')"
v-model="data.workerFk"
:has-info="true"
has-info="Responsible for approving invoices"
:rules="validate('supplier.workerFk')"
/>
<VnSelect

View File

@ -47,7 +47,7 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
option-label="name"
option-value="id"
/>
<VnSelectWorker :label="t('expedition.worker')" v-model="data.userFk" />
<VnSelectWorker v-model="data.userFk" :fields="['id', 'name']" />
</VnRow>
</template>
</FormModelPopup>

View File

@ -361,6 +361,7 @@ async function autofillBic(worker) {
<i18n>
es:
Create worker: Crear trabajador
Search worker: Buscar trabajador
You can search by worker id or name: Puedes buscar por id o nombre del trabajador
</i18n>