Merge pull request '8356-devToTest' (!1179) from 8356-devToTest into test
Reviewed-on: #1179 Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
commit
3a0d545b94
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.52.0",
|
"version": "25.02.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { Notify } from 'quasar';
|
|
||||||
import { onRequest, onResponseError } from 'src/boot/axios';
|
import { onRequest, onResponseError } from 'src/boot/axios';
|
||||||
import { describe, expect, it, vi } from 'vitest';
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
|
@ -27,6 +26,7 @@ describe('Axios boot', () => {
|
||||||
expect(resultConfig).toEqual(
|
expect(resultConfig).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
headers: {
|
headers: {
|
||||||
|
'Accept-Language': 'en-US',
|
||||||
Authorization: 'DEFAULT_TOKEN',
|
Authorization: 'DEFAULT_TOKEN',
|
||||||
},
|
},
|
||||||
})
|
})
|
|
@ -3,12 +3,12 @@ import { useSession } from 'src/composables/useSession';
|
||||||
import { Router } from 'src/router';
|
import { Router } from 'src/router';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
|
||||||
|
import { i18n } from 'src/boot/i18n';
|
||||||
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const stateQuery = useStateQueryStore();
|
const stateQuery = useStateQueryStore();
|
||||||
const baseUrl = '/api/';
|
const baseUrl = '/api/';
|
||||||
|
|
||||||
axios.defaults.baseURL = baseUrl;
|
axios.defaults.baseURL = baseUrl;
|
||||||
const axiosNoError = axios.create({ baseURL: baseUrl });
|
const axiosNoError = axios.create({ baseURL: baseUrl });
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ const onRequest = (config) => {
|
||||||
const token = session.getToken();
|
const token = session.getToken();
|
||||||
if (token.length && !config.headers.Authorization) {
|
if (token.length && !config.headers.Authorization) {
|
||||||
config.headers.Authorization = token;
|
config.headers.Authorization = token;
|
||||||
|
config.headers['Accept-Language'] = i18n.global.locale.value;
|
||||||
}
|
}
|
||||||
stateQuery.add(config);
|
stateQuery.add(config);
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { boot } from 'quasar/wrappers';
|
import { boot } from 'quasar/wrappers';
|
||||||
import { createI18n } from 'vue-i18n';
|
import { createI18n } from 'vue-i18n';
|
||||||
import messages from 'src/i18n';
|
import messages from 'src/i18n';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
const user = useState().getUser();
|
||||||
|
|
||||||
const i18n = createI18n({
|
const i18n = createI18n({
|
||||||
locale: navigator.language || navigator.userLanguage,
|
locale: user.value.lang || navigator.language || navigator.userLanguage,
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
globalInjection: true,
|
globalInjection: true,
|
||||||
messages,
|
messages,
|
||||||
|
|
|
@ -127,7 +127,7 @@ function resetData(data) {
|
||||||
originalData.value = JSON.parse(JSON.stringify(data));
|
originalData.value = JSON.parse(JSON.stringify(data));
|
||||||
formData.value = JSON.parse(JSON.stringify(data));
|
formData.value = JSON.parse(JSON.stringify(data));
|
||||||
|
|
||||||
if (watchChanges.value) watchChanges.value(); //destoy watcher
|
if (watchChanges.value) watchChanges.value(); //destroy watcher
|
||||||
watchChanges.value = watch(formData, () => (hasChanges.value = true), { deep: true });
|
watchChanges.value = watch(formData, () => (hasChanges.value = true), { deep: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,10 +270,8 @@ function getChanges() {
|
||||||
|
|
||||||
function isEmpty(obj) {
|
function isEmpty(obj) {
|
||||||
if (obj == null) return true;
|
if (obj == null) return true;
|
||||||
if (obj === undefined) return true;
|
if (Array.isArray(obj)) return !obj.length;
|
||||||
if (Object.keys(obj).length === 0) return true;
|
return !Object.keys(obj).length;
|
||||||
|
|
||||||
if (obj.length > 0) return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload(params) {
|
async function reload(params) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue';
|
import { onMounted, onUnmounted, computed, ref, watch, nextTick } from 'vue';
|
||||||
import { onBeforeRouteLeave, useRouter } from 'vue-router';
|
import { onBeforeRouteLeave, useRouter, useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
|
@ -12,7 +12,6 @@ import SkeletonForm from 'components/ui/SkeletonForm.vue';
|
||||||
import VnConfirm from './ui/VnConfirm.vue';
|
import VnConfirm from './ui/VnConfirm.vue';
|
||||||
import { tMobile } from 'src/composables/tMobile';
|
import { tMobile } from 'src/composables/tMobile';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
const { push } = useRouter();
|
const { push } = useRouter();
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
|
@ -17,12 +17,10 @@ const stateQuery = useStateQueryStore();
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const user = state.getUser();
|
const user = state.getUser();
|
||||||
const appName = 'Lilium';
|
const appName = 'Lilium';
|
||||||
|
const pinnedModulesRef = ref();
|
||||||
|
|
||||||
onMounted(() => stateStore.setMounted());
|
onMounted(() => stateStore.setMounted());
|
||||||
|
|
||||||
const pinnedModulesRef = ref();
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QHeader color="white" elevated>
|
<QHeader color="white" elevated>
|
||||||
<QToolbar class="q-py-sm q-px-md">
|
<QToolbar class="q-py-sm q-px-md">
|
||||||
|
@ -66,16 +64,6 @@ const pinnedModulesRef = ref();
|
||||||
<QSpace />
|
<QSpace />
|
||||||
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
|
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
|
||||||
<div id="actions-prepend"></div>
|
<div id="actions-prepend"></div>
|
||||||
<QBtn
|
|
||||||
flat
|
|
||||||
v-if="!quasar.platform.is.mobile"
|
|
||||||
@click="pinnedModulesRef.redirect($route.params.id)"
|
|
||||||
icon="more_up"
|
|
||||||
>
|
|
||||||
<QTooltip>
|
|
||||||
{{ t('Go to Salix') }}
|
|
||||||
</QTooltip>
|
|
||||||
</QBtn>
|
|
||||||
<QBtn
|
<QBtn
|
||||||
:class="{ 'q-pa-none': quasar.platform.is.mobile }"
|
:class="{ 'q-pa-none': quasar.platform.is.mobile }"
|
||||||
id="pinnedModules"
|
id="pinnedModules"
|
||||||
|
@ -107,7 +95,6 @@ const pinnedModulesRef = ref();
|
||||||
<VnBreadcrumbs v-if="$q.screen.lt.md" class="q-ml-md" />
|
<VnBreadcrumbs v-if="$q.screen.lt.md" class="q-ml-md" />
|
||||||
</QHeader>
|
</QHeader>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.searchbar {
|
.searchbar {
|
||||||
width: max-content;
|
width: max-content;
|
||||||
|
@ -116,9 +103,3 @@ const pinnedModulesRef = ref();
|
||||||
background-color: var(--vn-section-color);
|
background-color: var(--vn-section-color);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
|
||||||
en:
|
|
||||||
Go to Salix: Go to Salix
|
|
||||||
es:
|
|
||||||
Go to Salix: Ir a Salix
|
|
||||||
</i18n>
|
|
||||||
|
|
|
@ -87,10 +87,10 @@ async function saveDarkMode(value) {
|
||||||
async function saveLanguage(value) {
|
async function saveLanguage(value) {
|
||||||
const query = `/VnUsers/${user.value.id}`;
|
const query = `/VnUsers/${user.value.id}`;
|
||||||
try {
|
try {
|
||||||
await axios.patch(query, {
|
await axios.patch(query, { lang: value });
|
||||||
lang: value,
|
|
||||||
});
|
|
||||||
user.value.lang = value;
|
user.value.lang = value;
|
||||||
|
useState().setUser(user.value);
|
||||||
onDataSaved();
|
onDataSaved();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
onDataError();
|
onDataError();
|
||||||
|
|
|
@ -150,6 +150,7 @@ const tableModes = [
|
||||||
disable: $props.disableOption?.card,
|
disable: $props.disableOption?.card,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
const urlParams = route.query[$props.searchUrl];
|
const urlParams = route.query[$props.searchUrl];
|
||||||
hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
|
hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
|
||||||
|
@ -383,7 +384,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
:class="col.headerClass"
|
:class="col.headerClass"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="column self-start q-ml-xs ellipsis"
|
class="column ellipsis"
|
||||||
:class="`text-${col?.align ?? 'left'}`"
|
:class="`text-${col?.align ?? 'left'}`"
|
||||||
:style="$props.columnSearch ? 'height: 75px' : ''"
|
:style="$props.columnSearch ? 'height: 75px' : ''"
|
||||||
>
|
>
|
||||||
|
@ -425,7 +426,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
<!-- Columns -->
|
<!-- Columns -->
|
||||||
<QTd
|
<QTd
|
||||||
auto-width
|
auto-width
|
||||||
class="no-margin q-px-xs"
|
class="no-margin"
|
||||||
:class="[getColAlign(col), col.columnClass]"
|
:class="[getColAlign(col), col.columnClass]"
|
||||||
:style="col.style"
|
:style="col.style"
|
||||||
v-if="col.visible ?? true"
|
v-if="col.visible ?? true"
|
||||||
|
@ -537,13 +538,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
class="fields"
|
class="fields"
|
||||||
>
|
>
|
||||||
<VnLv
|
<VnLv :label="col.label + ':'">
|
||||||
:label="
|
|
||||||
!col.component && col.label
|
|
||||||
? `${col.label}:`
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<template #value>
|
<template #value>
|
||||||
<span
|
<span
|
||||||
@click="stopEventPropagation($event)"
|
@click="stopEventPropagation($event)"
|
||||||
|
@ -705,7 +700,7 @@ es:
|
||||||
|
|
||||||
.grid-three {
|
.grid-three {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(400px, max-content));
|
grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
grid-gap: 20px;
|
grid-gap: 20px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -754,21 +749,6 @@ es:
|
||||||
top: 0;
|
top: 0;
|
||||||
padding: 12px 0;
|
padding: 12px 0;
|
||||||
}
|
}
|
||||||
tbody {
|
|
||||||
.q-checkbox {
|
|
||||||
display: flex;
|
|
||||||
margin-bottom: 9px;
|
|
||||||
& .q-checkbox__label {
|
|
||||||
margin-left: 31px;
|
|
||||||
color: var(--vn-text-color);
|
|
||||||
}
|
|
||||||
& .q-checkbox__inner {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
color: var(--vn-label-color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.sticky {
|
.sticky {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
|
|
@ -0,0 +1,248 @@
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
|
import { vi, afterEach, beforeEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
describe('CrudModel', () => {
|
||||||
|
let wrapper;
|
||||||
|
let vm;
|
||||||
|
let data;
|
||||||
|
beforeAll(() => {
|
||||||
|
wrapper = createWrapper(CrudModel, {
|
||||||
|
global: {
|
||||||
|
stubs: [
|
||||||
|
'vnPaginate',
|
||||||
|
'useState',
|
||||||
|
'arrayData',
|
||||||
|
'useStateStore',
|
||||||
|
'vue-i18n',
|
||||||
|
],
|
||||||
|
mocks: {
|
||||||
|
validate: vi.fn(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
propsData: {
|
||||||
|
dataRequired: {
|
||||||
|
fk: 1,
|
||||||
|
},
|
||||||
|
dataKey: 'crudModelKey',
|
||||||
|
model: 'crudModel',
|
||||||
|
url: 'crudModelUrl',
|
||||||
|
saveFn: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
wrapper=wrapper.wrapper;
|
||||||
|
vm=wrapper.vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
vm.fetch([]);
|
||||||
|
vm.watchChanges = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('insert()', () => {
|
||||||
|
it('should new element in list with index 0 if formData not has data', () => {
|
||||||
|
vm.insert();
|
||||||
|
|
||||||
|
expect(vm.formData.length).toEqual(1);
|
||||||
|
expect(vm.formData[0].fk).toEqual(1);
|
||||||
|
expect(vm.formData[0].$index).toEqual(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getChanges()', () => {
|
||||||
|
it('should return correct updates and creates', async () => {
|
||||||
|
vm.fetch([
|
||||||
|
{ id: 1, name: 'New name one' },
|
||||||
|
{ id: 2, name: 'New name two' },
|
||||||
|
{ id: 3, name: 'Bruce Wayne' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
vm.originalData = [
|
||||||
|
{ id: 1, name: 'Tony Starks' },
|
||||||
|
{ id: 2, name: 'Jessica Jones' },
|
||||||
|
{ id: 3, name: 'Bruce Wayne' },
|
||||||
|
];
|
||||||
|
|
||||||
|
vm.insert();
|
||||||
|
const result = vm.getChanges();
|
||||||
|
|
||||||
|
const expected = {
|
||||||
|
creates: [
|
||||||
|
{
|
||||||
|
$index: 3,
|
||||||
|
fk: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
updates: [
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
name: 'New name one',
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
name: 'New name two',
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
id: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(result).toEqual(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getDifferences()', () => {
|
||||||
|
it('should return the differences between two objects', async () => {
|
||||||
|
const obj1 = {
|
||||||
|
a: 1,
|
||||||
|
b: 2,
|
||||||
|
c: 3,
|
||||||
|
};
|
||||||
|
const obj2 = {
|
||||||
|
a: null,
|
||||||
|
b: 4,
|
||||||
|
d: 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = vm.getDifferences(obj1, obj2);
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
a: null,
|
||||||
|
b: 4,
|
||||||
|
d: 5,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('isEmpty()', () => {
|
||||||
|
let dummyObj;
|
||||||
|
let dummyArray;
|
||||||
|
let result;
|
||||||
|
it('should return true if object si null', async () => {
|
||||||
|
dummyObj = null;
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true if object si undefined', async () => {
|
||||||
|
dummyObj = undefined;
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true if object is empty', async () => {
|
||||||
|
dummyObj ={};
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if object is not empty', async () => {
|
||||||
|
dummyObj = {a:1, b:2, c:3};
|
||||||
|
result = vm.isEmpty(dummyObj);
|
||||||
|
|
||||||
|
expect(result).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true if array is empty', async () => {
|
||||||
|
dummyArray = [];
|
||||||
|
result = vm.isEmpty(dummyArray);
|
||||||
|
|
||||||
|
expect(result).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false if array is not empty', async () => {
|
||||||
|
dummyArray = [1,2,3];
|
||||||
|
result = vm.isEmpty(dummyArray);
|
||||||
|
|
||||||
|
expect(result).toBe(false);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('resetData()', () => {
|
||||||
|
it('should add $index to elements in data[] and sets originalData and formData with data', async () => {
|
||||||
|
data = [{
|
||||||
|
name: 'Tony',
|
||||||
|
lastName: 'Stark',
|
||||||
|
age: 42,
|
||||||
|
}];
|
||||||
|
|
||||||
|
vm.resetData(data);
|
||||||
|
|
||||||
|
expect(vm.originalData).toEqual(data);
|
||||||
|
expect(vm.originalData[0].$index).toEqual(0);
|
||||||
|
expect(vm.formData).toEqual(data);
|
||||||
|
expect(vm.formData[0].$index).toEqual(0);
|
||||||
|
expect(vm.watchChanges).not.toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should dont do nothing if data is null', async () => {
|
||||||
|
vm.resetData(null);
|
||||||
|
|
||||||
|
expect(vm.watchChanges).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set originalData and formatData with data and generate watchChanges', async () => {
|
||||||
|
data = {
|
||||||
|
name: 'Tony',
|
||||||
|
lastName: 'Stark',
|
||||||
|
age: 42,
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.resetData(data);
|
||||||
|
|
||||||
|
expect(vm.originalData).toEqual(data);
|
||||||
|
expect(vm.formData).toEqual(data);
|
||||||
|
expect(vm.watchChanges).not.toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('saveChanges()', () => {
|
||||||
|
data = [{
|
||||||
|
name: 'Tony',
|
||||||
|
lastName: 'Stark',
|
||||||
|
age: 42,
|
||||||
|
}];
|
||||||
|
|
||||||
|
it('should call saveFn if exists', async () => {
|
||||||
|
await wrapper.setProps({ saveFn: vi.fn() });
|
||||||
|
|
||||||
|
vm.saveChanges(data);
|
||||||
|
|
||||||
|
expect(vm.saveFn).toHaveBeenCalledOnce();
|
||||||
|
expect(vm.isLoading).toBe(false);
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
|
||||||
|
await wrapper.setProps({ saveFn: '' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should use default url if there's not saveFn", async () => {
|
||||||
|
const postMock =vi.spyOn(axios, 'post');
|
||||||
|
|
||||||
|
vm.formData = [{
|
||||||
|
name: 'Bruce',
|
||||||
|
lastName: 'Wayne',
|
||||||
|
age: 45,
|
||||||
|
}]
|
||||||
|
|
||||||
|
await vm.saveChanges(data);
|
||||||
|
|
||||||
|
expect(postMock).toHaveBeenCalledWith(vm.url + '/crud', data);
|
||||||
|
expect(vm.isLoading).toBe(false);
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
expect(vm.originalData).toEqual(JSON.parse(JSON.stringify(vm.formData)));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,56 @@
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import EditForm from 'components/EditTableCellValueForm.vue';
|
||||||
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
const fieldA = 'fieldA';
|
||||||
|
const fieldB = 'fieldB';
|
||||||
|
|
||||||
|
describe('EditForm', () => {
|
||||||
|
let vm;
|
||||||
|
const mockRows = [
|
||||||
|
{ id: 1, itemFk: 101 },
|
||||||
|
{ id: 2, itemFk: 102 },
|
||||||
|
];
|
||||||
|
const mockFieldsOptions = [
|
||||||
|
{ label: 'Field A', field: fieldA, component: 'input', attrs: {} },
|
||||||
|
{ label: 'Field B', field: fieldB, component: 'date', attrs: {} },
|
||||||
|
];
|
||||||
|
const editUrl = '/api/edit';
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
vi.spyOn(axios, 'post').mockResolvedValue({ status: 200 });
|
||||||
|
vm = createWrapper(EditForm, {
|
||||||
|
props: {
|
||||||
|
rows: mockRows,
|
||||||
|
fieldsOptions: mockFieldsOptions,
|
||||||
|
editUrl,
|
||||||
|
},
|
||||||
|
}).vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('onSubmit()', () => {
|
||||||
|
it('should call axios.post with the correct parameters in the payload', async () => {
|
||||||
|
const selectedField = { field: fieldA, component: 'input', attrs: {} };
|
||||||
|
const newValue = 'Test Value';
|
||||||
|
|
||||||
|
vm.selectedField = selectedField;
|
||||||
|
vm.newValue = newValue;
|
||||||
|
|
||||||
|
await vm.onSubmit();
|
||||||
|
|
||||||
|
const payload = axios.post.mock.calls[0][1];
|
||||||
|
|
||||||
|
expect(axios.post).toHaveBeenCalledWith(editUrl, expect.any(Object));
|
||||||
|
expect(payload.field).toEqual(fieldA);
|
||||||
|
expect(payload.newValue).toEqual(newValue);
|
||||||
|
|
||||||
|
expect(payload.lines).toEqual(expect.arrayContaining(mockRows));
|
||||||
|
|
||||||
|
expect(vm.isLoading).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,149 @@
|
||||||
|
import { describe, expect, it, beforeAll, vi, afterAll } from 'vitest';
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import FormModel from 'src/components/FormModel.vue';
|
||||||
|
|
||||||
|
describe('FormModel', () => {
|
||||||
|
const model = 'mockModel';
|
||||||
|
const url = 'mockUrl';
|
||||||
|
const formInitialData = { mockKey: 'mockVal' };
|
||||||
|
|
||||||
|
describe('modelValue', () => {
|
||||||
|
it('should use the provided model', () => {
|
||||||
|
const { vm } = mount({ propsData: { model } });
|
||||||
|
expect(vm.modelValue).toBe(model);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should use the route meta title when model is not provided', () => {
|
||||||
|
const { vm } = mount({});
|
||||||
|
expect(vm.modelValue).toBe('formModel_mockTitle');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('onMounted()', () => {
|
||||||
|
let mockGet;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
mockGet = vi.spyOn(axios, 'get').mockResolvedValue({ data: {} });
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
mockGet.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not fetch when has formInitialData', () => {
|
||||||
|
mount({ propsData: { url, model, autoLoad: true, formInitialData } });
|
||||||
|
expect(mockGet).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fetch when there is url and auto-load', () => {
|
||||||
|
mount({ propsData: { url, model, autoLoad: true } });
|
||||||
|
expect(mockGet).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not observe changes', () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, observeFormChanges: false, formInitialData },
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(vm.hasChanges).toBe(true);
|
||||||
|
vm.reset();
|
||||||
|
expect(vm.hasChanges).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should observe changes', async () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData },
|
||||||
|
});
|
||||||
|
vm.state.set(model, formInitialData);
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
expect(vm.hasChanges).toBe(true);
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('trimData()', () => {
|
||||||
|
let vm;
|
||||||
|
beforeAll(() => {
|
||||||
|
vm = mount({}).vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should trim whitespace from string values', () => {
|
||||||
|
const data = { key1: ' value1 ', key2: ' value2 ' };
|
||||||
|
const trimmedData = vm.trimData(data);
|
||||||
|
expect(trimmedData).toEqual({ key1: 'value1', key2: 'value2' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not modify non-string values', () => {
|
||||||
|
const data = { key1: 123, key2: true, key3: null, key4: undefined };
|
||||||
|
const trimmedData = vm.trimData(data);
|
||||||
|
expect(trimmedData).toEqual(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('save()', async () => {
|
||||||
|
it('should not call if there are not changes', async () => {
|
||||||
|
const { vm } = mount({ propsData: { url, model } });
|
||||||
|
|
||||||
|
await vm.save();
|
||||||
|
expect(vm.hasChanges).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call axios.patch with the right data', async () => {
|
||||||
|
const spy = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
|
const { vm } = mount({ propsData: { url, model, formInitialData } });
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
expect(spy).toHaveBeenCalled();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call axios.post with the right data', async () => {
|
||||||
|
const spy = vi.spyOn(axios, 'post').mockResolvedValue({ data: {} });
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData, urlCreate: 'mockUrlCreate' },
|
||||||
|
});
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
expect(spy).toHaveBeenCalled();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should use the saveFn', async () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData, saveFn: () => {} },
|
||||||
|
});
|
||||||
|
const spyPatch = vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
|
const spySaveFn = vi.spyOn(vm.$props, 'saveFn');
|
||||||
|
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
expect(spyPatch).not.toHaveBeenCalled();
|
||||||
|
expect(spySaveFn).toHaveBeenCalled();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reload the data after save', async () => {
|
||||||
|
const { vm } = mount({
|
||||||
|
propsData: { url, model, formInitialData, reload: true },
|
||||||
|
});
|
||||||
|
vi.spyOn(axios, 'patch').mockResolvedValue({ data: {} });
|
||||||
|
|
||||||
|
vm.formData.mockKey = 'newVal';
|
||||||
|
await vm.$nextTick();
|
||||||
|
await vm.save();
|
||||||
|
vm.formData.mockKey = 'mockVal';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function mount({ propsData = {} }) {
|
||||||
|
return createWrapper(FormModel, {
|
||||||
|
propsData,
|
||||||
|
});
|
||||||
|
}
|
|
@ -2,7 +2,11 @@
|
||||||
import { ref, onMounted, useSlots } from 'vue';
|
import { ref, onMounted, useSlots } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const stateStore = useStateStore();
|
||||||
const slots = useSlots();
|
const slots = useSlots();
|
||||||
const hasContent = ref(false);
|
const hasContent = ref(false);
|
||||||
const rightPanel = ref(null);
|
const rightPanel = ref(null);
|
||||||
|
@ -11,7 +15,6 @@ onMounted(() => {
|
||||||
rightPanel.value = document.querySelector('#right-panel');
|
rightPanel.value = document.querySelector('#right-panel');
|
||||||
if (!rightPanel.value) return;
|
if (!rightPanel.value) return;
|
||||||
|
|
||||||
// Check if there's content to display
|
|
||||||
const observer = new MutationObserver(() => {
|
const observer = new MutationObserver(() => {
|
||||||
hasContent.value = rightPanel.value.childNodes.length;
|
hasContent.value = rightPanel.value.childNodes.length;
|
||||||
});
|
});
|
||||||
|
@ -21,12 +24,9 @@ onMounted(() => {
|
||||||
childList: true,
|
childList: true,
|
||||||
attributes: true,
|
attributes: true,
|
||||||
});
|
});
|
||||||
|
if ((!slots['right-panel'] && !hasContent.value) || quasar.platform.is.mobile)
|
||||||
if (!slots['right-panel'] && !hasContent.value) stateStore.rightDrawer = false;
|
stateStore.rightDrawer = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Teleport to="#actions-append" v-if="stateStore.isHeaderMounted()">
|
<Teleport to="#actions-append" v-if="stateStore.isHeaderMounted()">
|
||||||
|
@ -45,7 +45,7 @@ const stateStore = useStateStore();
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</div>
|
</div>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256">
|
||||||
<QScrollArea class="fit">
|
<QScrollArea class="fit">
|
||||||
<div id="right-panel"></div>
|
<div id="right-panel"></div>
|
||||||
<slot v-if="!hasContent" name="right-panel" />
|
<slot v-if="!hasContent" name="right-panel" />
|
||||||
|
|
|
@ -106,7 +106,7 @@ const manageDate = (date) => {
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
@click="isPopupOpen = true"
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
|
@ -125,13 +125,6 @@ const manageDate = (date) => {
|
||||||
isPopupOpen = false;
|
isPopupOpen = false;
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
|
||||||
v-if="showEvent"
|
|
||||||
name="event"
|
|
||||||
class="cursor-pointer"
|
|
||||||
@click="isPopupOpen = !isPopupOpen"
|
|
||||||
:title="t('Open date')"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<QMenu
|
<QMenu
|
||||||
v-if="$q.screen.gt.xs"
|
v-if="$q.screen.gt.xs"
|
||||||
|
@ -151,15 +144,6 @@ const manageDate = (date) => {
|
||||||
</QInput>
|
</QInput>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="scss">
|
|
||||||
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
|
|
||||||
border-bottom-style: solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vn-input-date.q-field--outlined.q-field--readonly .q-field__control:before {
|
|
||||||
border-style: solid;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Open date: Abrir fecha
|
Open date: Abrir fecha
|
||||||
|
|
|
@ -80,7 +80,7 @@ function dateToTime(newDate) {
|
||||||
:class="{ required: isRequired }"
|
:class="{ required: isRequired }"
|
||||||
style="min-width: 100px"
|
style="min-width: 100px"
|
||||||
:rules="mixinRules"
|
:rules="mixinRules"
|
||||||
@click="isPopupOpen = false"
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
type="time"
|
type="time"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
>
|
>
|
||||||
|
@ -100,12 +100,6 @@ function dateToTime(newDate) {
|
||||||
isPopupOpen = false;
|
isPopupOpen = false;
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<QIcon
|
|
||||||
name="Schedule"
|
|
||||||
class="cursor-pointer"
|
|
||||||
@click="isPopupOpen = !isPopupOpen"
|
|
||||||
:title="t('Open time')"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<QMenu
|
<QMenu
|
||||||
v-if="$q.screen.gt.xs"
|
v-if="$q.screen.gt.xs"
|
||||||
|
|
|
@ -26,7 +26,7 @@ const locationProperties = [
|
||||||
(obj) => obj.country?.name,
|
(obj) => obj.country?.name,
|
||||||
];
|
];
|
||||||
|
|
||||||
const formatLocation = (obj, properties) => {
|
const formatLocation = (obj, properties = locationProperties) => {
|
||||||
const parts = properties.map((prop) => {
|
const parts = properties.map((prop) => {
|
||||||
if (typeof prop === 'string') {
|
if (typeof prop === 'string') {
|
||||||
return obj[prop];
|
return obj[prop];
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import VnDmsList from 'src/components/common/VnDmsList.vue';
|
||||||
|
import { vi, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
|
describe('VnDmsList', () => {
|
||||||
|
let vm;
|
||||||
|
const dms = {
|
||||||
|
userFk: 1,
|
||||||
|
name: 'DMS 1'
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
vi.spyOn(axios, 'get').mockResolvedValue({ data: [] });
|
||||||
|
vm = createWrapper(VnDmsList, {
|
||||||
|
props: {
|
||||||
|
model: 'WorkerDms/1110/filter',
|
||||||
|
defaultDmsCode: 'hhrrData',
|
||||||
|
filter: 'wd.workerFk',
|
||||||
|
updateModel: 'Workers',
|
||||||
|
deleteModel: 'WorkerDms',
|
||||||
|
downloadModel: 'WorkerDms'
|
||||||
|
}
|
||||||
|
}).vm;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('setData()', () => {
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
userFk: 1,
|
||||||
|
name: 'Jessica',
|
||||||
|
lastName: 'Jones',
|
||||||
|
file: '4.jpg',
|
||||||
|
created: '2021-07-28 21:00:00'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userFk: 2,
|
||||||
|
name: 'Bruce',
|
||||||
|
lastName: 'Banner',
|
||||||
|
created: '2022-07-28 21:00:00',
|
||||||
|
dms: {
|
||||||
|
userFk: 2,
|
||||||
|
name: 'Bruce',
|
||||||
|
lastName: 'BannerDMS',
|
||||||
|
created: '2022-07-28 21:00:00',
|
||||||
|
file: '4.jpg',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userFk: 3,
|
||||||
|
name: 'Natasha',
|
||||||
|
lastName: 'Romanoff',
|
||||||
|
file: '4.jpg',
|
||||||
|
created: '2021-10-28 21:00:00'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
it('Should replace objects that contain the "dms" property with the value of the same and sort by creation date', () => {
|
||||||
|
vm.setData(data);
|
||||||
|
expect([vm.rows][0][0].lastName).toEqual('BannerDMS');
|
||||||
|
expect([vm.rows][0][1].lastName).toEqual('Romanoff');
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('parseDms()', () => {
|
||||||
|
const resultDms = { ...dms, userId:1};
|
||||||
|
|
||||||
|
it('Should add properties that end with "Fk" by changing the suffix to "Id"', () => {
|
||||||
|
const parsedDms = vm.parseDms(dms);
|
||||||
|
expect(parsedDms).toEqual(resultDms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('showFormDialog()', () => {
|
||||||
|
const resultDms = { ...dms, userId:1};
|
||||||
|
|
||||||
|
it('should call fn parseDms() and set show true if dms is defined', () => {
|
||||||
|
vm.showFormDialog(dms);
|
||||||
|
expect(vm.formDialog.show).toEqual(true);
|
||||||
|
expect(vm.formDialog.dms).toEqual(resultDms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import VnLocation from 'components/common/VnLocation.vue';
|
||||||
|
import { vi, afterEach, expect, it, beforeEach, describe } from 'vitest';
|
||||||
|
|
||||||
|
function buildComponent(data) {
|
||||||
|
return createWrapper(VnLocation, {
|
||||||
|
global: {
|
||||||
|
props: {
|
||||||
|
location: data
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}).vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('formatLocation', () => {
|
||||||
|
let locationBase;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
locationBase = {
|
||||||
|
postcode: '46680',
|
||||||
|
city: 'Algemesi',
|
||||||
|
province: { name: 'Valencia' },
|
||||||
|
country: { name: 'Spain' }
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the postcode, city, province and country', () => {
|
||||||
|
const location = { ...locationBase };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('46680, Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the postcode and country', () => {
|
||||||
|
const location = { ...locationBase, city: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('46680, Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the city, province and country', () => {
|
||||||
|
const location = { ...locationBase, postcode: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the country', () => {
|
||||||
|
const location = { ...locationBase, postcode: undefined, city: undefined, province: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.formatLocation(location)).toEqual('Spain');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('showLabel', () => {
|
||||||
|
let locationBase;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
locationBase = {
|
||||||
|
code: '46680',
|
||||||
|
town: 'Algemesi',
|
||||||
|
province: 'Valencia',
|
||||||
|
country: 'Spain'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with postcode, city, province and country', () => {
|
||||||
|
const location = { ...locationBase };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('46680, Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with postcode and country', () => {
|
||||||
|
const location = { ...locationBase, town: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('46680, Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with city, province and country', () => {
|
||||||
|
const location = { ...locationBase, code: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('Algemesi(Valencia), Spain');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the label with country', () => {
|
||||||
|
const location = { ...locationBase, code: undefined, town: undefined, province: undefined };
|
||||||
|
const vm = buildComponent(location);
|
||||||
|
expect(vm.showLabel(location)).toEqual('Spain');
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,10 +1,10 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch, onBeforeMount } from 'vue';
|
import { ref, computed, watch, onBeforeMount, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import SkeletonSummary from 'components/ui/SkeletonSummary.vue';
|
import SkeletonSummary from 'components/ui/SkeletonSummary.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import { isDialogOpened } from 'src/filters';
|
import { isDialogOpened } from 'src/filters';
|
||||||
|
import { useStateStore } from 'src/stores/useStateStore';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
url: {
|
url: {
|
||||||
|
@ -40,6 +40,7 @@ const { store } = arrayData;
|
||||||
const entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
|
const entity = computed(() => (Array.isArray(store.data) ? store.data[0] : store.data));
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
|
const stateStore = useStateStore();
|
||||||
defineExpose({
|
defineExpose({
|
||||||
entity,
|
entity,
|
||||||
fetch,
|
fetch,
|
||||||
|
@ -51,6 +52,9 @@ onBeforeMount(async () => {
|
||||||
watch(props, async () => await fetch());
|
watch(props, async () => await fetch());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
stateStore.rightDrawerChangeValue(false);
|
||||||
|
});
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
store.url = props.url;
|
store.url = props.url;
|
||||||
store.filter = props.filter ?? {};
|
store.filter = props.filter ?? {};
|
||||||
|
@ -60,7 +64,6 @@ async function fetch() {
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="summary container">
|
<div class="summary container">
|
||||||
<QCard class="cardSummary">
|
<QCard class="cardSummary">
|
||||||
|
@ -81,7 +84,7 @@ async function fetch() {
|
||||||
<span v-else></span>
|
<span v-else></span>
|
||||||
</slot>
|
</slot>
|
||||||
<slot name="header" :entity="entity" dense>
|
<slot name="header" :entity="entity" dense>
|
||||||
<VnLv :label="`${entity.id} -`" :value="entity.name" />
|
{{ entity.id + ' - ' + entity.name }}
|
||||||
</slot>
|
</slot>
|
||||||
<slot name="header-right" :entity="entity">
|
<slot name="header-right" :entity="entity">
|
||||||
<span></span>
|
<span></span>
|
||||||
|
@ -94,7 +97,6 @@ async function fetch() {
|
||||||
</QCard>
|
</QCard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.summary.container {
|
.summary.container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -16,7 +16,13 @@ const $props = defineProps({
|
||||||
required: false,
|
required: false,
|
||||||
default: 'value',
|
default: 'value',
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const tags = computed(() => {
|
const tags = computed(() => {
|
||||||
return Object.keys($props.item)
|
return Object.keys($props.item)
|
||||||
.filter((i) => i.startsWith(`${$props.tag}`))
|
.filter((i) => i.startsWith(`${$props.tag}`))
|
||||||
|
@ -28,10 +34,21 @@ const tags = computed(() => {
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const columnStyle = computed(() => {
|
||||||
|
if ($props.columns) {
|
||||||
|
return {
|
||||||
|
'grid-template-columns': `repeat(${$props.columns}, 1fr)`,
|
||||||
|
'max-width': `${$props.columns * 4}rem`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="fetchedTags">
|
<div class="fetchedTags">
|
||||||
<div class="wrap">
|
<div class="wrap" :style="columnStyle">
|
||||||
<div
|
<div
|
||||||
v-for="(val, key) in tags"
|
v-for="(val, key) in tags"
|
||||||
:key="key"
|
:key="key"
|
||||||
|
@ -39,37 +56,43 @@ const tags = computed(() => {
|
||||||
:title="`${key}: ${val}`"
|
:title="`${key}: ${val}`"
|
||||||
:class="{ empty: !val }"
|
:class="{ empty: !val }"
|
||||||
>
|
>
|
||||||
{{ val }}
|
<span class="text">{{ val }} </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.fetchedTags {
|
.fetchedTags {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
.wrap {
|
.wrap {
|
||||||
width: 100%;
|
display: grid;
|
||||||
flex-wrap: wrap;
|
|
||||||
display: flex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-tag {
|
.inline-tag {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
height: 1rem;
|
height: 1rem;
|
||||||
margin: 0.05rem;
|
margin: 0.05rem;
|
||||||
color: $color-font-secondary;
|
color: var(--vn-label-color);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
flex: 1;
|
border: 1px solid var(--vn-label-color);
|
||||||
border: 1px solid $color-spacer;
|
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-width: 4rem;
|
min-width: 4rem;
|
||||||
max-width: 4rem;
|
max-width: 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
.empty {
|
.empty {
|
||||||
border: 1px solid #2b2b2b;
|
border: 1px solid var(--vn-empty-tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -39,7 +39,7 @@ const val = computed(() => $props.value);
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-if="label || $slots.label" class="label">
|
<div v-if="label || $slots.label" class="label">
|
||||||
<slot name="label">
|
<slot name="label">
|
||||||
<span>{{ label }}</span>
|
<span style="color: var(--vn-label-color)">{{ label }}</span>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
|
|
|
@ -250,7 +250,7 @@ input::-webkit-inner-spin-button {
|
||||||
.q-table {
|
.q-table {
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
padding: 1px 10px 1px 10px;
|
padding: 1px 3px 1px 3px;
|
||||||
max-width: 130px;
|
max-width: 130px;
|
||||||
div span {
|
div span {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -306,3 +306,20 @@ input::-webkit-inner-spin-button {
|
||||||
.no-visible {
|
.no-visible {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
.q-field__inner {
|
||||||
|
.q-field__control {
|
||||||
|
min-height: auto !important;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
.q-field__native.row {
|
||||||
|
min-height: auto !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.q-date__header-today {
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid;
|
||||||
|
box-shadow: 0 4px 6px #00000000;
|
||||||
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ globals:
|
||||||
workCenters: Work centers
|
workCenters: Work centers
|
||||||
modes: Modes
|
modes: Modes
|
||||||
zones: Zones
|
zones: Zones
|
||||||
zonesList: Zones
|
zonesList: List
|
||||||
deliveryDays: Delivery days
|
deliveryDays: Delivery days
|
||||||
upcomingDeliveries: Upcoming deliveries
|
upcomingDeliveries: Upcoming deliveries
|
||||||
role: Role
|
role: Role
|
||||||
|
|
|
@ -144,7 +144,7 @@ globals:
|
||||||
workCenters: Centros de trabajo
|
workCenters: Centros de trabajo
|
||||||
modes: Modos
|
modes: Modos
|
||||||
zones: Zonas
|
zones: Zonas
|
||||||
zonesList: Zonas
|
zonesList: Listado
|
||||||
deliveryDays: Días de entrega
|
deliveryDays: Días de entrega
|
||||||
upcomingDeliveries: Próximos repartos
|
upcomingDeliveries: Próximos repartos
|
||||||
role: Role
|
role: Role
|
||||||
|
@ -863,6 +863,7 @@ components:
|
||||||
ended: Hasta
|
ended: Hasta
|
||||||
mine: Para mi
|
mine: Para mi
|
||||||
hasMinPrice: Precio mínimo
|
hasMinPrice: Precio mínimo
|
||||||
|
wareHouseFk: Almacén
|
||||||
# LatestBuysFilter
|
# LatestBuysFilter
|
||||||
salesPersonFk: Comprador
|
salesPersonFk: Comprador
|
||||||
active: Activo
|
active: Activo
|
||||||
|
|
|
@ -53,7 +53,6 @@ const hasAccount = ref(false);
|
||||||
<AccountDescriptorMenu :has-account="hasAccount" />
|
<AccountDescriptorMenu :has-account="hasAccount" />
|
||||||
</template>
|
</template>
|
||||||
<template #before>
|
<template #before>
|
||||||
<!-- falla id :id="entityId.value" collection="user" size="160x160" -->
|
|
||||||
<VnImg :id="entityId" collection="user" resolution="520x520" class="photo">
|
<VnImg :id="entityId" collection="user" resolution="520x520" class="photo">
|
||||||
<template #error>
|
<template #error>
|
||||||
<div
|
<div
|
||||||
|
@ -75,7 +74,7 @@ const hasAccount = ref(false);
|
||||||
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
<VnLv :label="t('account.card.nickname')" :value="entity.name" />
|
||||||
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ entity }">
|
<template #icons="{ entity }">
|
||||||
<QCardActions class="q-gutter-x-md">
|
<QCardActions class="q-gutter-x-md">
|
||||||
<QIcon
|
<QIcon
|
||||||
v-if="!entity.active"
|
v-if="!entity.active"
|
||||||
|
@ -83,7 +82,7 @@ const hasAccount = ref(false);
|
||||||
name="vn:disabled"
|
name="vn:disabled"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
size="sm"
|
size="xs"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('account.card.deactivated') }}</QTooltip>
|
<QTooltip>{{ t('account.card.deactivated') }}</QTooltip>
|
||||||
|
@ -91,10 +90,10 @@ const hasAccount = ref(false);
|
||||||
<QIcon
|
<QIcon
|
||||||
color="primary"
|
color="primary"
|
||||||
name="contact_mail"
|
name="contact_mail"
|
||||||
v-if="entity.hasAccount"
|
v-if="hasAccount"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
size="sm"
|
size="xs"
|
||||||
class="fill-icon"
|
class="fill-icon"
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('account.card.enabled') }}</QTooltip>
|
<QTooltip>{{ t('account.card.enabled') }}</QTooltip>
|
||||||
|
|
|
@ -164,19 +164,7 @@ const columns = computed(() => [
|
||||||
:autofocus="col.tabIndex == 1"
|
:autofocus="col.tabIndex == 1"
|
||||||
input-debounce="0"
|
input-debounce="0"
|
||||||
hide-selected
|
hide-selected
|
||||||
>
|
/>
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption>
|
|
||||||
{{ scope.opt?.nickname }}
|
|
||||||
{{ scope.opt?.code }}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelectWorker>
|
|
||||||
<VnSelect
|
<VnSelect
|
||||||
v-else
|
v-else
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
|
|
|
@ -57,6 +57,7 @@ function onFetch(rows, newRows) {
|
||||||
const price = row.quantity * sale.price;
|
const price = row.quantity * sale.price;
|
||||||
const discount = (sale.discount * price) / 100;
|
const discount = (sale.discount * price) / 100;
|
||||||
amountClaimed.value = amountClaimed.value + (price - discount);
|
amountClaimed.value = amountClaimed.value + (price - discount);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,9 +208,10 @@ async function saveWhenHasChanges() {
|
||||||
selection="multiple"
|
selection="multiple"
|
||||||
v-model:selected="selected"
|
v-model:selected="selected"
|
||||||
:grid="$q.screen.lt.md"
|
:grid="$q.screen.lt.md"
|
||||||
|
|
||||||
>
|
>
|
||||||
<template #body-cell-claimed="{ row }">
|
<template #body-cell-claimed="{ row }">
|
||||||
<QTd auto-width align="right" class="text-primary">
|
<QTd auto-width align="right" class="text-primary shrink">
|
||||||
<QInput
|
<QInput
|
||||||
v-model.number="row.quantity"
|
v-model.number="row.quantity"
|
||||||
type="number"
|
type="number"
|
||||||
|
@ -220,7 +222,7 @@ async function saveWhenHasChanges() {
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-description="{ row, value }">
|
<template #body-cell-description="{ row, value }">
|
||||||
<QTd auto-width align="right" class="text-primary">
|
<QTd auto-width align="right" class="link expand">
|
||||||
{{ value }}
|
{{ value }}
|
||||||
<ItemDescriptorProxy
|
<ItemDescriptorProxy
|
||||||
:id="row.sale.itemFk"
|
:id="row.sale.itemFk"
|
||||||
|
@ -228,7 +230,7 @@ async function saveWhenHasChanges() {
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-discount="{ row, value, rowIndex }">
|
<template #body-cell-discount="{ row, value, rowIndex }">
|
||||||
<QTd auto-width align="right" class="text-primary">
|
<QTd auto-width align="right" class="link shrink">
|
||||||
{{ value }}
|
{{ value }}
|
||||||
<VnDiscount
|
<VnDiscount
|
||||||
:quantity="row.quantity"
|
:quantity="row.quantity"
|
||||||
|
@ -264,7 +266,7 @@ async function saveWhenHasChanges() {
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection side>
|
<QItemSection side>
|
||||||
<template v-if="column.name === 'claimed'">
|
<template v-if="column.name === 'claimed'">
|
||||||
<QItemLabel class="text-primary">
|
<QItemLabel class="text-primary shrink">
|
||||||
<QInput
|
<QInput
|
||||||
v-model.number="
|
v-model.number="
|
||||||
props.row.quantity
|
props.row.quantity
|
||||||
|
@ -282,7 +284,7 @@ async function saveWhenHasChanges() {
|
||||||
<template
|
<template
|
||||||
v-else-if="column.name === 'discount'"
|
v-else-if="column.name === 'discount'"
|
||||||
>
|
>
|
||||||
<QItemLabel class="text-primary">
|
<QItemLabel class="text-primary shrink">
|
||||||
{{ column.value }}
|
{{ column.value }}
|
||||||
<VnDiscount
|
<VnDiscount
|
||||||
:quantity="props.row.quantity"
|
:quantity="props.row.quantity"
|
||||||
|
@ -330,6 +332,7 @@ async function saveWhenHasChanges() {
|
||||||
.grid-style-transition {
|
.grid-style-transition {
|
||||||
transition: transform 0.28s, background-color 0.28s;
|
transition: transform 0.28s, background-color 0.28s;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -345,12 +345,9 @@ function claimUrl(section) {
|
||||||
<span v-if="col.name != 'description'">{{
|
<span v-if="col.name != 'description'">{{
|
||||||
t(col.value)
|
t(col.value)
|
||||||
}}</span>
|
}}</span>
|
||||||
<QBtn
|
<span class="link" v-if="col.name === 'description'">{{
|
||||||
v-if="col.name == 'description'"
|
t(col.value)
|
||||||
flat
|
}}</span>
|
||||||
color="blue"
|
|
||||||
>{{ col.value }}</QBtn
|
|
||||||
>
|
|
||||||
<ItemDescriptorProxy
|
<ItemDescriptorProxy
|
||||||
v-if="col.name == 'description'"
|
v-if="col.name == 'description'"
|
||||||
:id="props.row.sale.itemFk"
|
:id="props.row.sale.itemFk"
|
||||||
|
|
|
@ -30,7 +30,7 @@ defineExpose({ states });
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params, searchFn }">
|
<template #body="{ params }">
|
||||||
<div class="q-pa-sm q-gutter-y-sm">
|
<div class="q-pa-sm q-gutter-y-sm">
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('claim.customerId')"
|
:label="t('claim.customerId')"
|
||||||
|
@ -49,12 +49,9 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Salesperson')"
|
:label="t('Salesperson')"
|
||||||
v-model="params.salesPersonFk"
|
v-model="params.salesPersonFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/activeWithInheritedRole"
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
option-filter="firstName"
|
option-filter="firstName"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
@ -63,12 +60,9 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('claim.attendedBy')"
|
:label="t('claim.attendedBy')"
|
||||||
v-model="params.attenderFk"
|
v-model="params.attenderFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/activeWithInheritedRole"
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
option-filter="firstName"
|
option-filter="firstName"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
@ -77,9 +71,7 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('claim.state')"
|
:label="t('claim.state')"
|
||||||
v-model="params.claimStateFk"
|
v-model="params.claimStateFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="states"
|
:options="states"
|
||||||
option-value="id"
|
|
||||||
option-label="description"
|
option-label="description"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
|
@ -87,7 +79,6 @@ defineExpose({ states });
|
||||||
/>
|
/>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
v-model="params.created"
|
v-model="params.created"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:label="t('claim.created')"
|
:label="t('claim.created')"
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
|
@ -96,10 +87,7 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Item')"
|
:label="t('Item')"
|
||||||
v-model="params.itemFk"
|
v-model="params.itemFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Items/withName"
|
url="Items/withName"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
sort-by="id DESC"
|
sort-by="id DESC"
|
||||||
outlined
|
outlined
|
||||||
|
@ -118,21 +106,26 @@ defineExpose({ states });
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('claim.responsible')"
|
:label="t('claim.responsible')"
|
||||||
v-model="params.claimResponsibleFk"
|
v-model="params.claimResponsibleFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
url="Workers/activeWithInheritedRole"
|
url="Workers/activeWithInheritedRole"
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
:use-like="false"
|
:use-like="false"
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
option-filter="firstName"
|
option-filter="firstName"
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
rounded
|
rounded
|
||||||
/>
|
/>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('claim.zone')"
|
||||||
|
v-model="params.zoneFk"
|
||||||
|
url="Zones"
|
||||||
|
:use-like="false"
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
dense
|
||||||
|
/>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="params.myTeam"
|
v-model="params.myTeam"
|
||||||
:label="t('params.myTeam')"
|
:label="t('params.myTeam')"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -153,6 +146,7 @@ en:
|
||||||
created: Created
|
created: Created
|
||||||
myTeam: My team
|
myTeam: My team
|
||||||
itemFk: Item
|
itemFk: Item
|
||||||
|
zoneFk: Zone
|
||||||
es:
|
es:
|
||||||
params:
|
params:
|
||||||
search: Contiene
|
search: Contiene
|
||||||
|
@ -165,6 +159,7 @@ es:
|
||||||
created: Creada
|
created: Creada
|
||||||
myTeam: Mi equipo
|
myTeam: Mi equipo
|
||||||
itemFk: Artículo
|
itemFk: Artículo
|
||||||
|
zoneFk: Zona
|
||||||
Client Name: Nombre del cliente
|
Client Name: Nombre del cliente
|
||||||
Salesperson: Comercial
|
Salesperson: Comercial
|
||||||
Item: Artículo
|
Item: Artículo
|
||||||
|
|
|
@ -10,6 +10,7 @@ import ClaimSummary from './Card/ClaimSummary.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
|
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
@ -95,7 +96,12 @@ const columns = computed(() => [
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderBy: 'priority',
|
orderBy: 'cs.priority',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
label: t('claim.zone'),
|
||||||
|
name: 'zoneFk',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -105,6 +111,7 @@ const columns = computed(() => [
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
action: (row) => viewSummary(row.id, ClaimSummary),
|
action: (row) => viewSummary(row.id, ClaimSummary),
|
||||||
|
isPrimary: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -131,11 +138,10 @@ const STATE_COLOR = {
|
||||||
<VnTable
|
<VnTable
|
||||||
data-key="ClaimList"
|
data-key="ClaimList"
|
||||||
url="Claims/filter"
|
url="Claims/filter"
|
||||||
:order="['t.priority ASC', 'created ASC']"
|
:order="['cs.priority ASC', 'created ASC']"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="claim"
|
redirect="claim"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
auto-load
|
|
||||||
>
|
>
|
||||||
<template #column-clientFk="{ row }">
|
<template #column-clientFk="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
|
@ -148,6 +154,12 @@ const STATE_COLOR = {
|
||||||
<VnUserLink :name="row.workerName" :worker-id="row.workerFk" />
|
<VnUserLink :name="row.workerName" :worker-id="row.workerFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-zoneFk="{ row }">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.zoneName }}
|
||||||
|
<ZoneDescriptorProxy :id="row.zoneId" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ const columns = computed(() => [
|
||||||
label: t('Creation date'),
|
label: t('Creation date'),
|
||||||
format: ({ created }) => toDateHourMin(created),
|
format: ({ created }) => toDateHourMin(created),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
|
style: 'color: var(--vn-label-color)',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -16,14 +16,17 @@ const { t } = useI18n();
|
||||||
|
|
||||||
const businessTypes = ref([]);
|
const businessTypes = ref([]);
|
||||||
const contactChannels = ref([]);
|
const contactChannels = ref([]);
|
||||||
const handleSalesModelValue = (val) => ({
|
const handleSalesModelValue = (val) => {
|
||||||
|
if (!val) val = '';
|
||||||
|
return {
|
||||||
or: [
|
or: [
|
||||||
{ id: val },
|
{ id: val },
|
||||||
{ name: val },
|
{ name: val },
|
||||||
{ nickname: { like: '%' + val + '%' } },
|
{ nickname: { like: '%' + val + '%' } },
|
||||||
{ code: { like: `${val}%` } },
|
{ code: { like: `${val}%` } },
|
||||||
],
|
],
|
||||||
});
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, onMounted } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
@ -14,7 +14,12 @@ import CustomerDescriptorMenu from './CustomerDescriptorMenu.vue';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
const state = useState();
|
const state = useState();
|
||||||
|
|
||||||
const customer = computed(() => state.get('customer'));
|
const customer = ref();
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
customer.value = state.get('customer');
|
||||||
|
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
|
||||||
|
});
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -38,7 +43,6 @@ const entityId = computed(() => {
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = (entity) => {
|
const setData = (entity) => {
|
||||||
data.value = useCardDescription(entity?.name, entity?.id);
|
data.value = useCardDescription(entity?.name, entity?.id);
|
||||||
if (customer.value) customer.value.webAccess = data.value?.account?.isActive;
|
|
||||||
};
|
};
|
||||||
const debtWarning = computed(() => {
|
const debtWarning = computed(() => {
|
||||||
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
return customer.value?.debt > customer.value?.credit ? 'negative' : 'primary';
|
||||||
|
|
|
@ -12,14 +12,17 @@ defineProps({
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const handleSalesModelValue = (val) => ({
|
const handleSalesModelValue = (val) => {
|
||||||
|
if (!val) val = '';
|
||||||
|
return {
|
||||||
or: [
|
or: [
|
||||||
{ id: val },
|
{ id: val },
|
||||||
{ name: val },
|
{ name: val },
|
||||||
{ nickname: { like: '%' + val + '%' } },
|
{ nickname: { like: '%' + val + '%' } },
|
||||||
{ code: { like: `${val}%` } },
|
{ code: { like: `${val}%` } },
|
||||||
],
|
],
|
||||||
});
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const exprBuilder = (param, value) => {
|
const exprBuilder = (param, value) => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -2,22 +2,21 @@
|
||||||
import { ref, computed, markRaw } from 'vue';
|
import { ref, computed, markRaw } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
import { toDate } from 'src/filters';
|
||||||
|
|
||||||
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import CustomerSummary from './Card/CustomerSummary.vue';
|
||||||
|
import CustomerFilter from './CustomerFilter.vue';
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import CustomerSummary from './Card/CustomerSummary.vue';
|
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
||||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||||
import { toDate } from 'src/filters';
|
|
||||||
import CustomerFilter from './CustomerFilter.vue';
|
|
||||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -405,6 +404,7 @@ function handleLocation(data, location) {
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
data-key="CustomerList"
|
data-key="CustomerList"
|
||||||
url="Clients/filter"
|
url="Clients/filter"
|
||||||
|
order="id DESC"
|
||||||
:create="{
|
:create="{
|
||||||
urlCreate: 'Clients/createWithUser',
|
urlCreate: 'Clients/createWithUser',
|
||||||
title: t('globals.pageTitles.customerCreate'),
|
title: t('globals.pageTitles.customerCreate'),
|
||||||
|
@ -414,10 +414,9 @@ function handleLocation(data, location) {
|
||||||
isEqualizated: false,
|
isEqualizated: false,
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
order="id DESC"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="customer"
|
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
|
redirect="customer"
|
||||||
>
|
>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnSelectWorker
|
<VnSelectWorker
|
||||||
|
@ -430,7 +429,26 @@ function handleLocation(data, location) {
|
||||||
:id-value="data.salesPersonFk"
|
:id-value="data.salesPersonFk"
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
auto-load
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<VnAvatar
|
||||||
|
:worker-id="data.salesPersonFk"
|
||||||
|
color="primary"
|
||||||
|
:title="title"
|
||||||
/>
|
/>
|
||||||
|
</template>
|
||||||
|
<template #option="scope">
|
||||||
|
<QItem v-bind="scope.itemProps">
|
||||||
|
<QItemSection>
|
||||||
|
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||||
|
<QItemLabel caption
|
||||||
|
>{{ scope.opt?.nickname }},
|
||||||
|
{{ scope.opt?.code }}</QItemLabel
|
||||||
|
>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelectWorker>
|
||||||
<VnLocation
|
<VnLocation
|
||||||
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
:acls="[{ model: 'Province', props: '*', accessType: 'WRITE' }]"
|
||||||
v-model="data.location"
|
v-model="data.location"
|
||||||
|
@ -451,7 +469,7 @@ function handleLocation(data, location) {
|
||||||
</template>
|
</template>
|
||||||
<i18n>
|
<i18n>
|
||||||
es:
|
es:
|
||||||
Web user: Usuario Web
|
Web user: Usuario web
|
||||||
</i18n>
|
</i18n>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.col-content {
|
.col-content {
|
||||||
|
|
|
@ -52,7 +52,7 @@ const { t } = useI18n();
|
||||||
<VnSelectWorker
|
<VnSelectWorker
|
||||||
:label="t('department.bossDepartment')"
|
:label="t('department.bossDepartment')"
|
||||||
v-model="data.workerFk"
|
v-model="data.workerFk"
|
||||||
:rules="validate('department.workerFk')"
|
:rules="validate('department.bossDepartment')"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('department.selfConsumptionCustomer')"
|
:label="t('department.selfConsumptionCustomer')"
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
|
|
||||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
@ -20,11 +18,6 @@ const props = defineProps({
|
||||||
|
|
||||||
const currenciesOptions = ref([]);
|
const currenciesOptions = ref([]);
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
onMounted(async () => {
|
|
||||||
stateStore.rightDrawer = true;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -49,8 +49,10 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('globals.id'),
|
label: t('globals.id'),
|
||||||
name: 'id',
|
name: 'id',
|
||||||
isTitle: true,
|
isId: true,
|
||||||
cardVisible: true,
|
chip: {
|
||||||
|
condition: () => true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -177,9 +179,6 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
onMounted(async () => {
|
|
||||||
stateStore.rightDrawer = true;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
|
@ -207,7 +206,6 @@ onMounted(async () => {
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="entry"
|
redirect="entry"
|
||||||
auto-load
|
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
>
|
>
|
||||||
<template #column-status="{ row }">
|
<template #column-status="{ row }">
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, onMounted, onUnmounted } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { downloadFile } from 'src/composables/downloadFile';
|
import { downloadFile } from 'src/composables/downloadFile';
|
||||||
import { toDate, toCurrency } from 'src/filters/index';
|
import { toDate, toCurrency } from 'src/filters/index';
|
||||||
|
@ -17,14 +16,10 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
const user = useState().getUser();
|
const user = useState().getUser();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
onMounted(async () => (stateStore.rightDrawer = true));
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const companies = ref([]);
|
const companies = ref([]);
|
||||||
const cols = computed(() => [
|
const cols = computed(() => [
|
||||||
|
@ -38,6 +33,10 @@ const cols = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: 'Id',
|
label: 'Id',
|
||||||
|
isId: true,
|
||||||
|
chip: {
|
||||||
|
condition: () => true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -51,6 +50,7 @@ const cols = computed(() => [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -81,6 +81,7 @@ const cols = computed(() => [
|
||||||
component: 'date',
|
component: 'date',
|
||||||
},
|
},
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.dueDated)),
|
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.dueDated)),
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -92,6 +93,7 @@ const cols = computed(() => [
|
||||||
name: 'amount',
|
name: 'amount',
|
||||||
label: t('InvoiceIn.list.amount'),
|
label: t('InvoiceIn.list.amount'),
|
||||||
format: ({ amount }) => toCurrency(amount),
|
format: ({ amount }) => toCurrency(amount),
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'companyFk',
|
name: 'companyFk',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, onUnmounted, ref, computed, watchEffect } from 'vue';
|
import { ref, computed, watchEffect } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
|
@ -10,7 +10,6 @@ import { usePrintService } from 'src/composables/usePrintService';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
|
import InvoiceOutSummary from './Card/InvoiceOutSummary.vue';
|
||||||
import { toCurrency, toDate } from 'src/filters/index';
|
import { toCurrency, toDate } from 'src/filters/index';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { QBtn } from 'quasar';
|
import { QBtn } from 'quasar';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
@ -21,7 +20,6 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const invoiceOutSerialsOptions = ref([]);
|
const invoiceOutSerialsOptions = ref([]);
|
||||||
|
@ -147,8 +145,6 @@ const columns = computed(() => [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
onMounted(() => (stateStore.rightDrawer = true));
|
|
||||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
|
||||||
|
|
||||||
function openPdf(id) {
|
function openPdf(id) {
|
||||||
openReport(`${MODEL}/${id}/download`);
|
openReport(`${MODEL}/${id}/download`);
|
||||||
|
@ -214,7 +210,6 @@ watchEffect(selectedRows);
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="invoice-out"
|
redirect="invoice-out"
|
||||||
auto-load
|
|
||||||
:table="{
|
:table="{
|
||||||
'row-key': 'id',
|
'row-key': 'id',
|
||||||
selection: 'multiple',
|
selection: 'multiple',
|
||||||
|
|
|
@ -203,6 +203,12 @@ const onIntrastatCreated = (response, formData) => {
|
||||||
v-model="data.hasKgPrice"
|
v-model="data.hasKgPrice"
|
||||||
:label="t('item.basicData.hasKgPrice')"
|
:label="t('item.basicData.hasKgPrice')"
|
||||||
/>
|
/>
|
||||||
|
<QCheckbox
|
||||||
|
v-model="data.isCustomInspectionRequired"
|
||||||
|
:label="t('item.basicData.isCustomInspectionRequired')"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div>
|
<div>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="data.isFragile"
|
v-model="data.isFragile"
|
||||||
|
|
|
@ -233,7 +233,7 @@ async function updateWarehouse(warehouseFk) {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center">
|
||||||
<QTable
|
<QTable
|
||||||
:rows="itemBalances"
|
:rows="itemBalances"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
|
|
@ -53,7 +53,6 @@ const columns = computed(() => [
|
||||||
name: 'itemFk',
|
name: 'itemFk',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
isId: true,
|
isId: true,
|
||||||
cardVisible: true,
|
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
@ -65,14 +64,12 @@ const columns = computed(() => [
|
||||||
name: 'name',
|
name: 'name',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
create: true,
|
create: true,
|
||||||
cardVisible: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.fixedPrice.groupingPrice'),
|
label: t('item.fixedPrice.groupingPrice'),
|
||||||
field: 'rate2',
|
field: 'rate2',
|
||||||
name: 'rate2',
|
name: 'rate2',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
@ -81,7 +78,6 @@ const columns = computed(() => [
|
||||||
field: 'rate3',
|
field: 'rate3',
|
||||||
name: 'rate3',
|
name: 'rate3',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
@ -91,7 +87,6 @@ const columns = computed(() => [
|
||||||
field: 'minPrice',
|
field: 'minPrice',
|
||||||
name: 'minPrice',
|
name: 'minPrice',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
},
|
},
|
||||||
|
@ -100,7 +95,6 @@ const columns = computed(() => [
|
||||||
field: 'started',
|
field: 'started',
|
||||||
name: 'started',
|
name: 'started',
|
||||||
format: ({ started }) => toDate(started),
|
format: ({ started }) => toDate(started),
|
||||||
cardVisible: true,
|
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'date',
|
component: 'date',
|
||||||
|
@ -116,7 +110,6 @@ const columns = computed(() => [
|
||||||
field: 'ended',
|
field: 'ended',
|
||||||
name: 'ended',
|
name: 'ended',
|
||||||
...defaultColumnAttrs,
|
...defaultColumnAttrs,
|
||||||
cardVisible: true,
|
|
||||||
columnField: {
|
columnField: {
|
||||||
component: 'date',
|
component: 'date',
|
||||||
class: 'shrink',
|
class: 'shrink',
|
||||||
|
@ -251,11 +244,14 @@ const upsertPrice = async (props, resetMinPrice = false) => {
|
||||||
}
|
}
|
||||||
if (!changes.updates && !changes.creates) return;
|
if (!changes.updates && !changes.creates) return;
|
||||||
const data = await upsertFixedPrice(row);
|
const data = await upsertFixedPrice(row);
|
||||||
tableRef.value.CrudModelRef.formData[props.rowIndex] = data;
|
Object.assign(tableRef.value.CrudModelRef.formData[props.rowIndex], data);
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
tableRef.value.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
async function upsertFixedPrice(row) {
|
async function upsertFixedPrice(row) {
|
||||||
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
const { data } = await axios.patch('FixedPrices/upsertFixedPrice', row);
|
||||||
|
data.hasMinPrice = data.hasMinPrice ? 1 : 0;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,12 +391,6 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
</template>
|
</template>
|
||||||
</VnSubToolbar>
|
</VnSubToolbar>
|
||||||
<VnTable
|
<VnTable
|
||||||
@on-fetch="
|
|
||||||
(data) =>
|
|
||||||
data.forEach((item) => {
|
|
||||||
item.hasMinPrice = `${item.hasMinPrice !== 0}`;
|
|
||||||
})
|
|
||||||
"
|
|
||||||
:default-remove="false"
|
:default-remove="false"
|
||||||
:default-reset="false"
|
:default-reset="false"
|
||||||
:default-save="false"
|
:default-save="false"
|
||||||
|
@ -466,7 +456,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
</span>
|
</span>
|
||||||
<span class="subName">{{ row.subName }}</span>
|
<span class="subName">{{ row.subName }}</span>
|
||||||
<ItemDescriptorProxy :id="row.itemFk" />
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
<FetchedTags :item="row" />
|
<FetchedTags :item="row" :columns="3" />
|
||||||
</template>
|
</template>
|
||||||
<template #column-rate2="props">
|
<template #column-rate2="props">
|
||||||
<QTd class="col">
|
<QTd class="col">
|
||||||
|
@ -498,14 +488,15 @@ function handleOnDataSave({ CrudModelRef }) {
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:model-value="props.row.hasMinPrice"
|
:model-value="props.row.hasMinPrice"
|
||||||
@update:model-value="updateMinPrice($event, props)"
|
@update:model-value="updateMinPrice($event, props)"
|
||||||
:false-value="'false'"
|
:false-value="0"
|
||||||
:true-value="'true'"
|
:true-value="1"
|
||||||
|
:toggle-indeterminate="false"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
class="col"
|
class="col"
|
||||||
type="currency"
|
type="currency"
|
||||||
mask="###.##"
|
mask="###.##"
|
||||||
:disable="props.row.hasMinPrice === 1"
|
:disable="props.row.hasMinPrice === 0"
|
||||||
v-model.number="props.row.minPrice"
|
v-model.number="props.row.minPrice"
|
||||||
v-on="getRowUpdateInputEvents(props)"
|
v-on="getRowUpdateInputEvents(props)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -32,7 +32,7 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('components.itemsFilterPanel.buyerFk')"
|
:label="t('params.buyerFk')"
|
||||||
v-model="params.buyerFk"
|
v-model="params.buyerFk"
|
||||||
:options="itemTypeWorkersOptions"
|
:options="itemTypeWorkersOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -51,7 +51,7 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
auto-load
|
auto-load
|
||||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||||
:label="t('globals.warehouse')"
|
:label="t('params.warehouseFk')"
|
||||||
v-model="params.warehouseFk"
|
v-model="params.warehouseFk"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -66,7 +66,7 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('components.itemsFilterPanel.started')"
|
:label="t('params.started')"
|
||||||
v-model="params.started"
|
v-model="params.started"
|
||||||
is-outlined
|
is-outlined
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
@ -76,7 +76,7 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
<QItem class="q-my-md">
|
<QItem class="q-my-md">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('components.itemsFilterPanel.ended')"
|
:label="t('params.ended')"
|
||||||
v-model="params.ended"
|
v-model="params.ended"
|
||||||
is-outlined
|
is-outlined
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
@ -86,7 +86,7 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('components.itemsFilterPanel.mine')"
|
:label="t('params.mine')"
|
||||||
v-model="params.mine"
|
v-model="params.mine"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
@ -94,14 +94,14 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
|
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="params.showBadDates"
|
v-model="params.showBadDates"
|
||||||
:label="t(`components.itemsFilterPanel.showBadDates`)"
|
:label="t(`params.showBadDates`)"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
>
|
>
|
||||||
</QCheckbox>
|
</QCheckbox>
|
||||||
|
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('components.itemsFilterPanel.hasMinPrice')"
|
:label="t('params.hasMinPrice')"
|
||||||
v-model="params.hasMinPrice"
|
v-model="params.hasMinPrice"
|
||||||
toggle-indeterminate
|
toggle-indeterminate
|
||||||
@update:model-value="searchFn()"
|
@update:model-value="searchFn()"
|
||||||
|
@ -111,3 +111,23 @@ const itemTypeWorkersOptions = ref([]);
|
||||||
</template>
|
</template>
|
||||||
</ItemsFilterPanel>
|
</ItemsFilterPanel>
|
||||||
</template>
|
</template>
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
params:
|
||||||
|
buyerFk: Buyer
|
||||||
|
warehouseFk: Warehouse
|
||||||
|
started: Started
|
||||||
|
ended: Ended
|
||||||
|
mine: Mine
|
||||||
|
showBadDates: Show future items
|
||||||
|
hasMinPrice: Has Min Price
|
||||||
|
es:
|
||||||
|
params:
|
||||||
|
buyerFk: Comprador
|
||||||
|
warehouseFk: Almacén
|
||||||
|
started: Desde
|
||||||
|
ended: Hasta
|
||||||
|
mine: Para mi
|
||||||
|
showBadDates: Ver items a futuro
|
||||||
|
hasMinPrice: Precio mínimo
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import ItemSummary from '../Item/Card/ItemSummary.vue';
|
import ItemSummary from '../Item/Card/ItemSummary.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
import ItemDescriptorProxy from './Card/ItemDescriptorProxy.vue';
|
||||||
|
import ItemTypeDescriptorProxy from './ItemType/Card/ItemTypeDescriptorProxy.vue';
|
||||||
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
import { cloneItem } from 'src/pages/Item/composables/cloneItem';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import ItemListFilter from './ItemListFilter.vue';
|
import ItemListFilter from './ItemListFilter.vue';
|
||||||
|
@ -56,7 +57,6 @@ const columns = computed(() => [
|
||||||
name: 'image',
|
name: 'image',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
columnFilter: false,
|
columnFilter: false,
|
||||||
cardVisible: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.list.id'),
|
label: t('item.list.id'),
|
||||||
|
@ -94,7 +94,7 @@ const columns = computed(() => [
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'search',
|
name: 'search',
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
columnClass: 'expand',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.list.stems'),
|
label: t('item.list.stems'),
|
||||||
|
@ -132,10 +132,13 @@ const columns = computed(() => [
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
columnField: {
|
|
||||||
component: null,
|
|
||||||
},
|
|
||||||
create: true,
|
create: true,
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: t('item.list.typeName'),
|
||||||
|
name: 'typeName',
|
||||||
|
align: 'left',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('item.list.category'),
|
label: t('item.list.category'),
|
||||||
|
@ -220,7 +223,6 @@ const columns = computed(() => [
|
||||||
label: t('item.list.weight'),
|
label: t('item.list.weight'),
|
||||||
toolTip: t('item.list.weightByPiece'),
|
toolTip: t('item.list.weightByPiece'),
|
||||||
name: 'weightByPiece',
|
name: 'weightByPiece',
|
||||||
align: 'left',
|
|
||||||
component: 'input',
|
component: 'input',
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
|
@ -296,7 +298,6 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
data-key="ItemList"
|
data-key="ItemList"
|
||||||
|
@ -341,6 +342,13 @@ const columns = computed(() => [
|
||||||
<ItemDescriptorProxy :id="row.id" />
|
<ItemDescriptorProxy :id="row.id" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-typeName="{ row }">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.typeName }}
|
||||||
|
{{ row.typeFk }}
|
||||||
|
<ItemTypeDescriptorProxy :id="row.typeFk" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
<template #column-userName="{ row }">
|
<template #column-userName="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row.userName }}
|
{{ row.userName }}
|
||||||
|
@ -354,15 +362,15 @@ const columns = computed(() => [
|
||||||
{{ row?.subName.toUpperCase() }}
|
{{ row?.subName.toUpperCase() }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FetchedTags :item="row" :max-length="6" />
|
<FetchedTags :item="row" :columns="3" />
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.subName {
|
.subName {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
|
font-size: small;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
|
|
@ -6,13 +6,11 @@ import { useI18n } from 'vue-i18n';
|
||||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: false,
|
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
summary: {
|
summary: {
|
||||||
|
@ -24,6 +22,10 @@ const $props = defineProps({
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const entityId = computed(() => {
|
||||||
|
return $props.id || route.params.id;
|
||||||
|
});
|
||||||
|
|
||||||
const itemTypeFilter = {
|
const itemTypeFilter = {
|
||||||
include: [
|
include: [
|
||||||
{ relation: 'worker' },
|
{ relation: 'worker' },
|
||||||
|
@ -33,10 +35,6 @@ const itemTypeFilter = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const entityId = computed(() => {
|
|
||||||
return $props.id || route.params.id;
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = ref(useCardDescription());
|
const data = ref(useCardDescription());
|
||||||
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
|
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
|
||||||
</script>
|
</script>
|
||||||
|
@ -48,8 +46,8 @@ const setData = (entity) => (data.value = useCardDescription(entity.code, entity
|
||||||
:filter="itemTypeFilter"
|
:filter="itemTypeFilter"
|
||||||
:title="data.title"
|
:title="data.title"
|
||||||
:subtitle="data.subtitle"
|
:subtitle="data.subtitle"
|
||||||
|
data-key="itemTypeDescriptor"
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
data-key="entry"
|
|
||||||
>
|
>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('shared.code')" :value="entity.code" />
|
<VnLv :label="t('shared.code')" :value="entity.code" />
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<script setup>
|
||||||
|
import ItemTypeDescriptor from './ItemTypeDescriptor.vue';
|
||||||
|
import ItemTypeSummary from './ItemTypeSummary.vue';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QPopupProxy>
|
||||||
|
<ItemTypeDescriptor v-if="$props.id" :id="$props.id" :summary="ItemTypeSummary" />
|
||||||
|
</QPopupProxy>
|
||||||
|
</template>
|
|
@ -135,7 +135,7 @@ item:
|
||||||
origin: Orig.
|
origin: Orig.
|
||||||
userName: Buyer
|
userName: Buyer
|
||||||
weight: Weight
|
weight: Weight
|
||||||
weightByPiece: Weight/Piece
|
weightByPiece: Weight/stem
|
||||||
stemMultiplier: Multiplier
|
stemMultiplier: Multiplier
|
||||||
producer: Producer
|
producer: Producer
|
||||||
landed: Landed
|
landed: Landed
|
||||||
|
@ -158,6 +158,7 @@ item:
|
||||||
isFragileTooltip: Is shown at website, app that this item cannot travel (wreath, palms, ...)
|
isFragileTooltip: Is shown at website, app that this item cannot travel (wreath, palms, ...)
|
||||||
isPhotoRequested: Do photo
|
isPhotoRequested: Do photo
|
||||||
isPhotoRequestedTooltip: This item does need a photo
|
isPhotoRequestedTooltip: This item does need a photo
|
||||||
|
isCustomInspectionRequired: Needs physical inspection (PIF)
|
||||||
description: Description
|
description: Description
|
||||||
fixedPrice:
|
fixedPrice:
|
||||||
itemFk: Item ID
|
itemFk: Item ID
|
||||||
|
|
|
@ -136,7 +136,7 @@ item:
|
||||||
size: Medida
|
size: Medida
|
||||||
origin: Orig.
|
origin: Orig.
|
||||||
weight: Peso
|
weight: Peso
|
||||||
weightByPiece: Peso (gramos)/tallo
|
weightByPiece: Peso/tallo
|
||||||
userName: Comprador
|
userName: Comprador
|
||||||
stemMultiplier: Multiplicador
|
stemMultiplier: Multiplicador
|
||||||
producer: Productor
|
producer: Productor
|
||||||
|
@ -160,6 +160,7 @@ item:
|
||||||
isFragileTooltip: Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...)
|
isFragileTooltip: Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...)
|
||||||
isPhotoRequested: Hacer foto
|
isPhotoRequested: Hacer foto
|
||||||
isPhotoRequestedTooltip: Este artículo necesita una foto
|
isPhotoRequestedTooltip: Este artículo necesita una foto
|
||||||
|
isCustomInspectionRequired: Necesita inspección física (PIF)
|
||||||
description: Descripción
|
description: Descripción
|
||||||
fixedPrice:
|
fixedPrice:
|
||||||
itemFk: ID Artículo
|
itemFk: ID Artículo
|
||||||
|
|
|
@ -281,6 +281,7 @@ en:
|
||||||
problems: With problems
|
problems: With problems
|
||||||
pending: Pending
|
pending: Pending
|
||||||
alertLevel: Grouped State
|
alertLevel: Grouped State
|
||||||
|
department: Department
|
||||||
FREE: Free
|
FREE: Free
|
||||||
DELIVERED: Delivered
|
DELIVERED: Delivered
|
||||||
ON_PREPARATION: On preparation
|
ON_PREPARATION: On preparation
|
||||||
|
@ -300,6 +301,7 @@ es:
|
||||||
problems: Con problemas
|
problems: Con problemas
|
||||||
pending: Pendiente
|
pending: Pendiente
|
||||||
alertLevel: Estado agrupado
|
alertLevel: Estado agrupado
|
||||||
|
department: Departamento
|
||||||
FREE: Libre
|
FREE: Libre
|
||||||
DELIVERED: Servido
|
DELIVERED: Servido
|
||||||
ON_PREPARATION: En preparación
|
ON_PREPARATION: En preparación
|
||||||
|
|
|
@ -71,9 +71,11 @@ onMounted(async () => (stateStore.rightDrawer = false));
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<QCard v-if="volumeSummary" class="order-volume-summary q-pa-lg">
|
<QCard v-if="volumeSummary" class="order-volume-summary q-pa-lg">
|
||||||
<VnLv :label="t('total')" :value="`${volumeSummary?.totalVolume} m³`" />
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('boxes')"
|
:label="`${t('total')}: `"
|
||||||
|
:value="`${volumeSummary?.totalVolume} m³`" />
|
||||||
|
<VnLv
|
||||||
|
:label="`${t('boxes')}: `"
|
||||||
:value="`${dashIfEmpty(volumeSummary?.totalBoxes)} U`"
|
:value="`${dashIfEmpty(volumeSummary?.totalBoxes)} U`"
|
||||||
/>
|
/>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
@ -111,12 +113,12 @@ onMounted(async () => (stateStore.rightDrawer = false));
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.order-volume-summary {
|
.order-volume-summary {
|
||||||
.vn-label-value {
|
.vn-label-value {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 2%;
|
gap: 0.5%;
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
color: var(--vn-label-color);
|
color: var(--vn-label-color);
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import axios from 'axios';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref, onMounted } from 'vue';
|
||||||
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
import { dashIfEmpty, toCurrency, toDate } from 'src/filters';
|
||||||
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
import { toDateTimeFormat } from 'src/filters/date';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
|
||||||
|
import axios from 'axios';
|
||||||
|
import OrderSummary from 'pages/Order/Card/OrderSummary.vue';
|
||||||
|
import OrderSearchbar from './Card/OrderSearchbar.vue';
|
||||||
|
import OrderFilter from './Card/OrderFilter.vue';
|
||||||
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
|
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import OrderSearchbar from './Card/OrderSearchbar.vue';
|
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
|
||||||
import OrderFilter from './Card/OrderFilter.vue';
|
|
||||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
|
||||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
|
||||||
import { toDateTimeFormat } from 'src/filters/date';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
@ -171,9 +173,9 @@ const getDateColor = (date) => {
|
||||||
today.setHours(0, 0, 0, 0);
|
today.setHours(0, 0, 0, 0);
|
||||||
const timeTicket = new Date(date);
|
const timeTicket = new Date(date);
|
||||||
timeTicket.setHours(0, 0, 0, 0);
|
timeTicket.setHours(0, 0, 0, 0);
|
||||||
const comparation = today - timeTicket;
|
const difference = today - timeTicket;
|
||||||
if (comparation == 0) return 'bg-warning';
|
if (difference == 0) return 'bg-warning';
|
||||||
if (comparation < 0) return 'bg-success';
|
if (difference < 0) return 'bg-success';
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
@ -201,8 +203,8 @@ const getDateColor = (date) => {
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
:user-params="{ showEmpty: false }"
|
:user-params="{ showEmpty: false }"
|
||||||
:right-search="false"
|
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
:right-search="false"
|
||||||
redirect="order"
|
redirect="order"
|
||||||
>
|
>
|
||||||
<template #column-clientFk="{ row }">
|
<template #column-clientFk="{ row }">
|
||||||
|
|
|
@ -26,7 +26,7 @@ const routeFilter = {
|
||||||
};
|
};
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'right',
|
||||||
isId: true,
|
isId: true,
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: 'Id',
|
label: 'Id',
|
||||||
|
|
|
@ -43,7 +43,7 @@ const filter = {
|
||||||
data-key="ShelvingSummary"
|
data-key="ShelvingSummary"
|
||||||
>
|
>
|
||||||
<template #header="{ entity }">
|
<template #header="{ entity }">
|
||||||
<div>{{ entity.code }}</div>
|
<div>{{ entity.id }} - {{ entity.code }}</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<QCard class="vn-one">
|
<QCard class="vn-one">
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { onMounted } from 'vue';
|
|
||||||
import CardList from 'components/ui/CardList.vue';
|
import CardList from 'components/ui/CardList.vue';
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
@ -12,7 +10,6 @@ import ShelvingSearchbar from 'pages/Shelving/Card/ShelvingSearchbar.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
|
@ -20,8 +17,6 @@ const filter = {
|
||||||
include: [{ relation: 'parking' }],
|
include: [{ relation: 'parking' }],
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = true));
|
|
||||||
|
|
||||||
function navigate(id) {
|
function navigate(id) {
|
||||||
router.push({ path: `/shelving/${id}` });
|
router.push({ path: `/shelving/${id}` });
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@ import axios from 'axios';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
|
||||||
const { notify } = useNotify();
|
|
||||||
const route = useRoute();
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
const bankEntitiesRef = ref(null);
|
const bankEntitiesRef = ref(null);
|
||||||
const supplier = ref(null);
|
const supplier = ref(null);
|
||||||
|
|
|
@ -6,9 +6,11 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
import VnSelectWorker from 'src/components/common/VnSelectWorker.vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const arrayData = useArrayData();
|
||||||
const companySizes = [
|
const companySizes = [
|
||||||
{ id: 'small', name: t('globals.small'), size: '1-5' },
|
{ id: 'small', name: t('globals.small'), size: '1-5' },
|
||||||
{ id: 'medium', name: t('globals.medium'), size: '6-50' },
|
{ id: 'medium', name: t('globals.medium'), size: '6-50' },
|
||||||
|
@ -22,6 +24,7 @@ const companySizes = [
|
||||||
model="supplier"
|
model="supplier"
|
||||||
auto-load
|
auto-load
|
||||||
:clear-store-on-unmount="false"
|
:clear-store-on-unmount="false"
|
||||||
|
@on-data-saved="arrayData.fetch({})"
|
||||||
>
|
>
|
||||||
<template #form="{ data, validate }">
|
<template #form="{ data, validate }">
|
||||||
<VnRow>
|
<VnRow>
|
||||||
|
|
|
@ -9,7 +9,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import { toDateString } from 'src/filters';
|
import { toDateString } from 'src/filters';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
import { getUrl } from 'src/composables/getUrl';
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -26,7 +26,7 @@ const $props = defineProps({
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const url = ref();
|
const url = ref();
|
||||||
const state = useState();
|
const arrayData = useArrayData();
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: [
|
fields: [
|
||||||
|
@ -77,7 +77,7 @@ const setData = (entity) => {
|
||||||
data.value = useCardDescription(entity.ref, entity.id);
|
data.value = useCardDescription(entity.ref, entity.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const supplier = computed(() => state.get('supplier'));
|
const supplier = computed(() => arrayData.store.data);
|
||||||
|
|
||||||
const getEntryQueryParams = (supplier) => {
|
const getEntryQueryParams = (supplier) => {
|
||||||
if (!supplier) return null;
|
if (!supplier) return null;
|
||||||
|
|
|
@ -41,7 +41,7 @@ const getUrl = (section) => `#/supplier/${entityId.value}/${section}`;
|
||||||
data-key="SupplierSummary"
|
data-key="SupplierSummary"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>{{ supplier.name }} - {{ supplier.id }}</span>
|
<span>{{ supplier.id }} - {{ supplier.name }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #body>
|
<template #body>
|
||||||
|
|
|
@ -14,7 +14,10 @@ const columns = computed(() => [
|
||||||
align: 'left',
|
align: 'left',
|
||||||
label: t('globals.id'),
|
label: t('globals.id'),
|
||||||
name: 'id',
|
name: 'id',
|
||||||
isTitle: true,
|
isId: true,
|
||||||
|
chip: {
|
||||||
|
condition: () => true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -24,6 +27,7 @@ const columns = computed(() => [
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'search',
|
name: 'search',
|
||||||
},
|
},
|
||||||
|
isTitle: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -32,6 +36,7 @@ const columns = computed(() => [
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
inWhere: true,
|
inWhere: true,
|
||||||
},
|
},
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -40,6 +45,7 @@ const columns = computed(() => [
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
name: 'search',
|
name: 'search',
|
||||||
},
|
},
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -119,7 +125,6 @@ const columns = computed(() => [
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
order="id ASC"
|
order="id ASC"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
auto-load
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('basicData.item'),
|
label: t('basicData.item'),
|
||||||
name: 'packagingItemFk',
|
name: 'longName',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
columnFilter: {
|
columnFilter: {
|
||||||
|
@ -321,12 +321,18 @@ onMounted(async () => {
|
||||||
"
|
"
|
||||||
order="created DESC"
|
order="created DESC"
|
||||||
>
|
>
|
||||||
<template #column-packagingItemFk="{ row }">
|
<template #column-freightItemName="{ row }">
|
||||||
<span class="link" @click.stop>
|
<span class="link" @click.stop>
|
||||||
{{ row.packagingItemFk }}
|
{{ row.freightItemName }}
|
||||||
<ItemDescriptorProxy :id="row.packagingItemFk" />
|
<ItemDescriptorProxy :id="row.packagingItemFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #column-longName="{ row }">
|
||||||
|
<span class="link" @click.stop>
|
||||||
|
{{ row.longName }}
|
||||||
|
<ItemDescriptorProxy :id="row.itemFk" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
<QDialog ref="newTicketDialogRef" transition-show="scale" transition-hide="scale">
|
<QDialog ref="newTicketDialogRef" transition-show="scale" transition-hide="scale">
|
||||||
<ExpeditionNewTicket
|
<ExpeditionNewTicket
|
||||||
|
|
|
@ -100,6 +100,7 @@ const columns = computed(() => [
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
cardVisible: true,
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson),
|
format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -131,12 +132,14 @@ const columns = computed(() => [
|
||||||
name: 'nickname',
|
name: 'nickname',
|
||||||
label: t('ticketList.nickname'),
|
label: t('ticketList.nickname'),
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
isTitle: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'addressNickname',
|
name: 'addressNickname',
|
||||||
label: t('ticketList.addressNickname'),
|
label: t('ticketList.addressNickname'),
|
||||||
columnClass: 'expand',
|
columnClass: 'expand',
|
||||||
|
cardVisible: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
|
@ -1,15 +1,44 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import VnCard from 'components/common/VnCard.vue';
|
import VnCard from 'components/common/VnCard.vue';
|
||||||
import TravelDescriptor from './TravelDescriptor.vue';
|
import TravelDescriptor from './TravelDescriptor.vue';
|
||||||
import filter from './TravelFilter.js';
|
import TravelFilter from '../TravelFilter.vue';
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
fields: [
|
||||||
|
'id',
|
||||||
|
'ref',
|
||||||
|
'shipped',
|
||||||
|
'landed',
|
||||||
|
'totalEntries',
|
||||||
|
'warehouseInFk',
|
||||||
|
'warehouseOutFk',
|
||||||
|
'cargoSupplierFk',
|
||||||
|
'agencyModeFk',
|
||||||
|
],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'warehouseIn',
|
||||||
|
scope: {
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'warehouseOut',
|
||||||
|
scope: {
|
||||||
|
fields: ['name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Travel"
|
data-key="Travel"
|
||||||
base-url="Travels"
|
base-url="Travels"
|
||||||
:descriptor="TravelDescriptor"
|
|
||||||
:filter="filter"
|
|
||||||
search-data-key="TravelList"
|
search-data-key="TravelList"
|
||||||
|
:filter="filter"
|
||||||
|
:descriptor="TravelDescriptor"
|
||||||
|
:filter-panel="TravelFilter"
|
||||||
:searchbar-props="{
|
:searchbar-props="{
|
||||||
url: 'Travels/filter',
|
url: 'Travels/filter',
|
||||||
searchUrl: 'table',
|
searchUrl: 'table',
|
||||||
|
|
|
@ -240,7 +240,7 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
||||||
data-key="TravelSummary"
|
data-key="TravelSummary"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>{{ travel.ref }} - {{ travel.id }}</span>
|
<span>{{ travel.id }} - {{ travel.ref }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #body>
|
<template #body>
|
||||||
|
|
|
@ -11,9 +11,8 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import EntryDescriptorProxy from '../Entry/Card/EntryDescriptorProxy.vue';
|
import EntryDescriptorProxy from '../Entry/Card/EntryDescriptorProxy.vue';
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { toCurrency } from 'src/filters';
|
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate, toCurrency } from 'src/filters';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -128,6 +127,10 @@ const tableColumnComponents = {
|
||||||
component: 'span',
|
component: 'span',
|
||||||
attrs: {},
|
attrs: {},
|
||||||
},
|
},
|
||||||
|
isCustomInspectionRequired: {
|
||||||
|
component: 'span',
|
||||||
|
attrs: {},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
|
@ -589,7 +592,16 @@ const getColor = (percentage) => {
|
||||||
<QBtn flat class="link" dense>{{ entry.supplierName }}</QBtn>
|
<QBtn flat class="link" dense>{{ entry.supplierName }}</QBtn>
|
||||||
<SupplierDescriptorProxy :id="entry.supplierFk" />
|
<SupplierDescriptorProxy :id="entry.supplierFk" />
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd />
|
<QTd>
|
||||||
|
<QIcon
|
||||||
|
v-if="entry.isCustomInspectionRequired"
|
||||||
|
name="warning"
|
||||||
|
color="negative"
|
||||||
|
size="xs"
|
||||||
|
:title="t('requiresInspection')"
|
||||||
|
>
|
||||||
|
</QIcon>
|
||||||
|
</QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
<span>{{ toCurrency(entry.invoiceAmount) }}</span>
|
<span>{{ toCurrency(entry.invoiceAmount) }}</span>
|
||||||
</QTd>
|
</QTd>
|
||||||
|
@ -704,8 +716,9 @@ en:
|
||||||
physicKg: Phy. KG
|
physicKg: Phy. KG
|
||||||
shipped: W. shipped
|
shipped: W. shipped
|
||||||
landed: W. landed
|
landed: W. landed
|
||||||
|
requiresInspection: Requires inspection
|
||||||
|
BIP: Boder Inspection Point
|
||||||
notes: Notes
|
notes: Notes
|
||||||
|
|
||||||
es:
|
es:
|
||||||
searchExtraCommunity: Buscar por envío extra comunitario
|
searchExtraCommunity: Buscar por envío extra comunitario
|
||||||
kg: KG Bloq.
|
kg: KG Bloq.
|
||||||
|
@ -714,4 +727,6 @@ es:
|
||||||
landed: F. llegada
|
landed: F. llegada
|
||||||
notes: Notas
|
notes: Notas
|
||||||
Open as PDF: Abrir como PDF
|
Open as PDF: Abrir como PDF
|
||||||
|
requiresInspection: Requiere inspección
|
||||||
|
BIP: Punto de Inspección Fronteriza
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -27,7 +27,7 @@ defineExpose({ states });
|
||||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
<template #tags="{ tag, formatFn }">
|
<template #tags="{ tag, formatFn }">
|
||||||
<div class="q-gutter-x-xs">
|
<div class="q-gutter-x-xs">
|
||||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
<strong>{{ t(`travel.${tag.label}`) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -124,7 +124,7 @@ defineExpose({ states });
|
||||||
is-outlined
|
is-outlined
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('travel.travelList.tableVisibleColumns.daysOnward')"
|
:label="t('travel.daysOnward')"
|
||||||
v-model="params.daysOnward"
|
v-model="params.daysOnward"
|
||||||
lazy-rules
|
lazy-rules
|
||||||
is-outlined
|
is-outlined
|
||||||
|
@ -147,6 +147,7 @@ en:
|
||||||
landed: Landed
|
landed: Landed
|
||||||
landingHour: Landing Hour
|
landingHour: Landing Hour
|
||||||
totalEntries: Σ
|
totalEntries: Σ
|
||||||
|
daysOnward: Days Onward
|
||||||
es:
|
es:
|
||||||
travel:
|
travel:
|
||||||
Id: Id
|
Id: Id
|
||||||
|
@ -159,4 +160,5 @@ es:
|
||||||
landed: F.Entrega
|
landed: F.Entrega
|
||||||
landingHour: Hora de entrega
|
landingHour: Hora de entrega
|
||||||
totalEntries: Σ
|
totalEntries: Σ
|
||||||
|
daysOnward: Días en adelante
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRouter, useRoute } from 'vue-router';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import VnTable from 'components/VnTable/VnTable.vue';
|
import VnTable from 'components/VnTable/VnTable.vue';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import TravelSummary from './Card/TravelSummary.vue';
|
import TravelSummary from './Card/TravelSummary.vue';
|
||||||
|
@ -11,11 +10,11 @@ import { toDate } from 'src/filters';
|
||||||
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
|
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import TravelFilter from './TravelFilter.vue';
|
import TravelFilter from './TravelFilter.vue';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
|
@ -26,10 +25,6 @@ const $props = defineProps({
|
||||||
});
|
});
|
||||||
const entityId = computed(() => $props.id || route.params.id);
|
const entityId = computed(() => $props.id || route.params.id);
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
stateStore.rightDrawer = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
const cloneTravel = (travelData) => {
|
const cloneTravel = (travelData) => {
|
||||||
const stringifiedTravelData = JSON.stringify(travelData);
|
const stringifiedTravelData = JSON.stringify(travelData);
|
||||||
redirectToCreateView(stringifiedTravelData);
|
redirectToCreateView(stringifiedTravelData);
|
||||||
|
@ -51,11 +46,11 @@ const columns = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'id',
|
name: 'id',
|
||||||
label: t('globals.id'),
|
label: 'Id',
|
||||||
isId: true,
|
|
||||||
chip: {
|
chip: {
|
||||||
condition: () => true,
|
condition: () => true,
|
||||||
},
|
},
|
||||||
|
isId: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -144,7 +139,6 @@ const columns = computed(() => [
|
||||||
columnField: {
|
columnField: {
|
||||||
component: null,
|
component: null,
|
||||||
},
|
},
|
||||||
cardVisible: true,
|
|
||||||
create: true,
|
create: true,
|
||||||
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)),
|
format: (row, dashIfEmpty) => dashIfEmpty(toDate(row.landed)),
|
||||||
},
|
},
|
||||||
|
@ -222,7 +216,6 @@ const columns = computed(() => [
|
||||||
:user-params="{ daysOnward: 7 }"
|
:user-params="{ daysOnward: 7 }"
|
||||||
order="landed DESC"
|
order="landed DESC"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
auto-load
|
|
||||||
:is-editable="false"
|
:is-editable="false"
|
||||||
>
|
>
|
||||||
<template #column-status="{ row }">
|
<template #column-status="{ row }">
|
||||||
|
@ -281,7 +274,6 @@ const columns = computed(() => [
|
||||||
</template>
|
</template>
|
||||||
</VnTable>
|
</VnTable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
Add entry: Add entry
|
Add entry: Add entry
|
||||||
|
@ -296,7 +288,6 @@ es:
|
||||||
Add entry: Añadir Entrada
|
Add entry: Añadir Entrada
|
||||||
Create Travels: Crear envíos
|
Create Travels: Crear envíos
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.is-active {
|
.is-active {
|
||||||
color: #c8e484;
|
color: #c8e484;
|
||||||
|
|
|
@ -98,9 +98,7 @@ async function remove(row) {
|
||||||
url="Wagons"
|
url="Wagons"
|
||||||
:filter="filter"
|
:filter="filter"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
auto-load
|
|
||||||
order="id DESC"
|
order="id DESC"
|
||||||
:right-search="false"
|
|
||||||
:column-search="false"
|
:column-search="false"
|
||||||
:default-mode="'card'"
|
:default-mode="'card'"
|
||||||
:disable-option="{ table: true }"
|
:disable-option="{ table: true }"
|
||||||
|
|
|
@ -107,6 +107,7 @@ const columns = computed(() => [
|
||||||
title: t('components.smartCard.viewSummary'),
|
title: t('components.smartCard.viewSummary'),
|
||||||
icon: 'preview',
|
icon: 'preview',
|
||||||
action: (row) => viewSummary(row.id, WorkerSummary),
|
action: (row) => viewSummary(row.id, WorkerSummary),
|
||||||
|
isPrimary: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { computed, ref, onMounted } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { toCurrency } from 'src/filters';
|
import { toCurrency } from 'src/filters';
|
||||||
|
@ -9,7 +9,6 @@ import { toTimeFormat } from 'src/filters/date';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
|
||||||
import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
|
import ZoneSummary from 'src/pages/Zone/Card/ZoneSummary.vue';
|
||||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
|
@ -18,15 +17,16 @@ import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||||
import ZoneFilterPanel from './ZoneFilterPanel.vue';
|
import ZoneFilterPanel from './ZoneFilterPanel.vue';
|
||||||
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
|
import ZoneSearchbar from './Card/ZoneSearchbar.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { viewSummary } = useSummaryDialog();
|
const { viewSummary } = useSummaryDialog();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
const stateStore = useStateStore();
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
const warehouseOptions = ref([]);
|
const warehouseOptions = ref([]);
|
||||||
|
const validAddresses = ref([]);
|
||||||
|
|
||||||
const tableFilter = {
|
const tableFilter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -36,6 +36,32 @@ const tableFilter = {
|
||||||
fields: ['id', 'name'],
|
fields: ['id', 'name'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
relation: 'address',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'nickname', 'provinceFk', 'postalCode'],
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'province',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
relation: 'postcode',
|
||||||
|
scope: {
|
||||||
|
fields: ['code', 'townFk'],
|
||||||
|
include: {
|
||||||
|
relation: 'town',
|
||||||
|
scope: {
|
||||||
|
fields: ['id', 'name'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,7 +123,14 @@ const columns = computed(() => [
|
||||||
label: t('list.close'),
|
label: t('list.close'),
|
||||||
cardVisible: true,
|
cardVisible: true,
|
||||||
format: (row) => toTimeFormat(row.hour),
|
format: (row) => toTimeFormat(row.hour),
|
||||||
hidden: true,
|
columnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'left',
|
||||||
|
name: 'addressFk',
|
||||||
|
label: t('list.addressFk'),
|
||||||
|
cardVisible: true,
|
||||||
|
columnFilter: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -132,10 +165,26 @@ const handleClone = (id) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => (stateStore.rightDrawer = true));
|
function showValidAddresses(row) {
|
||||||
|
if (row.addressFk) {
|
||||||
|
const isValid = validAddresses.value.some(
|
||||||
|
(address) => address.addressFk === row.addressFk
|
||||||
|
);
|
||||||
|
if (isValid)
|
||||||
|
return `${row.address?.nickname},
|
||||||
|
${row.address?.postcode?.town?.name} (${row.address?.province?.name})`;
|
||||||
|
else return '-';
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="RoadmapAddresses"
|
||||||
|
auto-load
|
||||||
|
@on-fetch="(data) => (validAddresses = data)"
|
||||||
|
/>
|
||||||
<ZoneSearchbar />
|
<ZoneSearchbar />
|
||||||
<RightMenu>
|
<RightMenu>
|
||||||
<template #right-panel>
|
<template #right-panel>
|
||||||
|
@ -156,8 +205,10 @@ onMounted(() => (stateStore.rightDrawer = true));
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
redirect="zone"
|
redirect="zone"
|
||||||
:right-search="false"
|
:right-search="false"
|
||||||
auto-load
|
|
||||||
>
|
>
|
||||||
|
<template #column-addressFk="{ row }">
|
||||||
|
{{ showValidAddresses(row) }}
|
||||||
|
</template>
|
||||||
<template #more-create-dialog="{ data }">
|
<template #more-create-dialog="{ data }">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
url="AgencyModes"
|
url="AgencyModes"
|
||||||
|
|
|
@ -32,6 +32,7 @@ list:
|
||||||
warehouse: Warehouse
|
warehouse: Warehouse
|
||||||
createZone: Create zone
|
createZone: Create zone
|
||||||
zoneSummary: Summary
|
zoneSummary: Summary
|
||||||
|
addressFk: Address
|
||||||
create:
|
create:
|
||||||
name: Name
|
name: Name
|
||||||
closingHour: Closing hour
|
closingHour: Closing hour
|
||||||
|
|
|
@ -33,6 +33,7 @@ list:
|
||||||
isVolumetric: Volumétrico
|
isVolumetric: Volumétrico
|
||||||
createZone: Crear zona
|
createZone: Crear zona
|
||||||
zoneSummary: Resumen
|
zoneSummary: Resumen
|
||||||
|
addressFk: Consignatario
|
||||||
create:
|
create:
|
||||||
closingHour: Hora de cierre
|
closingHour: Hora de cierre
|
||||||
itemMaxSize: Medida máxima
|
itemMaxSize: Medida máxima
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue