8315-devToTest #1094

Merged
alexm merged 253 commits from 8315-devToTest into test 2024-12-18 10:31:55 +00:00
14 changed files with 44 additions and 137 deletions
Showing only changes of commit 1e1032b3da - Show all commits

View File

@ -1,48 +1,10 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import VnSelect from 'components/common/VnSelect.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
const { t } = useI18n();
const emit = defineEmits(['update:modelValue']);
const $props = defineProps({
modelValue: {
type: [String, Number, Object],
default: null,
},
label: {
type: String,
required: true,
},
url: {
type: String,
required: true,
},
optionValue: {
type: String,
default: 'id',
},
optionLabel: {
type: String,
default: 'name',
},
fields: {
type: Array,
default: null,
},
params: {
type: Object,
default: null,
},
sortBy: {
type: String,
default: null,
},
exprBuilder: {
type: Function,
default: null,
},
hasAvatar: {
type: Boolean,
default: false,
@ -51,9 +13,13 @@ const $props = defineProps({
type: Boolean,
default: false,
},
noOne: {
type: Boolean,
default: false,
modelValue: {
type: [String, Number, Object],
default: null,
},
params: {
type: Object,
default: null,
},
});
@ -69,24 +35,27 @@ const value = computed({
<template>
<VnSelect
:label="t($props.label)"
v-bind="$attrs"
v-model="value"
:url="$props.url"
:option-value="$props.optionValue"
:option-label="$props.optionLabel"
:fields="$props.fields"
:url="
$props.params
? `Workers/search?departmentCodes=${JSON.stringify(
$props.params.departmentCodes
)}`
: 'Workers/search'
"
option-value="id"
option-label="nickname"
:fields="['id', 'name', 'nickname', 'code']"
sort-by="name ASC"
:params="$props.params"
:sort-by="$props.sortBy"
:expr-builder="$props.exprBuilder"
:no-one="$props.noOne"
hide-selected
>
<template #prepend v-if="hasAvatar">
<template #prepend v-if="$props.hasAvatar">
<VnAvatar :worker-id="value" color="primary" :title="title" />
</template>
<template #append v-if="hasInfo">
<template #append v-if="$props.hasInfo">
<QIcon name="info" class="cursor-pointer">
<QTooltip>{{ t('Responsible for approving invoices') }}</QTooltip>
<QTooltip>{{ $t('Responsible for approving invoices') }}</QTooltip>
</QIcon>
</template>
<template #option="scope">

View File

@ -8,7 +8,6 @@ import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
const route = useRoute();
@ -16,7 +15,6 @@ const { t } = useI18n();
const businessTypes = ref([]);
const contactChannels = ref([]);
const title = ref();
const handleSalesModelValue = (val) => ({
or: [
{ id: val },
@ -107,28 +105,14 @@ const exprBuilder = (param, value) => {
<VnSelectWorker
:label="t('customer.summary.salesPerson')"
v-model="data.salesPersonFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'nickname'"
:fields="['id', 'name', 'nickname']"
:params="{
departmentCodes: ['VT', 'shopping'],
}"
:sort-by="'nickname ASC'"
:has-avatar="true"
:rules="validate('client.salesPersonFk')"
:expr-builder="exprBuilder"
emit-value
auto-load
>
<template #prepend>
<VnAvatar
:worker-id="data.salesPersonFk"
color="primary"
:title="title"
/>
</template>
</VnSelectWorker>
/>
<VnSelect
v-model="data.contactChannelFk"
:options="contactChannels"

View File

@ -69,14 +69,9 @@ const exprBuilder = (param, value) => {
<VnSelectWorker
:label="t('Salesperson')"
v-model="params.salesPersonFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
:params="{
departmentCodes: ['VT'],
}"
:sort-by="'nickname ASC'"
:expr-builder="exprBuilder"
@update:model-value="searchFn()"
emit-value

View File

@ -424,17 +424,14 @@ function handleLocation(data, location) {
<VnSelectWorker
:label="t('customer.summary.salesPerson')"
v-model="data.salesPersonFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'nickname'"
:fields="['id', 'name', 'nickname']"
:params="{
departmentCodes: ['VT', 'shopping'],
}"
:sort-by="'nickname ASC'"
:has-avatar="true"
:id-value="data.salesPersonFk"
emit-value
auto-load
option-label="nickname"
/>
<VnLocation
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"

View File

@ -52,10 +52,6 @@ const { t } = useI18n();
<VnSelectWorker
:label="t('department.bossDepartment')"
v-model="data.workerFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
:rules="validate('department.workerFk')"
/>
<VnSelect

View File

@ -148,13 +148,8 @@ const decrement = (paramsObj, key) => {
<QItemSection>
<VnSelectWorker
:label="t('params.requesterFk')"
v-model="params.requesterFkk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
v-model="params.requesterFk"
@update:model-value="searchFn()"
:sort-by="'name ASC'"
:params="{ departmentCodes: ['VT'] }"
dense
outlined

View File

@ -115,13 +115,23 @@ const getLocale = (label) => {
rounded
:label="t('globals.params.salesPersonFk')"
v-model="params.salesPersonFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
:params="{ departmentCodes: ['VT'] }"
:no-one="true"
/>
>
<template #option="{ opt, itemProps }">
<QItem v-bind="itemProps">
<QItemSection>
<QItemLabel>{{ opt.name }}</QItemLabel>
<QItemLabel
v-if="opt.code"
class="text-grey text-caption"
>
{{ `${opt.nickname}, ${opt.code}` }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectWorker>
</QItemSection>
</QItem>
<QItem>

View File

@ -65,11 +65,6 @@ const sourceList = ref([]);
<VnSelectWorker
:label="t('globals.salesPerson')"
v-model="params.workerFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'nickname'"
:fields="['id', 'name', 'nickname']"
:sort-by="'nickname ASC'"
dense
outlined
rounded

View File

@ -35,11 +35,6 @@ const emit = defineEmits(['search']);
<VnSelectWorker
:label="t('Worker')"
v-model="params.workerFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'nickname'"
:fields="['id', 'name', 'nickname']"
:sort-by="'nickname ASC'"
dense
outlined
rounded

View File

@ -95,15 +95,7 @@ const onSave = (data, response) => {
>
<template #form="{ data }">
<VnRow>
<VnSelectWorker
:label="t('worker')"
v-model="data.workerFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'nickname'"
:fields="['id', 'name', 'nickname']"
:sort-by="'nickname ASC'"
/>
<VnSelectWorker :label="t('worker')" v-model="data.workerFk" />
<VnSelect
:label="t('Vehicle')"
v-model="data.vehicleFk"

View File

@ -34,11 +34,6 @@ const companySizes = [
<VnSelectWorker
:label="t('supplier.basicData.workerFk')"
v-model="data.workerFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
:sort-by="'nickname ASC'"
:has-info="true"
:rules="validate('supplier.workerFk')"
/>

View File

@ -47,15 +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"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
:sort-by="'name ASC'"
/>
<VnSelectWorker :label="t('expedition.worker')" v-model="data.userFk" />
</VnRow>
</template>
</FormModelPopup>

View File

@ -153,10 +153,6 @@ async function autofillBic(worker) {
<VnSelectWorker
:label="t('worker.summary.boss')"
v-model="data.bossFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
:rules="validate('Worker.boss')"
/>
</VnRow>

View File

@ -15,10 +15,10 @@ import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
import FetchData from 'src/components/FetchData.vue';
import RightMenu from 'src/components/common/RightMenu.vue';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
import WorkerFilter from './WorkerFilter.vue';
import { useState } from 'src/composables/useState';
import axios from 'axios';
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
const { t } = useI18n();
const tableRef = ref();
@ -264,10 +264,6 @@ async function autofillBic(worker) {
<VnSelectWorker
:label="t('worker.summary.boss')"
v-model="data.bossFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
/>
</VnRow>
<VnRow>