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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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