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> <script setup>
import { computed } from 'vue'; import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import VnSelect from 'components/common/VnSelect.vue'; import VnSelect from 'components/common/VnSelect.vue';
import VnAvatar from 'src/components/ui/VnAvatar.vue'; import VnAvatar from 'src/components/ui/VnAvatar.vue';
const { t } = useI18n();
const emit = defineEmits(['update:modelValue']); const emit = defineEmits(['update:modelValue']);
const $props = defineProps({ 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: { hasAvatar: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -51,9 +13,13 @@ const $props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
noOne: { modelValue: {
type: Boolean, type: [String, Number, Object],
default: false, default: null,
},
params: {
type: Object,
default: null,
}, },
}); });
@ -69,24 +35,27 @@ const value = computed({
<template> <template>
<VnSelect <VnSelect
:label="t($props.label)" v-bind="$attrs"
v-model="value" v-model="value"
:url="$props.url" :url="
:option-value="$props.optionValue" $props.params
:option-label="$props.optionLabel" ? `Workers/search?departmentCodes=${JSON.stringify(
:fields="$props.fields" $props.params.departmentCodes
)}`
: 'Workers/search'
"
option-value="id"
option-label="nickname"
:fields="['id', 'name', 'nickname', 'code']"
sort-by="name ASC"
:params="$props.params" :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" /> <VnAvatar :worker-id="value" color="primary" :title="title" />
</template> </template>
<template #append v-if="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('Responsible for approving invoices') }}</QTooltip>
</QIcon> </QIcon>
</template> </template>
<template #option="scope"> <template #option="scope">

View File

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

View File

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

View File

@ -424,17 +424,14 @@ function handleLocation(data, location) {
<VnSelectWorker <VnSelectWorker
:label="t('customer.summary.salesPerson')" :label="t('customer.summary.salesPerson')"
v-model="data.salesPersonFk" v-model="data.salesPersonFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'nickname'"
:fields="['id', 'name', 'nickname']"
:params="{ :params="{
departmentCodes: ['VT', 'shopping'], departmentCodes: ['VT', 'shopping'],
}" }"
:sort-by="'nickname ASC'"
:has-avatar="true" :has-avatar="true"
: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

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

View File

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

View File

@ -115,13 +115,23 @@ const getLocale = (label) => {
rounded rounded
:label="t('globals.params.salesPersonFk')" :label="t('globals.params.salesPersonFk')"
v-model="params.salesPersonFk" v-model="params.salesPersonFk"
:url="'Workers/search'"
:option-value="'id'"
:option-label="'name'"
:fields="['id', 'name', 'nickname']"
:params="{ departmentCodes: ['VT'] }" :params="{ departmentCodes: ['VT'] }"
:no-one="true" :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> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>

View File

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

View File

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

View File

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

View File

@ -34,11 +34,6 @@ const companySizes = [
<VnSelectWorker <VnSelectWorker
:label="t('supplier.basicData.workerFk')" :label="t('supplier.basicData.workerFk')"
v-model="data.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" :has-info="true"
:rules="validate('supplier.workerFk')" :rules="validate('supplier.workerFk')"
/> />

View File

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

View File

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

View File

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