Merge branch 'dev' of https: refs #8372//gitea.verdnatura.es/verdnatura/salix-front into 8372-fixDoubleRequest
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
commit
5f12532983
|
@ -14,8 +14,8 @@ export default defineConfig({
|
|||
downloadsFolder: 'test/cypress/downloads',
|
||||
video: false,
|
||||
specPattern: 'test/cypress/integration/**/*.spec.js',
|
||||
experimentalRunAllSpecs: true,
|
||||
watchForFileChanges: true,
|
||||
experimentalRunAllSpecs: false,
|
||||
watchForFileChanges: false,
|
||||
reporter: 'cypress-mochawesome-reporter',
|
||||
reporterOptions: {
|
||||
charts: true,
|
||||
|
|
|
@ -30,7 +30,6 @@ export default configure(function (/* ctx */) {
|
|||
// --> boot files are part of "main.js"
|
||||
// https://v2.quasar.dev/quasar-cli/boot-files
|
||||
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar', 'quasar.defaults'],
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
||||
css: ['app.scss'],
|
||||
|
||||
|
|
|
@ -51,4 +51,5 @@ export default boot(({ app }) => {
|
|||
|
||||
await useCau(response, message);
|
||||
};
|
||||
app.provide('app', app);
|
||||
});
|
||||
|
|
|
@ -64,6 +64,10 @@ const $props = defineProps({
|
|||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
beforeSaveFn: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
goTo: {
|
||||
type: String,
|
||||
default: '',
|
||||
|
@ -176,7 +180,11 @@ async function saveChanges(data) {
|
|||
hasChanges.value = false;
|
||||
return;
|
||||
}
|
||||
const changes = data || getChanges();
|
||||
let changes = data || getChanges();
|
||||
if ($props.beforeSaveFn) {
|
||||
changes = await $props.beforeSaveFn(changes, getChanges);
|
||||
}
|
||||
|
||||
try {
|
||||
await axios.post($props.saveUrl || $props.url + '/crud', changes);
|
||||
} finally {
|
||||
|
@ -229,12 +237,12 @@ async function remove(data) {
|
|||
componentProps: {
|
||||
title: t('globals.confirmDeletion'),
|
||||
message: t('globals.confirmDeletionMessage'),
|
||||
newData,
|
||||
data: { deletes: ids },
|
||||
ids,
|
||||
promise: saveChanges,
|
||||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
await saveChanges({ deletes: ids });
|
||||
newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
|
||||
fetch(newData);
|
||||
});
|
||||
|
@ -374,6 +382,8 @@ watch(formUrl, async () => {
|
|||
@click="onSubmit"
|
||||
:disable="!hasChanges"
|
||||
:title="t('globals.save')"
|
||||
v-shortcut="'s'"
|
||||
shortcut="s"
|
||||
data-cy="crudModelDefaultSaveBtn"
|
||||
/>
|
||||
<slot name="moreAfterActions" />
|
||||
|
|
|
@ -181,6 +181,7 @@ const selectTravel = ({ id }) => {
|
|||
color="primary"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
data-cy="save-filter-travel-form"
|
||||
/>
|
||||
</div>
|
||||
<QTable
|
||||
|
@ -191,9 +192,10 @@ const selectTravel = ({ id }) => {
|
|||
:no-data-label="t('Enter a new search')"
|
||||
class="q-mt-lg"
|
||||
@row-click="(_, row) => selectTravel(row)"
|
||||
data-cy="table-filter-travel-form"
|
||||
>
|
||||
<template #body-cell-id="{ row }">
|
||||
<QTd auto-width @click.stop>
|
||||
<QTd auto-width @click.stop data-cy="travelFk-travel-form">
|
||||
<QBtn flat color="blue">{{ row.id }}</QBtn>
|
||||
<TravelDescriptorProxy :id="row.id" />
|
||||
</QTd>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
|
@ -15,23 +15,30 @@ defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
showSaveAndContinueBtn: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const formModelRef = ref(null);
|
||||
const closeButton = ref(null);
|
||||
|
||||
const isSaveAndContinue = ref(false);
|
||||
const onDataSaved = (formData, requestResponse) => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
if (closeButton.value && isSaveAndContinue) closeButton.value.click();
|
||||
emit('onDataSaved', formData, requestResponse);
|
||||
};
|
||||
|
||||
const isLoading = computed(() => formModelRef.value?.isLoading);
|
||||
const reset = computed(() => formModelRef.value?.reset);
|
||||
|
||||
defineExpose({
|
||||
isLoading,
|
||||
onDataSaved,
|
||||
isSaveAndContinue,
|
||||
reset,
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -51,6 +58,19 @@ defineExpose({
|
|||
<p>{{ subtitle }}</p>
|
||||
<slot name="form-inputs" :data="data" :validate="validate" />
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
v-if="showSaveAndContinueBtn"
|
||||
:label="t('globals.isSaveAndContinue')"
|
||||
:title="t('globals.isSaveAndContinue')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
class="q-ml-sm"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
data-cy="FormModelPopup_isSaveAndContinue"
|
||||
z-max
|
||||
@click="() => (isSaveAndContinue = true)"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
:title="t('globals.cancel')"
|
||||
|
@ -59,10 +79,15 @@ defineExpose({
|
|||
flat
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
@click="emit('onDataCanceled')"
|
||||
v-close-popup
|
||||
data-cy="FormModelPopup_cancel"
|
||||
v-close-popup
|
||||
z-max
|
||||
@click="
|
||||
() => {
|
||||
isSaveAndContinue = false;
|
||||
emit('onDataCanceled');
|
||||
}
|
||||
"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.save')"
|
||||
|
@ -74,6 +99,7 @@ defineExpose({
|
|||
:loading="isLoading"
|
||||
data-cy="FormModelPopup_save"
|
||||
z-max
|
||||
@click="() => (isSaveAndContinue = false)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -26,6 +26,7 @@ const itemComputed = computed(() => {
|
|||
:to="{ name: itemComputed.name }"
|
||||
clickable
|
||||
v-ripple
|
||||
:data-cy="`${itemComputed.name}-menu-item`"
|
||||
>
|
||||
<QItemSection avatar v-if="itemComputed.icon">
|
||||
<QIcon :name="itemComputed.icon" />
|
||||
|
|
|
@ -9,6 +9,7 @@ import VnSelect from 'components/common/VnSelect.vue';
|
|||
import FormPopup from './FormPopup.vue';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
invoiceOutData: {
|
||||
|
@ -131,15 +132,11 @@ const refund = async () => {
|
|||
:required="true"
|
||||
/> </VnRow
|
||||
><VnRow>
|
||||
<div>
|
||||
<QCheckbox
|
||||
:label="t('Inherit warehouse')"
|
||||
v-model="invoiceParams.inheritWarehouse"
|
||||
/>
|
||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||
<QTooltip>{{ t('Inherit warehouse tooltip') }}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnCheckbox
|
||||
v-model="invoiceParams.inheritWarehouse"
|
||||
:label="t('Inherit warehouse')"
|
||||
:info="t('Inherit warehouse tooltip')"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormPopup>
|
||||
|
|
|
@ -10,6 +10,7 @@ import VnSelect from 'components/common/VnSelect.vue';
|
|||
import FormPopup from './FormPopup.vue';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import VnCheckbox from './common/VnCheckbox.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
invoiceOutData: {
|
||||
|
@ -186,15 +187,11 @@ const makeInvoice = async () => {
|
|||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<div>
|
||||
<QCheckbox
|
||||
:label="t('Bill destination client')"
|
||||
v-model="checked"
|
||||
/>
|
||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||
<QTooltip>{{ t('transferInvoiceInfo') }}</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnCheckbox
|
||||
v-model="checked"
|
||||
:label="t('Bill destination client')"
|
||||
:info="t('transferInvoiceInfo')"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormPopup>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<script setup>
|
||||
import { markRaw, computed } from 'vue';
|
||||
import { QIcon, QCheckbox } from 'quasar';
|
||||
import { QIcon, QCheckbox, QToggle } from 'quasar';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
/* basic input */
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnSelectCache from 'components/common/VnSelectCache.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
|
@ -12,8 +11,11 @@ import VnInputDate from 'components/common/VnInputDate.vue';
|
|||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
import VnComponent from 'components/common/VnComponent.vue';
|
||||
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||
import VnSelectEnum from '../common/VnSelectEnum.vue';
|
||||
import VnCheckbox from '../common/VnCheckbox.vue';
|
||||
|
||||
const model = defineModel(undefined, { required: true });
|
||||
const emit = defineEmits(['blur']);
|
||||
const $props = defineProps({
|
||||
column: {
|
||||
type: Object,
|
||||
|
@ -39,10 +41,18 @@ const $props = defineProps({
|
|||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
autofocus: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showLabel: {
|
||||
type: Boolean,
|
||||
default: null,
|
||||
},
|
||||
eventHandlers: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const defaultSelect = {
|
||||
|
@ -99,7 +109,8 @@ const defaultComponents = {
|
|||
},
|
||||
},
|
||||
checkbox: {
|
||||
component: markRaw(QCheckbox),
|
||||
ref: 'checkbox',
|
||||
component: markRaw(VnCheckbox),
|
||||
attrs: ({ model }) => {
|
||||
const defaultAttrs = {
|
||||
disable: !$props.isEditable,
|
||||
|
@ -115,6 +126,10 @@ const defaultComponents = {
|
|||
},
|
||||
forceAttrs: {
|
||||
label: $props.showLabel && $props.column.label,
|
||||
autofocus: true,
|
||||
},
|
||||
events: {
|
||||
blur: () => emit('blur'),
|
||||
},
|
||||
},
|
||||
select: {
|
||||
|
@ -125,12 +140,19 @@ const defaultComponents = {
|
|||
component: markRaw(VnSelect),
|
||||
...defaultSelect,
|
||||
},
|
||||
selectEnum: {
|
||||
component: markRaw(VnSelectEnum),
|
||||
...defaultSelect,
|
||||
},
|
||||
icon: {
|
||||
component: markRaw(QIcon),
|
||||
},
|
||||
userLink: {
|
||||
component: markRaw(VnUserLink),
|
||||
},
|
||||
toggle: {
|
||||
component: markRaw(QToggle),
|
||||
},
|
||||
};
|
||||
|
||||
const value = computed(() => {
|
||||
|
@ -160,7 +182,28 @@ const col = computed(() => {
|
|||
return newColumn;
|
||||
});
|
||||
|
||||
const components = computed(() => $props.components ?? defaultComponents);
|
||||
const components = computed(() => {
|
||||
const sourceComponents = $props.components ?? defaultComponents;
|
||||
|
||||
return Object.keys(sourceComponents).reduce((acc, key) => {
|
||||
const component = sourceComponents[key];
|
||||
|
||||
if (!component || typeof component !== 'object') {
|
||||
acc[key] = component;
|
||||
return acc;
|
||||
}
|
||||
|
||||
acc[key] = {
|
||||
...component,
|
||||
attrs: {
|
||||
...(component.attrs || {}),
|
||||
autofocus: $props.autofocus,
|
||||
},
|
||||
event: { ...component?.event, ...$props?.eventHandlers },
|
||||
};
|
||||
return acc;
|
||||
}, {});
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="row no-wrap">
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
<script setup>
|
||||
import { markRaw, computed } from 'vue';
|
||||
import { QCheckbox } from 'quasar';
|
||||
import { QCheckbox, QToggle } from 'quasar';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
|
||||
/* basic input */
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||
import VnColumn from 'components/VnTable/VnColumn.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
column: {
|
||||
|
@ -27,6 +25,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: 'table',
|
||||
},
|
||||
customClass: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
defineExpose({ addFilter, props: $props });
|
||||
|
@ -34,7 +36,7 @@ defineExpose({ addFilter, props: $props });
|
|||
const model = defineModel(undefined, { required: true });
|
||||
const arrayData = useArrayData(
|
||||
$props.dataKey,
|
||||
$props.searchUrl ? { searchUrl: $props.searchUrl } : null
|
||||
$props.searchUrl ? { searchUrl: $props.searchUrl } : null,
|
||||
);
|
||||
const columnFilter = computed(() => $props.column?.columnFilter);
|
||||
|
||||
|
@ -46,19 +48,18 @@ const enterEvent = {
|
|||
|
||||
const defaultAttrs = {
|
||||
filled: !$props.showTitle,
|
||||
class: 'q-px-xs q-pb-xs q-pt-none fit',
|
||||
dense: true,
|
||||
};
|
||||
|
||||
const forceAttrs = {
|
||||
label: $props.showTitle ? '' : columnFilter.value?.label ?? $props.column.label,
|
||||
label: $props.showTitle ? '' : (columnFilter.value?.label ?? $props.column.label),
|
||||
};
|
||||
|
||||
const selectComponent = {
|
||||
component: markRaw(VnSelect),
|
||||
event: updateEvent,
|
||||
attrs: {
|
||||
class: 'q-px-sm q-pb-xs q-pt-none fit',
|
||||
class: `q-pt-none fit ${$props.customClass}`,
|
||||
dense: true,
|
||||
filled: !$props.showTitle,
|
||||
},
|
||||
|
@ -109,14 +110,24 @@ const components = {
|
|||
component: markRaw(QCheckbox),
|
||||
event: updateEvent,
|
||||
attrs: {
|
||||
dense: true,
|
||||
class: $props.showTitle ? 'q-py-sm q-mt-md' : 'q-px-md q-py-xs fit',
|
||||
class: $props.showTitle ? 'q-py-sm' : 'q-px-md q-py-xs fit',
|
||||
'toggle-indeterminate': true,
|
||||
size: 'sm',
|
||||
},
|
||||
forceAttrs,
|
||||
},
|
||||
select: selectComponent,
|
||||
rawSelect: selectComponent,
|
||||
toggle: {
|
||||
component: markRaw(QToggle),
|
||||
event: updateEvent,
|
||||
attrs: {
|
||||
class: $props.showTitle ? 'q-py-sm' : 'q-px-md q-py-xs fit',
|
||||
'toggle-indeterminate': true,
|
||||
size: 'sm',
|
||||
},
|
||||
forceAttrs,
|
||||
},
|
||||
};
|
||||
|
||||
async function addFilter(value, name) {
|
||||
|
@ -132,19 +143,8 @@ async function addFilter(value, name) {
|
|||
await arrayData.addFilter({ params: { [field]: value } });
|
||||
}
|
||||
|
||||
function alignRow() {
|
||||
switch ($props.column.align) {
|
||||
case 'left':
|
||||
return 'justify-start items-start';
|
||||
case 'right':
|
||||
return 'justify-end items-end';
|
||||
default:
|
||||
return 'flex-center';
|
||||
}
|
||||
}
|
||||
|
||||
const showFilter = computed(
|
||||
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions'
|
||||
() => $props.column?.columnFilter !== false && $props.column.name != 'tableActions',
|
||||
);
|
||||
|
||||
const onTabPressed = async () => {
|
||||
|
@ -152,13 +152,8 @@ const onTabPressed = async () => {
|
|||
};
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
v-if="showFilter"
|
||||
class="full-width"
|
||||
:class="alignRow()"
|
||||
style="max-height: 45px; overflow: hidden"
|
||||
>
|
||||
<VnTableColumn
|
||||
<div v-if="showFilter" class="full-width flex-center" style="overflow: hidden">
|
||||
<VnColumn
|
||||
:column="$props.column"
|
||||
default="input"
|
||||
v-model="model"
|
||||
|
@ -168,3 +163,8 @@ const onTabPressed = async () => {
|
|||
/>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
label.vn-label-padding > .q-field__inner > .q-field__control {
|
||||
padding: inherit !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -41,6 +41,7 @@ async function orderBy(name, direction) {
|
|||
break;
|
||||
}
|
||||
if (!direction) return await arrayData.deleteOrder(name);
|
||||
|
||||
await arrayData.addOrder(name, direction);
|
||||
}
|
||||
|
||||
|
@ -51,45 +52,60 @@ defineExpose({ orderBy });
|
|||
@mouseenter="hover = true"
|
||||
@mouseleave="hover = false"
|
||||
@click="orderBy(name, model?.direction)"
|
||||
class="row items-center no-wrap cursor-pointer"
|
||||
class="row items-center no-wrap cursor-pointer title"
|
||||
>
|
||||
<span :title="label">{{ label }}</span>
|
||||
<QChip
|
||||
v-if="name"
|
||||
:label="!vertical ? model?.index : ''"
|
||||
:icon="
|
||||
(model?.index || hover) && !vertical
|
||||
? model?.direction == 'DESC'
|
||||
? 'arrow_downward'
|
||||
: 'arrow_upward'
|
||||
: undefined
|
||||
"
|
||||
:size="vertical ? '' : 'sm'"
|
||||
:class="[
|
||||
model?.index ? 'color-vn-text' : 'bg-transparent',
|
||||
vertical ? 'q-px-none' : '',
|
||||
]"
|
||||
class="no-box-shadow"
|
||||
:clickable="true"
|
||||
style="min-width: 40px"
|
||||
>
|
||||
<div
|
||||
class="column flex-center"
|
||||
v-if="vertical"
|
||||
:style="!model?.index && 'color: #5d5d5d'"
|
||||
<sup v-if="name && model?.index">
|
||||
<QChip
|
||||
:label="!vertical ? model?.index : ''"
|
||||
:icon="
|
||||
(model?.index || hover) && !vertical
|
||||
? model?.direction == 'DESC'
|
||||
? 'arrow_downward'
|
||||
: 'arrow_upward'
|
||||
: undefined
|
||||
"
|
||||
:size="vertical ? '' : 'sm'"
|
||||
:class="[
|
||||
model?.index ? 'color-vn-text' : 'bg-transparent',
|
||||
vertical ? 'q-px-none' : '',
|
||||
]"
|
||||
class="no-box-shadow"
|
||||
:clickable="true"
|
||||
style="min-width: 40px; max-height: 30px"
|
||||
>
|
||||
{{ model?.index }}
|
||||
<QIcon
|
||||
:name="
|
||||
model?.index
|
||||
? model?.direction == 'DESC'
|
||||
? 'arrow_downward'
|
||||
: 'arrow_upward'
|
||||
: 'swap_vert'
|
||||
"
|
||||
size="xs"
|
||||
/>
|
||||
</div>
|
||||
</QChip>
|
||||
<div
|
||||
class="column flex-center"
|
||||
v-if="vertical"
|
||||
:style="!model?.index && 'color: #5d5d5d'"
|
||||
>
|
||||
{{ model?.index }}
|
||||
<QIcon
|
||||
:name="
|
||||
model?.index
|
||||
? model?.direction == 'DESC'
|
||||
? 'arrow_downward'
|
||||
: 'arrow_upward'
|
||||
: 'swap_vert'
|
||||
"
|
||||
size="xs"
|
||||
/>
|
||||
</div>
|
||||
</QChip>
|
||||
</sup>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.title {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
sup {
|
||||
vertical-align: super; /* Valor predeterminado */
|
||||
/* También puedes usar otros valores como "baseline", "top", "text-top", etc. */
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,22 +1,37 @@
|
|||
<script setup>
|
||||
import { ref, onBeforeMount, onMounted, computed, watch, useAttrs } from 'vue';
|
||||
import {
|
||||
ref,
|
||||
onBeforeMount,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
computed,
|
||||
watch,
|
||||
h,
|
||||
render,
|
||||
inject,
|
||||
useAttrs,
|
||||
} from 'vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useFilterParams } from 'src/composables/useFilterParams';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
|
||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||
import VnColumn from 'components/VnTable/VnColumn.vue';
|
||||
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||
import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
||||
import VnTableFilter from './VnTableFilter.vue';
|
||||
import { getColAlign } from 'src/composables/getColAlign';
|
||||
|
||||
const arrayData = useArrayData(useAttrs()['data-key']);
|
||||
const $props = defineProps({
|
||||
columns: {
|
||||
type: Array,
|
||||
|
@ -42,10 +57,6 @@ const $props = defineProps({
|
|||
type: [Function, Boolean],
|
||||
default: null,
|
||||
},
|
||||
rowCtrlClick: {
|
||||
type: [Function, Boolean],
|
||||
default: null,
|
||||
},
|
||||
redirect: {
|
||||
type: String,
|
||||
default: null,
|
||||
|
@ -114,7 +125,19 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
withFilters: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
createComplement: {
|
||||
type: Object,
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
|
@ -132,10 +155,18 @@ const showForm = ref(false);
|
|||
const splittedColumns = ref({ columns: [] });
|
||||
const columnsVisibilitySkipped = ref();
|
||||
const createForm = ref();
|
||||
const createRef = ref(null);
|
||||
const tableRef = ref();
|
||||
const params = ref(useFilterParams($attrs['data-key']).params);
|
||||
const orders = ref(useFilterParams($attrs['data-key']).orders);
|
||||
const app = inject('app');
|
||||
|
||||
const editingRow = ref(null);
|
||||
const editingField = ref(null);
|
||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||
const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon);
|
||||
const selectRegex = /select/;
|
||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||
const tableModes = [
|
||||
{
|
||||
icon: 'view_column',
|
||||
|
@ -156,7 +187,8 @@ onBeforeMount(() => {
|
|||
hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
if ($props.isEditable) document.addEventListener('click', clickHandler);
|
||||
mode.value =
|
||||
quasar.platform.is.mobile && !$props.disableOption?.card
|
||||
? CARD_MODE
|
||||
|
@ -178,14 +210,25 @@ onMounted(() => {
|
|||
}
|
||||
});
|
||||
|
||||
onUnmounted(async () => {
|
||||
if ($props.isEditable) document.removeEventListener('click', clickHandler);
|
||||
});
|
||||
|
||||
watch(
|
||||
() => $props.columns,
|
||||
(value) => splitColumns(value),
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const isTableMode = computed(() => mode.value == TABLE_MODE);
|
||||
const showRightIcon = computed(() => $props.rightSearch || $props.rightSearchIcon);
|
||||
defineExpose({
|
||||
create: createForm,
|
||||
reload,
|
||||
redirect: redirectFn,
|
||||
selected,
|
||||
CrudModelRef,
|
||||
params,
|
||||
tableRef,
|
||||
});
|
||||
|
||||
function splitColumns(columns) {
|
||||
splittedColumns.value = {
|
||||
|
@ -231,16 +274,6 @@ const rowClickFunction = computed(() => {
|
|||
return () => {};
|
||||
});
|
||||
|
||||
const rowCtrlClickFunction = computed(() => {
|
||||
if ($props.rowCtrlClick != undefined) return $props.rowCtrlClick;
|
||||
if ($props.redirect)
|
||||
return (evt, { id }) => {
|
||||
stopEventPropagation(evt);
|
||||
window.open(`/#/${$props.redirect}/${id}`, '_blank');
|
||||
};
|
||||
return () => {};
|
||||
});
|
||||
|
||||
function redirectFn(id) {
|
||||
router.push({ path: `/${$props.redirect}/${id}` });
|
||||
}
|
||||
|
@ -262,21 +295,6 @@ function columnName(col) {
|
|||
return name;
|
||||
}
|
||||
|
||||
function getColAlign(col) {
|
||||
return 'text-' + (col.align ?? 'left');
|
||||
}
|
||||
|
||||
const emit = defineEmits(['onFetch', 'update:selected', 'saveChanges']);
|
||||
defineExpose({
|
||||
create: createForm,
|
||||
reload,
|
||||
redirect: redirectFn,
|
||||
selected,
|
||||
CrudModelRef,
|
||||
params,
|
||||
tableRef,
|
||||
});
|
||||
|
||||
function handleOnDataSaved(_) {
|
||||
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
||||
else $props.create.onDataSaved(_);
|
||||
|
@ -304,6 +322,214 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isEditableColumn(column) {
|
||||
const isEditableCol = column?.isEditable ?? true;
|
||||
const isVisible = column?.visible ?? true;
|
||||
const hasComponent = column?.component;
|
||||
|
||||
return $props.isEditable && isVisible && hasComponent && isEditableCol;
|
||||
}
|
||||
|
||||
function hasEditableFormat(column) {
|
||||
if (isEditableColumn(column)) return 'editable-text';
|
||||
}
|
||||
|
||||
const clickHandler = async (event) => {
|
||||
const clickedElement = event.target.closest('td');
|
||||
|
||||
const isDateElement = event.target.closest('.q-date');
|
||||
const isTimeElement = event.target.closest('.q-time');
|
||||
|
||||
if (isDateElement || isTimeElement) return;
|
||||
|
||||
if (clickedElement === null) {
|
||||
destroyInput(editingRow.value, editingField.value);
|
||||
return;
|
||||
}
|
||||
const rowIndex = clickedElement.getAttribute('data-row-index');
|
||||
const colField = clickedElement.getAttribute('data-col-field');
|
||||
const column = $props.columns.find((col) => col.name === colField);
|
||||
|
||||
if (editingRow.value !== null && editingField.value !== null) {
|
||||
if (editingRow.value === rowIndex && editingField.value === colField) {
|
||||
return;
|
||||
}
|
||||
|
||||
destroyInput(editingRow.value, editingField.value);
|
||||
}
|
||||
if (isEditableColumn(column))
|
||||
await renderInput(Number(rowIndex), colField, clickedElement);
|
||||
};
|
||||
|
||||
async function handleTabKey(event, rowIndex, colField) {
|
||||
if (editingRow.value == rowIndex && editingField.value == colField)
|
||||
destroyInput(editingRow.value, editingField.value);
|
||||
|
||||
const direction = event.shiftKey ? -1 : 1;
|
||||
const { nextRowIndex, nextColumnName } = await handleTabNavigation(
|
||||
rowIndex,
|
||||
colField,
|
||||
direction,
|
||||
);
|
||||
|
||||
if (nextRowIndex < 0 || nextRowIndex >= arrayData.store.data.length) return;
|
||||
|
||||
event.preventDefault();
|
||||
await renderInput(nextRowIndex, nextColumnName, null);
|
||||
}
|
||||
|
||||
async function renderInput(rowId, field, clickedElement) {
|
||||
editingField.value = field;
|
||||
editingRow.value = rowId;
|
||||
|
||||
const originalColumn = $props.columns.find((col) => col.name === field);
|
||||
const column = { ...originalColumn, ...{ label: '' } };
|
||||
const row = CrudModelRef.value.formData[rowId];
|
||||
const oldValue = CrudModelRef.value.formData[rowId][column?.name];
|
||||
|
||||
if (!clickedElement)
|
||||
clickedElement = document.querySelector(
|
||||
`[data-row-index="${rowId}"][data-col-field="${field}"]`,
|
||||
);
|
||||
|
||||
Array.from(clickedElement.childNodes).forEach((child) => {
|
||||
child.style.visibility = 'hidden';
|
||||
child.style.position = 'relative';
|
||||
});
|
||||
|
||||
const isSelect = selectRegex.test(column?.component);
|
||||
if (isSelect) column.attrs = { ...column.attrs, 'emit-value': false };
|
||||
|
||||
const node = h(VnColumn, {
|
||||
row: row,
|
||||
class: 'temp-input',
|
||||
column: column,
|
||||
modelValue: row[column.name],
|
||||
componentProp: 'columnField',
|
||||
autofocus: true,
|
||||
focusOnMount: true,
|
||||
eventHandlers: {
|
||||
'update:modelValue': async (value) => {
|
||||
if (isSelect) {
|
||||
row[column.name] = value[column.attrs?.optionValue ?? 'id'];
|
||||
row[column?.name + 'TextValue'] =
|
||||
value[column.attrs?.optionLabel ?? 'name'];
|
||||
await column?.cellEvent?.['update:modelValue']?.(
|
||||
value,
|
||||
oldValue,
|
||||
row,
|
||||
);
|
||||
} else row[column.name] = value;
|
||||
await column?.cellEvent?.['update:modelValue']?.(value, oldValue, row);
|
||||
},
|
||||
keyup: async (event) => {
|
||||
if (event.key === 'Enter') handleBlur(rowId, field, clickedElement);
|
||||
},
|
||||
keydown: async (event) => {
|
||||
switch (event.key) {
|
||||
case 'Tab':
|
||||
await handleTabKey(event, rowId, field);
|
||||
event.stopPropagation();
|
||||
break;
|
||||
case 'Escape':
|
||||
destroyInput(rowId, field, clickedElement);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
click: (event) => {
|
||||
column?.cellEvent?.['click']?.(event, row);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
node.appContext = app._context;
|
||||
render(node, clickedElement);
|
||||
|
||||
if (['checkbox', 'toggle', undefined].includes(column?.component))
|
||||
node.el?.querySelector('span > div').focus();
|
||||
}
|
||||
|
||||
function destroyInput(rowIndex, field, clickedElement) {
|
||||
if (!clickedElement)
|
||||
clickedElement = document.querySelector(
|
||||
`[data-row-index="${rowIndex}"][data-col-field="${field}"]`,
|
||||
);
|
||||
if (clickedElement) {
|
||||
render(null, clickedElement);
|
||||
Array.from(clickedElement.childNodes).forEach((child) => {
|
||||
child.style.visibility = 'visible';
|
||||
child.style.position = '';
|
||||
});
|
||||
}
|
||||
if (editingRow.value !== rowIndex || editingField.value !== field) return;
|
||||
editingRow.value = null;
|
||||
editingField.value = null;
|
||||
}
|
||||
|
||||
function handleBlur(rowIndex, field, clickedElement) {
|
||||
destroyInput(rowIndex, field, clickedElement);
|
||||
}
|
||||
|
||||
async function handleTabNavigation(rowIndex, colName, direction) {
|
||||
const columns = $props.columns;
|
||||
const totalColumns = columns.length;
|
||||
let currentColumnIndex = columns.findIndex((col) => col.name === colName);
|
||||
|
||||
let iterations = 0;
|
||||
let newColumnIndex = currentColumnIndex;
|
||||
|
||||
do {
|
||||
iterations++;
|
||||
newColumnIndex = (newColumnIndex + direction + totalColumns) % totalColumns;
|
||||
|
||||
if (isEditableColumn(columns[newColumnIndex])) break;
|
||||
} while (iterations < totalColumns);
|
||||
|
||||
if (iterations >= totalColumns) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (direction === 1 && newColumnIndex <= currentColumnIndex) {
|
||||
rowIndex++;
|
||||
} else if (direction === -1 && newColumnIndex >= currentColumnIndex) {
|
||||
rowIndex--;
|
||||
}
|
||||
return { nextRowIndex: rowIndex, nextColumnName: columns[newColumnIndex].name };
|
||||
}
|
||||
|
||||
function getCheckboxIcon(value) {
|
||||
switch (typeof value) {
|
||||
case 'boolean':
|
||||
return value ? 'check' : 'close';
|
||||
case 'number':
|
||||
return value === 0 ? 'close' : 'check';
|
||||
case 'undefined':
|
||||
return 'indeterminate_check_box';
|
||||
default:
|
||||
return 'indeterminate_check_box';
|
||||
}
|
||||
}
|
||||
|
||||
function getToggleIcon(value) {
|
||||
if (value === null) return 'help_outline';
|
||||
return value ? 'toggle_on' : 'toggle_off';
|
||||
}
|
||||
|
||||
function formatColumnValue(col, row, dashIfEmpty) {
|
||||
if (col?.format) {
|
||||
if (selectRegex.test(col?.component) && row[col?.name + 'TextValue']) {
|
||||
return dashIfEmpty(row[col?.name + 'TextValue']);
|
||||
} else {
|
||||
return col.format(row, dashIfEmpty);
|
||||
}
|
||||
} else {
|
||||
return dashIfEmpty(row[col?.name]);
|
||||
}
|
||||
}
|
||||
const checkbox = ref(null);
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer
|
||||
|
@ -311,7 +537,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
v-model="stateStore.rightDrawer"
|
||||
side="right"
|
||||
:width="256"
|
||||
show-if-above
|
||||
:overlay="$props.overlay"
|
||||
>
|
||||
<QScrollArea class="fit">
|
||||
<VnTableFilter
|
||||
|
@ -332,7 +558,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
<CrudModel
|
||||
v-bind="$attrs"
|
||||
:class="$attrs['class'] ?? 'q-px-md'"
|
||||
:limit="$attrs['limit'] ?? 20"
|
||||
:limit="$attrs['limit'] ?? 100"
|
||||
ref="CrudModelRef"
|
||||
@on-fetch="(...args) => emit('onFetch', ...args)"
|
||||
:search-url="searchUrl"
|
||||
|
@ -348,8 +574,12 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
<QTable
|
||||
ref="tableRef"
|
||||
v-bind="table"
|
||||
class="vnTable"
|
||||
:class="{ 'last-row-sticky': $props.footer }"
|
||||
:class="[
|
||||
'vnTable',
|
||||
table ? 'selection-cell' : '',
|
||||
$props.footer ? 'last-row-sticky' : '',
|
||||
]"
|
||||
wrap-cells
|
||||
:columns="splittedColumns.columns"
|
||||
:rows="rows"
|
||||
v-model:selected="selected"
|
||||
|
@ -365,9 +595,10 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
@selection="(details) => handleSelection(details, rows)"
|
||||
>
|
||||
<template #top-left v-if="!$props.withoutHeader">
|
||||
<slot name="top-left"></slot>
|
||||
<slot name="top-left"> </slot>
|
||||
</template>
|
||||
<template #top-right v-if="!$props.withoutHeader">
|
||||
<slot name="top-right"></slot>
|
||||
<VnVisibleColumn
|
||||
v-if="isTableMode"
|
||||
v-model="splittedColumns.columns"
|
||||
|
@ -381,6 +612,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
dense
|
||||
:options="tableModes.filter((mode) => !mode.disable)"
|
||||
/>
|
||||
|
||||
<QBtn
|
||||
v-if="showRightIcon"
|
||||
icon="filter_alt"
|
||||
|
@ -392,32 +624,38 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
<template #header-cell="{ col }">
|
||||
<QTh
|
||||
v-if="col.visible ?? true"
|
||||
:style="col.headerStyle"
|
||||
:class="col.headerClass"
|
||||
class="body-cell"
|
||||
:style="col?.width ? `max-width: ${col?.width}` : ''"
|
||||
style="padding: inherit"
|
||||
>
|
||||
<div
|
||||
class="column ellipsis"
|
||||
:class="`text-${col?.align ?? 'left'}`"
|
||||
:style="$props.columnSearch ? 'height: 75px' : ''"
|
||||
class="no-padding"
|
||||
:style="
|
||||
withFilters && $props.columnSearch ? 'height: 75px' : ''
|
||||
"
|
||||
>
|
||||
<div class="row items-center no-wrap" style="height: 30px">
|
||||
<div class="text-center" style="height: 30px">
|
||||
<QTooltip v-if="col.toolTip">{{ col.toolTip }}</QTooltip>
|
||||
<VnTableOrder
|
||||
v-model="orders[col.orderBy ?? col.name]"
|
||||
:name="col.orderBy ?? col.name"
|
||||
:label="col?.label"
|
||||
:label="col?.labelAbbreviation ?? col?.label"
|
||||
:data-key="$attrs['data-key']"
|
||||
:search-url="searchUrl"
|
||||
/>
|
||||
</div>
|
||||
<VnFilter
|
||||
v-if="$props.columnSearch"
|
||||
v-if="
|
||||
$props.columnSearch &&
|
||||
col.columnSearch !== false &&
|
||||
withFilters
|
||||
"
|
||||
:column="col"
|
||||
:show-title="true"
|
||||
:data-key="$attrs['data-key']"
|
||||
v-model="params[columnName(col)]"
|
||||
:search-url="searchUrl"
|
||||
class="full-width"
|
||||
customClass="header-filter"
|
||||
/>
|
||||
</div>
|
||||
</QTh>
|
||||
|
@ -435,32 +673,63 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell="{ col, row, rowIndex }">
|
||||
<!-- Columns -->
|
||||
<QTd
|
||||
auto-width
|
||||
class="no-margin"
|
||||
:class="[getColAlign(col), col.columnClass]"
|
||||
:style="col.style"
|
||||
class="no-margin q-px-xs"
|
||||
v-if="col.visible ?? true"
|
||||
@click.ctrl="
|
||||
($event) =>
|
||||
rowCtrlClickFunction && rowCtrlClickFunction($event, row)
|
||||
"
|
||||
:style="{
|
||||
'max-width': col?.width ?? false,
|
||||
position: 'relative',
|
||||
}"
|
||||
:class="[
|
||||
col.columnClass,
|
||||
'body-cell no-margin no-padding',
|
||||
getColAlign(col),
|
||||
]"
|
||||
:data-row-index="rowIndex"
|
||||
:data-col-field="col?.name"
|
||||
>
|
||||
<slot
|
||||
:name="`column-${col.name}`"
|
||||
:col="col"
|
||||
:row="row"
|
||||
:row-index="rowIndex"
|
||||
<div
|
||||
class="no-padding no-margin peter"
|
||||
style="
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
"
|
||||
>
|
||||
<VnTableColumn
|
||||
:column="col"
|
||||
<slot
|
||||
:name="`column-${col.name}`"
|
||||
:col="col"
|
||||
:row="row"
|
||||
:is-editable="col.isEditable ?? isEditable"
|
||||
v-model="row[col.name]"
|
||||
component-prop="columnField"
|
||||
/>
|
||||
</slot>
|
||||
:row-index="rowIndex"
|
||||
>
|
||||
<QIcon
|
||||
v-if="col?.component === 'toggle'"
|
||||
:name="
|
||||
col?.getIcon
|
||||
? col.getIcon(row[col?.name])
|
||||
: getToggleIcon(row[col?.name])
|
||||
"
|
||||
style="color: var(--vn-text-color)"
|
||||
:class="hasEditableFormat(col)"
|
||||
size="14px"
|
||||
/>
|
||||
<QIcon
|
||||
v-else-if="col?.component === 'checkbox'"
|
||||
:name="getCheckboxIcon(row[col?.name])"
|
||||
style="color: var(--vn-text-color)"
|
||||
:class="hasEditableFormat(col)"
|
||||
size="14px"
|
||||
/>
|
||||
<span
|
||||
v-else
|
||||
:class="hasEditableFormat(col)"
|
||||
:style="col?.style ? col.style(row) : null"
|
||||
style="bottom: 0"
|
||||
>
|
||||
{{ formatColumnValue(col, row, dashIfEmpty) }}
|
||||
</span>
|
||||
</slot>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-tableActions="{ col, row }">
|
||||
|
@ -563,7 +832,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
:row="row"
|
||||
:row-index="index"
|
||||
>
|
||||
<VnTableColumn
|
||||
<VnColumn
|
||||
:column="col"
|
||||
:row="row"
|
||||
:is-editable="false"
|
||||
|
@ -603,14 +872,17 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
</component>
|
||||
</template>
|
||||
<template #bottom-row="{ cols }" v-if="$props.footer">
|
||||
<QTr v-if="rows.length" style="height: 30px">
|
||||
<QTr v-if="rows.length" style="height: 45px">
|
||||
<QTh v-if="table.selection" />
|
||||
<QTh
|
||||
v-for="col of cols.filter((cols) => cols.visible ?? true)"
|
||||
:key="col?.id"
|
||||
class="text-center"
|
||||
:class="getColAlign(col)"
|
||||
>
|
||||
<slot :name="`column-footer-${col.name}`" />
|
||||
<slot
|
||||
:name="`column-footer-${col.name}`"
|
||||
:isEditableColumn="isEditableColumn(col)"
|
||||
/>
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
|
@ -654,32 +926,53 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
{{ createForm?.title }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
||||
<QDialog
|
||||
v-model="showForm"
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
:full-width="createComplement?.isFullWidth ?? false"
|
||||
@before-hide="
|
||||
() => {
|
||||
if (createRef.isSaveAndContinue) {
|
||||
showForm = true;
|
||||
createForm.formInitialData = { ...create.formInitialData };
|
||||
}
|
||||
}
|
||||
"
|
||||
data-cy="vn-table-create-dialog"
|
||||
>
|
||||
<FormModelPopup
|
||||
ref="createRef"
|
||||
v-bind="createForm"
|
||||
:model="$attrs['data-key'] + 'Create'"
|
||||
@on-data-saved="(_, res) => createForm.onDataSaved(res)"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<div class="grid-create">
|
||||
<slot
|
||||
v-for="column of splittedColumns.create"
|
||||
:key="column.name"
|
||||
:name="`column-create-${column.name}`"
|
||||
:data="data"
|
||||
:column-name="column.name"
|
||||
:label="column.label"
|
||||
>
|
||||
<VnTableColumn
|
||||
:column="column"
|
||||
:row="{}"
|
||||
default="input"
|
||||
v-model="data[column.name]"
|
||||
:show-label="true"
|
||||
component-prop="columnCreate"
|
||||
/>
|
||||
</slot>
|
||||
<slot name="more-create-dialog" :data="data" />
|
||||
<div :style="createComplement?.containerStyle">
|
||||
<div>
|
||||
<slot name="previous-create-dialog" :data="data" />
|
||||
</div>
|
||||
<div class="grid-create" :style="createComplement?.columnGridStyle">
|
||||
<slot
|
||||
v-for="column of splittedColumns.create"
|
||||
:key="column.name"
|
||||
:name="`column-create-${column.name}`"
|
||||
:data="data"
|
||||
:column-name="column.name"
|
||||
:label="column.label"
|
||||
>
|
||||
<VnColumn
|
||||
:column="column"
|
||||
:row="{}"
|
||||
default="input"
|
||||
v-model="data[column.name]"
|
||||
:show-label="true"
|
||||
component-prop="columnCreate"
|
||||
:data-cy="`${column.name}-create-popup`"
|
||||
/>
|
||||
</slot>
|
||||
<slot name="more-create-dialog" :data="data" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
|
@ -697,6 +990,42 @@ es:
|
|||
</i18n>
|
||||
|
||||
<style lang="scss">
|
||||
.selection-cell {
|
||||
table td:first-child {
|
||||
padding: 0px;
|
||||
}
|
||||
}
|
||||
.side-padding {
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
}
|
||||
.editable-text:hover {
|
||||
border-bottom: 1px dashed var(--q-primary);
|
||||
@extend .side-padding;
|
||||
}
|
||||
.editable-text {
|
||||
border-bottom: 1px dashed var(--vn-label-color);
|
||||
@extend .side-padding;
|
||||
}
|
||||
.cell-input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding-top: 0px !important;
|
||||
}
|
||||
.q-field--labeled .q-field__native,
|
||||
.q-field--labeled .q-field__prefix,
|
||||
.q-field--labeled .q-field__suffix {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.body-cell {
|
||||
padding-left: 2px !important;
|
||||
padding-right: 2px !important;
|
||||
position: relative;
|
||||
}
|
||||
.bg-chip-secondary {
|
||||
background-color: var(--vn-page-color);
|
||||
color: var(--vn-text-color);
|
||||
|
@ -713,7 +1042,7 @@ es:
|
|||
|
||||
.grid-three {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
|
||||
max-width: 100%;
|
||||
grid-gap: 20px;
|
||||
margin: 0 auto;
|
||||
|
@ -722,7 +1051,6 @@ es:
|
|||
.grid-create {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
|
||||
max-width: 100%;
|
||||
grid-gap: 20px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
@ -738,7 +1066,9 @@ es:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.q-table tbody tr td {
|
||||
position: relative;
|
||||
}
|
||||
.q-table {
|
||||
th {
|
||||
padding: 0;
|
||||
|
@ -838,4 +1168,15 @@ es:
|
|||
.q-table__middle.q-virtual-scroll.q-virtual-scroll--vertical.scroll {
|
||||
background-color: var(--vn-section-color);
|
||||
}
|
||||
.temp-input {
|
||||
top: 0;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
label.header-filter > .q-field__inner > .q-field__control {
|
||||
padding: inherit;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -29,25 +29,29 @@ function columnName(col) {
|
|||
<VnFilterPanel v-bind="$attrs" :search-button="true" :disable-submit-event="true">
|
||||
<template #body="{ params, orders, searchFn }">
|
||||
<div
|
||||
class="row no-wrap flex-center"
|
||||
class="container"
|
||||
v-for="col of columns.filter((c) => c.columnFilter ?? true)"
|
||||
:key="col.id"
|
||||
>
|
||||
<VnFilter
|
||||
ref="tableFilterRef"
|
||||
:column="col"
|
||||
:data-key="$attrs['data-key']"
|
||||
v-model="params[columnName(col)]"
|
||||
:search-url="searchUrl"
|
||||
/>
|
||||
<VnTableOrder
|
||||
v-if="col?.columnFilter !== false && col?.name !== 'tableActions'"
|
||||
v-model="orders[col.orderBy ?? col.name]"
|
||||
:name="col.orderBy ?? col.name"
|
||||
:data-key="$attrs['data-key']"
|
||||
:search-url="searchUrl"
|
||||
:vertical="true"
|
||||
/>
|
||||
<div class="filter">
|
||||
<VnFilter
|
||||
ref="tableFilterRef"
|
||||
:column="col"
|
||||
:data-key="$attrs['data-key']"
|
||||
v-model="params[columnName(col)]"
|
||||
:search-url="searchUrl"
|
||||
/>
|
||||
</div>
|
||||
<div class="order">
|
||||
<VnTableOrder
|
||||
v-if="col?.columnFilter !== false && col?.name !== 'tableActions'"
|
||||
v-model="orders[col.orderBy ?? col.name]"
|
||||
:name="col.orderBy ?? col.name"
|
||||
:data-key="$attrs['data-key']"
|
||||
:search-url="searchUrl"
|
||||
:vertical="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<slot
|
||||
name="moreFilterPanel"
|
||||
|
@ -68,3 +72,21 @@ function columnName(col) {
|
|||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 45px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.filter {
|
||||
width: 70%;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
.order {
|
||||
width: 10%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -32,16 +32,21 @@ const areAllChecksMarked = computed(() => {
|
|||
|
||||
function setUserConfigViewData(data, isLocal) {
|
||||
if (!data) return;
|
||||
// Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config
|
||||
if (!isLocal) localColumns.value = [];
|
||||
// Array to Object
|
||||
|
||||
const skippeds = $props.skip.reduce((a, v) => ({ ...a, [v]: v }), {});
|
||||
|
||||
for (let column of columns.value) {
|
||||
const { label, name } = column;
|
||||
const { label, name, labelAbbreviation } = column;
|
||||
if (skippeds[name]) continue;
|
||||
column.visible = data[name] ?? true;
|
||||
if (!isLocal) localColumns.value.push({ name, label, visible: column.visible });
|
||||
if (!isLocal)
|
||||
localColumns.value.push({
|
||||
name,
|
||||
label,
|
||||
labelAbbreviation,
|
||||
visible: column.visible,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,7 +157,11 @@ onMounted(async () => {
|
|||
<QCheckbox
|
||||
v-for="col in localColumns"
|
||||
:key="col.name"
|
||||
:label="col.label ?? col.name"
|
||||
:label="
|
||||
col?.labelAbbreviation
|
||||
? col.labelAbbreviation + ` (${col.label ?? col.name})`
|
||||
: (col.label ?? col.name)
|
||||
"
|
||||
v-model="col.visible"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
@ -1,61 +1,65 @@
|
|||
import { vi, describe, expect, it, beforeEach, beforeAll, afterEach } from 'vitest';
|
||||
import { vi, describe, expect, it, beforeEach, afterEach } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import UserPanel from 'src/components/UserPanel.vue';
|
||||
import axios from 'axios';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
vi.mock('src/utils/quasarLang', () => ({
|
||||
default: vi.fn(),
|
||||
}));
|
||||
|
||||
describe('UserPanel', () => {
|
||||
let wrapper;
|
||||
let vm;
|
||||
let state;
|
||||
let wrapper;
|
||||
let vm;
|
||||
let state;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = createWrapper(UserPanel, {});
|
||||
state = useState();
|
||||
state.setUser({
|
||||
id: 115,
|
||||
name: 'itmanagement',
|
||||
nickname: 'itManagementNick',
|
||||
lang: 'en',
|
||||
darkMode: false,
|
||||
companyFk: 442,
|
||||
warehouseFk: 1,
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
beforeEach(() => {
|
||||
wrapper = createWrapper(UserPanel, {});
|
||||
state = useState();
|
||||
state.setUser({
|
||||
id: 115,
|
||||
name: 'itmanagement',
|
||||
nickname: 'itManagementNick',
|
||||
lang: 'en',
|
||||
darkMode: false,
|
||||
companyFk: 442,
|
||||
warehouseFk: 1,
|
||||
});
|
||||
wrapper = wrapper.wrapper;
|
||||
vm = wrapper.vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should fetch warehouses data on mounted', async () => {
|
||||
const fetchData = wrapper.findComponent({ name: 'FetchData' });
|
||||
expect(fetchData.props('url')).toBe('Warehouses');
|
||||
expect(fetchData.props('autoLoad')).toBe(true);
|
||||
});
|
||||
it('should fetch warehouses data on mounted', async () => {
|
||||
const fetchData = wrapper.findComponent({ name: 'FetchData' });
|
||||
expect(fetchData.props('url')).toBe('Warehouses');
|
||||
expect(fetchData.props('autoLoad')).toBe(true);
|
||||
});
|
||||
|
||||
it('should toggle dark mode correctly and update preferences', async () => {
|
||||
await vm.saveDarkMode(true);
|
||||
expect(axios.patch).toHaveBeenCalledWith('/UserConfigs/115', { darkMode: true });
|
||||
expect(vm.user.darkMode).toBe(true);
|
||||
vm.updatePreferences();
|
||||
expect(vm.darkMode).toBe(true);
|
||||
});
|
||||
it('should toggle dark mode correctly and update preferences', async () => {
|
||||
await vm.saveDarkMode(true);
|
||||
expect(axios.patch).toHaveBeenCalledWith('/UserConfigs/115', { darkMode: true });
|
||||
expect(vm.user.darkMode).toBe(true);
|
||||
await vm.updatePreferences();
|
||||
expect(vm.darkMode).toBe(true);
|
||||
});
|
||||
|
||||
it('should change user language and update preferences', async () => {
|
||||
const userLanguage = 'es';
|
||||
await vm.saveLanguage(userLanguage);
|
||||
expect(axios.patch).toHaveBeenCalledWith('/VnUsers/115', { lang: userLanguage });
|
||||
expect(vm.user.lang).toBe(userLanguage);
|
||||
vm.updatePreferences();
|
||||
expect(vm.locale).toBe(userLanguage);
|
||||
});
|
||||
it('should change user language and update preferences', async () => {
|
||||
const userLanguage = 'es';
|
||||
await vm.saveLanguage(userLanguage);
|
||||
expect(axios.patch).toHaveBeenCalledWith('/VnUsers/115', { lang: userLanguage });
|
||||
expect(vm.user.lang).toBe(userLanguage);
|
||||
await vm.updatePreferences();
|
||||
expect(vm.locale).toBe(userLanguage);
|
||||
});
|
||||
|
||||
it('should update user data', async () => {
|
||||
const key = 'name';
|
||||
const value = 'itboss';
|
||||
await vm.saveUserData(key, value);
|
||||
expect(axios.post).toHaveBeenCalledWith('UserConfigs/setUserConfig', { [key]: value });
|
||||
});
|
||||
});
|
||||
it('should update user data', async () => {
|
||||
const key = 'name';
|
||||
const value = 'itboss';
|
||||
await vm.saveUserData(key, value);
|
||||
expect(axios.post).toHaveBeenCalledWith('UserConfigs/setUserConfig', { [key]: value });
|
||||
});
|
||||
});
|
|
@ -0,0 +1,43 @@
|
|||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
const model = defineModel({ type: [Number, Boolean] });
|
||||
const $props = defineProps({
|
||||
info: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const checkboxModel = computed({
|
||||
get() {
|
||||
if (typeof model.value === 'number') {
|
||||
return model.value !== 0;
|
||||
}
|
||||
return model.value;
|
||||
},
|
||||
set(value) {
|
||||
if (typeof model.value === 'number') {
|
||||
model.value = value ? 1 : 0;
|
||||
} else {
|
||||
model.value = value;
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<QCheckbox v-bind="$attrs" v-on="$attrs" v-model="checkboxModel" />
|
||||
<QIcon
|
||||
v-if="info"
|
||||
v-bind="$attrs"
|
||||
class="cursor-info q-ml-sm"
|
||||
name="info"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ info }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</template>
|
|
@ -0,0 +1,32 @@
|
|||
<script setup>
|
||||
const $props = defineProps({
|
||||
colors: {
|
||||
type: String,
|
||||
default: '{"value":[]}',
|
||||
},
|
||||
});
|
||||
|
||||
const colorArray = JSON.parse($props.colors)?.value;
|
||||
const maxHeight = 30;
|
||||
const colorHeight = maxHeight / colorArray?.length;
|
||||
</script>
|
||||
<template>
|
||||
<div class="color-div" :style="{ height: `${maxHeight}px` }">
|
||||
<div
|
||||
v-for="(color, index) in colorArray"
|
||||
:key="index"
|
||||
:style="{
|
||||
backgroundColor: `#${color}`,
|
||||
height: `${colorHeight}px`,
|
||||
}"
|
||||
>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.color-div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
|
@ -17,6 +17,8 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['blur']);
|
||||
|
||||
const componentArray = computed(() => {
|
||||
if (typeof $props.prop === 'object') return [$props.prop];
|
||||
return $props.prop;
|
||||
|
@ -54,6 +56,7 @@ function toValueAttrs(attrs) {
|
|||
v-bind="mix(toComponent).attrs"
|
||||
v-on="mix(toComponent).event ?? {}"
|
||||
v-model="model"
|
||||
@blur="emit('blur')"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
|
|
|
@ -11,6 +11,7 @@ const emit = defineEmits([
|
|||
'update:options',
|
||||
'keyup.enter',
|
||||
'remove',
|
||||
'blur',
|
||||
]);
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -136,6 +137,7 @@ const handleUppercase = () => {
|
|||
:type="$attrs.type"
|
||||
:class="{ required: isRequired }"
|
||||
@keyup.enter="emit('keyup.enter')"
|
||||
@blur="emit('blur')"
|
||||
@keydown="handleKeydown"
|
||||
:clearable="false"
|
||||
:rules="mixinRules"
|
||||
|
@ -143,7 +145,7 @@ const handleUppercase = () => {
|
|||
hide-bottom-space
|
||||
:data-cy="$attrs.dataCy ?? $attrs.label + '_input'"
|
||||
>
|
||||
<template #prepend>
|
||||
<template #prepend v-if="$slots.prepend">
|
||||
<slot name="prepend" />
|
||||
</template>
|
||||
<template #append>
|
||||
|
@ -168,11 +170,11 @@ const handleUppercase = () => {
|
|||
}
|
||||
"
|
||||
></QIcon>
|
||||
|
||||
|
||||
<QIcon
|
||||
name="match_case"
|
||||
size="xs"
|
||||
v-if="!$attrs.disabled && !($attrs.readonly) && $props.uppercase"
|
||||
v-if="!$attrs.disabled && !$attrs.readonly && $props.uppercase"
|
||||
@click="handleUppercase"
|
||||
class="uppercase-icon"
|
||||
>
|
||||
|
@ -180,7 +182,7 @@ const handleUppercase = () => {
|
|||
{{ t('Convert to uppercase') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
|
||||
|
||||
<slot name="append" v-if="$slots.append && !$attrs.disabled" />
|
||||
<QIcon v-if="info" name="info">
|
||||
<QTooltip max-width="350px">
|
||||
|
@ -194,13 +196,15 @@ const handleUppercase = () => {
|
|||
|
||||
<style>
|
||||
.uppercase-icon {
|
||||
transition: color 0.3s, transform 0.2s;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
color 0.3s,
|
||||
transform 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.uppercase-icon:hover {
|
||||
color: #ed9937;
|
||||
transform: scale(1.2);
|
||||
color: #ed9937;
|
||||
transform: scale(1.2);
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
|
@ -214,4 +218,4 @@ const handleUppercase = () => {
|
|||
maxLength: El valor excede los {value} carácteres
|
||||
inputMax: Debe ser menor a {value}
|
||||
Convert to uppercase: Convertir a mayúsculas
|
||||
</i18n>
|
||||
</i18n>
|
||||
|
|
|
@ -42,7 +42,7 @@ const formattedDate = computed({
|
|||
if (value.at(2) == '/') value = value.split('/').reverse().join('/');
|
||||
value = date.formatDate(
|
||||
new Date(value).toISOString(),
|
||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
||||
'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
||||
);
|
||||
}
|
||||
const [year, month, day] = value.split('-').map((e) => parseInt(e));
|
||||
|
@ -55,7 +55,7 @@ const formattedDate = computed({
|
|||
orgDate.getHours(),
|
||||
orgDate.getMinutes(),
|
||||
orgDate.getSeconds(),
|
||||
orgDate.getMilliseconds()
|
||||
orgDate.getMilliseconds(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ const formattedDate = computed({
|
|||
});
|
||||
|
||||
const popupDate = computed(() =>
|
||||
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value
|
||||
model.value ? date.formatDate(new Date(model.value), 'YYYY/MM/DD') : model.value,
|
||||
);
|
||||
onMounted(() => {
|
||||
// fix quasar bug
|
||||
|
@ -73,7 +73,7 @@ onMounted(() => {
|
|||
watch(
|
||||
() => model.value,
|
||||
(val) => (formattedDate.value = val),
|
||||
{ immediate: true }
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
const styleAttrs = computed(() => {
|
||||
|
|
|
@ -8,6 +8,7 @@ defineProps({
|
|||
});
|
||||
|
||||
const model = defineModel({ type: [Number, String] });
|
||||
const emit = defineEmits(['blur']);
|
||||
</script>
|
||||
<template>
|
||||
<VnInput
|
||||
|
@ -24,5 +25,6 @@ const model = defineModel({ type: [Number, String] });
|
|||
model = parseFloat(val).toFixed(decimalPlaces);
|
||||
}
|
||||
"
|
||||
@blur="emit('blur')"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
defineProps({
|
||||
label: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: null,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: 'primary',
|
||||
},
|
||||
tooltip: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
const popupProxyRef = ref(null);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QBtn :color="$props.color" :icon="$props.icon" :label="$t($props.label)">
|
||||
<template #default>
|
||||
<slot name="extraIcon"></slot>
|
||||
<QPopupProxy ref="popupProxyRef" style="max-width: none">
|
||||
<QCard>
|
||||
<slot :popup="popupProxyRef"></slot>
|
||||
</QCard>
|
||||
</QPopupProxy>
|
||||
<QTooltip>{{ $t($props.tooltip) }}</QTooltip>
|
||||
</template>
|
||||
</QBtn>
|
||||
</template>
|
|
@ -14,7 +14,7 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
const options = ref([]);
|
||||
|
||||
const emit = defineEmits(['blur']);
|
||||
onBeforeMount(async () => {
|
||||
const { url, optionValue, optionLabel } = useAttrs();
|
||||
const findBy = $props.find ?? url?.charAt(0)?.toLocaleLowerCase() + url?.slice(1, -1);
|
||||
|
@ -35,5 +35,5 @@ onBeforeMount(async () => {
|
|||
});
|
||||
</script>
|
||||
<template>
|
||||
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" />
|
||||
<VnSelect v-bind="$attrs" :options="$attrs.options ?? options" @blur="emit('blur')" />
|
||||
</template>
|
||||
|
|
|
@ -37,7 +37,6 @@ const isAllowedToCreate = computed(() => {
|
|||
|
||||
defineExpose({ vnSelectDialogRef: select });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSelect
|
||||
ref="select"
|
||||
|
@ -67,7 +66,6 @@ defineExpose({ vnSelectDialogRef: select });
|
|||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.default-icon {
|
||||
cursor: pointer;
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<script setup>
|
||||
import VnSelectDialog from './VnSelectDialog.vue';
|
||||
import FilterTravelForm from 'src/components/FilterTravelForm.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'src/filters';
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
onFilterTravelSelected: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<VnSelectDialog
|
||||
:label="t('entry.basicData.travel')"
|
||||
v-bind="$attrs"
|
||||
url="Travels/filter"
|
||||
:fields="['id', 'warehouseInName']"
|
||||
option-value="id"
|
||||
option-label="warehouseInName"
|
||||
map-options
|
||||
hide-selected
|
||||
:required="true"
|
||||
action-icon="filter_alt"
|
||||
:roles-allowed-to-create="['buyer']"
|
||||
>
|
||||
<template #form>
|
||||
<FilterTravelForm @travel-selected="onFilterTravelSelected(data, $event)" />
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.agencyModeName }} -
|
||||
{{ scope.opt?.warehouseInName }}
|
||||
({{ toDate(scope.opt?.shipped) }}) →
|
||||
{{ scope.opt?.warehouseOutName }}
|
||||
({{ toDate(scope.opt?.landed) }})
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</template>
|
|
@ -1,53 +1,32 @@
|
|||
<script setup>
|
||||
defineProps({
|
||||
hasImage: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div id="descriptor-skeleton">
|
||||
<div id="descriptor-skeleton" class="bg-vn-page">
|
||||
<div class="row justify-between q-pa-sm">
|
||||
<QSkeleton square size="40px" />
|
||||
<QSkeleton square size="40px" />
|
||||
<QSkeleton square height="40px" width="20px" />
|
||||
<QSkeleton square size="30px" v-for="i in 3" :key="i" />
|
||||
</div>
|
||||
<div class="col justify-between q-pa-sm q-gutter-y-xs">
|
||||
<QSkeleton square height="40px" width="150px" />
|
||||
<QSkeleton square height="30px" width="70px" />
|
||||
<div class="q-pa-xs" v-if="hasImage">
|
||||
<QSkeleton square height="200px" width="100%" />
|
||||
</div>
|
||||
<div class="col q-pl-sm q-pa-sm q-mb-md">
|
||||
<div class="row justify-between">
|
||||
<QSkeleton type="text" square height="30px" width="20%" />
|
||||
<QSkeleton type="text" square height="30px" width="60%" />
|
||||
</div>
|
||||
<div class="row justify-between">
|
||||
<QSkeleton type="text" square height="30px" width="20%" />
|
||||
<QSkeleton type="text" square height="30px" width="60%" />
|
||||
</div>
|
||||
<div class="row justify-between">
|
||||
<QSkeleton type="text" square height="30px" width="20%" />
|
||||
<QSkeleton type="text" square height="30px" width="60%" />
|
||||
</div>
|
||||
<div class="row justify-between">
|
||||
<QSkeleton type="text" square height="30px" width="20%" />
|
||||
<QSkeleton type="text" square height="30px" width="60%" />
|
||||
</div>
|
||||
<div class="row justify-between">
|
||||
<QSkeleton type="text" square height="30px" width="20%" />
|
||||
<QSkeleton type="text" square height="30px" width="60%" />
|
||||
</div>
|
||||
<div class="row justify-between">
|
||||
<QSkeleton type="text" square height="30px" width="20%" />
|
||||
<QSkeleton type="text" square height="30px" width="60%" />
|
||||
<div class="col justify-between q-pa-md q-gutter-y-xs">
|
||||
<QSkeleton square height="25px" width="150px" />
|
||||
<QSkeleton square height="15px" width="70px" />
|
||||
</div>
|
||||
<div class="q-pl-sm q-pa-sm q-mb-md">
|
||||
<div class="row q-gutter-x-sm q-pa-none q-ma-none" v-for="i in 5" :key="i">
|
||||
<QSkeleton type="text" square height="20px" width="30%" />
|
||||
<QSkeleton type="text" square height="20px" width="60%" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<QCardActions>
|
||||
<QSkeleton size="40px" />
|
||||
<QSkeleton size="40px" />
|
||||
<QSkeleton size="40px" />
|
||||
<QSkeleton size="40px" />
|
||||
<QSkeleton size="40px" />
|
||||
<QCardActions class="q-gutter-x-sm justify-between">
|
||||
<QSkeleton size="40px" v-for="i in 5" :key="i" />
|
||||
</QCardActions>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
#descriptor-skeleton .q-card__actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -82,7 +82,7 @@ function cancel() {
|
|||
@click="cancel()"
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pb-none">
|
||||
<QCardSection class="q-pb-none" data-cy="VnConfirm_message">
|
||||
<span v-if="message !== false" v-html="message" />
|
||||
</QCardSection>
|
||||
<QCardSection class="row items-center q-pt-none">
|
||||
|
@ -95,6 +95,7 @@ function cancel() {
|
|||
:disable="isLoading"
|
||||
flat
|
||||
@click="cancel()"
|
||||
data-cy="VnConfirm_cancel"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
|
|
|
@ -293,6 +293,9 @@ const getLocale = (label) => {
|
|||
/>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.q-field__label.no-pointer-events.absolute.ellipsis {
|
||||
margin-left: 6px !important;
|
||||
}
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<QTooltip>
|
||||
{{ $t('components.cardDescriptor.moreOptions') }}
|
||||
</QTooltip>
|
||||
<QMenu ref="menuRef">
|
||||
<QMenu ref="menuRef" data-cy="descriptor-more-opts-menu">
|
||||
<QList>
|
||||
<slot name="menu" :menu-ref="$refs.menuRef" />
|
||||
</QList>
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<script setup>
|
||||
import { toPercentage } from 'filters/index';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const valueClass = computed(() =>
|
||||
props.value === 0 ? 'neutral' : props.value > 0 ? 'positive' : 'negative',
|
||||
);
|
||||
const iconName = computed(() =>
|
||||
props.value === 0 ? 'equal' : props.value > 0 ? 'arrow_upward' : 'arrow_downward',
|
||||
);
|
||||
const formattedValue = computed(() => props.value);
|
||||
</script>
|
||||
<template>
|
||||
<span :class="valueClass">
|
||||
<QIcon :name="iconName" size="sm" class="value-icon" />
|
||||
{{ toPercentage(formattedValue) }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.positive {
|
||||
color: $secondary;
|
||||
}
|
||||
.negative {
|
||||
color: $negative;
|
||||
}
|
||||
.neutral {
|
||||
color: $primary;
|
||||
}
|
||||
.value-icon {
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,65 @@
|
|||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
|
||||
export async function checkEntryLock(entryFk, userFk) {
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const { push } = useRouter();
|
||||
const { data } = await axios.get(`Entries/${entryFk}`, {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
fields: ['id', 'locked', 'lockerUserFk'],
|
||||
include: { relation: 'user', scope: { fields: ['id', 'nickname'] } },
|
||||
}),
|
||||
},
|
||||
});
|
||||
const entryConfig = await axios.get('EntryConfigs/findOne');
|
||||
|
||||
if (data?.lockerUserFk && data?.locked) {
|
||||
const now = new Date(Date.vnNow()).getTime();
|
||||
const lockedTime = new Date(data.locked).getTime();
|
||||
const timeDiff = (now - lockedTime) / 1000;
|
||||
const isMaxTimeLockExceeded = entryConfig.data.maxLockTime > timeDiff;
|
||||
|
||||
if (data?.lockerUserFk !== userFk && isMaxTimeLockExceeded) {
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
'data-cy': 'entry-lock-confirm',
|
||||
title: t('entry.lock.title'),
|
||||
message: t('entry.lock.message', {
|
||||
userName: data?.user?.nickname,
|
||||
time: timeDiff / 60,
|
||||
}),
|
||||
},
|
||||
})
|
||||
.onOk(
|
||||
async () =>
|
||||
await axios.patch(`Entries/${entryFk}`, {
|
||||
locked: Date.vnNow(),
|
||||
lockerUserFk: userFk,
|
||||
}),
|
||||
)
|
||||
.onCancel(() => {
|
||||
push({ path: `summary` });
|
||||
});
|
||||
}
|
||||
} else {
|
||||
await axios
|
||||
.patch(`Entries/${entryFk}`, {
|
||||
locked: Date.vnNow(),
|
||||
lockerUserFk: userFk,
|
||||
})
|
||||
.then(
|
||||
quasar.notify({
|
||||
message: t('entry.lock.success'),
|
||||
color: 'positive',
|
||||
group: false,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
export function getColAlign(col) {
|
||||
let align;
|
||||
switch (col.component) {
|
||||
case 'select':
|
||||
align = 'left';
|
||||
break;
|
||||
case 'number':
|
||||
align = 'right';
|
||||
break;
|
||||
case 'date':
|
||||
case 'checkbox':
|
||||
align = 'center';
|
||||
break;
|
||||
default:
|
||||
align = col?.align;
|
||||
}
|
||||
|
||||
if (/^is[A-Z]/.test(col.name) || /^has[A-Z]/.test(col.name)) align = 'center';
|
||||
|
||||
return 'text-' + (align ?? 'center');
|
||||
}
|
|
@ -27,6 +27,15 @@ export function useRole() {
|
|||
|
||||
return false;
|
||||
}
|
||||
function likeAny(roles) {
|
||||
const roleStore = state.getRoles();
|
||||
for (const role of roles) {
|
||||
if (!roleStore.value.findIndex((rs) => rs.startsWith(role)) !== -1)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
function isEmployee() {
|
||||
return hasAny(['employee']);
|
||||
}
|
||||
|
@ -35,6 +44,7 @@ export function useRole() {
|
|||
isEmployee,
|
||||
fetch,
|
||||
hasAny,
|
||||
likeAny,
|
||||
state,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -21,7 +21,10 @@ body.body--light {
|
|||
.q-header .q-toolbar {
|
||||
color: var(--vn-text-color);
|
||||
}
|
||||
|
||||
--vn-color-negative: $negative;
|
||||
}
|
||||
|
||||
body.body--dark {
|
||||
--vn-header-color: #5d5d5d;
|
||||
--vn-page-color: #222;
|
||||
|
@ -37,6 +40,8 @@ body.body--dark {
|
|||
--vn-text-color-contrast: black;
|
||||
|
||||
background-color: var(--vn-page-color);
|
||||
|
||||
--vn-color-negative: $negative;
|
||||
}
|
||||
|
||||
a {
|
||||
|
@ -75,7 +80,6 @@ a {
|
|||
text-decoration: underline;
|
||||
}
|
||||
|
||||
// Removes chrome autofill background
|
||||
input:-webkit-autofill,
|
||||
select:-webkit-autofill {
|
||||
color: var(--vn-text-color);
|
||||
|
@ -149,11 +153,6 @@ select:-webkit-autofill {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.vn-table-separation-row {
|
||||
height: 16px !important;
|
||||
background-color: var(--vn-section-color) !important;
|
||||
}
|
||||
|
||||
/* Estilo para el asterisco en campos requeridos */
|
||||
.q-field.required .q-field__label:after {
|
||||
content: ' *';
|
||||
|
@ -230,10 +229,12 @@ input::-webkit-inner-spin-button {
|
|||
max-width: 100%;
|
||||
}
|
||||
|
||||
.q-table__container {
|
||||
/* ===== Scrollbar CSS ===== /
|
||||
/ Firefox */
|
||||
.remove-bg {
|
||||
filter: brightness(1.1);
|
||||
mix-blend-mode: multiply;
|
||||
}
|
||||
|
||||
.q-table__container {
|
||||
* {
|
||||
scrollbar-width: auto;
|
||||
scrollbar-color: var(--vn-label-color) transparent;
|
||||
|
@ -274,8 +275,6 @@ input::-webkit-inner-spin-button {
|
|||
font-size: 11pt;
|
||||
}
|
||||
td {
|
||||
font-size: 11pt;
|
||||
border-top: 1px solid var(--vn-page-color);
|
||||
border-collapse: collapse;
|
||||
}
|
||||
}
|
||||
|
@ -319,9 +318,6 @@ input::-webkit-inner-spin-button {
|
|||
max-width: fit-content;
|
||||
}
|
||||
|
||||
.row > .column:has(.q-checkbox) {
|
||||
max-width: fit-content;
|
||||
}
|
||||
.q-field__inner {
|
||||
.q-field__control {
|
||||
min-height: auto !important;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// Tip: Use the "Theme Builder" on Quasar's documentation website.
|
||||
// Tip: to add new colors https://quasar.dev/style/color-palette/#adding-your-own-colors
|
||||
$primary: #ec8916;
|
||||
$secondary: $primary;
|
||||
$secondary: #89be34;
|
||||
$positive: #c8e484;
|
||||
$negative: #fb5252;
|
||||
$info: #84d0e2;
|
||||
|
@ -30,7 +30,9 @@ $color-spacer: #7979794d;
|
|||
$border-thin-light: 1px solid $color-spacer-light;
|
||||
$primary-light: #f5b351;
|
||||
$dark-shadow-color: black;
|
||||
$layout-shadow-dark: 0 0 10px 2px #00000033, 0 0px 10px #0000003d;
|
||||
$layout-shadow-dark:
|
||||
0 0 10px 2px #00000033,
|
||||
0 0px 10px #0000003d;
|
||||
$spacing-md: 16px;
|
||||
$color-font-secondary: #777;
|
||||
$width-xs: 400px;
|
||||
|
|
|
@ -33,6 +33,7 @@ globals:
|
|||
reset: Reset
|
||||
close: Close
|
||||
cancel: Cancel
|
||||
isSaveAndContinue: Save and continue
|
||||
clone: Clone
|
||||
confirm: Confirm
|
||||
assign: Assign
|
||||
|
@ -167,6 +168,7 @@ globals:
|
|||
workCenters: Work centers
|
||||
modes: Modes
|
||||
zones: Zones
|
||||
negative: Negative
|
||||
zonesList: List
|
||||
deliveryDays: Delivery days
|
||||
upcomingDeliveries: Upcoming deliveries
|
||||
|
@ -174,6 +176,7 @@ globals:
|
|||
alias: Alias
|
||||
aliasUsers: Users
|
||||
subRoles: Subroles
|
||||
myAccount: Mi cuenta
|
||||
inheritedRoles: Inherited Roles
|
||||
customers: Customers
|
||||
customerCreate: New customer
|
||||
|
@ -406,6 +409,106 @@ cau:
|
|||
subtitle: By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.
|
||||
inputLabel: Explain why this error should not appear
|
||||
askPrivileges: Ask for privileges
|
||||
entry:
|
||||
list:
|
||||
newEntry: New entry
|
||||
tableVisibleColumns:
|
||||
isExcludedFromAvailable: Exclude from inventory
|
||||
isOrdered: Ordered
|
||||
isConfirmed: Ready to label
|
||||
isReceived: Received
|
||||
isRaid: Raid
|
||||
landed: Date
|
||||
supplierFk: Supplier
|
||||
reference: Ref/Alb/Guide
|
||||
invoiceNumber: Invoice
|
||||
agencyModeId: Agency
|
||||
isBooked: Booked
|
||||
companyFk: Company
|
||||
evaNotes: Notes
|
||||
warehouseOutFk: Origin
|
||||
warehouseInFk: Destiny
|
||||
entryTypeDescription: Entry type
|
||||
invoiceAmount: Import
|
||||
travelFk: Travel
|
||||
summary:
|
||||
invoiceAmount: Amount
|
||||
commission: Commission
|
||||
currency: Currency
|
||||
invoiceNumber: Invoice number
|
||||
ordered: Ordered
|
||||
booked: Booked
|
||||
excludedFromAvailable: Inventory
|
||||
travelReference: Reference
|
||||
travelAgency: Agency
|
||||
travelShipped: Shipped
|
||||
travelDelivered: Delivered
|
||||
travelLanded: Landed
|
||||
travelReceived: Received
|
||||
buys: Buys
|
||||
stickers: Stickers
|
||||
package: Package
|
||||
packing: Pack.
|
||||
grouping: Group.
|
||||
buyingValue: Buying value
|
||||
import: Import
|
||||
pvp: PVP
|
||||
basicData:
|
||||
travel: Travel
|
||||
currency: Currency
|
||||
commission: Commission
|
||||
observation: Observation
|
||||
booked: Booked
|
||||
excludedFromAvailable: Inventory
|
||||
buys:
|
||||
observations: Observations
|
||||
packagingFk: Box
|
||||
color: Color
|
||||
printedStickers: Printed stickers
|
||||
notes:
|
||||
observationType: Observation type
|
||||
latestBuys:
|
||||
tableVisibleColumns:
|
||||
image: Picture
|
||||
itemFk: Item ID
|
||||
weightByPiece: Weight/Piece
|
||||
isActive: Active
|
||||
family: Family
|
||||
entryFk: Entry
|
||||
freightValue: Freight value
|
||||
comissionValue: Commission value
|
||||
packageValue: Package value
|
||||
isIgnored: Is ignored
|
||||
price2: Grouping
|
||||
price3: Packing
|
||||
minPrice: Min
|
||||
ektFk: Ekt
|
||||
packingOut: Package out
|
||||
landing: Landing
|
||||
isExcludedFromAvailable: Exclude from inventory
|
||||
isRaid: Raid
|
||||
invoiceNumber: Invoice
|
||||
reference: Ref/Alb/Guide
|
||||
params:
|
||||
isExcludedFromAvailable: Excluir del inventario
|
||||
isOrdered: Pedida
|
||||
isConfirmed: Lista para etiquetar
|
||||
isReceived: Recibida
|
||||
isRaid: Redada
|
||||
landed: Fecha
|
||||
supplierFk: Proveedor
|
||||
invoiceNumber: Nº Factura
|
||||
reference: Ref/Alb/Guía
|
||||
agencyModeId: Agencia
|
||||
isBooked: Asentado
|
||||
companyFk: Empresa
|
||||
travelFk: Envio
|
||||
evaNotes: Notas
|
||||
warehouseOutFk: Origen
|
||||
warehouseInFk: Destino
|
||||
entryTypeDescription: Tipo entrada
|
||||
invoiceAmount: Importe
|
||||
dated: Fecha
|
||||
ticket:
|
||||
params:
|
||||
ticketFk: Ticket ID
|
||||
|
|
|
@ -33,9 +33,11 @@ globals:
|
|||
reset: Restaurar
|
||||
close: Cerrar
|
||||
cancel: Cancelar
|
||||
isSaveAndContinue: Guardar y continuar
|
||||
clone: Clonar
|
||||
confirm: Confirmar
|
||||
assign: Asignar
|
||||
replace: Sustituir
|
||||
back: Volver
|
||||
yes: Si
|
||||
no: No
|
||||
|
@ -48,6 +50,7 @@ globals:
|
|||
rowRemoved: Fila eliminada
|
||||
pleaseWait: Por favor espera...
|
||||
noPinnedModules: No has fijado ningún módulo
|
||||
split: Split
|
||||
summary:
|
||||
basicData: Datos básicos
|
||||
daysOnward: Días adelante
|
||||
|
@ -55,8 +58,8 @@ globals:
|
|||
today: Hoy
|
||||
yesterday: Ayer
|
||||
dateFormat: es-ES
|
||||
microsip: Abrir en MicroSIP
|
||||
noSelectedRows: No tienes ninguna línea seleccionada
|
||||
microsip: Abrir en MicroSIP
|
||||
downloadCSVSuccess: Descarga de CSV exitosa
|
||||
reference: Referencia
|
||||
agency: Agencia
|
||||
|
@ -76,8 +79,10 @@ globals:
|
|||
requiredField: Campo obligatorio
|
||||
class: clase
|
||||
type: Tipo
|
||||
reason: motivo
|
||||
reason: Motivo
|
||||
removeSelection: Eliminar selección
|
||||
noResults: Sin resultados
|
||||
results: resultados
|
||||
system: Sistema
|
||||
notificationSent: Notificación enviada
|
||||
warehouse: Almacén
|
||||
|
@ -166,6 +171,7 @@ globals:
|
|||
agency: Agencia
|
||||
workCenters: Centros de trabajo
|
||||
modes: Modos
|
||||
negative: Tickets negativos
|
||||
zones: Zonas
|
||||
zonesList: Listado
|
||||
deliveryDays: Días de entrega
|
||||
|
@ -286,9 +292,9 @@ globals:
|
|||
buyRequest: Peticiones de compra
|
||||
wasteBreakdown: Deglose de mermas
|
||||
itemCreate: Nuevo artículo
|
||||
tax: 'IVA'
|
||||
botanical: 'Botánico'
|
||||
barcode: 'Código de barras'
|
||||
tax: IVA
|
||||
botanical: Botánico
|
||||
barcode: Código de barras
|
||||
itemTypeCreate: Nueva familia
|
||||
family: Familia
|
||||
lastEntries: Últimas entradas
|
||||
|
@ -397,6 +403,87 @@ cau:
|
|||
subtitle: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
||||
inputLabel: Explique el motivo por el que no deberia aparecer este fallo
|
||||
askPrivileges: Solicitar permisos
|
||||
entry:
|
||||
list:
|
||||
newEntry: Nueva entrada
|
||||
tableVisibleColumns:
|
||||
isExcludedFromAvailable: Excluir del inventario
|
||||
isOrdered: Pedida
|
||||
isConfirmed: Lista para etiquetar
|
||||
isReceived: Recibida
|
||||
isRaid: Redada
|
||||
landed: Fecha
|
||||
supplierFk: Proveedor
|
||||
invoiceNumber: Nº Factura
|
||||
reference: Ref/Alb/Guía
|
||||
agencyModeId: Agencia
|
||||
isBooked: Asentado
|
||||
companyFk: Empresa
|
||||
travelFk: Envio
|
||||
evaNotes: Notas
|
||||
warehouseOutFk: Origen
|
||||
warehouseInFk: Destino
|
||||
entryTypeDescription: Tipo entrada
|
||||
invoiceAmount: Importe
|
||||
summary:
|
||||
invoiceAmount: Importe
|
||||
commission: Comisión
|
||||
currency: Moneda
|
||||
invoiceNumber: Núm. factura
|
||||
ordered: Pedida
|
||||
booked: Contabilizada
|
||||
excludedFromAvailable: Inventario
|
||||
travelReference: Referencia
|
||||
travelAgency: Agencia
|
||||
travelShipped: F. envio
|
||||
travelWarehouseOut: Alm. salida
|
||||
travelDelivered: Enviada
|
||||
travelLanded: F. entrega
|
||||
travelReceived: Recibida
|
||||
buys: Compras
|
||||
stickers: Etiquetas
|
||||
package: Embalaje
|
||||
packing: Pack.
|
||||
grouping: Group.
|
||||
buyingValue: Coste
|
||||
import: Importe
|
||||
pvp: PVP
|
||||
basicData:
|
||||
travel: Envío
|
||||
currency: Moneda
|
||||
observation: Observación
|
||||
commission: Comisión
|
||||
booked: Asentado
|
||||
excludedFromAvailable: Inventario
|
||||
buys:
|
||||
observations: Observaciónes
|
||||
packagingFk: Embalaje
|
||||
color: Color
|
||||
printedStickers: Etiquetas impresas
|
||||
notes:
|
||||
observationType: Tipo de observación
|
||||
latestBuys:
|
||||
tableVisibleColumns:
|
||||
image: Foto
|
||||
itemFk: Id Artículo
|
||||
weightByPiece: Peso (gramos)/tallo
|
||||
isActive: Activo
|
||||
family: Familia
|
||||
entryFk: Entrada
|
||||
freightValue: Porte
|
||||
comissionValue: Comisión
|
||||
packageValue: Embalaje
|
||||
isIgnored: Ignorado
|
||||
price2: Grouping
|
||||
price3: Packing
|
||||
minPrice: Min
|
||||
ektFk: Ekt
|
||||
packingOut: Embalaje envíos
|
||||
landing: Llegada
|
||||
isExcludedFromAvailable: Excluir del inventario
|
||||
isRaid: Redada
|
||||
invoiceNumber: Nº Factura
|
||||
reference: Ref/Alb/Guía
|
||||
ticket:
|
||||
params:
|
||||
ticketFk: ID de ticket
|
||||
|
@ -410,6 +497,38 @@ ticket:
|
|||
freightItemName: Nombre
|
||||
packageItemName: Embalaje
|
||||
longName: Descripción
|
||||
pageTitles:
|
||||
tickets: Tickets
|
||||
list: Listado
|
||||
ticketCreate: Nuevo ticket
|
||||
summary: Resumen
|
||||
basicData: Datos básicos
|
||||
boxing: Encajado
|
||||
sms: Sms
|
||||
notes: Notas
|
||||
sale: Lineas del pedido
|
||||
dms: Gestión documental
|
||||
negative: Tickets negativos
|
||||
volume: Volumen
|
||||
observation: Notas
|
||||
ticketAdvance: Adelantar tickets
|
||||
futureTickets: Tickets a futuro
|
||||
expedition: Expedición
|
||||
purchaseRequest: Petición de compra
|
||||
weeklyTickets: Tickets programados
|
||||
saleTracking: Líneas preparadas
|
||||
services: Servicios
|
||||
tracking: Estados
|
||||
components: Componentes
|
||||
pictures: Fotos
|
||||
packages: Bultos
|
||||
list:
|
||||
nickname: Alias
|
||||
state: Estado
|
||||
shipped: Enviado
|
||||
landed: Entregado
|
||||
salesPerson: Comercial
|
||||
total: Total
|
||||
card:
|
||||
customerId: ID cliente
|
||||
customerCard: Ficha del cliente
|
||||
|
@ -456,15 +575,11 @@ ticket:
|
|||
consigneeStreet: Dirección
|
||||
create:
|
||||
address: Dirección
|
||||
order:
|
||||
field:
|
||||
salesPersonFk: Comercial
|
||||
form:
|
||||
clientFk: Cliente
|
||||
addressFk: Dirección
|
||||
agencyModeFk: Agencia
|
||||
list:
|
||||
newOrder: Nuevo Pedido
|
||||
invoiceOut:
|
||||
card:
|
||||
issued: Fecha emisión
|
||||
customerCard: Ficha del cliente
|
||||
ticketList: Listado de tickets
|
||||
summary:
|
||||
issued: Fecha
|
||||
dued: Fecha límite
|
||||
|
@ -475,6 +590,71 @@ order:
|
|||
fee: Cuota
|
||||
tickets: Tickets
|
||||
totalWithVat: Importe
|
||||
globalInvoices:
|
||||
errors:
|
||||
chooseValidClient: Selecciona un cliente válido
|
||||
chooseValidCompany: Selecciona una empresa válida
|
||||
chooseValidPrinter: Selecciona una impresora válida
|
||||
chooseValidSerialType: Selecciona una tipo de serie válida
|
||||
fillDates: La fecha de la factura y la fecha máxima deben estar completas
|
||||
invoiceDateLessThanMaxDate: La fecha de la factura no puede ser menor que la fecha máxima
|
||||
invoiceWithFutureDate: Existe una factura con una fecha futura
|
||||
noTicketsToInvoice: No existen tickets para facturar
|
||||
criticalInvoiceError: Error crítico en la facturación proceso detenido
|
||||
invalidSerialTypeForAll: El tipo de serie debe ser global cuando se facturan todos los clientes
|
||||
table:
|
||||
addressId: Id dirección
|
||||
streetAddress: Dirección fiscal
|
||||
statusCard:
|
||||
percentageText: '{getPercentage}% {getAddressNumber} de {getNAddresses}'
|
||||
pdfsNumberText: '{nPdfs} de {totalPdfs} PDFs'
|
||||
negativeBases:
|
||||
clientId: Id cliente
|
||||
base: Base
|
||||
active: Activo
|
||||
hasToInvoice: Facturar
|
||||
verifiedData: Datos comprobados
|
||||
comercial: Comercial
|
||||
errors:
|
||||
downloadCsvFailed: Error al descargar CSV
|
||||
order:
|
||||
field:
|
||||
salesPersonFk: Comercial
|
||||
form:
|
||||
clientFk: Cliente
|
||||
addressFk: Dirección
|
||||
agencyModeFk: Agencia
|
||||
list:
|
||||
newOrder: Nuevo Pedido
|
||||
summary:
|
||||
basket: Cesta
|
||||
notConfirmed: No confirmada
|
||||
created: Creado
|
||||
createdFrom: Creado desde
|
||||
address: Dirección
|
||||
total: Total
|
||||
vat: IVA
|
||||
state: Estado
|
||||
alias: Alias
|
||||
items: Artículos
|
||||
orderTicketList: Tickets del pedido
|
||||
amount: Monto
|
||||
confirm: Confirmar
|
||||
confirmLines: Confirmar lineas
|
||||
shelving:
|
||||
list:
|
||||
parking: Parking
|
||||
priority: Prioridad
|
||||
newShelving: Nuevo Carro
|
||||
summary:
|
||||
recyclable: Reciclable
|
||||
parking:
|
||||
pickingOrder: Orden de recogida
|
||||
row: Fila
|
||||
column: Columna
|
||||
searchBar:
|
||||
info: Puedes buscar por código de parking
|
||||
label: Buscar parking...
|
||||
department:
|
||||
chat: Chat
|
||||
bossDepartment: Jefe de departamento
|
||||
|
@ -635,8 +815,8 @@ wagon:
|
|||
volumeNotEmpty: El volumen no puede estar vacío
|
||||
typeNotEmpty: El tipo no puede estar vacío
|
||||
maxTrays: Has alcanzado el número máximo de bandejas
|
||||
minHeightBetweenTrays: 'La distancia mínima entre bandejas es '
|
||||
maxWagonHeight: 'La altura máxima del vagón es '
|
||||
minHeightBetweenTrays: La distancia mínima entre bandejas es
|
||||
maxWagonHeight: La altura máxima del vagón es
|
||||
uncompleteTrays: Hay bandejas sin completar
|
||||
params:
|
||||
label: Etiqueta
|
||||
|
@ -783,7 +963,7 @@ components:
|
|||
cardDescriptor:
|
||||
mainList: Listado principal
|
||||
summary: Resumen
|
||||
moreOptions: 'Más opciones'
|
||||
moreOptions: Más opciones
|
||||
leftMenu:
|
||||
addToPinned: Añadir a fijados
|
||||
removeFromPinned: Eliminar de fijados
|
||||
|
|
|
@ -12,6 +12,7 @@ import VnInputPassword from 'src/components/common/VnInputPassword.vue';
|
|||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
hasAccount: {
|
||||
|
@ -121,18 +122,14 @@ onMounted(() => {
|
|||
:promise="sync"
|
||||
>
|
||||
<template #customHTML>
|
||||
{{ shouldSyncPassword }}
|
||||
<QCheckbox
|
||||
:label="t('account.card.actions.sync.checkbox')"
|
||||
<VnCheckbox
|
||||
v-model="shouldSyncPassword"
|
||||
class="full-width"
|
||||
:label="t('account.card.actions.sync.checkbox')"
|
||||
:info="t('account.card.actions.sync.tooltip')"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<QIcon style="padding-left: 10px" color="primary" name="info" size="sm">
|
||||
<QTooltip>{{ t('account.card.actions.sync.tooltip') }}</QTooltip>
|
||||
</QIcon></QCheckbox
|
||||
>
|
||||
color="primary"
|
||||
/>
|
||||
<VnInputPassword
|
||||
v-if="shouldSyncPassword"
|
||||
:label="t('login.password')"
|
||||
|
|
|
@ -218,7 +218,7 @@ const updateDateParams = (value, params) => {
|
|||
<div v-if="row.subName" class="subName">
|
||||
{{ row.subName }}
|
||||
</div>
|
||||
<FetchedTags :item="row" :max-length="3" />
|
||||
<FetchedTags :item="row" />
|
||||
</template>
|
||||
<template #moreFilterPanel="{ params }">
|
||||
<div class="column no-wrap flex-center q-gutter-y-md q-mt-xs q-pr-xl">
|
||||
|
|
|
@ -110,7 +110,21 @@ const debtWarning = computed(() => {
|
|||
>
|
||||
<QTooltip>{{ t('customer.card.isDisabled') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="entity.isFreezed" name="vn:frozen" size="xs" color="primary">
|
||||
|
||||
<QIcon
|
||||
v-if="entity?.substitutionAllowed"
|
||||
name="help"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Allowed substitution') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="customer?.isFreezed"
|
||||
name="vn:frozen"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('customer.card.isFrozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
|
|
|
@ -61,6 +61,16 @@ const openCreateForm = (type) => {
|
|||
.join('&');
|
||||
useOpenURL(`/#/${type}/list?${params}`);
|
||||
};
|
||||
const updateSubstitutionAllowed = async () => {
|
||||
try {
|
||||
await axios.patch(`Clients/${route.params.id}`, {
|
||||
substitutionAllowed: !$props.customer.substitutionAllowed,
|
||||
});
|
||||
notify('globals.notificationSent', 'positive');
|
||||
} catch (error) {
|
||||
notify(error.message, 'positive');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -69,6 +79,13 @@ const openCreateForm = (type) => {
|
|||
{{ t('globals.pageTitles.createTicket') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection @click="updateSubstitutionAllowed()">{{
|
||||
$props.customer.substitutionAllowed
|
||||
? t('Disable substitution')
|
||||
: t('Allow substitution')
|
||||
}}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection @click="showSmsDialog()">{{ t('Send SMS') }}</QItemSection>
|
||||
</QItem>
|
||||
|
|
|
@ -9,6 +9,7 @@ import VnRow from 'components/ui/VnRow.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
@ -110,14 +111,11 @@ function handleLocation(data, location) {
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<QCheckbox :label="t('Has to invoice')" v-model="data.hasToInvoice" />
|
||||
<div>
|
||||
<QCheckbox :label="t('globals.isVies')" v-model="data.isVies" />
|
||||
<QIcon name="info" class="cursor-info q-ml-sm" size="sm">
|
||||
<QTooltip>
|
||||
{{ t('whenActivatingIt') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnCheckbox
|
||||
v-model="data.isVies"
|
||||
:label="t('globals.isVies')"
|
||||
:info="t('whenActivatingIt')"
|
||||
/>
|
||||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
|
@ -129,17 +127,11 @@ function handleLocation(data, location) {
|
|||
</VnRow>
|
||||
|
||||
<VnRow>
|
||||
<div>
|
||||
<QCheckbox
|
||||
:label="t('Is equalizated')"
|
||||
v-model="data.isEqualizated"
|
||||
/>
|
||||
<QIcon class="cursor-info q-ml-sm" name="info" size="sm">
|
||||
<QTooltip>
|
||||
{{ t('inOrderToInvoice') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnCheckbox
|
||||
v-model="data.isEqualizated"
|
||||
:label="t('Is equalizated')"
|
||||
:info="t('inOrderToInvoice')"
|
||||
/>
|
||||
<QCheckbox :label="t('Daily invoice')" v-model="data.hasDailyInvoice" />
|
||||
</VnRow>
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
|
@ -52,11 +51,7 @@ const exprBuilder = (param, value) => {
|
|||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('globals.name')"
|
||||
v-model="params.name"
|
||||
is-outlined
|
||||
/>
|
||||
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
|
|
|
@ -264,6 +264,7 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'isActive',
|
||||
label: t('customer.summary.isActive'),
|
||||
component: 'checkbox',
|
||||
chip: {
|
||||
color: null,
|
||||
condition: (value) => !value,
|
||||
|
@ -302,6 +303,7 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'isFreezed',
|
||||
label: t('customer.extendedList.tableVisibleColumns.isFreezed'),
|
||||
component: 'checkbox',
|
||||
chip: {
|
||||
color: null,
|
||||
condition: (value) => value,
|
||||
|
@ -419,7 +421,7 @@ function handleLocation(data, location) {
|
|||
<VnTable
|
||||
ref="tableRef"
|
||||
:data-key="dataKey"
|
||||
url="Clients/filter"
|
||||
url="Clients/extendedListFilter"
|
||||
:create="{
|
||||
urlCreate: 'Clients/createWithUser',
|
||||
title: t('globals.pageTitles.customerCreate'),
|
||||
|
|
|
@ -9,7 +9,7 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
|
|||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
|
|
|
@ -1,30 +1,32 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { checkEntryLock } from 'src/composables/checkEntryLock';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
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 VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import FilterTravelForm from 'src/components/FilterTravelForm.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import VnSelectTravelExtended from 'src/components/common/VnSelectTravelExtended.vue';
|
||||
import VnSelectSupplier from 'src/components/common/VnSelectSupplier.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { hasAny } = useRole();
|
||||
const isAdministrative = () => hasAny(['administrative']);
|
||||
const state = useState();
|
||||
const user = state.getUser().fn();
|
||||
|
||||
const companiesOptions = ref([]);
|
||||
const currenciesOptions = ref([]);
|
||||
|
||||
const onFilterTravelSelected = (formData, id) => {
|
||||
formData.travelFk = id;
|
||||
};
|
||||
onMounted(() => {
|
||||
checkEntryLock(route.params.id, user.id);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -52,46 +54,24 @@ const onFilterTravelSelected = (formData, id) => {
|
|||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow>
|
||||
<VnSelectTravelExtended
|
||||
:data="data"
|
||||
v-model="data.travelFk"
|
||||
:onFilterTravelSelected="(data, result) => (data.travelFk = result)"
|
||||
/>
|
||||
<VnSelectSupplier
|
||||
v-model="data.supplierFk"
|
||||
hide-selected
|
||||
:required="true"
|
||||
map-options
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('entry.basicData.travel')"
|
||||
v-model="data.travelFk"
|
||||
url="Travels/filter"
|
||||
:fields="['id', 'warehouseInName']"
|
||||
option-value="id"
|
||||
option-label="warehouseInName"
|
||||
map-options
|
||||
hide-selected
|
||||
:required="true"
|
||||
action-icon="filter_alt"
|
||||
>
|
||||
<template #form>
|
||||
<FilterTravelForm
|
||||
@travel-selected="onFilterTravelSelected(data, $event)"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.agencyModeName }} -
|
||||
{{ scope.opt?.warehouseInName }}
|
||||
({{ toDate(scope.opt?.shipped) }}) →
|
||||
{{ scope.opt?.warehouseOutName }}
|
||||
({{ toDate(scope.opt?.landed) }})
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput v-model="data.reference" :label="t('globals.reference')" />
|
||||
<VnInputNumber
|
||||
v-model="data.invoiceAmount"
|
||||
:label="t('entry.summary.invoiceAmount')"
|
||||
:positive="false"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
|
@ -113,8 +93,7 @@ const onFilterTravelSelected = (formData, id) => {
|
|||
<VnInputNumber
|
||||
:label="t('entry.summary.commission')"
|
||||
v-model="data.commission"
|
||||
step="1"
|
||||
autofocus
|
||||
:step="1"
|
||||
:positive="false"
|
||||
/>
|
||||
<VnSelect
|
||||
|
@ -161,7 +140,7 @@ const onFilterTravelSelected = (formData, id) => {
|
|||
:label="t('entry.summary.excludedFromAvailable')"
|
||||
/>
|
||||
<QCheckbox
|
||||
v-if="isAdministrative()"
|
||||
:disable="!isAdministrative()"
|
||||
v-model="data.isBooked"
|
||||
:label="t('entry.basicData.booked')"
|
||||
/>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,19 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import EntryDescriptorMenu from './EntryDescriptorMenu.vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||
import axios from 'axios';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { push } = useRouter();
|
||||
const { openReport } = usePrintService();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -83,6 +90,58 @@ const getEntryRedirectionFilter = (entry) => {
|
|||
to,
|
||||
});
|
||||
};
|
||||
|
||||
function showEntryReport() {
|
||||
openReport(`Entries/${entityId.value}/entry-order-pdf`);
|
||||
}
|
||||
|
||||
function showNotification(type, message) {
|
||||
quasar.notify({
|
||||
type: type,
|
||||
message: t(message),
|
||||
});
|
||||
}
|
||||
|
||||
async function recalculateRates(entity) {
|
||||
try {
|
||||
const entryConfig = await axios.get('EntryConfigs/findOne');
|
||||
if (entryConfig.data?.inventorySupplierFk === entity.supplierFk) {
|
||||
showNotification(
|
||||
'negative',
|
||||
'Cannot recalculate prices because this is an inventory entry',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await axios.post(`Entries/${entityId.value}/recalcEntryPrices`);
|
||||
showNotification('positive', 'Entry prices recalculated');
|
||||
} catch (error) {
|
||||
showNotification('negative', 'Failed to recalculate rates');
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function cloneEntry() {
|
||||
try {
|
||||
const response = await axios.post(`Entries/${entityId.value}/cloneEntry`);
|
||||
push({ path: `/entry/${response.data}` });
|
||||
showNotification('positive', 'Entry cloned');
|
||||
} catch (error) {
|
||||
showNotification('negative', 'Failed to clone entry');
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteEntry() {
|
||||
try {
|
||||
await axios.post(`Entries/${entityId.value}/deleteEntry`);
|
||||
push({ path: `/entry/list` });
|
||||
showNotification('positive', 'Entry deleted');
|
||||
} catch (error) {
|
||||
showNotification('negative', 'Failed to delete entry');
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -96,15 +155,56 @@ const getEntryRedirectionFilter = (entry) => {
|
|||
width="lg-width"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<EntryDescriptorMenu :id="entity.id" />
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="showEntryReport(entity)"
|
||||
data-cy="show-entry-report"
|
||||
>
|
||||
<QItemSection>{{ t('Show entry report') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="recalculateRates(entity)"
|
||||
data-cy="recalculate-rates"
|
||||
>
|
||||
<QItemSection>{{ t('Recalculate rates') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="cloneEntry(entity)" data-cy="clone-entry">
|
||||
<QItemSection>{{ t('Clone') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="deleteEntry(entity)" data-cy="delete-entry">
|
||||
<QItemSection>{{ t('Delete') }}</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('globals.agency')" :value="entity.travel?.agency?.name" />
|
||||
<VnLv :label="t('shipped')" :value="toDate(entity.travel?.shipped)" />
|
||||
<VnLv :label="t('landed')" :value="toDate(entity.travel?.landed)" />
|
||||
<VnLv :label="t('Travel')">
|
||||
<template #value>
|
||||
<span class="link" v-if="entity?.travelFk">
|
||||
{{ entity.travel?.agency?.name }}
|
||||
{{ entity.travel?.warehouseOut?.code }} →
|
||||
{{ entity.travel?.warehouseIn?.code }}
|
||||
<TravelDescriptorProxy :id="entity?.travelFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('globals.warehouseOut')"
|
||||
:value="entity.travel?.warehouseOut?.name"
|
||||
:label="t('entry.summary.travelShipped')"
|
||||
:value="toDate(entity.travel?.shipped)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelLanded')"
|
||||
:value="toDate(entity.travel?.landed)"
|
||||
/>
|
||||
<VnLv :label="t('entry.summary.currency')" :value="entity?.currency?.code" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.invoiceAmount')"
|
||||
:value="entity?.invoiceAmount"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.summary.entryType')"
|
||||
:value="entity?.entryType?.description"
|
||||
/>
|
||||
</template>
|
||||
<template #icons="{ entity }">
|
||||
|
@ -131,6 +231,14 @@ const getEntryRedirectionFilter = (entry) => {
|
|||
}}</QTooltip
|
||||
>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="!entity?.travelFk"
|
||||
name="vn:deletedTicket"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('This entry is deleted') }}</QTooltip>
|
||||
</QIcon>
|
||||
</QCardActions>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
|
@ -143,21 +251,6 @@ const getEntryRedirectionFilter = (entry) => {
|
|||
>
|
||||
<QTooltip>{{ t('Supplier card') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:to="{
|
||||
name: 'TravelMain',
|
||||
query: {
|
||||
params: JSON.stringify({
|
||||
agencyModeFk: entity.travel?.agencyModeFk,
|
||||
}),
|
||||
},
|
||||
}"
|
||||
size="md"
|
||||
icon="local_airport"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('All travels with current agency') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:to="{
|
||||
name: 'EntryMain',
|
||||
|
@ -177,10 +270,24 @@ const getEntryRedirectionFilter = (entry) => {
|
|||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Travel: Envío
|
||||
Supplier card: Ficha del proveedor
|
||||
All travels with current agency: Todos los envíos con la agencia actual
|
||||
All entries with current supplier: Todas las entradas con el proveedor actual
|
||||
Show entry report: Ver informe del pedido
|
||||
Inventory entry: Es inventario
|
||||
Virtual entry: Es una redada
|
||||
shipped: Enviado
|
||||
landed: Recibido
|
||||
This entry is deleted: Esta entrada está eliminada
|
||||
Cannot recalculate prices because this is an inventory entry: No se pueden recalcular los precios porque es una entrada de inventario
|
||||
Entry deleted: Entrada eliminada
|
||||
Entry cloned: Entrada clonada
|
||||
Entry prices recalculated: Precios de la entrada recalculados
|
||||
Failed to recalculate rates: No se pudieron recalcular las tarifas
|
||||
Failed to clone entry: No se pudo clonar la entrada
|
||||
Failed to delete entry: No se pudo eliminar la entrada
|
||||
Recalculate rates: Recalcular tarifas
|
||||
Clone: Clonar
|
||||
Delete: Eliminar
|
||||
</i18n>
|
||||
|
|
|
@ -9,6 +9,7 @@ export default {
|
|||
'shipped',
|
||||
'agencyModeFk',
|
||||
'warehouseOutFk',
|
||||
'warehouseInFk',
|
||||
'daysInForward',
|
||||
],
|
||||
include: [
|
||||
|
@ -21,13 +22,13 @@ export default {
|
|||
{
|
||||
relation: 'warehouseOut',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
fields: ['name', 'code'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
fields: ['name', 'code'],
|
||||
},
|
||||
},
|
||||
],
|
||||
|
@ -39,5 +40,17 @@ export default {
|
|||
fields: ['id', 'nickname'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'currency',
|
||||
scope: {
|
||||
fields: ['id', 'code'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'entryType',
|
||||
scope: {
|
||||
fields: ['code', 'description'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -2,19 +2,17 @@
|
|||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'src/filters';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import axios from 'axios';
|
||||
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||
|
||||
import { toDate, toCurrency, toCelsius } from 'src/filters';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import axios from 'axios';
|
||||
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
import EntryDescriptorMenu from './EntryDescriptorMenu.vue';
|
||||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
import EntryBuys from './EntryBuys.vue';
|
||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
import VnToSummary from 'src/components/ui/VnToSummary.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -33,117 +31,6 @@ const entry = ref();
|
|||
const entryBuys = ref([]);
|
||||
const entryUrl = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
entryUrl.value = (await getUrl('entry/')) + entityId.value;
|
||||
});
|
||||
|
||||
const tableColumnComponents = {
|
||||
quantity: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
},
|
||||
stickers: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
packagingFk: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
weight: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
packing: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
grouping: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
buyingValue: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
amount: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
pvp: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
const entriesTableColumns = computed(() => {
|
||||
return [
|
||||
{
|
||||
label: t('globals.quantity'),
|
||||
field: 'quantity',
|
||||
name: 'quantity',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.summary.stickers'),
|
||||
field: 'stickers',
|
||||
name: 'stickers',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.summary.package'),
|
||||
field: 'packagingFk',
|
||||
name: 'packagingFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('globals.weight'),
|
||||
field: 'weight',
|
||||
name: 'weight',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.summary.packing'),
|
||||
field: 'packing',
|
||||
name: 'packing',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.summary.grouping'),
|
||||
field: 'grouping',
|
||||
name: 'grouping',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.summary.buyingValue'),
|
||||
field: 'buyingValue',
|
||||
name: 'buyingValue',
|
||||
align: 'left',
|
||||
format: (value) => toCurrency(value),
|
||||
},
|
||||
{
|
||||
label: t('entry.summary.import'),
|
||||
name: 'amount',
|
||||
align: 'left',
|
||||
format: (_, row) => toCurrency(row.buyingValue * row.quantity),
|
||||
},
|
||||
{
|
||||
label: t('entry.summary.pvp'),
|
||||
name: 'pvp',
|
||||
align: 'left',
|
||||
format: (_, row) => toCurrency(row.price2) + ' / ' + toCurrency(row.price3),
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
async function setEntryData(data) {
|
||||
if (data) entry.value = data;
|
||||
await fetchEntryBuys();
|
||||
|
@ -153,14 +40,18 @@ const fetchEntryBuys = async () => {
|
|||
const { data } = await axios.get(`Entries/${entry.value.id}/getBuys`);
|
||||
if (data) entryBuys.value = data;
|
||||
};
|
||||
</script>
|
||||
|
||||
onMounted(async () => {
|
||||
entryUrl.value = (await getUrl('entry/')) + entityId.value;
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summaryRef"
|
||||
:url="`Entries/${entityId}/getEntry`"
|
||||
@on-fetch="(data) => setEntryData(data)"
|
||||
data-key="EntrySummary"
|
||||
data-cy="entry-summary"
|
||||
>
|
||||
<template #header-left>
|
||||
<VnToSummary
|
||||
|
@ -173,159 +64,154 @@ const fetchEntryBuys = async () => {
|
|||
<template #header>
|
||||
<span>{{ entry.id }} - {{ entry.supplier.nickname }}</span>
|
||||
</template>
|
||||
<template #menu="{ entity }">
|
||||
<EntryDescriptorMenu :id="entity.id" />
|
||||
</template>
|
||||
<template #body>
|
||||
<QCard class="vn-one">
|
||||
<VnTitle
|
||||
:url="`#/entry/${entityId}/basic-data`"
|
||||
:text="t('globals.summary.basicData')"
|
||||
/>
|
||||
<VnLv :label="t('entry.summary.commission')" :value="entry.commission" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.currency')"
|
||||
:value="entry.currency?.name"
|
||||
/>
|
||||
<VnLv :label="t('globals.company')" :value="entry.company.code" />
|
||||
<VnLv :label="t('globals.reference')" :value="entry.reference" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.invoiceNumber')"
|
||||
:value="entry.invoiceNumber"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.basicData.initialTemperature')"
|
||||
:value="toCelsius(entry.initialTemperature)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.basicData.finalTemperature')"
|
||||
:value="toCelsius(entry.finalTemperature)"
|
||||
/>
|
||||
<div class="card-group">
|
||||
<div class="card-content">
|
||||
<VnLv
|
||||
:label="t('entry.summary.commission')"
|
||||
:value="entry?.commission"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.summary.currency')"
|
||||
:value="entry?.currency?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.company')"
|
||||
:value="entry?.company?.code"
|
||||
/>
|
||||
<VnLv :label="t('globals.reference')" :value="entry?.reference" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.invoiceNumber')"
|
||||
:value="entry?.invoiceNumber"
|
||||
/>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<VnCheckbox
|
||||
:label="t('entry.summary.ordered')"
|
||||
v-model="entry.isOrdered"
|
||||
:disable="true"
|
||||
size="xs"
|
||||
/>
|
||||
<VnCheckbox
|
||||
:label="t('globals.confirmed')"
|
||||
v-model="entry.isConfirmed"
|
||||
:disable="true"
|
||||
size="xs"
|
||||
/>
|
||||
<VnCheckbox
|
||||
:label="t('entry.summary.booked')"
|
||||
v-model="entry.isBooked"
|
||||
:disable="true"
|
||||
size="xs"
|
||||
/>
|
||||
<VnCheckbox
|
||||
:label="t('entry.summary.excludedFromAvailable')"
|
||||
v-model="entry.isExcludedFromAvailable"
|
||||
:disable="true"
|
||||
size="xs"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCard class="vn-one" v-if="entry?.travelFk">
|
||||
<VnTitle
|
||||
:url="`#/entry/${entityId}/basic-data`"
|
||||
:text="t('globals.summary.basicData')"
|
||||
:url="`#/travel/${entry.travel.id}/summary`"
|
||||
:text="t('Travel')"
|
||||
/>
|
||||
<VnLv :label="t('entry.summary.travelReference')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ entry.travel.ref }}
|
||||
<TravelDescriptorProxy :id="entry.travel.id" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelAgency')"
|
||||
:value="entry.travel.agency?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.shipped')"
|
||||
:value="toDate(entry.travel.shipped)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.warehouseOut')"
|
||||
:value="entry.travel.warehouseOut?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelDelivered')"
|
||||
:value="entry.travel.isDelivered"
|
||||
/>
|
||||
<VnLv :label="t('globals.landed')" :value="toDate(entry.travel.landed)" />
|
||||
<VnLv
|
||||
:label="t('globals.warehouseIn')"
|
||||
:value="entry.travel.warehouseIn?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelReceived')"
|
||||
:value="entry.travel.isReceived"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<VnTitle :url="`#/travel/${entityId}/summary`" :text="t('Travel data')" />
|
||||
<VnRow class="block">
|
||||
<VnLv :label="t('entry.summary.ordered')" :value="entry.isOrdered" />
|
||||
<VnLv :label="t('globals.confirmed')" :value="entry.isConfirmed" />
|
||||
<VnLv :label="t('entry.summary.booked')" :value="entry.isBooked" />
|
||||
<VnLv
|
||||
:label="t('entry.summary.excludedFromAvailable')"
|
||||
:value="entry.isExcludedFromAvailable"
|
||||
/>
|
||||
</VnRow>
|
||||
<div class="card-group">
|
||||
<div class="card-content">
|
||||
<VnLv :label="t('entry.summary.travelReference')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ entry.travel.ref }}
|
||||
<TravelDescriptorProxy :id="entry.travel.id" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelAgency')"
|
||||
:value="entry.travel.agency?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelShipped')"
|
||||
:value="toDate(entry.travel.shipped)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.warehouseOut')"
|
||||
:value="entry.travel.warehouseOut?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.summary.travelLanded')"
|
||||
:value="toDate(entry.travel.landed)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.warehouseIn')"
|
||||
:value="entry.travel.warehouseIn?.name"
|
||||
/>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<VnCheckbox
|
||||
:label="t('entry.summary.travelDelivered')"
|
||||
v-model="entry.travel.isDelivered"
|
||||
:disable="true"
|
||||
size="xs"
|
||||
/>
|
||||
<VnCheckbox
|
||||
:label="t('entry.summary.travelReceived')"
|
||||
v-model="entry.travel.isReceived"
|
||||
:disable="true"
|
||||
size="xs"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</QCard>
|
||||
<QCard class="vn-max">
|
||||
<VnTitle
|
||||
:url="`#/entry/${entityId}/buys`"
|
||||
:text="t('entry.summary.buys')"
|
||||
/>
|
||||
<QTable
|
||||
:rows="entryBuys"
|
||||
:columns="entriesTableColumns"
|
||||
row-key="index"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body="{ cols, row, rowIndex }">
|
||||
<QTr no-hover>
|
||||
<QTd v-for="col in cols" :key="col?.name">
|
||||
<component
|
||||
:is="tableColumnComponents[col?.name].component()"
|
||||
v-bind="tableColumnComponents[col?.name].props()"
|
||||
@click="tableColumnComponents[col?.name].event()"
|
||||
class="col-content"
|
||||
>
|
||||
<template
|
||||
v-if="
|
||||
col?.name !== 'observation' &&
|
||||
col?.name !== 'isConfirmed'
|
||||
"
|
||||
>{{ col.value }}</template
|
||||
>
|
||||
<QTooltip v-if="col.toolTip">{{
|
||||
col.toolTip
|
||||
}}</QTooltip>
|
||||
</component>
|
||||
</QTd>
|
||||
</QTr>
|
||||
<QTr no-hover>
|
||||
<QTd>
|
||||
<span>{{ row.item.itemType.code }}</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<span>{{ row.item.id }}</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<span>{{ row.item.size }}</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<span>{{ toCurrency(row.item.minPrice) }}</span>
|
||||
</QTd>
|
||||
<QTd colspan="6">
|
||||
<span>{{ row.item.concept }}</span>
|
||||
<span v-if="row.item.subName" class="subName">
|
||||
{{ row.item.subName }}
|
||||
</span>
|
||||
<FetchedTags :item="row.item" />
|
||||
</QTd>
|
||||
</QTr>
|
||||
<!-- Esta última row es utilizada para agregar un espaciado y así marcar una diferencia visual entre los diferentes buys -->
|
||||
<QTr v-if="rowIndex !== entryBuys.length - 1">
|
||||
<QTd colspan="10" class="vn-table-separation-row" />
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
<EntryBuys
|
||||
v-if="entityId"
|
||||
:id="Number(entityId)"
|
||||
:editable-mode="false"
|
||||
table-height="49vh"
|
||||
/>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.separation-row {
|
||||
background-color: var(--vn-section-color) !important;
|
||||
.card-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-overflow: ellipsis;
|
||||
> div {
|
||||
max-height: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1010px) {
|
||||
.card-group {
|
||||
flex-direction: row;
|
||||
}
|
||||
.card-content {
|
||||
flex: 1;
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Travel data: Datos envío
|
||||
Travel: Envío
|
||||
InvoiceIn data: Datos factura
|
||||
</i18n>
|
||||
|
|
|
@ -19,6 +19,7 @@ const props = defineProps({
|
|||
|
||||
const currenciesOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const entryFilterPanel = ref();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -38,7 +39,7 @@ const companiesOptions = ref([]);
|
|||
@on-fetch="(data) => (currenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<VnFilterPanel ref="entryFilterPanel" :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`entryFilter.params.${tag.label}`) }}: </strong>
|
||||
|
@ -48,70 +49,65 @@ const companiesOptions = ref([]);
|
|||
<template #body="{ params, searchFn }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.search"
|
||||
:label="t('entryFilter.params.search')"
|
||||
is-outlined
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('params.isExcludedFromAvailable')"
|
||||
v-model="params.isExcludedFromAvailable"
|
||||
toggle-indeterminate
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('params.isExcludedFromAvailable') }}
|
||||
</QTooltip>
|
||||
</QCheckbox>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.isOrdered')"
|
||||
v-model="params.isOrdered"
|
||||
toggle-indeterminate
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('entry.list.tableVisibleColumns.isOrdered') }}
|
||||
</QTooltip>
|
||||
</QCheckbox>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.reference"
|
||||
:label="t('entryFilter.params.reference')"
|
||||
is-outlined
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('params.isReceived')"
|
||||
v-model="params.isReceived"
|
||||
toggle-indeterminate
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('entry.list.tableVisibleColumns.isReceived') }}
|
||||
</QTooltip>
|
||||
</QCheckbox>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('entry.list.tableVisibleColumns.isConfirmed')"
|
||||
v-model="params.isConfirmed"
|
||||
toggle-indeterminate
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('entry.list.tableVisibleColumns.isConfirmed') }}
|
||||
</QTooltip>
|
||||
</QCheckbox>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.invoiceNumber"
|
||||
:label="t('entryFilter.params.invoiceNumber')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.travelFk"
|
||||
:label="t('entryFilter.params.travelFk')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('entryFilter.params.companyFk')"
|
||||
v-model="params.companyFk"
|
||||
<VnInputDate
|
||||
:label="t('params.landed')"
|
||||
v-model="params.landed"
|
||||
@update:model-value="searchFn()"
|
||||
:options="companiesOptions"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('entryFilter.params.currencyFk')"
|
||||
v-model="params.currencyFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="currenciesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInput v-model="params.id" label="Id" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -125,62 +121,165 @@ const companiesOptions = ref([]);
|
|||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('entryFilter.params.created')"
|
||||
v-model="params.created"
|
||||
@update:model-value="searchFn()"
|
||||
<VnInput
|
||||
v-model="params.invoiceNumber"
|
||||
:label="t('params.invoiceNumber')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('entryFilter.params.from')"
|
||||
v-model="params.from"
|
||||
@update:model-value="searchFn()"
|
||||
<VnInput
|
||||
v-model="params.reference"
|
||||
:label="t('entry.list.tableVisibleColumns.reference')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('entryFilter.params.to')"
|
||||
v-model="params.to"
|
||||
<VnSelect
|
||||
:label="t('params.agencyModeId')"
|
||||
v-model="params.agencyModeId"
|
||||
@update:model-value="searchFn()"
|
||||
url="AgencyModes"
|
||||
:fields="['id', 'name']"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.evaNotes"
|
||||
:label="t('params.evaNotes')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('entryFilter.params.isBooked')"
|
||||
v-model="params.isBooked"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('entryFilter.params.isConfirmed')"
|
||||
v-model="params.isConfirmed"
|
||||
toggle-indeterminate
|
||||
<VnSelect
|
||||
:label="t('params.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="Warehouses"
|
||||
:fields="['id', 'name']"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('entryFilter.params.isOrdered')"
|
||||
v-model="params.isOrdered"
|
||||
toggle-indeterminate
|
||||
<VnSelect
|
||||
:label="t('params.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="Warehouses"
|
||||
:fields="['id', 'name']"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.name }}
|
||||
</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ `#${scope.opt?.id} , ${scope.opt?.nickname}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.invoiceNumber"
|
||||
:label="t('params.invoiceNumber')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="t('params.entryTypeCode')"
|
||||
v-model="params.entryTypeCode"
|
||||
@update:model-value="searchFn()"
|
||||
url="EntryTypes"
|
||||
:fields="['code', 'description']"
|
||||
option-value="code"
|
||||
option-label="description"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.evaNotes"
|
||||
:label="t('params.evaNotes')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
isExcludedFromAvailable: Inventory
|
||||
isOrdered: Ordered
|
||||
isReceived: Received
|
||||
isConfirmed: Confirmed
|
||||
isRaid: Raid
|
||||
landed: Date
|
||||
id: Id
|
||||
supplierFk: Supplier
|
||||
invoiceNumber: Invoice number
|
||||
reference: Ref/Alb/Guide
|
||||
agencyModeId: Agency mode
|
||||
evaNotes: Notes
|
||||
warehouseOutFk: Origin
|
||||
warehouseInFk: Destiny
|
||||
entryTypeCode: Entry type
|
||||
hasToShowDeletedEntries: Show deleted entries
|
||||
es:
|
||||
params:
|
||||
isExcludedFromAvailable: Inventario
|
||||
isOrdered: Pedida
|
||||
isConfirmed: Confirmado
|
||||
isReceived: Recibida
|
||||
isRaid: Raid
|
||||
landed: Fecha
|
||||
id: Id
|
||||
supplierFk: Proveedor
|
||||
invoiceNumber: Núm. factura
|
||||
reference: Ref/Alb/Guía
|
||||
agencyModeId: Modo agencia
|
||||
evaNotes: Notas
|
||||
warehouseOutFk: Origen
|
||||
warehouseInFk: Destino
|
||||
entryTypeCode: Tipo de entrada
|
||||
hasToShowDeletedEntries: Mostrar entradas eliminadas
|
||||
</i18n>
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { onBeforeMount } from 'vue';
|
||||
|
||||
import EntryFilter from './EntryFilter.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { toCelsius, toDate } from 'src/filters';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import EntrySummary from './Card/EntrySummary.vue';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||
import VnSection from 'src/components/common/VnSection.vue';
|
||||
import VnSelectTravelExtended from 'src/components/common/VnSelectTravelExtended.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const defaultEntry = ref({});
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const dataKey = 'EntryList';
|
||||
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const entryFilter = {
|
||||
const entryQueryFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'suppliers',
|
||||
|
@ -40,44 +44,53 @@ const entryFilter = {
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'status',
|
||||
columnFilter: false,
|
||||
label: 'Ex',
|
||||
toolTip: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),
|
||||
name: 'isExcludedFromAvailable',
|
||||
component: 'checkbox',
|
||||
width: '35px',
|
||||
},
|
||||
{
|
||||
label: 'Pe',
|
||||
toolTip: t('entry.list.tableVisibleColumns.isOrdered'),
|
||||
name: 'isOrdered',
|
||||
component: 'checkbox',
|
||||
width: '35px',
|
||||
},
|
||||
{
|
||||
label: 'Le',
|
||||
toolTip: t('entry.list.tableVisibleColumns.isConfirmed'),
|
||||
name: 'isConfirmed',
|
||||
component: 'checkbox',
|
||||
width: '35px',
|
||||
},
|
||||
{
|
||||
label: 'Re',
|
||||
toolTip: t('entry.list.tableVisibleColumns.isReceived'),
|
||||
name: 'isReceived',
|
||||
component: 'checkbox',
|
||||
width: '35px',
|
||||
},
|
||||
{
|
||||
label: t('entry.list.tableVisibleColumns.landed'),
|
||||
name: 'landed',
|
||||
component: 'date',
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)),
|
||||
width: '105px',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.id'),
|
||||
name: 'id',
|
||||
isId: true,
|
||||
component: 'number',
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.reference'),
|
||||
name: 'reference',
|
||||
isTitle: true,
|
||||
component: 'input',
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.created'),
|
||||
name: 'created',
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
component: 'date',
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.created)),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.supplierFk'),
|
||||
name: 'supplierFk',
|
||||
create: true,
|
||||
|
@ -87,164 +100,205 @@ const columns = computed(() => [
|
|||
url: 'suppliers',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.supplierName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.isBooked'),
|
||||
name: 'isBooked',
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'checkbox',
|
||||
label: t('entry.list.tableVisibleColumns.invoiceNumber'),
|
||||
name: 'invoiceNumber',
|
||||
component: 'input',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.isConfirmed'),
|
||||
name: 'isConfirmed',
|
||||
label: t('entry.list.tableVisibleColumns.reference'),
|
||||
name: 'reference',
|
||||
isTitle: true,
|
||||
component: 'input',
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'checkbox',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.isOrdered'),
|
||||
name: 'isOrdered',
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'checkbox',
|
||||
label: 'AWB',
|
||||
name: 'awbCode',
|
||||
component: 'input',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.companyFk'),
|
||||
label: t('entry.list.tableVisibleColumns.agencyModeId'),
|
||||
name: 'agencyModeId',
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'agencyModes',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.agencyModeName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.evaNotes'),
|
||||
name: 'evaNotes',
|
||||
component: 'input',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.warehouseOutFk'),
|
||||
name: 'warehouseOutFk',
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseOutName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.warehouseInFk'),
|
||||
name: 'warehouseInFk',
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.warehouseInName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.entryTypeDescription'),
|
||||
name: 'entryTypeCode',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'dated',
|
||||
label: t('entry.list.tableVisibleColumns.dated'),
|
||||
component: 'date',
|
||||
cardVisible: false,
|
||||
visible: false,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
name: 'companyFk',
|
||||
label: t('entry.list.tableVisibleColumns.companyFk'),
|
||||
cardVisible: false,
|
||||
visible: false,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'companies',
|
||||
fields: ['id', 'code'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'code',
|
||||
optionValue: 'id',
|
||||
url: 'Companies',
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
create: true,
|
||||
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.companyCode),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.travelFk'),
|
||||
name: 'travelFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'travels',
|
||||
fields: ['id', 'ref'],
|
||||
optionLabel: 'ref',
|
||||
optionValue: 'id',
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
label: t('entry.list.tableVisibleColumns.travelFk'),
|
||||
cardVisible: false,
|
||||
visible: false,
|
||||
create: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('entry.list.tableVisibleColumns.invoiceAmount'),
|
||||
name: 'invoiceAmount',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'initialTemperature',
|
||||
label: t('entry.basicData.initialTemperature'),
|
||||
field: 'initialTemperature',
|
||||
format: (row) => toCelsius(row.initialTemperature),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'finalTemperature',
|
||||
label: t('entry.basicData.finalTemperature'),
|
||||
field: 'finalTemperature',
|
||||
format: (row) => toCelsius(row.finalTemperature),
|
||||
},
|
||||
{
|
||||
label: t('entry.list.tableVisibleColumns.isExcludedFromAvailable'),
|
||||
name: 'isExcludedFromAvailable',
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row.id, EntrySummary),
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
function getBadgeAttrs(row) {
|
||||
const date = row.landed;
|
||||
let today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
let timeTicket = new Date(date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
|
||||
let timeDiff = today - timeTicket;
|
||||
|
||||
if (timeDiff > 0) return { color: 'warning', 'text-color': 'black' };
|
||||
switch (row.entryTypeCode) {
|
||||
case 'regularization':
|
||||
case 'life':
|
||||
case 'internal':
|
||||
case 'inventory':
|
||||
if (!row.isOrdered || !row.isConfirmed)
|
||||
return { color: 'negative', 'text-color': 'black' };
|
||||
break;
|
||||
case 'product':
|
||||
case 'packaging':
|
||||
case 'devaluation':
|
||||
case 'payment':
|
||||
case 'transport':
|
||||
if (
|
||||
row.invoiceAmount === null ||
|
||||
(row.invoiceNumber === null && row.reference === null) ||
|
||||
!row.isOrdered ||
|
||||
!row.isConfirmed
|
||||
)
|
||||
return { color: 'negative', 'text-color': 'black' };
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (timeDiff < 0) return { color: 'info', 'text-color': 'black' };
|
||||
return { color: 'transparent' };
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
defaultEntry.value = (await axios.get('EntryConfigs/findOne')).data;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSection
|
||||
:data-key="dataKey"
|
||||
:columns="columns"
|
||||
prefix="entry"
|
||||
url="Entries/filter"
|
||||
:array-data-props="{
|
||||
url: 'Entries/filter',
|
||||
order: 'id DESC',
|
||||
userFilter: entryFilter,
|
||||
order: 'landed DESC',
|
||||
userFilter: EntryFilter,
|
||||
}"
|
||||
>
|
||||
<template #advanced-menu>
|
||||
<EntryFilter data-key="EntryList" />
|
||||
<EntryFilter :data-key="dataKey" />
|
||||
</template>
|
||||
<template #body>
|
||||
<VnTable
|
||||
v-if="defaultEntry.defaultSupplierFk"
|
||||
ref="tableRef"
|
||||
:data-key="dataKey"
|
||||
url="Entries/filter"
|
||||
:filter="entryQueryFilter"
|
||||
order="landed DESC"
|
||||
:create="{
|
||||
urlCreate: 'Entries',
|
||||
title: t('entry.list.newEntry'),
|
||||
title: t('Create entry'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
formInitialData: {
|
||||
supplierFk: defaultEntry.defaultSupplierFk,
|
||||
dated: Date.vnNew(),
|
||||
companyFk: user?.companyFk,
|
||||
},
|
||||
}"
|
||||
:columns="columns"
|
||||
redirect="entry"
|
||||
:right-search="false"
|
||||
>
|
||||
<template #column-status="{ row }">
|
||||
<div class="row q-gutter-xs">
|
||||
<QIcon
|
||||
v-if="!!row.isExcludedFromAvailable"
|
||||
name="vn:inventory"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t(
|
||||
'entry.list.tableVisibleColumns.isExcludedFromAvailable',
|
||||
)
|
||||
}}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="!!row.isRaid" name="vn:net" color="primary">
|
||||
<QTooltip>
|
||||
{{
|
||||
t('globals.raid', {
|
||||
daysInForward: row.daysInForward,
|
||||
})
|
||||
}}</QTooltip
|
||||
>
|
||||
</QIcon>
|
||||
</div>
|
||||
<template #column-landed="{ row }">
|
||||
<QBadge
|
||||
v-if="row?.travelFk"
|
||||
v-bind="getBadgeAttrs(row)"
|
||||
class="q-pa-sm"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toDate(row.landed) }}
|
||||
</QBadge>
|
||||
</template>
|
||||
<template #column-supplierFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
|
@ -252,13 +306,26 @@ const columns = computed(() => [
|
|||
<SupplierDescriptorProxy :id="row.supplierFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-travelFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.travelRef }}
|
||||
<TravelDescriptorProxy :id="row.travelFk" />
|
||||
</span>
|
||||
<template #column-create-travelFk="{ data }">
|
||||
<VnSelectTravelExtended
|
||||
:data="data"
|
||||
v-model="data.travelFk"
|
||||
:onFilterTravelSelected="
|
||||
(data, result) => (data.travelFk = result)
|
||||
"
|
||||
data-cy="entry-travel-select"
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
</VnSection>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Inventory entry: Es inventario
|
||||
Virtual entry: Es una redada
|
||||
Search entries: Buscar entradas
|
||||
You can search by entry reference: Puedes buscar por referencia de la entrada
|
||||
Create entry: Crear entrada
|
||||
</i18n>
|
||||
|
|
|
@ -1,21 +1,36 @@
|
|||
entry:
|
||||
lock:
|
||||
title: Lock entry
|
||||
message: This entry has been locked by {userName} for {time} minutes. Do you want to unlock it?
|
||||
success: The entry has been locked successfully
|
||||
list:
|
||||
newEntry: New entry
|
||||
tableVisibleColumns:
|
||||
created: Creation
|
||||
supplierFk: Supplier
|
||||
isBooked: Booked
|
||||
isConfirmed: Confirmed
|
||||
isExcludedFromAvailable: Exclude from inventory
|
||||
isOrdered: Ordered
|
||||
isConfirmed: Ready to label
|
||||
isReceived: Received
|
||||
isRaid: Raid
|
||||
landed: Date
|
||||
supplierFk: Supplier
|
||||
reference: Ref/Alb/Guide
|
||||
invoiceNumber: Invoice
|
||||
agencyModeId: Agency
|
||||
isBooked: Booked
|
||||
companyFk: Company
|
||||
travelFk: Travel
|
||||
isExcludedFromAvailable: Inventory
|
||||
evaNotes: Notes
|
||||
warehouseOutFk: Origin
|
||||
warehouseInFk: Destiny
|
||||
entryTypeDescription: Entry type
|
||||
invoiceAmount: Import
|
||||
travelFk: Travel
|
||||
dated: Dated
|
||||
inventoryEntry: Inventory entry
|
||||
summary:
|
||||
commission: Commission
|
||||
currency: Currency
|
||||
invoiceNumber: Invoice number
|
||||
invoiceAmount: Invoice amount
|
||||
ordered: Ordered
|
||||
booked: Booked
|
||||
excludedFromAvailable: Inventory
|
||||
|
@ -33,6 +48,7 @@ entry:
|
|||
buyingValue: Buying value
|
||||
import: Import
|
||||
pvp: PVP
|
||||
entryType: Entry type
|
||||
basicData:
|
||||
travel: Travel
|
||||
currency: Currency
|
||||
|
@ -69,17 +85,55 @@ entry:
|
|||
landing: Landing
|
||||
isExcludedFromAvailable: Es inventory
|
||||
params:
|
||||
toShipped: To
|
||||
fromShipped: From
|
||||
daysOnward: Days onward
|
||||
daysAgo: Days ago
|
||||
warehouseInFk: Warehouse in
|
||||
isExcludedFromAvailable: Exclude from inventory
|
||||
isOrdered: Ordered
|
||||
isConfirmed: Ready to label
|
||||
isReceived: Received
|
||||
isIgnored: Ignored
|
||||
isRaid: Raid
|
||||
landed: Date
|
||||
supplierFk: Supplier
|
||||
reference: Ref/Alb/Guide
|
||||
invoiceNumber: Invoice
|
||||
agencyModeId: Agency
|
||||
isBooked: Booked
|
||||
companyFk: Company
|
||||
evaNotes: Notes
|
||||
warehouseOutFk: Origin
|
||||
warehouseInFk: Destiny
|
||||
entryTypeDescription: Entry type
|
||||
invoiceAmount: Import
|
||||
travelFk: Travel
|
||||
dated: Dated
|
||||
itemFk: Item id
|
||||
hex: Color
|
||||
name: Item name
|
||||
size: Size
|
||||
stickers: Stickers
|
||||
packagingFk: Packaging
|
||||
weight: Kg
|
||||
groupingMode: Grouping selector
|
||||
grouping: Grouping
|
||||
quantity: Quantity
|
||||
buyingValue: Buying value
|
||||
price2: Package
|
||||
price3: Box
|
||||
minPrice: Minumum price
|
||||
hasMinPrice: Has minimum price
|
||||
packingOut: Packing out
|
||||
comment: Comment
|
||||
subName: Supplier name
|
||||
tags: Tags
|
||||
company_name: Company name
|
||||
itemTypeFk: Item type
|
||||
workerFk: Worker id
|
||||
search: Search entries
|
||||
searchInfo: You can search by entry reference
|
||||
descriptorMenu:
|
||||
showEntryReport: Show entry report
|
||||
entryFilter:
|
||||
params:
|
||||
isExcludedFromAvailable: Exclude from inventory
|
||||
invoiceNumber: Invoice number
|
||||
travelFk: Travel
|
||||
companyFk: Company
|
||||
|
@ -91,8 +145,16 @@ entryFilter:
|
|||
isBooked: Booked
|
||||
isConfirmed: Confirmed
|
||||
isOrdered: Ordered
|
||||
isReceived: Received
|
||||
search: General search
|
||||
reference: Reference
|
||||
landed: Landed
|
||||
id: Id
|
||||
agencyModeId: Agency
|
||||
evaNotes: Notes
|
||||
warehouseOutFk: Origin
|
||||
warehouseInFk: Destiny
|
||||
entryTypeCode: Entry type
|
||||
myEntries:
|
||||
id: ID
|
||||
landed: Landed
|
||||
|
|
|
@ -1,21 +1,36 @@
|
|||
entry:
|
||||
lock:
|
||||
title: Entrada bloqueada
|
||||
message: Esta entrada ha sido bloqueada por {userName} hace {time} minutos. ¿Quieres desbloquearla?
|
||||
success: La entrada ha sido bloqueada correctamente
|
||||
list:
|
||||
newEntry: Nueva entrada
|
||||
tableVisibleColumns:
|
||||
created: Creación
|
||||
supplierFk: Proveedor
|
||||
isBooked: Asentado
|
||||
isConfirmed: Confirmado
|
||||
isExcludedFromAvailable: Excluir del inventario
|
||||
isOrdered: Pedida
|
||||
isConfirmed: Lista para etiquetar
|
||||
isReceived: Recibida
|
||||
isRaid: Redada
|
||||
landed: Fecha
|
||||
supplierFk: Proveedor
|
||||
invoiceNumber: Nº Factura
|
||||
reference: Ref/Alb/Guía
|
||||
agencyModeId: Agencia
|
||||
isBooked: Asentado
|
||||
companyFk: Empresa
|
||||
travelFk: Envio
|
||||
isExcludedFromAvailable: Inventario
|
||||
evaNotes: Notas
|
||||
warehouseOutFk: Origen
|
||||
warehouseInFk: Destino
|
||||
entryTypeDescription: Tipo entrada
|
||||
invoiceAmount: Importe
|
||||
dated: Fecha
|
||||
inventoryEntry: Es inventario
|
||||
summary:
|
||||
commission: Comisión
|
||||
currency: Moneda
|
||||
invoiceNumber: Núm. factura
|
||||
invoiceAmount: Importe
|
||||
ordered: Pedida
|
||||
booked: Contabilizada
|
||||
excludedFromAvailable: Inventario
|
||||
|
@ -34,12 +49,13 @@ entry:
|
|||
buyingValue: Coste
|
||||
import: Importe
|
||||
pvp: PVP
|
||||
entryType: Tipo entrada
|
||||
basicData:
|
||||
travel: Envío
|
||||
currency: Moneda
|
||||
observation: Observación
|
||||
commission: Comisión
|
||||
booked: Asentado
|
||||
booked: Contabilizada
|
||||
excludedFromAvailable: Inventario
|
||||
initialTemperature: Ini °C
|
||||
finalTemperature: Fin °C
|
||||
|
@ -69,31 +85,70 @@ entry:
|
|||
packingOut: Embalaje envíos
|
||||
landing: Llegada
|
||||
isExcludedFromAvailable: Es inventario
|
||||
params:
|
||||
toShipped: Hasta
|
||||
fromShipped: Desde
|
||||
warehouseInFk: Alm. entrada
|
||||
daysOnward: Días adelante
|
||||
daysAgo: Días atras
|
||||
descriptorMenu:
|
||||
showEntryReport: Ver informe del pedido
|
||||
|
||||
search: Buscar entradas
|
||||
searchInfo: Puedes buscar por referencia de entrada
|
||||
params:
|
||||
isExcludedFromAvailable: Excluir del inventario
|
||||
isOrdered: Pedida
|
||||
isConfirmed: Lista para etiquetar
|
||||
isReceived: Recibida
|
||||
isRaid: Redada
|
||||
isIgnored: Ignorado
|
||||
landed: Fecha
|
||||
supplierFk: Proveedor
|
||||
invoiceNumber: Nº Factura
|
||||
reference: Ref/Alb/Guía
|
||||
agencyModeId: Agencia
|
||||
isBooked: Asentado
|
||||
companyFk: Empresa
|
||||
travelFk: Envio
|
||||
evaNotes: Notas
|
||||
warehouseOutFk: Origen
|
||||
warehouseInFk: Destino
|
||||
entryTypeDescription: Tipo entrada
|
||||
invoiceAmount: Importe
|
||||
dated: Fecha
|
||||
itemFk: Id artículo
|
||||
hex: Color
|
||||
name: Nombre artículo
|
||||
size: Medida
|
||||
stickers: Etiquetas
|
||||
packagingFk: Embalaje
|
||||
weight: Kg
|
||||
groupinMode: Selector de grouping
|
||||
grouping: Grouping
|
||||
quantity: Quantity
|
||||
buyingValue: Precio de compra
|
||||
price2: Paquete
|
||||
price3: Caja
|
||||
minPrice: Precio mínimo
|
||||
hasMinPrice: Tiene precio mínimo
|
||||
packingOut: Packing out
|
||||
comment: Referencia
|
||||
subName: Nombre proveedor
|
||||
tags: Etiquetas
|
||||
company_name: Nombre empresa
|
||||
itemTypeFk: Familia
|
||||
workerFk: Comprador
|
||||
entryFilter:
|
||||
params:
|
||||
invoiceNumber: Núm. factura
|
||||
travelFk: Envío
|
||||
companyFk: Empresa
|
||||
currencyFk: Moneda
|
||||
supplierFk: Proveedor
|
||||
from: Desde
|
||||
to: Hasta
|
||||
created: Fecha creación
|
||||
isBooked: Asentado
|
||||
isConfirmed: Confirmado
|
||||
isExcludedFromAvailable: Inventario
|
||||
isOrdered: Pedida
|
||||
search: Búsqueda general
|
||||
reference: Referencia
|
||||
isConfirmed: Confirmado
|
||||
isReceived: Recibida
|
||||
isRaid: Raid
|
||||
landed: Fecha
|
||||
id: Id
|
||||
supplierFk: Proveedor
|
||||
invoiceNumber: Núm. factura
|
||||
reference: Ref/Alb/Guía
|
||||
agencyModeId: Modo agencia
|
||||
evaNotes: Notas
|
||||
warehouseOutFk: Origen
|
||||
warehouseInFk: Destino
|
||||
entryTypeCode: Tipo de entrada
|
||||
hasToShowDeletedEntries: Mostrar entradas eliminadas
|
||||
myEntries:
|
||||
id: ID
|
||||
landed: F. llegada
|
||||
|
|
|
@ -29,6 +29,7 @@ const cols = computed(() => [
|
|||
name: 'isBooked',
|
||||
label: t('invoiceIn.isBooked'),
|
||||
columnFilter: false,
|
||||
component: 'checkbox',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
|
|
@ -11,6 +11,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import FilterItemForm from 'src/components/FilterItemForm.vue';
|
||||
import CreateIntrastatForm from './CreateIntrastatForm.vue';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -208,30 +209,20 @@ const onIntrastatCreated = (response, formData) => {
|
|||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div>
|
||||
<QCheckbox
|
||||
v-model="data.isFragile"
|
||||
:label="t('item.basicData.isFragile')"
|
||||
class="q-mr-sm"
|
||||
/>
|
||||
<QIcon name="info" class="cursor-pointer" size="xs">
|
||||
<QTooltip max-width="300px">
|
||||
{{ t('item.basicData.isFragileTooltip') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<div>
|
||||
<QCheckbox
|
||||
v-model="data.isPhotoRequested"
|
||||
:label="t('item.basicData.isPhotoRequested')"
|
||||
class="q-mr-sm"
|
||||
/>
|
||||
<QIcon name="info" class="cursor-pointer" size="xs">
|
||||
<QTooltip>
|
||||
{{ t('item.basicData.isPhotoRequestedTooltip') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnCheckbox
|
||||
v-model="data.isFragile"
|
||||
:label="t('item.basicData.isFragile')"
|
||||
:info="t('item.basicData.isFragileTooltip')"
|
||||
class="q-mr-sm"
|
||||
size="xs"
|
||||
/>
|
||||
<VnCheckbox
|
||||
v-model="data.isPhotoRequested"
|
||||
:label="t('item.basicData.isPhotoRequested')"
|
||||
:info="t('item.basicData.isPhotoRequestedTooltip')"
|
||||
class="q-mr-sm"
|
||||
size="xs"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
|
|
|
@ -7,8 +7,8 @@ import FetchData from 'components/FetchData.vue';
|
|||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateGenusForm from './CreateGenusForm.vue';
|
||||
import CreateSpecieForm from './CreateSpecieForm.vue';
|
||||
import CreateGenusForm from '../components/CreateGenusForm.vue';
|
||||
import CreateSpecieForm from '../components/CreateSpecieForm.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
|
|
@ -34,6 +34,10 @@ const $props = defineProps({
|
|||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
proxyRender: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -112,7 +116,7 @@ const updateStock = async () => {
|
|||
<template #value>
|
||||
<span class="link">
|
||||
{{ entity.itemType?.worker?.user?.name }}
|
||||
<WorkerDescriptorProxy :id="entity.itemType?.worker?.id" />
|
||||
<WorkerDescriptorProxy :id="entity.itemType?.worker?.id ?? NaN" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
|
@ -147,7 +151,7 @@ const updateStock = async () => {
|
|||
</QCardActions>
|
||||
</template>
|
||||
<template #actions="{}">
|
||||
<QCardActions class="row justify-center">
|
||||
<QCardActions class="row justify-center" v-if="proxyRender">
|
||||
<QBtn
|
||||
:to="{
|
||||
name: 'ItemDiary',
|
||||
|
@ -160,6 +164,16 @@ const updateStock = async () => {
|
|||
>
|
||||
<QTooltip>{{ t('item.descriptor.itemDiary') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:to="{
|
||||
name: 'ItemLastEntries',
|
||||
}"
|
||||
size="md"
|
||||
icon="vn:regentry"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('item.descriptor.itemLastEntries') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
|
|
|
@ -4,7 +4,7 @@ import ItemSummary from './ItemSummary.vue';
|
|||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
type: [Number, String],
|
||||
required: true,
|
||||
},
|
||||
dated: {
|
||||
|
@ -21,9 +21,8 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<QPopupProxy style="max-width: 10px">
|
||||
<ItemDescriptor
|
||||
v-if="$props.id"
|
||||
:id="$props.id"
|
||||
|
@ -31,6 +30,7 @@ const $props = defineProps({
|
|||
:dated="dated"
|
||||
:sale-fk="saleFk"
|
||||
:warehouse-fk="warehouseFk"
|
||||
:proxy-render="true"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,332 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import VnStockValueDisplay from 'src/components/ui/VnStockValueDisplay.vue';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import axios from 'axios';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
const MATCH = 'match';
|
||||
|
||||
const { t } = useI18n();
|
||||
const $props = defineProps({
|
||||
itemLack: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
replaceAction: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
sales: {
|
||||
type: Array,
|
||||
required: false,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const proposalSelected = ref([]);
|
||||
const ticketConfig = ref({});
|
||||
const proposalTableRef = ref(null);
|
||||
|
||||
const sale = computed(() => $props.sales[0]);
|
||||
const saleFk = computed(() => sale.value.saleFk);
|
||||
const filter = computed(() => ({
|
||||
itemFk: $props.itemLack.itemFk,
|
||||
sales: saleFk.value,
|
||||
}));
|
||||
|
||||
const defaultColumnAttrs = {
|
||||
align: 'center',
|
||||
sortable: false,
|
||||
};
|
||||
const emit = defineEmits(['onDialogClosed', 'itemReplaced']);
|
||||
|
||||
const conditionalValuePrice = (price) =>
|
||||
price > 1 + ticketConfig.value.lackAlertPrice / 100 ? 'match' : 'not-match';
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.available'),
|
||||
name: 'available',
|
||||
field: 'available',
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.counter'),
|
||||
name: 'counter',
|
||||
field: 'counter',
|
||||
columnClass: 'shrink',
|
||||
style: 'max-width: 75px',
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
label: t('proposal.longName'),
|
||||
name: 'longName',
|
||||
field: 'longName',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
label: t('item.list.color'),
|
||||
name: 'tag5',
|
||||
field: 'value5',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
label: t('item.list.stems'),
|
||||
name: 'tag6',
|
||||
field: 'value6',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
label: t('item.list.producer'),
|
||||
name: 'tag7',
|
||||
field: 'value7',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.price2'),
|
||||
name: 'price2',
|
||||
style: 'max-width: 75px',
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.minQuantity'),
|
||||
name: 'minQuantity',
|
||||
field: 'minQuantity',
|
||||
style: 'max-width: 75px',
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
},
|
||||
{
|
||||
...defaultColumnAttrs,
|
||||
label: t('proposal.located'),
|
||||
name: 'located',
|
||||
field: 'located',
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('Replace'),
|
||||
icon: 'change_circle',
|
||||
show: (row) => isSelectionAvailable(row),
|
||||
action: change,
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function extractMatchValues(obj) {
|
||||
return Object.keys(obj)
|
||||
.filter((key) => key.startsWith(MATCH))
|
||||
.map((key) => parseInt(key.replace(MATCH, ''), 10));
|
||||
}
|
||||
const gradientStyle = (value) => {
|
||||
let color = 'white';
|
||||
const perc = parseFloat(value);
|
||||
switch (true) {
|
||||
case perc >= 0 && perc < 33:
|
||||
color = 'primary';
|
||||
break;
|
||||
case perc >= 33 && perc < 66:
|
||||
color = 'warning';
|
||||
break;
|
||||
|
||||
default:
|
||||
color = 'secondary';
|
||||
break;
|
||||
}
|
||||
return color;
|
||||
};
|
||||
const statusConditionalValue = (row) => {
|
||||
const matches = extractMatchValues(row);
|
||||
const value = matches.reduce((acc, i) => acc + row[`${MATCH}${i}`], 0);
|
||||
return 100 * (value / matches.length);
|
||||
};
|
||||
|
||||
const isSelectionAvailable = (itemProposal) => {
|
||||
const { price2 } = itemProposal;
|
||||
const salePrice = sale.value.price;
|
||||
const byPrice = (100 * price2) / salePrice > ticketConfig.value.lackAlertPrice;
|
||||
if (byPrice) {
|
||||
return byPrice;
|
||||
}
|
||||
const byQuantity =
|
||||
(100 * itemProposal.available) / Math.abs($props.itemLack.lack) <
|
||||
ticketConfig.value.lackAlertPrice;
|
||||
return byQuantity;
|
||||
};
|
||||
|
||||
async function change({ itemFk: substitutionFk }) {
|
||||
try {
|
||||
const promises = $props.sales.map(({ saleFk, quantity }) => {
|
||||
const params = {
|
||||
saleFk,
|
||||
substitutionFk,
|
||||
quantity,
|
||||
};
|
||||
return axios.post('Sales/replaceItem', params);
|
||||
});
|
||||
const results = await Promise.allSettled(promises);
|
||||
|
||||
notifyResults(results, 'saleFk');
|
||||
emit('itemReplaced', {
|
||||
type: 'refresh',
|
||||
quantity: quantity.value,
|
||||
itemProposal: proposalSelected.value[0],
|
||||
});
|
||||
proposalSelected.value = [];
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleTicketConfig(data) {
|
||||
ticketConfig.value = data[0];
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="TicketConfigs"
|
||||
:filter="{ fields: ['lackAlertPrice'] }"
|
||||
@on-fetch="handleTicketConfig"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<VnTable
|
||||
v-if="ticketConfig"
|
||||
auto-load
|
||||
data-cy="proposalTable"
|
||||
ref="proposalTableRef"
|
||||
data-key="ItemsGetSimilar"
|
||||
url="Items/getSimilar"
|
||||
:user-filter="filter"
|
||||
:columns="columns"
|
||||
class="full-width q-mt-md"
|
||||
row-key="id"
|
||||
:row-click="change"
|
||||
:is-editable="false"
|
||||
:right-search="false"
|
||||
:without-header="true"
|
||||
:disable-option="{ card: true, table: true }"
|
||||
>
|
||||
<template #column-longName="{ row }">
|
||||
<QTd
|
||||
class="flex"
|
||||
style="max-width: 100%; flex-shrink: 50px; flex-wrap: nowrap"
|
||||
>
|
||||
<div
|
||||
class="middle full-width"
|
||||
:class="[`proposal-${gradientStyle(statusConditionalValue(row))}`]"
|
||||
>
|
||||
<QTooltip> {{ statusConditionalValue(row) }}% </QTooltip>
|
||||
</div>
|
||||
<div style="flex: 2 0 100%; align-content: center">
|
||||
<div>
|
||||
<span class="link">{{ row.longName }}</span>
|
||||
<ItemDescriptorProxy :id="row.id" />
|
||||
</div>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #column-tag5="{ row }">
|
||||
<span :class="{ match: !row.match5 }">{{ row.value5 }}</span>
|
||||
</template>
|
||||
<template #column-tag6="{ row }">
|
||||
<span :class="{ match: !row.match6 }">{{ row.value6 }}</span>
|
||||
</template>
|
||||
<template #column-tag7="{ row }">
|
||||
<span :class="{ match: !row.match7 }">{{ row.value7 }}</span>
|
||||
</template>
|
||||
<template #column-counter="{ row }">
|
||||
<span
|
||||
:class="{
|
||||
match: row.counter === 1,
|
||||
'not-match': row.counter !== 1,
|
||||
}"
|
||||
>{{ row.counter }}</span
|
||||
>
|
||||
</template>
|
||||
<template #column-minQuantity="{ row }">
|
||||
{{ row.minQuantity }}
|
||||
</template>
|
||||
<template #column-price2="{ row }">
|
||||
<div class="flex column items-center content-center">
|
||||
<VnStockValueDisplay :value="(sales[0].price - row.price2) / 100" />
|
||||
<span :class="[conditionalValuePrice(row.price2)]">{{
|
||||
toCurrency(row.price2)
|
||||
}}</span>
|
||||
</div>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@import 'src/css/quasar.variables.scss';
|
||||
.middle {
|
||||
float: left;
|
||||
margin-right: 2px;
|
||||
flex: 2 0 5px;
|
||||
}
|
||||
.match {
|
||||
color: $negative;
|
||||
}
|
||||
.not-match {
|
||||
color: inherit;
|
||||
}
|
||||
.proposal-warning {
|
||||
background-color: $warning;
|
||||
}
|
||||
.proposal-secondary {
|
||||
background-color: $secondary;
|
||||
}
|
||||
.proposal-primary {
|
||||
background-color: $primary;
|
||||
}
|
||||
.text {
|
||||
margin: 0.05rem;
|
||||
padding: 1px;
|
||||
border: 1px solid var(--vn-label-color);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: smaller;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,56 @@
|
|||
<script setup>
|
||||
import ItemProposal from './ItemProposal.vue';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
|
||||
const $props = defineProps({
|
||||
itemLack: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
replaceAction: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
sales: {
|
||||
type: Array,
|
||||
required: false,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const { dialogRef } = useDialogPluginComponent();
|
||||
const emit = defineEmits([
|
||||
'onDialogClosed',
|
||||
'itemReplaced',
|
||||
...useDialogPluginComponent.emits,
|
||||
]);
|
||||
defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() });
|
||||
</script>
|
||||
<template>
|
||||
<QDialog ref="dialogRef" transition-show="scale" transition-hide="scale">
|
||||
<QCard class="dialog-width">
|
||||
<QCardSection class="row items-center q-pb-none">
|
||||
<span class="text-h6 text-grey">{{ $t('Item proposal') }}</span>
|
||||
<QSpace />
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QCardSection>
|
||||
<QCardSection>
|
||||
<ItemProposal
|
||||
v-bind="$props"
|
||||
@item-replaced="
|
||||
(data) => {
|
||||
emit('itemReplaced', data);
|
||||
dialogRef.hide();
|
||||
}
|
||||
"
|
||||
></ItemProposal
|
||||
></QCardSection>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.dialog-width {
|
||||
max-width: $width-lg;
|
||||
}
|
||||
</style>
|
|
@ -112,6 +112,7 @@ item:
|
|||
available: Available
|
||||
warehouseText: 'Calculated on the warehouse of { warehouseName }'
|
||||
itemDiary: Item diary
|
||||
itemLastEntries: Last entries
|
||||
producer: Producer
|
||||
clone:
|
||||
title: All its properties will be copied
|
||||
|
@ -130,6 +131,7 @@ item:
|
|||
origin: Orig.
|
||||
userName: Buyer
|
||||
weight: Weight
|
||||
color: Color
|
||||
weightByPiece: Weight/stem
|
||||
stemMultiplier: Multiplier
|
||||
producer: Producer
|
||||
|
@ -215,4 +217,24 @@ item:
|
|||
specie: Specie
|
||||
search: 'Search item'
|
||||
searchInfo: 'You can search by id'
|
||||
regularizeStock: Regularize stock
|
||||
regularizeStock: Regularize stock
|
||||
itemProposal: Items proposal
|
||||
proposal:
|
||||
difference: Difference
|
||||
title: Items proposal
|
||||
itemFk: Item
|
||||
longName: Name
|
||||
subName: Producer
|
||||
value5: value5
|
||||
value6: value6
|
||||
value7: value7
|
||||
value8: value8
|
||||
available: Available
|
||||
minQuantity: minQuantity
|
||||
price2: Price
|
||||
located: Located
|
||||
counter: Counter
|
||||
groupingPrice: Grouping Price
|
||||
itemOldPrice: itemOld Price
|
||||
status: State
|
||||
quantityToReplace: Quanity to replace
|
||||
|
|
|
@ -118,6 +118,7 @@ item:
|
|||
available: Disponible
|
||||
warehouseText: 'Calculado sobre el almacén de { warehouseName }'
|
||||
itemDiary: Registro de compra-venta
|
||||
itemLastEntries: Últimas entradas
|
||||
producer: Productor
|
||||
clone:
|
||||
title: Todas sus propiedades serán copiadas
|
||||
|
@ -135,6 +136,7 @@ item:
|
|||
size: Medida
|
||||
origin: Orig.
|
||||
weight: Peso
|
||||
color: Color
|
||||
weightByPiece: Peso/tallo
|
||||
userName: Comprador
|
||||
stemMultiplier: Multiplicador
|
||||
|
@ -220,5 +222,30 @@ item:
|
|||
achieved: 'Conseguido'
|
||||
concept: 'Concepto'
|
||||
state: 'Estado'
|
||||
search: 'Buscar artículo'
|
||||
searchInfo: 'Puedes buscar por id'
|
||||
itemProposal: Artículos similares
|
||||
proposal:
|
||||
substitutionAvailable: Sustitución disponible
|
||||
notSubstitutionAvailableByPrice: Sustitución no disponible, 30% de diferencia por precio o cantidad
|
||||
compatibility: Compatibilidad
|
||||
title: Items de sustitución para los tickets seleccionados
|
||||
itemFk: Item
|
||||
longName: Nombre
|
||||
subName: Productor
|
||||
value5: value5
|
||||
value6: value6
|
||||
value7: value7
|
||||
value8: value8
|
||||
available: Disponible
|
||||
minQuantity: Min. cantidad
|
||||
price2: Precio
|
||||
located: Ubicado
|
||||
counter: Contador
|
||||
difference: Diferencial
|
||||
groupingPrice: Precio Grouping
|
||||
itemOldPrice: Precio itemOld
|
||||
status: Estado
|
||||
quantityToReplace: Cantidad a reemplazar
|
||||
replace: Sustituir
|
||||
replaceAndConfirm: Sustituir y confirmar precio
|
||||
search: 'Buscar artículo'
|
||||
searchInfo: 'Puedes buscar por id'
|
||||
|
|
|
@ -157,7 +157,7 @@ const openTab = (id) =>
|
|||
openConfirmationModal(
|
||||
$t('globals.deleteConfirmTitle'),
|
||||
$t('salesOrdersTable.deleteConfirmMessage'),
|
||||
removeOrders
|
||||
removeOrders,
|
||||
)
|
||||
"
|
||||
>
|
||||
|
|
|
@ -238,7 +238,7 @@ watch(
|
|||
lineFilter.value.where.orderFk = router.currentRoute.value.params.id;
|
||||
|
||||
tableLinesRef.value.reload();
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
|
|
|
@ -71,8 +71,9 @@ const columns = computed(() => [
|
|||
format: (row) => row?.name,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'isConfirmed',
|
||||
component: 'checkbox',
|
||||
label: t('module.isConfirmed'),
|
||||
},
|
||||
{
|
||||
|
@ -95,7 +96,9 @@ const columns = computed(() => [
|
|||
columnField: {
|
||||
component: null,
|
||||
},
|
||||
style: 'color="positive"',
|
||||
style: () => {
|
||||
return { color: 'positive' };
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
|
|
@ -51,7 +51,6 @@ const columns = computed(() => [
|
|||
name: 'isAnyVolumeAllowed',
|
||||
component: 'checkbox',
|
||||
cardVisible: true,
|
||||
disable: true,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
|
@ -72,7 +71,7 @@ const columns = computed(() => [
|
|||
:data-key
|
||||
:columns="columns"
|
||||
prefix="agency"
|
||||
:right-filter="false"
|
||||
:right-filter="true"
|
||||
:array-data-props="{
|
||||
url: 'Agencies',
|
||||
order: 'name',
|
||||
|
@ -83,6 +82,7 @@ const columns = computed(() => [
|
|||
<VnTable
|
||||
:data-key
|
||||
:columns="columns"
|
||||
is-editable="false"
|
||||
:right-search="false"
|
||||
:use-model="true"
|
||||
redirect="route/agency"
|
||||
|
|
|
@ -3,7 +3,7 @@ import { computed, ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { toDate } from 'src/filters';
|
||||
import { dashIfEmpty, toDate, toHour } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
|
||||
|
@ -38,7 +38,7 @@ const routeFilter = {
|
|||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'id',
|
||||
label: 'Id',
|
||||
chip: {
|
||||
|
@ -48,7 +48,7 @@ const columns = computed(() => [
|
|||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'workerFk',
|
||||
label: t('route.Worker'),
|
||||
create: true,
|
||||
|
@ -68,10 +68,10 @@ const columns = computed(() => [
|
|||
},
|
||||
useLike: false,
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.workerUserName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'agencyModeFk',
|
||||
label: t('route.Agency'),
|
||||
isTitle: true,
|
||||
|
@ -87,9 +87,10 @@ const columns = computed(() => [
|
|||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.agencyName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'vehicleFk',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
|
@ -107,29 +108,31 @@ const columns = computed(() => [
|
|||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.vehiclePlateNumber),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'dated',
|
||||
label: t('route.Date'),
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
format: ({ dated }, dashIfEmpty) =>
|
||||
dated === '0000-00-00' ? dashIfEmpty(null) : toDate(dated),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'from',
|
||||
label: t('route.From'),
|
||||
visible: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
format: ({ from }) => toDate(from),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'to',
|
||||
label: t('route.To'),
|
||||
visible: false,
|
||||
|
@ -146,18 +149,20 @@ const columns = computed(() => [
|
|||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'started',
|
||||
label: t('route.hourStarted'),
|
||||
component: 'time',
|
||||
columnFilter: false,
|
||||
format: ({ started }) => toHour(started),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'finished',
|
||||
label: t('route.hourFinished'),
|
||||
component: 'time',
|
||||
columnFilter: false,
|
||||
format: ({ finished }) => toHour(finished),
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
|
@ -176,7 +181,7 @@ const columns = computed(() => [
|
|||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'description',
|
||||
label: t('route.Description'),
|
||||
isTitle: true,
|
||||
|
@ -185,7 +190,7 @@ const columns = computed(() => [
|
|||
field: 'description',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'isOk',
|
||||
label: t('route.Served'),
|
||||
component: 'checkbox',
|
||||
|
@ -299,60 +304,62 @@ const openTicketsDialog = (id) => {
|
|||
<RouteFilter data-key="RouteList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
class="route-list"
|
||||
ref="tableRef"
|
||||
data-key="RouteList"
|
||||
url="Routes/filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:filter="routeFilter"
|
||||
redirect="route"
|
||||
:row-click="false"
|
||||
:create="{
|
||||
urlCreate: 'Routes',
|
||||
title: t('route.createRoute'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
save-url="Routes/crud"
|
||||
:disable-option="{ card: true }"
|
||||
table-height="85vh"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
>
|
||||
<QTooltip>{{ t('route.Clone Selected Routes') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
>
|
||||
<QTooltip>{{ t('route.Download selected routes as PDF') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
>
|
||||
<QTooltip>{{ t('route.Mark as served') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnTable>
|
||||
<QPage class="q-px-md">
|
||||
<VnTable
|
||||
class="route-list"
|
||||
ref="tableRef"
|
||||
data-key="RouteList"
|
||||
url="Routes/filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:filter="routeFilter"
|
||||
redirect="route"
|
||||
:row-click="false"
|
||||
:create="{
|
||||
urlCreate: 'Routes',
|
||||
title: t('route.createRoute'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
save-url="Routes/crud"
|
||||
:disable-option="{ card: true }"
|
||||
table-height="85vh"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
>
|
||||
<QTooltip>{{ t('route.Clone Selected Routes') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
>
|
||||
<QTooltip>{{ t('route.Download selected routes as PDF') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
>
|
||||
<QTooltip>{{ t('route.Mark as served') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnTable>
|
||||
</QPage>
|
||||
</template>
|
||||
|
|
|
@ -38,6 +38,17 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('route.Worker'),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
useLike: false,
|
||||
optionFilter: 'firstName',
|
||||
find: {
|
||||
value: 'workerFk',
|
||||
label: 'workerUserName',
|
||||
},
|
||||
},
|
||||
create: true,
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
|
@ -48,6 +59,15 @@ const columns = computed(() => [
|
|||
name: 'agencyName',
|
||||
label: t('route.Agency'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'agencyModes',
|
||||
fields: ['id', 'name'],
|
||||
find: {
|
||||
value: 'agencyModeFk',
|
||||
label: 'agencyName',
|
||||
},
|
||||
},
|
||||
create: true,
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
|
@ -57,6 +77,17 @@ const columns = computed(() => [
|
|||
name: 'vehiclePlateNumber',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'vehicles',
|
||||
fields: ['id', 'numberPlate'],
|
||||
optionLabel: 'numberPlate',
|
||||
optionFilterValue: 'numberPlate',
|
||||
find: {
|
||||
value: 'vehicleFk',
|
||||
label: 'vehiclePlateNumber',
|
||||
},
|
||||
},
|
||||
create: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import VnCardBeta from 'components/common/VnCardBeta.vue';
|
||||
import ParkingDescriptor from 'pages/Parking/Card/ParkingDescriptor.vue';
|
||||
import ParkingDescriptor from 'pages/Shelving/Parking/Card/ParkingDescriptor.vue';
|
||||
import filter from './ParkingFilter.js';
|
||||
</script>
|
||||
|
|
@ -10,6 +10,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -182,18 +183,11 @@ function handleLocation(data, location) {
|
|||
v-model="data.isTrucker"
|
||||
:label="t('supplier.fiscalData.isTrucker')"
|
||||
/>
|
||||
<div class="row items-center">
|
||||
<QCheckbox v-model="data.isVies" :label="t('globals.isVies')" />
|
||||
<QIcon name="info" size="xs" class="cursor-pointer q-ml-sm">
|
||||
<QTooltip>
|
||||
{{
|
||||
t(
|
||||
'When activating it, do not enter the country code in the ID field.'
|
||||
)
|
||||
}}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<VnCheckbox
|
||||
v-model="data.isVies"
|
||||
:label="t('globals.isVies')"
|
||||
:info="t('whenActivatingIt')"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
@ -201,6 +195,8 @@ function handleLocation(data, location) {
|
|||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
whenActivatingIt: When activating it, do not enter the country code in the ID field.
|
||||
es:
|
||||
When activating it, do not enter the country code in the ID field.: Al activarlo, no informar el código del país en el campo nif
|
||||
whenActivatingIt: Al activarlo, no informar el código del país en el campo nif.
|
||||
</i18n>
|
||||
|
|
|
@ -9,6 +9,7 @@ import FetchData from 'components/FetchData.vue';
|
|||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
const haveNegatives = defineModel('have-negatives', { type: Boolean, required: true });
|
||||
const formData = defineModel({ type: Object, required: true });
|
||||
|
@ -182,22 +183,19 @@ onMounted(async () => {
|
|||
</QCard>
|
||||
<QCard
|
||||
v-if="haveNegatives"
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
class="q-pa-xs q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCardSection horizontal class="flex row items-center">
|
||||
<QCheckbox
|
||||
:label="t('basicData.withoutNegatives')"
|
||||
<VnCheckbox
|
||||
v-model="formData.withoutNegatives"
|
||||
:label="t('basicData.withoutNegatives')"
|
||||
:info="t('basicData.withoutNegativesInfo')"
|
||||
:toggle-indeterminate="false"
|
||||
size="xs"
|
||||
/>
|
||||
<QIcon name="info" size="xs" class="q-ml-sm">
|
||||
<QTooltip max-width="350px">
|
||||
{{ t('basicData.withoutNegativesInfo') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QDrawer>
|
||||
|
|
|
@ -260,7 +260,7 @@ async function getZone(options) {
|
|||
auto-load
|
||||
/>
|
||||
<QForm>
|
||||
<VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
||||
<VnSelect
|
||||
:label="t('ticketList.client')"
|
||||
v-model="clientId"
|
||||
|
@ -296,7 +296,7 @@ async function getZone(options) {
|
|||
:rules="validate('ticketList.warehouse')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
||||
<VnSelect
|
||||
:label="t('basicData.address')"
|
||||
v-model="addressId"
|
||||
|
|
|
@ -14,7 +14,7 @@ import VnImg from 'src/components/ui/VnImg.vue';
|
|||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import TicketSaleMoreActions from './TicketSaleMoreActions.vue';
|
||||
import TicketTransfer from './TicketTransfer.vue';
|
||||
import TicketTransferProxy from './TicketTransferProxy.vue';
|
||||
|
||||
import { toCurrency, toPercentage } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
|
@ -609,8 +609,9 @@ watch(
|
|||
@click="setTransferParams()"
|
||||
data-cy="ticketSaleTransferBtn"
|
||||
>
|
||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||
<TicketTransfer
|
||||
<QTooltip>{{ t('ticketSale.transferLines') }}</QTooltip>
|
||||
<TicketTransferProxy
|
||||
class="full-width"
|
||||
:transfer="transfer"
|
||||
:ticket="store.data"
|
||||
@refresh-data="resetChanges()"
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import split from './components/split';
|
||||
const emit = defineEmits(['ticketTransfered']);
|
||||
|
||||
const $props = defineProps({
|
||||
ticket: {
|
||||
type: [Array, Object],
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
const splitDate = ref(Date.vnNew());
|
||||
|
||||
const splitSelectedRows = async () => {
|
||||
const tickets = Array.isArray($props.ticket) ? $props.ticket : [$props.ticket];
|
||||
await split(tickets, splitDate.value);
|
||||
emit('ticketTransfered', tickets);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnInputDate class="q-mr-sm" :label="$t('New date')" v-model="splitDate" clearable />
|
||||
<QBtn class="q-mr-sm" color="primary" label="Split" @click="splitSelectedRows"></QBtn>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
.q-table__bottom.row.items-center.q-table__bottom--nodata {
|
||||
border-top: none;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Sales to transfer: Líneas a transferir
|
||||
Destination ticket: Ticket destinatario
|
||||
</i18n>
|
|
@ -1,11 +1,11 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import TicketTransferForm from './TicketTransferForm.vue';
|
||||
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
const emit = defineEmits(['ticketTransfered']);
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
|
@ -21,16 +21,15 @@ const $props = defineProps({
|
|||
default: () => {},
|
||||
},
|
||||
ticket: {
|
||||
type: Object,
|
||||
type: [Array, Object],
|
||||
default: () => {},
|
||||
},
|
||||
});
|
||||
|
||||
onMounted(() => (_transfer.value = $props.transfer));
|
||||
const { t } = useI18n();
|
||||
const QPopupProxyRef = ref(null);
|
||||
const transferFormRef = ref(null);
|
||||
const _transfer = ref();
|
||||
|
||||
const transferLinesColumns = computed(() => [
|
||||
{
|
||||
label: t('ticketList.id'),
|
||||
|
@ -86,76 +85,74 @@ const handleRowClick = (row) => {
|
|||
transferFormRef.value.transferSales(ticketId);
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => (_transfer.value = $props.transfer));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy ref="QPopupProxyRef" data-cy="ticketTransferPopup">
|
||||
<QCard class="q-px-md" style="display: flex; width: 80vw">
|
||||
<QTable
|
||||
:rows="transfer.sales"
|
||||
:columns="transferLinesColumns"
|
||||
:title="t('Sales to transfer')"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model.number="row.quantity"
|
||||
:clearable="false"
|
||||
style="max-width: 60px"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<QSeparator vertical spaced />
|
||||
<QTable
|
||||
v-if="transfer.lastActiveTickets"
|
||||
:rows="transfer.lastActiveTickets"
|
||||
:columns="destinationTicketColumns"
|
||||
:title="t('Destination ticket')"
|
||||
row-key="id"
|
||||
class="full-width q-mt-md"
|
||||
@row-click="(_, row) => handleRowClick(row)"
|
||||
>
|
||||
<template #body-cell-address="{ row }">
|
||||
<QTd @click.stop>
|
||||
<span>
|
||||
{{ row.nickname }}
|
||||
{{ row.name }}
|
||||
{{ row.street }}
|
||||
{{ row.postalCode }}
|
||||
{{ row.city }}
|
||||
</span>
|
||||
<QTooltip>
|
||||
{{ row.nickname }}
|
||||
{{ row.name }}
|
||||
{{ row.street }}
|
||||
{{ row.postalCode }}
|
||||
{{ row.city }}
|
||||
</QTooltip>
|
||||
</QTd>
|
||||
</template>
|
||||
<QTable
|
||||
:rows="transfer.sales"
|
||||
:columns="transferLinesColumns"
|
||||
:title="t('Sales to transfer')"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model.number="row.quantity"
|
||||
:clearable="false"
|
||||
style="max-width: 60px"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<QSeparator vertical spaced />
|
||||
<QTable
|
||||
v-if="transfer.lastActiveTickets"
|
||||
:rows="transfer.lastActiveTickets"
|
||||
:columns="destinationTicketColumns"
|
||||
:title="t('Destination ticket')"
|
||||
row-key="id"
|
||||
class="full-width q-mt-md"
|
||||
@row-click="(_, row) => handleRowClick(row)"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
>
|
||||
<template #body-cell-address="{ row }">
|
||||
<QTd @click.stop>
|
||||
<span>
|
||||
{{ row.nickname }}
|
||||
{{ row.name }}
|
||||
{{ row.street }}
|
||||
{{ row.postalCode }}
|
||||
{{ row.city }}
|
||||
</span>
|
||||
<QTooltip>
|
||||
{{ row.nickname }}
|
||||
{{ row.name }}
|
||||
{{ row.street }}
|
||||
{{ row.postalCode }}
|
||||
{{ row.city }}
|
||||
</QTooltip>
|
||||
</QTd>
|
||||
</template>
|
||||
|
||||
<template #no-data>
|
||||
<TicketTransferForm ref="transferFormRef" v-bind="$props" />
|
||||
</template>
|
||||
<template #bottom>
|
||||
<TicketTransferForm ref="transferFormRef" v-bind="$props" />
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</QPopupProxy>
|
||||
<template #no-data>
|
||||
<TicketTransferForm ref="transferFormRef" v-bind="$props" />
|
||||
</template>
|
||||
<template #bottom>
|
||||
<TicketTransferForm ref="transferFormRef" v-bind="$props" />
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-table__bottom.row.items-center.q-table__bottom--nodata {
|
||||
border-top: none;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Sales to transfer: Líneas a transferir
|
||||
Destination ticket: Ticket destinatario
|
||||
Transfer to ticket: Transferir a ticket
|
||||
New ticket: Nuevo ticket
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import TicketTransfer from './TicketTransfer.vue';
|
||||
import Split from './TicketSplit.vue';
|
||||
const emit = defineEmits(['ticketTransfered']);
|
||||
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
newPrice: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
transfer: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
ticket: {
|
||||
type: [Array, Object],
|
||||
default: () => {},
|
||||
},
|
||||
split: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const popupProxyRef = ref(null);
|
||||
const splitRef = ref(null);
|
||||
const transferRef = ref(null);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy ref="popupProxyRef" data-cy="ticketTransferPopup">
|
||||
<div class="flex row items-center q-ma-lg" v-if="$props.split">
|
||||
<Split
|
||||
ref="splitRef"
|
||||
@splitSelectedRows="splitSelectedRows"
|
||||
:ticket="$props.ticket"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<TicketTransfer
|
||||
ref="transferRef"
|
||||
:ticket="$props.ticket"
|
||||
:sales="$props.sales"
|
||||
:transfer="$props.transfer"
|
||||
/>
|
||||
</div>
|
||||
</QPopupProxy>
|
||||
</template>
|
|
@ -0,0 +1,22 @@
|
|||
import axios from 'axios';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
|
||||
export default async function (data, date) {
|
||||
const reducedData = data.reduce((acc, item) => {
|
||||
const existing = acc.find(({ ticketFk }) => ticketFk === item.id);
|
||||
if (existing) {
|
||||
existing.sales.push(item.saleFk);
|
||||
} else {
|
||||
acc.push({ ticketFk: item.id, sales: [item.saleFk], date });
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const promises = reducedData.map((params) => axios.post(`Tickets/split`, params));
|
||||
|
||||
const results = await Promise.allSettled(promises);
|
||||
|
||||
notifyResults(results, 'ticketFk');
|
||||
|
||||
return results;
|
||||
}
|
|
@ -0,0 +1,198 @@
|
|||
<script setup>
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import ChangeQuantityDialog from './components/ChangeQuantityDialog.vue';
|
||||
import ChangeStateDialog from './components/ChangeStateDialog.vue';
|
||||
import ChangeItemDialog from './components/ChangeItemDialog.vue';
|
||||
import TicketTransferProxy from '../Card/TicketTransferProxy.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useState } from 'src/composables/useState';
|
||||
|
||||
import { useRoute } from 'vue-router';
|
||||
import TicketLackTable from './TicketLackTable.vue';
|
||||
import VnPopupProxy from 'src/components/common/VnPopupProxy.vue';
|
||||
import ItemProposalProxy from 'src/pages/Item/components/ItemProposalProxy.vue';
|
||||
|
||||
import { useQuasar } from 'quasar';
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const editableStates = ref([]);
|
||||
const stateStore = useStateStore();
|
||||
const tableRef = ref();
|
||||
const changeItemDialogRef = ref(null);
|
||||
const changeStateDialogRef = ref(null);
|
||||
const changeQuantityDialogRef = ref(null);
|
||||
const showProposalDialog = ref(false);
|
||||
const showChangeQuantityDialog = ref(false);
|
||||
const selectedRows = ref([]);
|
||||
const route = useRoute();
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = false;
|
||||
});
|
||||
onUnmounted(() => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
||||
const entityId = computed(() => route.params.id);
|
||||
const item = ref({});
|
||||
|
||||
const itemProposalSelected = ref(null);
|
||||
const reload = async () => {
|
||||
tableRef.value.tableRef.reload();
|
||||
};
|
||||
defineExpose({ reload });
|
||||
const filter = computed(() => ({
|
||||
scopeDays: route.query.days,
|
||||
showType: true,
|
||||
alertLevelCode: 'FREE',
|
||||
date: Date.vnNew(),
|
||||
warehouseFk: useState().getUser().value.warehouseFk,
|
||||
}));
|
||||
const itemProposalEvt = (data) => {
|
||||
const { itemProposal } = data;
|
||||
itemProposalSelected.value = itemProposal;
|
||||
reload();
|
||||
};
|
||||
|
||||
function onBuysFetched(data) {
|
||||
Object.assign(item.value, data[0]);
|
||||
}
|
||||
const showItemProposal = () => {
|
||||
quasar
|
||||
.dialog({
|
||||
component: ItemProposalProxy,
|
||||
componentProps: {
|
||||
itemLack: tableRef.value.itemLack,
|
||||
replaceAction: true,
|
||||
sales: selectedRows.value,
|
||||
},
|
||||
})
|
||||
.onOk(itemProposalEvt);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="States/editableStates"
|
||||
@on-fetch="(data) => (editableStates = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
:url="`Items/${entityId}/getCard`"
|
||||
:fields="['longName']"
|
||||
@on-fetch="(data) => (item = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
:url="`Buys/latestBuysFilter`"
|
||||
:fields="['longName']"
|
||||
:filter="{ where: { 'i.id': entityId } }"
|
||||
@on-fetch="onBuysFetched"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<TicketLackTable
|
||||
ref="tableRef"
|
||||
:filter="filter"
|
||||
@update:selection="({ value }, _) => (selectedRows = value)"
|
||||
>
|
||||
<template #top-right>
|
||||
<QBtnGroup push class="q-mr-lg" style="column-gap: 1px">
|
||||
<QBtn
|
||||
data-cy="transferLines"
|
||||
color="primary"
|
||||
:disable="!(selectedRows.length === 1)"
|
||||
>
|
||||
<template #default>
|
||||
<QIcon name="vn:splitline" />
|
||||
<QIcon name="vn:ticket" />
|
||||
|
||||
<QTooltip>{{ t('ticketSale.transferLines') }} </QTooltip>
|
||||
<TicketTransferProxy
|
||||
ref="transferFormRef"
|
||||
split="true"
|
||||
:ticket="selectedRows"
|
||||
:transfer="{
|
||||
sales: selectedRows,
|
||||
lastActiveTickets: selectedRows.map((row) => row.id),
|
||||
}"
|
||||
@ticket-transfered="reload"
|
||||
></TicketTransferProxy>
|
||||
</template>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
color="primary"
|
||||
@click="showProposalDialog = true"
|
||||
:disable="selectedRows.length < 1"
|
||||
data-cy="itemProposal"
|
||||
>
|
||||
<QIcon
|
||||
name="import_export"
|
||||
class="rotate-90"
|
||||
@click="showItemProposal"
|
||||
></QIcon>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('itemProposal') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<VnPopupProxy
|
||||
data-cy="changeItem"
|
||||
icon="sync"
|
||||
:disable="selectedRows.length < 1"
|
||||
:tooltip="t('negative.detail.modal.changeItem.title')"
|
||||
>
|
||||
<template #extraIcon> <QIcon name="vn:item" /> </template>
|
||||
<template v-slot="{ popup }">
|
||||
<ChangeItemDialog
|
||||
ref="changeItemDialogRef"
|
||||
@update-item="popup.hide()"
|
||||
:selected-rows="selectedRows"
|
||||
/></template>
|
||||
</VnPopupProxy>
|
||||
<VnPopupProxy
|
||||
data-cy="changeState"
|
||||
icon="sync"
|
||||
:disable="selectedRows.length < 1"
|
||||
:tooltip="t('negative.detail.modal.changeState.title')"
|
||||
>
|
||||
<template #extraIcon> <QIcon name="vn:eye" /> </template>
|
||||
<template v-slot="{ popup }">
|
||||
<ChangeStateDialog
|
||||
ref="changeStateDialogRef"
|
||||
@update-state="popup.hide()"
|
||||
:selected-rows="selectedRows"
|
||||
/></template>
|
||||
</VnPopupProxy>
|
||||
<VnPopupProxy
|
||||
data-cy="changeQuantity"
|
||||
icon="sync"
|
||||
:disable="selectedRows.length < 1"
|
||||
:tooltip="t('negative.detail.modal.changeQuantity.title')"
|
||||
@click="showChangeQuantityDialog = true"
|
||||
>
|
||||
<template #extraIcon> <QIcon name="exposure" /> </template>
|
||||
<template v-slot="{ popup }">
|
||||
<ChangeQuantityDialog
|
||||
ref="changeQuantityDialogRef"
|
||||
@update-quantity="popup.hide()"
|
||||
:selected-rows="selectedRows"
|
||||
/></template>
|
||||
</VnPopupProxy> </QBtnGroup
|
||||
></template>
|
||||
</TicketLackTable>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.list-enter-active,
|
||||
.list-leave-active {
|
||||
transition: all 1s ease;
|
||||
}
|
||||
.list-enter-from,
|
||||
.list-leave-to {
|
||||
opacity: 0;
|
||||
background-color: $primary;
|
||||
}
|
||||
.q-table.q-table__container > div:first-child {
|
||||
border-radius: unset;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,175 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const to = Date.vnNew();
|
||||
to.setDate(to.getDate() + 1);
|
||||
|
||||
const warehouses = ref();
|
||||
const categoriesOptions = ref([]);
|
||||
const itemTypesRef = ref(null);
|
||||
const itemTypesOptions = ref([]);
|
||||
|
||||
const itemTypesFilter = {
|
||||
fields: ['id', 'name', 'categoryFk'],
|
||||
include: 'category',
|
||||
order: 'name ASC',
|
||||
where: {},
|
||||
};
|
||||
const onCategoryChange = async (categoryFk, search) => {
|
||||
if (!categoryFk) {
|
||||
itemTypesFilter.where.categoryFk = null;
|
||||
delete itemTypesFilter.where.categoryFk;
|
||||
} else {
|
||||
itemTypesFilter.where.categoryFk = categoryFk;
|
||||
}
|
||||
search();
|
||||
await itemTypesRef.value.fetch();
|
||||
};
|
||||
const emit = defineEmits(['set-user-params']);
|
||||
|
||||
const setUserParams = (params) => {
|
||||
emit('set-user-params', params);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||
<FetchData
|
||||
url="ItemCategories"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||
@on-fetch="(data) => (categoriesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<FetchData
|
||||
ref="itemTypesRef"
|
||||
url="ItemTypes"
|
||||
:filter="itemTypesFilter"
|
||||
@on-fetch="(data) => (itemTypesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
@set-user-params="setUserParams"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`negative.${tag.label}`) }}</strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense class="q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.days"
|
||||
:label="t('negative.days')"
|
||||
dense
|
||||
is-outlined
|
||||
type="number"
|
||||
@update:model-value="
|
||||
(value) => {
|
||||
setUserParams(params);
|
||||
}
|
||||
"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.id"
|
||||
:label="t('negative.id')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.producer"
|
||||
:label="t('negative.producer')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.origen"
|
||||
:label="t('negative.origen')"
|
||||
dense
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection> </QItem
|
||||
><QItem>
|
||||
<QItemSection v-if="categoriesOptions">
|
||||
<VnSelect
|
||||
:label="t('negative.categoryFk')"
|
||||
v-model="params.categoryFk"
|
||||
@update:model-value="
|
||||
($event) => onCategoryChange($event, searchFn)
|
||||
"
|
||||
:options="categoriesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/> </QItemSection
|
||||
><QItemSection v-else>
|
||||
<QSkeleton class="full-width" type="QSelect" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection v-if="itemTypesOptions">
|
||||
<VnSelect
|
||||
:label="t('negative.type')"
|
||||
v-model="params.typeFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="itemTypesOptions"
|
||||
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?.category?.name
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect> </QItemSection
|
||||
><QItemSection v-else>
|
||||
<QSkeleton class="full-width" type="QSelect" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
|
@ -0,0 +1,227 @@
|
|||
<script setup>
|
||||
import { computed, ref, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { onBeforeMount } from 'vue';
|
||||
import { dashIfEmpty, toDate, toHour } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import TicketLackFilter from './TicketLackFilter.vue';
|
||||
onBeforeMount(() => {
|
||||
stateStore.$state.rightDrawer = true;
|
||||
});
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const selectedRows = ref([]);
|
||||
const tableRef = ref();
|
||||
const filterParams = ref({});
|
||||
const negativeParams = reactive({
|
||||
days: useRole().likeAny('buyer') ? 2 : 0,
|
||||
warehouseFk: useState().getUser().value.warehouseFk,
|
||||
});
|
||||
const redirectToCreateView = ({ itemFk }) => {
|
||||
router.push({
|
||||
name: 'NegativeDetail',
|
||||
params: { id: itemFk },
|
||||
query: { days: filterParams.value.days ?? negativeParams.days },
|
||||
});
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'date',
|
||||
align: 'left',
|
||||
label: t('negative.date'),
|
||||
format: ({ timed }) => toDate(timed),
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
isId: true,
|
||||
columnFilter: {
|
||||
component: 'date',
|
||||
},
|
||||
},
|
||||
{
|
||||
columnClass: 'shrink',
|
||||
name: 'timed',
|
||||
align: 'left',
|
||||
label: t('negative.timed'),
|
||||
format: ({ timed }) => toHour(timed),
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'time',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'itemFk',
|
||||
align: 'left',
|
||||
label: t('negative.id'),
|
||||
format: ({ itemFk }) => itemFk,
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'longName',
|
||||
align: 'left',
|
||||
label: t('negative.longName'),
|
||||
field: ({ longName }) => longName,
|
||||
|
||||
sortable: true,
|
||||
headerStyle: 'width: 350px',
|
||||
cardVisible: true,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
name: 'producer',
|
||||
align: 'left',
|
||||
label: t('negative.supplier'),
|
||||
field: ({ producer }) => dashIfEmpty(producer),
|
||||
sortable: true,
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
name: 'inkFk',
|
||||
align: 'left',
|
||||
label: t('negative.colour'),
|
||||
field: ({ inkFk }) => inkFk,
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'size',
|
||||
align: 'left',
|
||||
label: t('negative.size'),
|
||||
field: ({ size }) => size,
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'category',
|
||||
align: 'left',
|
||||
label: t('negative.origen'),
|
||||
field: ({ category }) => dashIfEmpty(category),
|
||||
sortable: true,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'lack',
|
||||
align: 'left',
|
||||
label: t('negative.lack'),
|
||||
field: ({ lack }) => lack,
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
sortable: true,
|
||||
headerStyle: 'padding-left: 33px',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
name: 'tableActions',
|
||||
align: 'left',
|
||||
actions: [
|
||||
{
|
||||
title: t('Open details'),
|
||||
icon: 'edit',
|
||||
action: redirectToCreateView,
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const setUserParams = (params) => {
|
||||
filterParams.value = params;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<TicketLackFilter data-key="NegativeList" @set-user-params="setUserParams" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
{{ filterRef }}
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="NegativeList"
|
||||
:url="`Tickets/itemLack`"
|
||||
:order="['itemFk DESC, date DESC, timed DESC']"
|
||||
:user-params="negativeParams"
|
||||
auto-load
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
:right-search="false"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
:map-key="false"
|
||||
:row-click="redirectToCreateView"
|
||||
v-model:selected="selectedRows"
|
||||
:create="false"
|
||||
:crud-model="{
|
||||
disableInfiniteScroll: true,
|
||||
}"
|
||||
:table="{
|
||||
'row-key': 'itemFk',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #column-itemFk="{ row }">
|
||||
<div
|
||||
style="display: flex; justify-content: space-around; align-items: center"
|
||||
>
|
||||
<span @click.stop>{{ row.itemFk }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-longName="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.longName }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
max-height: 100%;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.grid-style-transition {
|
||||
transition:
|
||||
transform 0.28s,
|
||||
background-color 0.28s;
|
||||
}
|
||||
|
||||
#true {
|
||||
background-color: $positive;
|
||||
}
|
||||
|
||||
#false {
|
||||
background-color: $negative;
|
||||
}
|
||||
|
||||
div.q-dialog__inner > div {
|
||||
max-width: fit-content !important;
|
||||
}
|
||||
.q-btn-group > .q-btn-item:not(:first-child) {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,362 @@
|
|||
<script setup>
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { toDate, toHour } from 'src/filters';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import ZoneDescriptorProxy from 'pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import TicketDescriptorProxy from '../Card/TicketDescriptorProxy.vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
filter: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
watch(
|
||||
() => $props.filter,
|
||||
(v) => {
|
||||
filterLack.value.where = v;
|
||||
tableRef.value.reload(filterLack);
|
||||
},
|
||||
);
|
||||
|
||||
const filterLack = ref({
|
||||
include: [
|
||||
{
|
||||
relation: 'workers',
|
||||
scope: {
|
||||
fields: ['id', 'firstName'],
|
||||
},
|
||||
},
|
||||
],
|
||||
where: { ...$props.filter },
|
||||
order: 'ts.alertLevelCode ASC',
|
||||
});
|
||||
|
||||
const selectedRows = ref([]);
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const entityId = computed(() => route.params.id);
|
||||
const item = ref({});
|
||||
const route = useRoute();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'status',
|
||||
align: 'left',
|
||||
sortable: false,
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
name: 'ticketFk',
|
||||
label: t('negative.detail.ticketFk'),
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
name: 'shipped',
|
||||
label: t('negative.detail.shipped'),
|
||||
field: 'shipped',
|
||||
align: 'left',
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: 'date',
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'minTimed',
|
||||
label: t('negative.detail.theoreticalhour'),
|
||||
field: 'minTimed',
|
||||
align: 'left',
|
||||
format: ({ minTimed }) => toHour(minTimed),
|
||||
sortable: true,
|
||||
component: 'time',
|
||||
columnClass: 'shrink',
|
||||
columnFilter: {},
|
||||
},
|
||||
{
|
||||
name: 'alertLevelCode',
|
||||
label: t('negative.detail.state'),
|
||||
columnFilter: {
|
||||
name: 'alertLevelCode',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'AlertLevels',
|
||||
fields: ['name', 'code'],
|
||||
optionLabel: 'code',
|
||||
optionValue: 'code',
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'zoneName',
|
||||
label: t('negative.detail.zoneName'),
|
||||
field: 'zoneName',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'nickname',
|
||||
label: t('negative.detail.nickname'),
|
||||
field: 'nickname',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'quantity',
|
||||
label: t('negative.detail.quantity'),
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
component: 'input',
|
||||
type: 'number',
|
||||
},
|
||||
]);
|
||||
|
||||
const emit = defineEmits(['update:selection']);
|
||||
const itemLack = ref(null);
|
||||
const fetchItemLack = ref(null);
|
||||
const tableRef = ref(null);
|
||||
defineExpose({ tableRef, itemLack });
|
||||
watch(selectedRows, () => emit('update:selection', selectedRows));
|
||||
const getInputEvents = ({ col, ...rows }) => ({
|
||||
'update:modelValue': () => saveChange(col.name, rows),
|
||||
'keyup.enter': () => saveChange(col.name, rows),
|
||||
});
|
||||
const saveChange = async (field, { row }) => {
|
||||
try {
|
||||
switch (field) {
|
||||
case 'alertLevelCode':
|
||||
await axios.post(`Tickets/state`, {
|
||||
ticketFk: row.ticketFk,
|
||||
code: row[field],
|
||||
});
|
||||
break;
|
||||
|
||||
case 'quantity':
|
||||
await axios.post(`Sales/${row.saleFk}/updateQuantity`, {
|
||||
quantity: +row.quantity,
|
||||
});
|
||||
break;
|
||||
}
|
||||
notify('globals.dataSaved', 'positive');
|
||||
fetchItemLack.value.fetch();
|
||||
} catch (err) {
|
||||
console.error('Error saving changes', err);
|
||||
f;
|
||||
}
|
||||
};
|
||||
|
||||
const hasToIgnore = (row) => row.hasToIgnore === 1;
|
||||
function onBuysFetched(data) {
|
||||
Object.assign(item.value, data[0]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="fetchItemLack"
|
||||
:url="`Tickets/itemLack`"
|
||||
:params="{ id: entityId }"
|
||||
@on-fetch="(data) => (itemLack = data[0])"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
:url="`Items/${entityId}/getCard`"
|
||||
:fields="['longName']"
|
||||
@on-fetch="(data) => (item = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
:url="`Buys/latestBuysFilter`"
|
||||
:fields="['longName']"
|
||||
:filter="{ where: { 'i.id': entityId } }"
|
||||
@on-fetch="onBuysFetched"
|
||||
auto-load
|
||||
/>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="NegativeItem"
|
||||
:map-key="false"
|
||||
:url="`Tickets/itemLack/${entityId}`"
|
||||
:columns="columns"
|
||||
auto-load
|
||||
:create="false"
|
||||
:create-as-dialog="false"
|
||||
:use-model="true"
|
||||
:filter="filterLack"
|
||||
:order="['ts.alertLevelCode ASC']"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
dense
|
||||
:is-editable="true"
|
||||
:row-click="false"
|
||||
:right-search="false"
|
||||
:right-search-icon="false"
|
||||
v-model:selected="selectedRows"
|
||||
:disable-option="{ card: true }"
|
||||
>
|
||||
<template #top-left>
|
||||
<div style="display: flex; align-items: center" v-if="itemLack">
|
||||
<!-- <VnImg :id="itemLack.itemFk" class="rounded image-wrapper"></VnImg> -->
|
||||
<div class="flex column" style="align-items: center">
|
||||
<QBadge
|
||||
ref="badgeLackRef"
|
||||
class="q-ml-xs"
|
||||
text-color="white"
|
||||
:color="itemLack.lack === 0 ? 'positive' : 'negative'"
|
||||
:label="itemLack.lack"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex column left" style="align-items: flex-start">
|
||||
<QBtn flat class="link text-blue">
|
||||
{{ item?.longName ?? item.name }}
|
||||
<ItemDescriptorProxy :id="entityId" />
|
||||
<FetchedTags class="q-ml-md" :item="item" :columns="7" />
|
||||
</QBtn>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #top-right>
|
||||
<slot name="top-right" />
|
||||
</template>
|
||||
|
||||
<template #column-status="{ row }">
|
||||
<QTd style="width: 150px">
|
||||
<div class="icon-container">
|
||||
<QIcon
|
||||
v-if="row.isBasket"
|
||||
name="vn:basket"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('negative.detail.isBasket') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasToIgnore"
|
||||
name="star"
|
||||
color="primary"
|
||||
class="cursor-pointer fill-icon"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{ t('negative.detail.hasToIgnore') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasObservation"
|
||||
name="change_circle"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>{{
|
||||
t('negative.detail.hasObservation')
|
||||
}}</QTooltip> </QIcon
|
||||
><QIcon
|
||||
v-if="row.isRookie"
|
||||
name="vn:Person"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{ t('negative.detail.isRookie') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.peticionCompra"
|
||||
name="vn:buyrequest"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{ t('negative.detail.peticionCompra') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.turno"
|
||||
name="vn:calendar"
|
||||
size="xs"
|
||||
color="primary"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTooltip>{{ t('negative.detail.turno') }}</QTooltip>
|
||||
</QIcon>
|
||||
</div></QTd
|
||||
>
|
||||
</template>
|
||||
<template #column-nickname="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.nickname }}
|
||||
<CustomerDescriptorProxy :id="row.customerId" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-ticketFk="{ row }">
|
||||
<span class="q-pa-sm link">
|
||||
{{ row.id }}
|
||||
<TicketDescriptorProxy :id="row.id" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-alertLevelCode="props">
|
||||
<VnSelect
|
||||
url="States/editableStates"
|
||||
auto-load
|
||||
hide-selected
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
v-model="props.row.alertLevelCode"
|
||||
v-on="getInputEvents(props)"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #column-zoneName="{ row }">
|
||||
<span class="link">{{ row.zoneName }}</span>
|
||||
<ZoneDescriptorProxy :id="row.zoneFk" />
|
||||
</template>
|
||||
<template #column-quantity="props">
|
||||
<VnInputNumber
|
||||
v-model.number="props.row.quantity"
|
||||
v-on="getInputEvents(props)"
|
||||
></VnInputNumber>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.icon-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 0.2fr);
|
||||
row-gap: 5px; /* Ajusta el espacio entre los iconos según sea necesario */
|
||||
}
|
||||
.icon-container > * {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.list-enter-active,
|
||||
.list-leave-active {
|
||||
transition: all 1s ease;
|
||||
}
|
||||
.list-enter-from,
|
||||
.list-leave-to {
|
||||
opacity: 0;
|
||||
background-color: $primary;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,90 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
const emit = defineEmits(['update-item']);
|
||||
|
||||
const showChangeItemDialog = ref(false);
|
||||
const newItem = ref(null);
|
||||
const $props = defineProps({
|
||||
selectedRows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
|
||||
const updateItem = async () => {
|
||||
try {
|
||||
showChangeItemDialog.value = true;
|
||||
const rowsToUpdate = $props.selectedRows.map(({ saleFk, quantity }) =>
|
||||
axios.post(`Sales/replaceItem`, {
|
||||
saleFk,
|
||||
substitutionFk: newItem.value,
|
||||
quantity,
|
||||
}),
|
||||
);
|
||||
const result = await Promise.allSettled(rowsToUpdate);
|
||||
notifyResults(result, 'saleFk');
|
||||
emit('update-item', newItem.value);
|
||||
} catch (err) {
|
||||
console.error('Error updating item:', err);
|
||||
return err;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center justify-center column items-stretch">
|
||||
{{ showChangeItemDialog }}
|
||||
<span>{{ $t('negative.detail.modal.changeItem.title') }}</span>
|
||||
<VnSelect
|
||||
url="Items/WithName"
|
||||
:fields="['id', 'name']"
|
||||
:sort-by="['id DESC']"
|
||||
:options="items"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="newItem"
|
||||
>
|
||||
</VnSelect>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn :label="$t('globals.cancel')" color="primary" flat v-close-popup />
|
||||
<QBtn
|
||||
:label="$t('globals.confirm')"
|
||||
color="primary"
|
||||
:disable="!newItem"
|
||||
@click="updateItem"
|
||||
unelevated
|
||||
autofocus
|
||||
/> </QCardActions
|
||||
></QCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
max-height: 100%;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.grid-style-transition {
|
||||
transition:
|
||||
transform 0.28s,
|
||||
background-color 0.28s;
|
||||
}
|
||||
|
||||
#true {
|
||||
background-color: $positive;
|
||||
}
|
||||
|
||||
#false {
|
||||
background-color: $negative;
|
||||
}
|
||||
|
||||
div.q-dialog__inner > div {
|
||||
max-width: fit-content !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,84 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
|
||||
const showChangeQuantityDialog = ref(false);
|
||||
const newQuantity = ref(null);
|
||||
const $props = defineProps({
|
||||
selectedRows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(['update-quantity']);
|
||||
const updateQuantity = async () => {
|
||||
try {
|
||||
showChangeQuantityDialog.value = true;
|
||||
const rowsToUpdate = $props.selectedRows.map(({ saleFk }) =>
|
||||
axios.post(`Sales/${saleFk}/updateQuantity`, {
|
||||
saleFk,
|
||||
quantity: +newQuantity.value,
|
||||
}),
|
||||
);
|
||||
|
||||
const result = await Promise.allSettled(rowsToUpdate);
|
||||
notifyResults(result, 'saleFk');
|
||||
|
||||
emit('update-quantity', newQuantity.value);
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center justify-center column items-stretch">
|
||||
<span>{{ $t('negative.detail.modal.changeQuantity.title') }}</span>
|
||||
<VnInput
|
||||
type="number"
|
||||
:min="0"
|
||||
:label="$t('negative.detail.modal.changeQuantity.placeholder')"
|
||||
v-model="newQuantity"
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn :label="$t('globals.cancel')" color="primary" flat v-close-popup />
|
||||
<QBtn
|
||||
:label="$t('globals.confirm')"
|
||||
color="primary"
|
||||
:disable="!newQuantity || newQuantity < 0"
|
||||
@click="updateQuantity"
|
||||
unelevated
|
||||
autofocus
|
||||
/> </QCardActions
|
||||
></QCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
max-height: 100%;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.grid-style-transition {
|
||||
transition:
|
||||
transform 0.28s,
|
||||
background-color 0.28s;
|
||||
}
|
||||
|
||||
#true {
|
||||
background-color: $positive;
|
||||
}
|
||||
|
||||
#false {
|
||||
background-color: $negative;
|
||||
}
|
||||
|
||||
div.q-dialog__inner > div {
|
||||
max-width: fit-content !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,91 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import axios from 'axios';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import notifyResults from 'src/utils/notifyResults';
|
||||
|
||||
const emit = defineEmits(['update-state']);
|
||||
const editableStates = ref([]);
|
||||
const showChangeStateDialog = ref(false);
|
||||
const newState = ref(null);
|
||||
const $props = defineProps({
|
||||
selectedRows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const updateState = async () => {
|
||||
try {
|
||||
showChangeStateDialog.value = true;
|
||||
const rowsToUpdate = $props.selectedRows.map(({ id }) =>
|
||||
axios.post(`Tickets/state`, {
|
||||
ticketFk: id,
|
||||
code: newState.value,
|
||||
}),
|
||||
);
|
||||
const result = await Promise.allSettled(rowsToUpdate);
|
||||
notifyResults(result, 'ticketFk');
|
||||
|
||||
emit('update-state', newState.value);
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="States/editableStates"
|
||||
@on-fetch="(data) => (editableStates = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QCard class="q-pa-sm">
|
||||
<QCardSection class="row items-center justify-center column items-stretch">
|
||||
<span>{{ $t('negative.detail.modal.changeState.title') }}</span>
|
||||
<VnSelect
|
||||
:label="$t('negative.detail.modal.changeState.placeholder')"
|
||||
v-model="newState"
|
||||
:options="editableStates"
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn :label="$t('globals.cancel')" color="primary" flat v-close-popup />
|
||||
<QBtn
|
||||
:label="$t('globals.confirm')"
|
||||
color="primary"
|
||||
:disable="!newState"
|
||||
@click="updateState"
|
||||
unelevated
|
||||
autofocus
|
||||
/> </QCardActions
|
||||
></QCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
max-height: 100%;
|
||||
padding: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.grid-style-transition {
|
||||
transition:
|
||||
transform 0.28s,
|
||||
background-color 0.28s;
|
||||
}
|
||||
|
||||
#true {
|
||||
background-color: $positive;
|
||||
}
|
||||
|
||||
#false {
|
||||
background-color: $negative;
|
||||
}
|
||||
|
||||
div.q-dialog__inner > div {
|
||||
max-width: fit-content !important;
|
||||
}
|
||||
</style>
|
|
@ -23,6 +23,8 @@ ticketSale:
|
|||
hasComponentLack: Component lack
|
||||
ok: Ok
|
||||
more: More
|
||||
transferLines: Transfer lines(no basket)/ Split
|
||||
transferBasket: Some row selected is basket
|
||||
advanceTickets:
|
||||
preparation: Preparation
|
||||
origin: Origin
|
||||
|
@ -188,7 +190,6 @@ ticketList:
|
|||
accountPayment: Account payment
|
||||
sendDocuware: Set delivered and send delivery note(s) to the tablet
|
||||
addPayment: Add payment
|
||||
date: Date
|
||||
company: Company
|
||||
amount: Amount
|
||||
reference: Reference
|
||||
|
@ -202,8 +203,6 @@ ticketList:
|
|||
creditCard: Credit card
|
||||
transfers: Transfers
|
||||
province: Province
|
||||
warehouse: Warehouse
|
||||
hour: Hour
|
||||
closure: Closure
|
||||
toLines: Go to lines
|
||||
addressNickname: Address nickname
|
||||
|
@ -214,3 +213,79 @@ ticketList:
|
|||
notVisible: Not visible
|
||||
clientFrozen: Client frozen
|
||||
componentLack: Component lack
|
||||
negative:
|
||||
hour: Hour
|
||||
id: Id Article
|
||||
longName: Article
|
||||
supplier: Supplier
|
||||
colour: Colour
|
||||
size: Size
|
||||
origen: Origin
|
||||
value: Negative
|
||||
itemFk: Article
|
||||
producer: Producer
|
||||
warehouse: Warehouse
|
||||
warehouseFk: Warehouse
|
||||
category: Category
|
||||
categoryFk: Family
|
||||
type: Type
|
||||
typeFk: Type
|
||||
lack: Negative
|
||||
inkFk: inkFk
|
||||
timed: timed
|
||||
date: Date
|
||||
minTimed: minTimed
|
||||
negativeAction: Negative
|
||||
totalNegative: Total negatives
|
||||
days: Days
|
||||
buttonsUpdate:
|
||||
item: Item
|
||||
state: State
|
||||
quantity: Quantity
|
||||
modalOrigin:
|
||||
title: Update negatives
|
||||
question: Select a state to update
|
||||
modalSplit:
|
||||
title: Confirm split selected
|
||||
question: Select a state to update
|
||||
detail:
|
||||
saleFk: Sale
|
||||
itemFk: Article
|
||||
ticketFk: Ticket
|
||||
code: Code
|
||||
nickname: Alias
|
||||
name: Name
|
||||
zoneName: Agency name
|
||||
shipped: Date
|
||||
theoreticalhour: Theoretical hour
|
||||
agName: Agency
|
||||
quantity: Quantity
|
||||
alertLevelCode: Group state
|
||||
state: State
|
||||
peticionCompra: Ticket request
|
||||
isRookie: Is rookie
|
||||
turno: Turn line
|
||||
isBasket: Basket
|
||||
hasObservation: Has substitution
|
||||
hasToIgnore: VIP
|
||||
modal:
|
||||
changeItem:
|
||||
title: Update item reference
|
||||
placeholder: New item
|
||||
changeState:
|
||||
title: Update tickets state
|
||||
placeholder: New state
|
||||
changeQuantity:
|
||||
title: Update tickets quantity
|
||||
placeholder: New quantity
|
||||
split:
|
||||
title: Are you sure you want to split selected tickets?
|
||||
subTitle: Confirm split action
|
||||
handleSplited:
|
||||
title: Handle splited tickets
|
||||
subTitle: Confirm date and agency
|
||||
split:
|
||||
ticket: Old ticket
|
||||
newTicket: New ticket
|
||||
status: Result
|
||||
message: Message
|
||||
|
|
|
@ -127,6 +127,8 @@ ticketSale:
|
|||
ok: Ok
|
||||
more: Más
|
||||
address: Consignatario
|
||||
transferLines: Transferir líneas(no cesta)/ Separar
|
||||
transferBasket: No disponible para una cesta
|
||||
size: Medida
|
||||
ticketComponents:
|
||||
serie: Serie
|
||||
|
@ -213,6 +215,81 @@ ticketList:
|
|||
toLines: Ir a lineas
|
||||
addressNickname: Alias consignatario
|
||||
ref: Referencia
|
||||
negative:
|
||||
hour: Hora
|
||||
id: Id Articulo
|
||||
longName: Articulo
|
||||
supplier: Productor
|
||||
colour: Color
|
||||
size: Medida
|
||||
origen: Origen
|
||||
value: Negativo
|
||||
warehouseFk: Almacen
|
||||
producer: Producer
|
||||
category: Categoría
|
||||
categoryFk: Familia
|
||||
typeFk: Familia
|
||||
warehouse: Almacen
|
||||
lack: Negativo
|
||||
inkFk: Color
|
||||
timed: Hora
|
||||
date: Fecha
|
||||
minTimed: Hora
|
||||
type: Tipo
|
||||
negativeAction: Negativo
|
||||
totalNegative: Total negativos
|
||||
days: Rango de dias
|
||||
buttonsUpdate:
|
||||
item: artículo
|
||||
state: Estado
|
||||
quantity: Cantidad
|
||||
modalOrigin:
|
||||
title: Actualizar negativos
|
||||
question: Seleccione un estado para guardar
|
||||
modalSplit:
|
||||
title: Confirmar acción de split
|
||||
question: Selecciona un estado
|
||||
detail:
|
||||
saleFk: Línea
|
||||
itemFk: Artículo
|
||||
ticketFk: Ticket
|
||||
code: code
|
||||
nickname: Alias
|
||||
name: Nombre
|
||||
zoneName: Agencia
|
||||
shipped: F. envío
|
||||
theoreticalhour: Hora teórica
|
||||
agName: Agencia
|
||||
quantity: Cantidad
|
||||
alertLevelCode: Estado agrupado
|
||||
state: Estado
|
||||
peticionCompra: Petición compra
|
||||
isRookie: Cliente nuevo
|
||||
turno: Linea turno
|
||||
isBasket: Cesta
|
||||
hasObservation: Tiene sustitución
|
||||
hasToIgnore: VIP
|
||||
modal:
|
||||
changeItem:
|
||||
title: Actualizar referencia artículo
|
||||
placeholder: Nuevo articulo
|
||||
changeState:
|
||||
title: Actualizar estado
|
||||
placeholder: Nuevo estado
|
||||
changeQuantity:
|
||||
title: Actualizar cantidad
|
||||
placeholder: Nueva cantidad
|
||||
split:
|
||||
title: ¿Seguro de separar los tickets seleccionados?
|
||||
subTitle: Confirma separar tickets seleccionados
|
||||
handleSplited:
|
||||
title: Gestionar tickets spliteados
|
||||
subTitle: Confir fecha y agencia
|
||||
split:
|
||||
ticket: Ticket viejo
|
||||
newTicket: Ticket nuevo
|
||||
status: Estado
|
||||
message: Mensaje
|
||||
rounding: Redondeo
|
||||
noVerifiedData: Sin datos comprobados
|
||||
purchaseRequest: Petición de compra
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue