forked from verdnatura/salix-front
fix: fix conflicts
This commit is contained in:
commit
1de74dec8e
|
@ -0,0 +1,36 @@
|
|||
import routes from 'src/router/modules';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
let isNotified = false;
|
||||
|
||||
export default {
|
||||
created: function () {
|
||||
const router = useRouter();
|
||||
const keyBindingMap = routes
|
||||
.filter((route) => route.meta.keyBinding)
|
||||
.reduce((map, route) => {
|
||||
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||
return map;
|
||||
}, {});
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
const { ctrlKey, altKey, code } = event;
|
||||
|
||||
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||
event.preventDefault();
|
||||
router.push(keyBindingMap[code]);
|
||||
isNotified = true;
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyUp = (event) => {
|
||||
const { ctrlKey, altKey } = event;
|
||||
if (!ctrlKey || !altKey) {
|
||||
isNotified = false;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
window.addEventListener('keyup', handleKeyUp);
|
||||
},
|
||||
};
|
|
@ -1,30 +1,52 @@
|
|||
import { getCurrentInstance } from 'vue';
|
||||
|
||||
function focusFirstInput(input) {
|
||||
input.focus();
|
||||
return;
|
||||
}
|
||||
export default {
|
||||
mounted: function () {
|
||||
const vm = getCurrentInstance();
|
||||
if (vm.type.name === 'QForm') {
|
||||
if (!['searchbarForm', 'filterPanelForm'].includes(this.$el?.id)) {
|
||||
// TODO: AUTOFOCUS IS NOT FOCUSING
|
||||
const that = this;
|
||||
this.$el.addEventListener('keyup', function (evt) {
|
||||
if (evt.key === 'Enter') {
|
||||
const input = evt.target;
|
||||
if (input.type == 'textarea' && evt.shiftKey) {
|
||||
evt.preventDefault();
|
||||
let { selectionStart, selectionEnd } = input;
|
||||
input.value =
|
||||
input.value.substring(0, selectionStart) +
|
||||
'\n' +
|
||||
input.value.substring(selectionEnd);
|
||||
selectionStart = selectionEnd = selectionStart + 1;
|
||||
return;
|
||||
}
|
||||
evt.preventDefault();
|
||||
that.onSubmit();
|
||||
}
|
||||
});
|
||||
const that = this;
|
||||
|
||||
const form = document.querySelector('.q-form#formModel');
|
||||
if (!form) return;
|
||||
try {
|
||||
const inputsFormCard = form.querySelectorAll(
|
||||
`input:not([disabled]):not([type="checkbox"])`
|
||||
);
|
||||
if (inputsFormCard.length) {
|
||||
focusFirstInput(inputsFormCard[0]);
|
||||
}
|
||||
const textareas = document.querySelectorAll(
|
||||
'textarea:not([disabled]), [contenteditable]:not([disabled])'
|
||||
);
|
||||
if (textareas.length) {
|
||||
focusFirstInput(textareas[textareas.length - 1]);
|
||||
}
|
||||
const inputs = document.querySelectorAll(
|
||||
'form#formModel input:not([disabled]):not([type="checkbox"])'
|
||||
);
|
||||
const input = inputs[0];
|
||||
if (!input) return;
|
||||
|
||||
focusFirstInput(input);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
form.addEventListener('keyup', function (evt) {
|
||||
if (evt.key === 'Enter') {
|
||||
const input = evt.target;
|
||||
if (input.type == 'textarea' && evt.shiftKey) {
|
||||
evt.preventDefault();
|
||||
let { selectionStart, selectionEnd } = input;
|
||||
input.value =
|
||||
input.value.substring(0, selectionStart) +
|
||||
'\n' +
|
||||
input.value.substring(selectionEnd);
|
||||
selectionStart = selectionEnd = selectionStart + 1;
|
||||
return;
|
||||
}
|
||||
evt.preventDefault();
|
||||
that.onSubmit();
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,11 +3,16 @@ import qFormMixin from './qformMixin';
|
|||
import keyShortcut from './keyShortcut';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { CanceledError } from 'axios';
|
||||
import { QForm } from 'quasar';
|
||||
import { QLayout } from 'quasar';
|
||||
import mainShortcutMixin from './mainShortcutMixin';
|
||||
|
||||
const { notify } = useNotify();
|
||||
|
||||
export default boot(({ app }) => {
|
||||
app.mixin(qFormMixin);
|
||||
QForm.mixins = [qFormMixin];
|
||||
QLayout.mixins = [mainShortcutMixin];
|
||||
|
||||
app.directive('shortcut', keyShortcut);
|
||||
app.config.errorHandler = (error) => {
|
||||
let message;
|
||||
|
|
|
@ -177,6 +177,7 @@ function normalize(text) {
|
|||
class="full-width"
|
||||
filled
|
||||
dense
|
||||
autofocus
|
||||
/>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
<script setup>
|
||||
import { computed, useAttrs } from 'vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const $props = defineProps({
|
||||
hasAvatar: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hasInfo: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number, Object],
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const $attrs = useAttrs();
|
||||
|
||||
const value = computed({
|
||||
get() {
|
||||
return $props.modelValue;
|
||||
},
|
||||
set(val) {
|
||||
emit('update:modelValue', val);
|
||||
},
|
||||
});
|
||||
|
||||
const url = computed(() => {
|
||||
let url = 'Workers/search';
|
||||
const { departmentCodes } = $attrs.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="url"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:fields="['id', 'name', 'nickname', 'code']"
|
||||
sort-by="nickname ASC"
|
||||
>
|
||||
<template #prepend v-if="$props.hasAvatar">
|
||||
<VnAvatar :worker-id="value" color="primary" :title="title" />
|
||||
</template>
|
||||
<template #append v-if="$props.hasInfo">
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip>{{ $t($props.hasInfo) }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt.name }}
|
||||
</QItemLabel>
|
||||
<QItemLabel v-if="!scope.opt.id">
|
||||
{{ scope.opt.nickname }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption v-else>
|
||||
{{ scope.opt.nickname }}, {{ scope.opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Responsible for approving invoices: Responsable de aprobar las facturas
|
||||
</i18n>
|
|
@ -1,50 +1,10 @@
|
|||
<script setup>
|
||||
import { useQuasar } from 'quasar';
|
||||
import Navbar from 'src/components/NavBar.vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import routes from 'src/router/modules';
|
||||
import { onMounted } from 'vue';
|
||||
|
||||
const quasar = useQuasar();
|
||||
|
||||
onMounted(() => {
|
||||
let isNotified = false;
|
||||
|
||||
const router = useRouter();
|
||||
const keyBindingMap = routes
|
||||
.filter((route) => route.meta.keyBinding)
|
||||
.reduce((map, route) => {
|
||||
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||
return map;
|
||||
}, {});
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
const { ctrlKey, altKey, code } = event;
|
||||
|
||||
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||
event.preventDefault();
|
||||
router.push(keyBindingMap[code]);
|
||||
isNotified = true;
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeyUp = (event) => {
|
||||
const { ctrlKey, altKey } = event;
|
||||
|
||||
if (!ctrlKey || !altKey) {
|
||||
isNotified = false;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
window.addEventListener('keyup', handleKeyUp);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QLayout view="hHh LpR fFf" v-shortcut>
|
||||
<Navbar />
|
||||
<RouterView></RouterView>
|
||||
<QFooter v-if="quasar.platform.is.mobile"></QFooter>
|
||||
<QFooter v-if="$q.platform.is.mobile"></QFooter>
|
||||
</QLayout>
|
||||
</template>
|
||||
|
|
|
@ -8,7 +8,7 @@ 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';
|
||||
import { getDifferences, getUpdatedValues } from 'src/filters';
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -16,7 +16,6 @@ const { t } = useI18n();
|
|||
|
||||
const businessTypes = ref([]);
|
||||
const contactChannels = ref([]);
|
||||
const title = ref();
|
||||
const handleSalesModelValue = (val) => ({
|
||||
or: [
|
||||
{ id: val },
|
||||
|
@ -117,41 +116,17 @@ function onBeforeSave(formData, originalData) {
|
|||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Workers/search"
|
||||
v-model="data.salesPersonFk"
|
||||
<VnSelectWorker
|
||||
:label="t('customer.summary.salesPerson')"
|
||||
v-model="data.salesPersonFk"
|
||||
:params="{
|
||||
departmentCodes: ['VT', 'shopping'],
|
||||
}"
|
||||
:fields="['id', 'nickname']"
|
||||
sort-by="nickname ASC"
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
: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>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt?.nickname }},
|
||||
{{ scope.opt?.code }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
<VnSelect
|
||||
v-model="data.contactChannelFk"
|
||||
:options="contactChannels"
|
||||
|
|
|
@ -3,6 +3,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
defineProps({
|
||||
|
@ -65,19 +66,14 @@ const exprBuilder = (param, value) => {
|
|||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
url="Workers/search"
|
||||
<VnSelectWorker
|
||||
:label="t('Salesperson')"
|
||||
v-model="params.salesPersonFk"
|
||||
:params="{
|
||||
departmentCodes: ['VT'],
|
||||
}"
|
||||
auto-load
|
||||
:label="t('Salesperson')"
|
||||
:expr-builder="exprBuilder"
|
||||
v-model="params.salesPersonFk"
|
||||
@update:model-value="searchFn()"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
sort-by="nickname ASC"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
|
@ -86,18 +82,7 @@ const exprBuilder = (param, value) => {
|
|||
outlined
|
||||
rounded
|
||||
:input-debounce="0"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.nickname }},{{ opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template></VnSelect
|
||||
>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { ref, computed, markRaw } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
|
@ -12,7 +11,7 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
|||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import CustomerFilter from './CustomerFilter.vue';
|
||||
import VnAvatar from 'src/components/ui/VnAvatar.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
|
@ -422,40 +421,17 @@ function handleLocation(data, location) {
|
|||
auto-load
|
||||
>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnSelect
|
||||
url="Workers/search"
|
||||
v-model="data.salesPersonFk"
|
||||
<VnSelectWorker
|
||||
:label="t('customer.summary.salesPerson')"
|
||||
v-model="data.salesPersonFk"
|
||||
:params="{
|
||||
departmentCodes: ['VT', 'shopping'],
|
||||
}"
|
||||
:fields="['id', 'nickname', 'code']"
|
||||
sort-by="nickname ASC"
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
:has-avatar="true"
|
||||
:id-value="data.salesPersonFk"
|
||||
emit-value
|
||||
auto-load
|
||||
>
|
||||
<template #prepend>
|
||||
<VnAvatar
|
||||
:worker-id="data.salesPersonFk"
|
||||
color="primary"
|
||||
:title="title"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt?.nickname }},
|
||||
{{ scope.opt?.code }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
|
||||
/>
|
||||
<VnLocation
|
||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||
v-model="data.location"
|
||||
|
|
|
@ -6,6 +6,7 @@ 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 VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -48,14 +49,9 @@ const { t } = useI18n();
|
|||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
<VnSelectWorker
|
||||
:label="t('department.bossDepartment')"
|
||||
v-model="data.workerFk"
|
||||
url="Workers/search"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
map-options
|
||||
:rules="validate('department.workerFk')"
|
||||
/>
|
||||
<VnSelect
|
||||
|
|
|
@ -8,6 +8,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -160,33 +161,17 @@ onMounted(async () => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
<VnSelectWorker
|
||||
:label="t('params.requesterFk')"
|
||||
v-model="params.requesterFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="Workers/search"
|
||||
:fields="['id', 'name']"
|
||||
order="name ASC"
|
||||
:params="{ departmentCodes: ['VT'] }"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt?.nickname }},
|
||||
{{ scope.opt?.code }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
|
|
@ -9,6 +9,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { dateRange } from 'src/filters';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
defineProps({ dataKey: { type: String, required: true } });
|
||||
const { t, te } = useI18n();
|
||||
|
@ -112,33 +113,16 @@ const getLocale = (label) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
<VnSelectWorker
|
||||
outlined
|
||||
dense
|
||||
rounded
|
||||
:label="t('globals.params.salesPersonFk')"
|
||||
v-model="params.salesPersonFk"
|
||||
url="Workers/search"
|
||||
:params="{ departmentCodes: ['VT'] }"
|
||||
is-outlined
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
: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>
|
||||
</VnSelect>
|
||||
</VnSelectWorker>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
|
|
@ -6,6 +6,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
|||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -61,28 +62,16 @@ const sourceList = ref([]);
|
|||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('salesPerson')"
|
||||
<VnSelectWorker
|
||||
:label="t('globals.salesPerson')"
|
||||
v-model="params.workerFk"
|
||||
url="Workers/search"
|
||||
:filter="{ departmentCodes: ['VT'] }"
|
||||
sort-by="nickname ASC"
|
||||
option-label="nickname"
|
||||
:params="{
|
||||
departmentCodes: ['VT'],
|
||||
}"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.nickname }},{{ opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
<VnInputDate
|
||||
v-model="params.from"
|
||||
:label="t('fromLanded')"
|
||||
|
|
|
@ -4,6 +4,7 @@ import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
|||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -31,29 +32,13 @@ const emit = defineEmits(['search']);
|
|||
<template #body="{ params }">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('Worker')"
|
||||
<VnSelectWorker
|
||||
v-model="params.workerFk"
|
||||
url="Workers/search"
|
||||
sort-by="nickname ASC"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:input-debounce="0"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.nickname }},{{ opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-sm">
|
||||
|
|
|
@ -11,6 +11,7 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
|||
import VnInput from 'components/common/VnInput.vue';
|
||||
import axios from 'axios';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
@ -94,26 +95,7 @@ const onSave = (data, response) => {
|
|||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('Worker')"
|
||||
v-model="data.workerFk"
|
||||
url="Workers/search"
|
||||
sort-by="nickname ASC"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:input-debounce="0"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ opt.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.nickname }}, {{ opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
<VnSelectWorker v-model="data.workerFk" />
|
||||
<VnSelect
|
||||
:label="t('Vehicle')"
|
||||
v-model="data.vehicleFk"
|
||||
|
|
|
@ -5,6 +5,7 @@ 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 VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -30,31 +31,11 @@ const companySizes = [
|
|||
:rules="validate('supplier.nickname')"
|
||||
clearable
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('supplier.basicData.workerFk')"
|
||||
<VnSelectWorker
|
||||
v-model="data.workerFk"
|
||||
url="Workers/search"
|
||||
sort-by="nickname ASC"
|
||||
has-info="Responsible for approving invoices"
|
||||
:rules="validate('supplier.workerFk')"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-pointer">
|
||||
<QTooltip>{{
|
||||
t('Responsible for approving invoices')
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.nickname }}, {{ scope.opt?.id }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('supplier.basicData.size')"
|
||||
v-model="data.companySize"
|
||||
|
@ -102,6 +83,5 @@ const companySizes = [
|
|||
|
||||
<i18n>
|
||||
es:
|
||||
Responsible for approving invoices: Responsable de aprobar las facturas
|
||||
Small(1-5), Medium(6-50), Big(> 50): Pequeño(1-5), Mediano(6-50), Grande(> 50)
|
||||
</i18n>
|
||||
|
|
|
@ -9,6 +9,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import { useState } from 'src/composables/useState';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const emit = defineEmits(['onRequestCreated']);
|
||||
|
||||
|
@ -46,29 +47,7 @@ const onStateFkChange = (formData) => (formData.userFk = user.value.id);
|
|||
option-label="name"
|
||||
option-value="id"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('expedition.worker')"
|
||||
v-model="data.userFk"
|
||||
url="Workers/search"
|
||||
fields=" ['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
>
|
||||
<template #option="{ opt, itemProps }">
|
||||
<QItem v-bind="itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ opt.name }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ opt.nickname }}, {{ opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template></VnSelect
|
||||
>
|
||||
<VnSelectWorker v-model="data.userFk" :fields="['id', 'name']" />
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
|
|
|
@ -133,6 +133,7 @@ function reloadData() {
|
|||
option-value="id"
|
||||
id="deviceProductionFk"
|
||||
hide-selected
|
||||
data-cy="pda-dialog-select"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
|
|
@ -14,6 +14,7 @@ import FormModel from 'components/FormModel.vue';
|
|||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
import VnRadio from 'src/components/common/VnRadio.vue';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const user = useState().getUser();
|
||||
|
@ -149,27 +150,11 @@ async function autofillBic(worker) {
|
|||
hide-selected
|
||||
:rules="validate('Worker.company')"
|
||||
/>
|
||||
<VnSelect
|
||||
<VnSelectWorker
|
||||
:label="t('worker.summary.boss')"
|
||||
v-model="data.bossFk"
|
||||
url="Workers/search"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
:rules="validate('Worker.boss')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt.nickname }},
|
||||
{{ scope.opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
|
|
|
@ -18,6 +18,7 @@ import RightMenu from 'src/components/common/RightMenu.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();
|
||||
|
@ -260,26 +261,10 @@ async function autofillBic(worker) {
|
|||
option-label="code"
|
||||
hide-selected
|
||||
/>
|
||||
<VnSelect
|
||||
<VnSelectWorker
|
||||
:label="t('worker.summary.boss')"
|
||||
v-model="data.bossFk"
|
||||
url="Workers/search"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
|
||||
<QItemLabel caption
|
||||
>{{ scope.opt.nickname }},
|
||||
{{ scope.opt.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.fi" :label="t('worker.create.fi')" />
|
||||
|
@ -376,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>
|
||||
|
|
|
@ -32,7 +32,12 @@ const agencyOptions = ref([]);
|
|||
<FormModel :url="`Zones/${route.params.id}`" auto-load model="zone">
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput :label="t('Name')" clearable v-model="data.name" />
|
||||
<VnInput
|
||||
data-cy="zone-basic-data-name"
|
||||
:label="t('Name')"
|
||||
clearable
|
||||
v-model="data.name"
|
||||
/>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
describe('WorkerPda', () => {
|
||||
const deviceProductionField =
|
||||
'.vn-row > .q-field > .q-field__inner > .q-field__control > .q-field__control-container';
|
||||
const select = '[data-cy="pda-dialog-select"]';
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('developer');
|
||||
|
@ -9,7 +8,8 @@ describe('WorkerPda', () => {
|
|||
|
||||
it('assign pda', () => {
|
||||
cy.get('.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon').click();
|
||||
cy.get(deviceProductionField).type('{downArrow}{enter}');
|
||||
cy.get(select).click();
|
||||
cy.get(select).type('{downArrow}{enter}');
|
||||
cy.get('.q-notification__message').should('have.text', 'Data created');
|
||||
});
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ describe('ZoneBasicData', () => {
|
|||
});
|
||||
|
||||
it('should throw an error if the name is empty', () => {
|
||||
cy.get('.q-card > :nth-child(1)').clear();
|
||||
cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}');
|
||||
cy.get('.q-btn-group > .q-btn--standard').click();
|
||||
cy.get(notification).should('contains.text', "can't be blank");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue