forked from verdnatura/salix-front
merge with salix-front branch dev
This commit is contained in:
commit
59c8ada077
|
@ -58,7 +58,7 @@ module.exports = {
|
||||||
rules: {
|
rules: {
|
||||||
'prefer-promise-reject-errors': 'off',
|
'prefer-promise-reject-errors': 'off',
|
||||||
'no-unused-vars': 'warn',
|
'no-unused-vars': 'warn',
|
||||||
|
"vue/no-multiple-template-root": "off" ,
|
||||||
// allow debugger during development only
|
// allow debugger during development only
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"@quasar/extras": "^1.16.4",
|
"@quasar/extras": "^1.16.4",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"chromium": "^3.0.3",
|
"chromium": "^3.0.3",
|
||||||
|
"croppie": "^2.6.5",
|
||||||
"pinia": "^2.1.3",
|
"pinia": "^2.1.3",
|
||||||
"quasar": "^2.12.0",
|
"quasar": "^2.12.0",
|
||||||
"validator": "^13.9.0",
|
"validator": "^13.9.0",
|
||||||
|
@ -3169,6 +3170,11 @@
|
||||||
"node": ">= 10"
|
"node": ">= 10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/croppie": {
|
||||||
|
"version": "2.6.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz",
|
||||||
|
"integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
|
||||||
|
},
|
||||||
"node_modules/cross-spawn": {
|
"node_modules/cross-spawn": {
|
||||||
"version": "7.0.3",
|
"version": "7.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-front",
|
"name": "salix-front",
|
||||||
"version": "24.02.01",
|
"version": "24.8.0",
|
||||||
"description": "Salix frontend",
|
"description": "Salix frontend",
|
||||||
"productName": "Salix",
|
"productName": "Salix",
|
||||||
"author": "Verdnatura",
|
"author": "Verdnatura",
|
||||||
|
@ -19,13 +19,13 @@
|
||||||
"@quasar/extras": "^1.16.4",
|
"@quasar/extras": "^1.16.4",
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"chromium": "^3.0.3",
|
"chromium": "^3.0.3",
|
||||||
|
"croppie": "^2.6.5",
|
||||||
"pinia": "^2.1.3",
|
"pinia": "^2.1.3",
|
||||||
"quasar": "^2.12.0",
|
"quasar": "^2.12.0",
|
||||||
"validator": "^13.9.0",
|
"validator": "^13.9.0",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-i18n": "^9.2.2",
|
"vue-i18n": "^9.2.2",
|
||||||
"vue-router": "^4.2.1",
|
"vue-router": "^4.2.1"
|
||||||
"vue-router-mock": "^0.2.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
@ -54,16 +55,18 @@ const onDataSaved = (data) => {
|
||||||
<template #form-inputs="{ data, validate }">
|
<template #form-inputs="{ data, validate }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<QInput
|
<VnInput
|
||||||
:label="t('name')"
|
:label="t('name')"
|
||||||
v-model="data.name"
|
v-model="data.name"
|
||||||
|
:required="true"
|
||||||
:rules="validate('bankEntity.name')"
|
:rules="validate('bankEntity.name')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<QInput
|
<VnInput
|
||||||
:label="t('swift')"
|
:label="t('swift')"
|
||||||
v-model="data.bic"
|
v-model="data.bic"
|
||||||
|
:required="true"
|
||||||
:rules="validate('bankEntity.bic')"
|
:rules="validate('bankEntity.bic')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -77,11 +80,17 @@ const onDataSaved = (data) => {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="country"
|
option-label="country"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
:required="true"
|
||||||
:rules="validate('bankEntity.countryFk')"
|
:rules="validate('bankEntity.countryFk')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showEntityField" class="col">
|
<div v-if="showEntityField" class="col">
|
||||||
<QInput :label="t('id')" v-model="data.id" />
|
<VnInput
|
||||||
|
:label="t('id')"
|
||||||
|
v-model="data.id"
|
||||||
|
:required="true"
|
||||||
|
:rules="validate('city.name')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
|
@ -92,15 +101,15 @@ const onDataSaved = (data) => {
|
||||||
en:
|
en:
|
||||||
title: New bank entity
|
title: New bank entity
|
||||||
subtitle: Please, ensure you put the correct data!
|
subtitle: Please, ensure you put the correct data!
|
||||||
name: Name *
|
name: Name
|
||||||
swift: Swift *
|
swift: Swift
|
||||||
country: Country
|
country: Country
|
||||||
id: Entity code
|
id: Entity code
|
||||||
es:
|
es:
|
||||||
title: Nueva entidad bancaria
|
title: Nueva entidad bancaria
|
||||||
subtitle: ¡Por favor, asegúrate de poner los datos correctos!
|
subtitle: ¡Por favor, asegúrate de poner los datos correctos!
|
||||||
name: Nombre *
|
name: Nombre
|
||||||
swift: Swift *
|
swift: Swift
|
||||||
country: País
|
country: País
|
||||||
id: Código de la entidad
|
id: Código de la entidad
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -0,0 +1,363 @@
|
||||||
|
<script setup>
|
||||||
|
import { reactive, computed, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
|
import Croppie from 'croppie/croppie';
|
||||||
|
import 'croppie/croppie.css';
|
||||||
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const emit = defineEmits(['closeForm', 'onPhotoUploaded']);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
collection: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { notify } = useNotify();
|
||||||
|
|
||||||
|
const uploadMethodsOptions = [
|
||||||
|
{ label: t('Select from computer'), value: 'computer' },
|
||||||
|
{ label: t('Import from external URL'), value: 'URL' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const viewportTypes = [
|
||||||
|
{
|
||||||
|
code: 'normal',
|
||||||
|
description: t('Normal'),
|
||||||
|
viewport: {
|
||||||
|
width: 400,
|
||||||
|
height: 400,
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
width: 1200,
|
||||||
|
height: 1200,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'panoramic',
|
||||||
|
description: t('Panoramic'),
|
||||||
|
viewport: {
|
||||||
|
width: 675,
|
||||||
|
height: 450,
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
width: 1350,
|
||||||
|
height: 900,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: 'vertical',
|
||||||
|
description: t('Vertical'),
|
||||||
|
viewport: {
|
||||||
|
width: 306.66,
|
||||||
|
height: 533.33,
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
width: 460,
|
||||||
|
height: 800,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const uploadMethodSelected = ref('computer');
|
||||||
|
const viewPortTypeSelected = ref(viewportTypes[0]);
|
||||||
|
const inputFileRef = ref(null);
|
||||||
|
const allowedContentTypes = ref('');
|
||||||
|
const photoContainerRef = ref(null);
|
||||||
|
const editor = ref(null);
|
||||||
|
const newPhoto = reactive({
|
||||||
|
id: props.id,
|
||||||
|
collection: props.collection,
|
||||||
|
file: null,
|
||||||
|
url: null,
|
||||||
|
blob: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
const openInputFile = () => {
|
||||||
|
inputFileRef.value.pickFiles();
|
||||||
|
};
|
||||||
|
|
||||||
|
const displayEditor = () => {
|
||||||
|
const viewportType = viewPortTypeSelected.value;
|
||||||
|
const viewport = viewportType.viewport;
|
||||||
|
const boundaryWidth = viewport.width + 200;
|
||||||
|
const boundaryHeight = viewport.height + 200;
|
||||||
|
|
||||||
|
if (editor.value) editor.value.destroy();
|
||||||
|
editor.value = new Croppie(photoContainerRef.value, {
|
||||||
|
viewport: { width: viewport.width, height: viewport.height },
|
||||||
|
boundary: { width: boundaryWidth, height: boundaryHeight },
|
||||||
|
enableOrientation: true,
|
||||||
|
showZoomer: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const viewportSelection = computed({
|
||||||
|
get() {
|
||||||
|
return viewPortTypeSelected.value;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
viewPortTypeSelected.value = val;
|
||||||
|
|
||||||
|
const hasFile = newPhoto.files || newPhoto.url;
|
||||||
|
if (!val || !hasFile) return;
|
||||||
|
|
||||||
|
let file;
|
||||||
|
if (uploadMethodSelected.value == 'computer') file = newPhoto.files;
|
||||||
|
else if (uploadMethodSelected.value == 'URL') file = newPhoto.url;
|
||||||
|
|
||||||
|
updatePhotoPreview(file);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const updatePhotoPreview = (value) => {
|
||||||
|
if (value) {
|
||||||
|
displayEditor();
|
||||||
|
if (uploadMethodSelected.value == 'computer') {
|
||||||
|
newPhoto.files = value;
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = (e) => editor.value.bind({ url: e.target.result });
|
||||||
|
reader.readAsDataURL(value);
|
||||||
|
} else if (uploadMethodSelected.value == 'URL') {
|
||||||
|
newPhoto.url = value;
|
||||||
|
const img = new Image();
|
||||||
|
img.crossOrigin = 'Anonymous';
|
||||||
|
img.src = value;
|
||||||
|
img.onload = () => editor.value.bind({ url: value });
|
||||||
|
img.onerror = () => {
|
||||||
|
notify(
|
||||||
|
t("This photo provider doesn't allow remote downloads"),
|
||||||
|
'negative'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const rotateLeft = () => {
|
||||||
|
editor.value.rotate(90);
|
||||||
|
};
|
||||||
|
|
||||||
|
const rotateRight = () => {
|
||||||
|
editor.value.rotate(-90);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onUploadAccept = () => {
|
||||||
|
try {
|
||||||
|
if (!newPhoto.files && !newPhoto.url) {
|
||||||
|
notify(t('Select an image'), 'negative');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
type: 'blob',
|
||||||
|
};
|
||||||
|
|
||||||
|
editor.value
|
||||||
|
.result(options)
|
||||||
|
.then((result) => {
|
||||||
|
const file = new File([result], newPhoto.files?.name || '');
|
||||||
|
newPhoto.blob = file;
|
||||||
|
})
|
||||||
|
.then(() => makeRequest());
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error uploading image');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const makeRequest = async () => {
|
||||||
|
const formData = new FormData();
|
||||||
|
const now = Date.vnNew();
|
||||||
|
const timestamp = now.getTime();
|
||||||
|
const fileName = `${newPhoto.files?.name}_${timestamp}`;
|
||||||
|
formData.append('blob', newPhoto.blob, fileName);
|
||||||
|
|
||||||
|
await axios.post('Images/upload', formData, {
|
||||||
|
params: newPhoto,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
emit('closeForm');
|
||||||
|
emit('onPhotoUploaded');
|
||||||
|
|
||||||
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
ref="allowTypesRef"
|
||||||
|
url="ImageContainers/allowedContentTypes"
|
||||||
|
@on-fetch="(data) => (allowedContentTypes = data.join(', '))"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<QForm @submit="onUploadAccept()" class="all-pointer-events">
|
||||||
|
<QCard class="q-pa-lg">
|
||||||
|
<span ref="closeButton" class="close-icon" v-close-popup>
|
||||||
|
<QIcon name="close" size="sm" />
|
||||||
|
</span>
|
||||||
|
<h1 class="title">{{ t('Edit photo') }}</h1>
|
||||||
|
<div class="row q-gutter-lg">
|
||||||
|
<div
|
||||||
|
v-show="newPhoto.files || newPhoto.url"
|
||||||
|
class="row q-gutter-lg items-center"
|
||||||
|
>
|
||||||
|
<QIcon
|
||||||
|
name="rotate_left"
|
||||||
|
size="sm"
|
||||||
|
color="primary"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="rotateLeft()"
|
||||||
|
>
|
||||||
|
<!-- <QTooltip class="no-pointer-events">
|
||||||
|
{{ t('Rotate left') }}
|
||||||
|
</QTooltip> -->
|
||||||
|
</QIcon>
|
||||||
|
<div>
|
||||||
|
<div ref="photoContainerRef" />
|
||||||
|
</div>
|
||||||
|
<QIcon
|
||||||
|
name="rotate_right"
|
||||||
|
size="sm"
|
||||||
|
color="primary"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="rotateRight()"
|
||||||
|
>
|
||||||
|
<!-- <QTooltip class="no-pointer-events">
|
||||||
|
{{ t('Rotate right') }}
|
||||||
|
</QTooltip> -->
|
||||||
|
</QIcon>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="column">
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<QOptionGroup
|
||||||
|
:options="uploadMethodsOptions"
|
||||||
|
type="radio"
|
||||||
|
v-model="uploadMethodSelected"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<QFile
|
||||||
|
v-if="uploadMethodSelected === 'computer'"
|
||||||
|
ref="inputFileRef"
|
||||||
|
:label="t('File')"
|
||||||
|
:multiple="false"
|
||||||
|
v-model="newPhoto.files"
|
||||||
|
@update:model-value="updatePhotoPreview($event)"
|
||||||
|
:accept="allowedContentTypes"
|
||||||
|
class="required cursor-pointer"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<QIcon
|
||||||
|
name="vn:attach"
|
||||||
|
class="cursor-pointer q-mr-sm"
|
||||||
|
@click="openInputFile()"
|
||||||
|
>
|
||||||
|
<!-- <QTooltip>{{ t('Select a file') }}</QTooltip> -->
|
||||||
|
</QIcon>
|
||||||
|
<QIcon name="info" class="cursor-pointer">
|
||||||
|
<QTooltip>{{
|
||||||
|
t(
|
||||||
|
'components.editPictureForm.allowedFilesText',
|
||||||
|
{
|
||||||
|
allowedContentTypes:
|
||||||
|
allowedContentTypes,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
</QFile>
|
||||||
|
<VnInput
|
||||||
|
v-if="uploadMethodSelected === 'URL'"
|
||||||
|
v-model="newPhoto.url"
|
||||||
|
@update:model-value="updatePhotoPreview($event)"
|
||||||
|
placeholder="https://"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<VnSelectFilter
|
||||||
|
:label="t('Orientation')"
|
||||||
|
:options="viewportTypes"
|
||||||
|
hide-selected
|
||||||
|
option-label="description"
|
||||||
|
v-model="viewportSelection"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<div class="q-mt-lg row justify-end">
|
||||||
|
<QBtn
|
||||||
|
:label="t('globals.save')"
|
||||||
|
type="submit"
|
||||||
|
color="primary"
|
||||||
|
:disabled="isLoading"
|
||||||
|
:loading="isLoading"
|
||||||
|
/>
|
||||||
|
<QBtn
|
||||||
|
:label="t('globals.cancel')"
|
||||||
|
type="reset"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
class="q-ml-sm"
|
||||||
|
:disabled="isLoading"
|
||||||
|
:loading="isLoading"
|
||||||
|
v-close-popup
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</QCard>
|
||||||
|
</QForm>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.title {
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-icon {
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Edit photo: Editar foto
|
||||||
|
Select from computer: Seleccionar desde ordenador
|
||||||
|
Import from external URL: Importar desde URL externa
|
||||||
|
Vertical: Vertical
|
||||||
|
Normal: Normal
|
||||||
|
Panoramic: Panorámica
|
||||||
|
Orientation: Orientación
|
||||||
|
File: Fichero
|
||||||
|
This photo provider doesn't allow remote downloads: Este proveedor de fotos no permite descargas remotas
|
||||||
|
Rotate left: Girar a la izquierda
|
||||||
|
Rotate right: Girar a la derecha
|
||||||
|
Select an image: Selecciona una imagen
|
||||||
|
</i18n>
|
|
@ -50,7 +50,6 @@ const submitData = async () => {
|
||||||
try {
|
try {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
||||||
console.log('submit:: ');
|
|
||||||
const payload = {
|
const payload = {
|
||||||
field: formData.field,
|
field: formData.field,
|
||||||
newValue: formData.newValue,
|
newValue: formData.newValue,
|
||||||
|
|
|
@ -45,7 +45,7 @@ onMounted(async () => {
|
||||||
async function fetch(fetchFilter = {}) {
|
async function fetch(fetchFilter = {}) {
|
||||||
try {
|
try {
|
||||||
const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
|
const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
|
||||||
if ($props.where) filter.where = $props.where;
|
if ($props.where && !fetchFilter.where) filter.where = $props.where;
|
||||||
if ($props.sortBy) filter.order = $props.sortBy;
|
if ($props.sortBy) filter.order = $props.sortBy;
|
||||||
if ($props.limit) filter.limit = $props.limit;
|
if ($props.limit) filter.limit = $props.limit;
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ async function fetch(fetchFilter = {}) {
|
||||||
});
|
});
|
||||||
|
|
||||||
emit('onFetch', data);
|
emit('onFetch', data);
|
||||||
|
return data;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,6 @@ const closeForm = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectTravel = ({ id }) => {
|
const selectTravel = ({ id }) => {
|
||||||
console.log('row:: ', id);
|
|
||||||
emit('travelSelected', id);
|
emit('travelSelected', id);
|
||||||
closeForm();
|
closeForm();
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,13 +186,6 @@ watch(formUrl, async () => {
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<QBanner
|
|
||||||
v-if="$props.observeFormChanges && hasChanges"
|
|
||||||
class="text-white bg-warning full-width"
|
|
||||||
>
|
|
||||||
<QIcon name="warning" size="md" class="q-mr-md" />
|
|
||||||
<span>{{ t('globals.changesToSave') }}</span>
|
|
||||||
</QBanner>
|
|
||||||
<div class="column items-center full-width">
|
<div class="column items-center full-width">
|
||||||
<QForm
|
<QForm
|
||||||
v-if="formData"
|
v-if="formData"
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
import FormModelPopup from './FormModelPopup.vue';
|
||||||
|
|
||||||
|
const emit = defineEmits(['onDataSaved']);
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
itemFk: {
|
||||||
|
type: Number,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
warehouseFk: {
|
||||||
|
type: Boolean,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const regularizeFormData = reactive({
|
||||||
|
itemFk: props.itemFk,
|
||||||
|
warehouseFk: props.warehouseFk,
|
||||||
|
quantity: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
const warehousesOptions = ref([]);
|
||||||
|
|
||||||
|
const onDataSaved = (data) => {
|
||||||
|
emit('onDataSaved', data);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="Warehouses"
|
||||||
|
@on-fetch="(data) => (warehousesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FormModelPopup
|
||||||
|
url-create="Items/regularize"
|
||||||
|
model="Items"
|
||||||
|
:title="t('Regularize stock')"
|
||||||
|
:form-initial-data="regularizeFormData"
|
||||||
|
@on-data-saved="onDataSaved($event)"
|
||||||
|
>
|
||||||
|
<template #form-inputs="{ data }">
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<QInput
|
||||||
|
:label="t('Type the visible quantity')"
|
||||||
|
v-model.number="data.quantity"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
<div class="col">
|
||||||
|
<VnSelectFilter
|
||||||
|
:label="t('Warehouse')"
|
||||||
|
v-model="data.warehouseFk"
|
||||||
|
:options="warehousesOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
hide-selected
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
</template>
|
||||||
|
</FormModelPopup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Warehouse: Almacén
|
||||||
|
Type the visible quantity: Introduce la cantidad visible
|
||||||
|
Regularize stock: Regularizar stock
|
||||||
|
</i18n>
|
|
@ -1,19 +1,19 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, computed } from 'vue';
|
import { onMounted, computed } from 'vue';
|
||||||
import { Dark, Quasar, useQuasar } from 'quasar';
|
import { Dark, Quasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
import { localeEquivalence } from "src/i18n/index";
|
import { localeEquivalence } from 'src/i18n/index';
|
||||||
|
|
||||||
const state = useState();
|
const state = useState();
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const quasar = useQuasar();
|
import { useClipboard } from 'src/composables/useClipboard';
|
||||||
|
const { copyText } = useClipboard();
|
||||||
const userLocale = computed({
|
const userLocale = computed({
|
||||||
get() {
|
get() {
|
||||||
return locale.value;
|
return locale.value;
|
||||||
|
@ -21,7 +21,7 @@ const userLocale = computed({
|
||||||
set(value) {
|
set(value) {
|
||||||
locale.value = value;
|
locale.value = value;
|
||||||
|
|
||||||
value = localeEquivalence[value] ?? value
|
value = localeEquivalence[value] ?? value;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/* @vite-ignore */
|
/* @vite-ignore */
|
||||||
|
@ -82,11 +82,7 @@ function logout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyUserToken() {
|
function copyUserToken() {
|
||||||
navigator.clipboard.writeText(session.getToken());
|
copyText(session.getToken(), { label: 'components.userPanel.copyToken' });
|
||||||
quasar.notify({
|
|
||||||
type: 'positive',
|
|
||||||
message: t('components.userPanel.copyToken'),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -129,7 +125,11 @@ function copyUserToken(){
|
||||||
<div class="text-subtitle1 q-mt-md">
|
<div class="text-subtitle1 q-mt-md">
|
||||||
<strong>{{ user.nickname }}</strong>
|
<strong>{{ user.nickname }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-subtitle3 text-grey-7 q-mb-xs copyUserToken" @click="copyUserToken()" >@{{ user.name }}
|
<div
|
||||||
|
class="text-subtitle3 text-grey-7 q-mb-xs copyText"
|
||||||
|
@click="copyUserToken()"
|
||||||
|
>
|
||||||
|
@{{ user.name }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -152,7 +152,7 @@ function copyUserToken(){
|
||||||
width: 150px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.copyUserToken {
|
.copyText {
|
||||||
&:hover {
|
&:hover {
|
||||||
cursor: alias;
|
cursor: alias;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
||||||
|
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||||
|
import VnSelectCreate from 'components/common/VnSelectCreate.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
const emit = defineEmits(['update:modelValue', 'update:options']);
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const postcodesOptions = ref([]);
|
||||||
|
const postcodesRef = ref(null);
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
modelValue: {
|
||||||
|
type: [String, Number, Object],
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
optionLabel: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
optionValue: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
filterOptions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
isClearable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
defaultFilter: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { options } = toRefs($props);
|
||||||
|
const myOptions = ref([]);
|
||||||
|
const myOptionsOriginal = ref([]);
|
||||||
|
|
||||||
|
const value = computed({
|
||||||
|
get() {
|
||||||
|
return $props.modelValue;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
emit('update:modelValue', value);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
locationFilter()
|
||||||
|
});
|
||||||
|
|
||||||
|
function setOptions(data) {
|
||||||
|
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||||
|
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||||
|
}
|
||||||
|
setOptions(options.value);
|
||||||
|
|
||||||
|
watch(options, (newValue) => {
|
||||||
|
setOptions(newValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
function showLabel(data) {
|
||||||
|
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function locationFilter(search) {
|
||||||
|
let where = { search };
|
||||||
|
postcodesRef.value.fetch({filter:{ where}, limit: 30});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFetch( data) {
|
||||||
|
postcodesOptions.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
ref="postcodesRef"
|
||||||
|
url="Postcodes/filter"
|
||||||
|
@on-fetch="(data) =>handleFetch(data)"
|
||||||
|
/>
|
||||||
|
<VnSelectCreate
|
||||||
|
v-if="postcodesRef"
|
||||||
|
v-model="value"
|
||||||
|
:options="postcodesOptions"
|
||||||
|
:label="t('Location')"
|
||||||
|
:option-label="showLabel"
|
||||||
|
:placeholder="t('search_by_postalcode')"
|
||||||
|
@input-value="locationFilter"
|
||||||
|
:default-filter="false"
|
||||||
|
:input-debounce="300"
|
||||||
|
:class="{ required: $attrs.required }"
|
||||||
|
v-bind="$attrs"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
use-input
|
||||||
|
clearable
|
||||||
|
hide-selected
|
||||||
|
fill-input
|
||||||
|
>
|
||||||
|
<template #form>
|
||||||
|
<CreateNewPostcode @on-data-saved="locationFilter()" />
|
||||||
|
</template>
|
||||||
|
<template #option="{itemProps, opt}">
|
||||||
|
<QItem v-bind="itemProps">
|
||||||
|
<QItemSection v-if="opt">
|
||||||
|
<QItemLabel>{{ opt.code }}</QItemLabel>
|
||||||
|
<QItemLabel caption>{{ showLabel(opt) }}</QItemLabel>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnSelectCreate>
|
||||||
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.add-icon {
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: $primary;
|
||||||
|
border-radius: 50px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
search_by_postalcode: Search by postalcode, town, province or country
|
||||||
|
es:
|
||||||
|
Location: Ubicación
|
||||||
|
search_by_postalcode: Buscar por código postal, ciudad o país
|
||||||
|
</i18n>
|
|
@ -168,17 +168,17 @@ function getLogTree(data) {
|
||||||
let originLog = null;
|
let originLog = null;
|
||||||
let userLog = null;
|
let userLog = null;
|
||||||
let modelLog = null;
|
let modelLog = null;
|
||||||
let prevLog;
|
|
||||||
let nLogs;
|
let nLogs;
|
||||||
|
|
||||||
data.forEach((log) => {
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
let log = data[i];
|
||||||
|
let prevLog = i > 0 ? data[i - 1] : null;
|
||||||
const locale = validations[log.changedModel]?.locale || {};
|
const locale = validations[log.changedModel]?.locale || {};
|
||||||
|
|
||||||
// Origin
|
// Origin
|
||||||
const originChanged = !prevLog || log.originFk != prevLog.originFk;
|
const originChanged = !prevLog || log.originFk != prevLog.originFk;
|
||||||
if (originChanged) {
|
if (originChanged) {
|
||||||
logs.push((originLog = { originFk: log.originFk, logs: [] }));
|
logs.push((originLog = { originFk: log.originFk, logs: [] }));
|
||||||
prevLog = log;
|
|
||||||
}
|
}
|
||||||
// User
|
// User
|
||||||
const userChanged = originChanged || log.userFk != prevLog.userFk;
|
const userChanged = originChanged || log.userFk != prevLog.userFk;
|
||||||
|
@ -197,6 +197,7 @@ function getLogTree(data) {
|
||||||
log.changedModel != prevLog.changedModel ||
|
log.changedModel != prevLog.changedModel ||
|
||||||
log.changedModelId != prevLog.changedModelId ||
|
log.changedModelId != prevLog.changedModelId ||
|
||||||
nLogs >= 6;
|
nLogs >= 6;
|
||||||
|
|
||||||
if (modelChanged) {
|
if (modelChanged) {
|
||||||
userLog.logs.push(
|
userLog.logs.push(
|
||||||
(modelLog = {
|
(modelLog = {
|
||||||
|
@ -221,7 +222,7 @@ function getLogTree(data) {
|
||||||
propNames = [...new Set(propNames)];
|
propNames = [...new Set(propNames)];
|
||||||
|
|
||||||
log.props = parseProps(propNames, locale, vals, olds);
|
log.props = parseProps(propNames, locale, vals, olds);
|
||||||
});
|
}
|
||||||
return logs;
|
return logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +321,6 @@ function selectFilter(type, dateType) {
|
||||||
}
|
}
|
||||||
if (type === 'action' && selectedFilters.value.changedModel === null) {
|
if (type === 'action' && selectedFilters.value.changedModel === null) {
|
||||||
selectedFilters.value.changedModel = undefined;
|
selectedFilters.value.changedModel = undefined;
|
||||||
reload = false;
|
|
||||||
}
|
}
|
||||||
if (type === 'userRadio') {
|
if (type === 'userRadio') {
|
||||||
selectedFilters.value.userFk = userRadio.value;
|
selectedFilters.value.userFk = userRadio.value;
|
||||||
|
@ -415,18 +415,19 @@ setLogTree();
|
||||||
<div class="line bg-grey"></div>
|
<div class="line bg-grey"></div>
|
||||||
</QItem>
|
</QItem>
|
||||||
<div
|
<div
|
||||||
class="user-log q-mb-sm row"
|
class="user-log q-mb-sm"
|
||||||
v-for="(userLog, userIndex) in originLog.logs"
|
v-for="(userLog, userIndex) in originLog.logs"
|
||||||
:key="userIndex"
|
:key="userIndex"
|
||||||
>
|
>
|
||||||
<div class="timeline">
|
<div class="timeline">
|
||||||
<div class="user-avatar">
|
<div class="user-avatar">
|
||||||
<VnUserLink v-if="userLog.user.image" :worker-id="userLog.user.id">
|
<VnUserLink :worker-id="userLog.user.id">
|
||||||
<template #link>
|
<template #link>
|
||||||
<VnAvatar
|
<VnAvatar
|
||||||
:class="{ 'cursor-pointer': userLog.user.id }"
|
:class="{ 'cursor-pointer': userLog.user.id }"
|
||||||
:worker-id="userLog.user.id"
|
:worker-id="userLog.user.id"
|
||||||
:title="userLog.user.nickname"
|
:title="userLog.user.nickname"
|
||||||
|
size="lg"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</VnUserLink>
|
</VnUserLink>
|
||||||
|
@ -663,9 +664,9 @@ setLogTree();
|
||||||
:label="t('globals.entity')"
|
:label="t('globals.entity')"
|
||||||
v-model="selectedFilters.changedModel"
|
v-model="selectedFilters.changedModel"
|
||||||
option-label="locale"
|
option-label="locale"
|
||||||
|
option-value="value"
|
||||||
:options="actions"
|
:options="actions"
|
||||||
@update:model-value="selectFilter('action')"
|
@update:model-value="selectFilter('action')"
|
||||||
@clear="() => selectFilter('action')"
|
|
||||||
hide-selected
|
hide-selected
|
||||||
/>
|
/>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -823,14 +824,30 @@ setLogTree();
|
||||||
.q-item {
|
.q-item {
|
||||||
min-height: 0px;
|
min-height: 0px;
|
||||||
}
|
}
|
||||||
|
.q-menu {
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
& > .loading {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
& > .q-card {
|
||||||
|
min-width: 180px;
|
||||||
|
max-width: 400px;
|
||||||
|
|
||||||
|
& > .header {
|
||||||
|
color: $dark;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.origin-log {
|
.origin-log {
|
||||||
&:first-child > .origin-info {
|
&:first-child > .origin-info {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
& > .origin-info {
|
& > .origin-info {
|
||||||
width: 100%;
|
|
||||||
max-width: 42em;
|
|
||||||
margin-top: 28px;
|
margin-top: 28px;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
|
|
||||||
|
@ -847,14 +864,15 @@ setLogTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.user-log {
|
.user-log {
|
||||||
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 40em;
|
max-width: 40em;
|
||||||
|
|
||||||
& > .timeline {
|
& > .timeline {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-right: 5px;
|
padding-right: 1px;
|
||||||
width: 50px;
|
width: 38px;
|
||||||
min-width: 38px;
|
min-width: 38px;
|
||||||
|
flex-grow: auto;
|
||||||
& > .arrow {
|
& > .arrow {
|
||||||
height: 8px;
|
height: 8px;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
|
@ -874,7 +892,7 @@ setLogTree();
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: $primary;
|
background-color: $primary;
|
||||||
width: 2px;
|
width: 2px;
|
||||||
left: 23px;
|
left: 19px;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: -8px;
|
bottom: -8px;
|
||||||
|
@ -893,6 +911,7 @@ setLogTree();
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
min-height: 22px;
|
||||||
.model-value {
|
.model-value {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
@ -984,25 +1003,6 @@ setLogTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.q-menu {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
& > .loading {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
& > .q-card {
|
|
||||||
min-width: 180px;
|
|
||||||
max-width: 400px;
|
|
||||||
|
|
||||||
& > .header {
|
|
||||||
color: $dark;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
<i18n>
|
<i18n>
|
||||||
en:
|
en:
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
import { onMounted } from 'vue';
|
||||||
import { ref, toRefs, computed, watch } from 'vue';
|
import { ref, toRefs, computed, watch } from 'vue';
|
||||||
const emit = defineEmits(['update:modelValue', 'update:options']);
|
const emit = defineEmits(['update:modelValue', 'update:options']);
|
||||||
|
|
||||||
|
@ -12,11 +14,19 @@ const $props = defineProps({
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
optionLabel: {
|
optionLabel: {
|
||||||
|
type: [String],
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
optionValue: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
url: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
filterOptions: {
|
filterOptions: {
|
||||||
type: Array,
|
type: [Array],
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
isClearable: {
|
isClearable: {
|
||||||
|
@ -27,12 +37,29 @@ const $props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
fields: {
|
||||||
|
type: Array,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
sortBy: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: Number,
|
||||||
|
default: 30,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const { optionLabel, options } = toRefs($props);
|
const { optionLabel, optionValue, options, modelValue } = toRefs($props);
|
||||||
const myOptions = ref([]);
|
const myOptions = ref([]);
|
||||||
const myOptionsOriginal = ref([]);
|
const myOptionsOriginal = ref([]);
|
||||||
const vnSelectRef = ref();
|
const vnSelectRef = ref();
|
||||||
|
const dataRef = ref();
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get() {
|
get() {
|
||||||
|
@ -47,8 +74,12 @@ function setOptions(data) {
|
||||||
myOptions.value = JSON.parse(JSON.stringify(data));
|
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||||
}
|
}
|
||||||
|
onMounted(() => {
|
||||||
setOptions(options.value);
|
setOptions(options.value);
|
||||||
const filter = (val, options) => {
|
if ($props.url && $props.modelValue) fetchFilter($props.modelValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function filter(val, options) {
|
||||||
const search = val.toString().toLowerCase();
|
const search = val.toString().toLowerCase();
|
||||||
|
|
||||||
if (!search) return options;
|
if (!search) return options;
|
||||||
|
@ -66,13 +97,29 @@ const filter = (val, options) => {
|
||||||
|
|
||||||
return id == search || optionLabel.includes(search);
|
return id == search || optionLabel.includes(search);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
const filterHandler = (val, update) => {
|
async function fetchFilter(val) {
|
||||||
|
if (!$props.url || !dataRef.value) return;
|
||||||
|
|
||||||
|
const { fields, sortBy, limit } = $props;
|
||||||
|
let key = optionLabel.value;
|
||||||
|
|
||||||
|
if (new RegExp(/\d/g).test(val)) key = optionValue.value;
|
||||||
|
|
||||||
|
const where = { [key]: { like: `%${val}%` } };
|
||||||
|
return dataRef.value.fetch({ fields, where, order: sortBy, limit });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function filterHandler(val, update) {
|
||||||
update(
|
update(
|
||||||
() => {
|
async () => {
|
||||||
if ($props.defaultFilter)
|
if (!$props.defaultFilter) return;
|
||||||
myOptions.value = filter(val, myOptionsOriginal.value);
|
if ($props.url) {
|
||||||
|
myOptions.value = await fetchFilter(val);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
myOptions.value = await filter(val, myOptionsOriginal.value);
|
||||||
},
|
},
|
||||||
(ref) => {
|
(ref) => {
|
||||||
if (val !== '' && ref.options.length > 0) {
|
if (val !== '' && ref.options.length > 0) {
|
||||||
|
@ -81,18 +128,33 @@ const filterHandler = (val, update) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
watch(options, (newValue) => {
|
watch(options, (newValue) => {
|
||||||
setOptions(newValue);
|
setOptions(newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(modelValue, (newValue) => {
|
||||||
|
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
|
||||||
|
fetchFilter(newValue);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<FetchData
|
||||||
|
ref="dataRef"
|
||||||
|
:url="$props.url"
|
||||||
|
@on-fetch="(data) => setOptions(data)"
|
||||||
|
:where="where || { [optionValue]: value }"
|
||||||
|
:limit="limit"
|
||||||
|
:order-by="orderBy"
|
||||||
|
:fields="fields"
|
||||||
|
/>
|
||||||
<QSelect
|
<QSelect
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:options="myOptions"
|
:options="myOptions"
|
||||||
:option-label="optionLabel"
|
:option-label="optionLabel"
|
||||||
|
:option-value="optionValue"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
|
@ -49,7 +49,6 @@ onMounted(async () => {
|
||||||
() => $props.url,
|
() => $props.url,
|
||||||
async (newUrl, lastUrl) => {
|
async (newUrl, lastUrl) => {
|
||||||
if (newUrl == lastUrl) return;
|
if (newUrl == lastUrl) return;
|
||||||
entity.value = null;
|
|
||||||
await getData();
|
await getData();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -62,7 +61,6 @@ async function getData() {
|
||||||
skip: 0,
|
skip: 0,
|
||||||
});
|
});
|
||||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||||
entity.value = data;
|
|
||||||
emit('onFetch', data);
|
emit('onFetch', data);
|
||||||
}
|
}
|
||||||
const emit = defineEmits(['onFetch']);
|
const emit = defineEmits(['onFetch']);
|
||||||
|
@ -81,6 +79,7 @@ function viewSummary(id) {
|
||||||
<div class="descriptor">
|
<div class="descriptor">
|
||||||
<template v-if="entity">
|
<template v-if="entity">
|
||||||
<div class="header bg-primary q-pa-sm justify-between">
|
<div class="header bg-primary q-pa-sm justify-between">
|
||||||
|
<slot name="header-extra-action" />
|
||||||
<QBtn
|
<QBtn
|
||||||
@click.stop="viewSummary(entity.id)"
|
@click.stop="viewSummary(entity.id)"
|
||||||
round
|
round
|
||||||
|
@ -118,7 +117,7 @@ function viewSummary(id) {
|
||||||
icon="more_vert"
|
icon="more_vert"
|
||||||
round
|
round
|
||||||
size="md"
|
size="md"
|
||||||
v-if="slots.menu"
|
:class="{ invisible: !slots.menu }"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('components.cardDescriptor.moreOptions') }}
|
{{ t('components.cardDescriptor.moreOptions') }}
|
||||||
|
|
|
@ -1,19 +1,37 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useSession } from 'src/composables/useSession';
|
import { useSession } from 'src/composables/useSession';
|
||||||
|
import { useColor } from 'src/composables/useColor';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
workerId: { type: Number, required: true },
|
workerId: { type: Number, required: true },
|
||||||
description: { type: String, default: null },
|
description: { type: String, default: null },
|
||||||
|
size: { type: String, default: null },
|
||||||
|
title: { type: String, default: null },
|
||||||
});
|
});
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const token = session.getToken();
|
const token = session.getToken();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const title = computed(() => $props.title ?? t('globals.system'));
|
||||||
|
const showLetter = ref(false);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="avatar-picture column items-center">
|
<div class="avatar-picture column items-center">
|
||||||
<QAvatar color="orange">
|
<QAvatar
|
||||||
|
:style="{
|
||||||
|
backgroundColor: useColor(title),
|
||||||
|
}"
|
||||||
|
:size="$props.size"
|
||||||
|
:title="title"
|
||||||
|
>
|
||||||
|
<template v-if="showLetter">{{ title.charAt(0) }}</template>
|
||||||
<QImg
|
<QImg
|
||||||
|
v-else
|
||||||
:src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
|
:src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
|
||||||
spinner-color="white"
|
spinner-color="white"
|
||||||
|
@error="showLetter = true"
|
||||||
/>
|
/>
|
||||||
</QAvatar>
|
</QAvatar>
|
||||||
<div class="description">
|
<div class="description">
|
||||||
|
|
|
@ -64,10 +64,12 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
async function search() {
|
async function search() {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
const params = { ...userParams.value };
|
const params = { ...userParams.value };
|
||||||
|
store.userParamsChanged = true;
|
||||||
|
store.filter.skip = 0;
|
||||||
|
store.skip = 0;
|
||||||
const { params: newParams } = await arrayData.addFilter({ params });
|
const { params: newParams } = await arrayData.addFilter({ params });
|
||||||
userParams.value = newParams;
|
userParams.value = newParams;
|
||||||
|
|
||||||
|
@ -89,7 +91,9 @@ async function reload() {
|
||||||
|
|
||||||
async function clearFilters() {
|
async function clearFilters() {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
store.userParamsChanged = true;
|
||||||
|
store.filter.skip = 0;
|
||||||
|
store.skip = 0;
|
||||||
// Filtrar los params no removibles
|
// Filtrar los params no removibles
|
||||||
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
||||||
props.unremovableParams.includes(param)
|
props.unremovableParams.includes(param)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
|
|
||||||
|
import { useClipboard } from 'src/composables/useClipboard';
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
label: { type: String, default: null },
|
label: { type: String, default: null },
|
||||||
value: {
|
value: {
|
||||||
|
@ -10,8 +11,19 @@ const $props = defineProps({
|
||||||
},
|
},
|
||||||
info: { type: String, default: null },
|
info: { type: String, default: null },
|
||||||
dash: { type: Boolean, default: true },
|
dash: { type: Boolean, default: true },
|
||||||
|
copy: { type: Boolean, default: false },
|
||||||
});
|
});
|
||||||
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
||||||
|
|
||||||
|
const { copyText } = useClipboard();
|
||||||
|
|
||||||
|
function copyValueText() {
|
||||||
|
copyText($props.value, {
|
||||||
|
component: {
|
||||||
|
copyValue: $props.value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.label,
|
.label,
|
||||||
|
@ -48,5 +60,16 @@ const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="copy" v-if="$props.copy && $props.value" @click="copyValueText()">
|
||||||
|
<QIcon name="Content_Copy" color="primary" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.copy {
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -104,6 +104,8 @@ async function paginate() {
|
||||||
await arrayData.loadMore();
|
await arrayData.loadMore();
|
||||||
|
|
||||||
if (!arrayData.hasMoreData.value) {
|
if (!arrayData.hasMoreData.value) {
|
||||||
|
if (store.userParamsChanged) arrayData.hasMoreData.value = true;
|
||||||
|
store.userParamsChanged = false;
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -129,9 +131,9 @@ async function onLoad(...params) {
|
||||||
pagination.value.page = pagination.value.page + 1;
|
pagination.value.page = pagination.value.page + 1;
|
||||||
|
|
||||||
await paginate();
|
await paginate();
|
||||||
|
let isDone = false;
|
||||||
const endOfPages = !arrayData.hasMoreData.value;
|
if (store.userParamsChanged) isDone = !arrayData.hasMoreData.value;
|
||||||
done(endOfPages);
|
done(isDone);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -172,7 +174,7 @@ async function onLoad(...params) {
|
||||||
v-if="store.data"
|
v-if="store.data"
|
||||||
@load="onLoad"
|
@load="onLoad"
|
||||||
:offset="offset"
|
:offset="offset"
|
||||||
class="full-width full-height overflow-auto"
|
class="full-width full-height"
|
||||||
>
|
>
|
||||||
<slot name="body" :rows="store.data"></slot>
|
<slot name="body" :rows="store.data"></slot>
|
||||||
<div v-if="isLoading" class="info-row q-pa-md text-center">
|
<div v-if="isLoading" class="info-row q-pa-md text-center">
|
||||||
|
|
|
@ -87,15 +87,10 @@ async function search() {
|
||||||
});
|
});
|
||||||
if (!props.redirect) return;
|
if (!props.redirect) return;
|
||||||
|
|
||||||
const rows = store.data;
|
const { matched: matches } = route;
|
||||||
const module = route.matched[1];
|
const { path } = matches[matches.length-1];
|
||||||
if (rows.length === 1) {
|
const newRoute = path.replace(':id', searchText.value);
|
||||||
const [firstRow] = rows;
|
await router.push(newRoute);
|
||||||
await router.push({ path: `${module.path}/${firstRow.id}` });
|
|
||||||
} else if (route.matched.length > 3) {
|
|
||||||
await router.push({ path: `/${module.path}` });
|
|
||||||
arrayData.updateStateParams();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, onUnmounted, ref } from 'vue';
|
import { onMounted, onUnmounted } from 'vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -13,9 +14,25 @@ onUnmounted(() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QToolbar class="bg-vn-dark justify-end">
|
<QToolbar class="bg-vn-dark justify-end sticky">
|
||||||
|
<slot name="st-data">
|
||||||
<div id="st-data"></div>
|
<div id="st-data"></div>
|
||||||
|
</slot>
|
||||||
<QSpace />
|
<QSpace />
|
||||||
|
<slot name="st-actions">
|
||||||
<div id="st-actions"></div>
|
<div id="st-actions"></div>
|
||||||
|
</slot>
|
||||||
</QToolbar>
|
</QToolbar>
|
||||||
</template>
|
</template>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.sticky {
|
||||||
|
position: sticky;
|
||||||
|
top: 61px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
@media (max-width: $breakpoint-sm) {
|
||||||
|
.sticky {
|
||||||
|
top: 90px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -4,5 +4,5 @@ import { useI18n } from 'vue-i18n';
|
||||||
export function tMobile(...args) {
|
export function tMobile(...args) {
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
if (!quasar.platform.is.mobile) return t(...args);
|
if (!quasar.screen.xs) return t(...args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,8 @@ export function useArrayData(key, userOptions) {
|
||||||
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
userParams = sanitizerParams(userParams, store?.exprBuilder);
|
||||||
|
|
||||||
store.userParams = userParams;
|
store.userParams = userParams;
|
||||||
|
store.skip = 0;
|
||||||
|
store.filter.skip = 0;
|
||||||
await fetch({ append: false });
|
await fetch({ append: false });
|
||||||
return { filter, params };
|
return { filter, params };
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
export function useClipboard() {
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const { t } = useI18n();
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {String} value Value to send to clipboardAPI
|
||||||
|
* @param {Object} {label, component} Refer to Quasar notify configuration. Label is the text to translate
|
||||||
|
*/
|
||||||
|
function copyText(value, { label = 'components.VnLv.copyText', component = {} }) {
|
||||||
|
navigator.clipboard.writeText(value);
|
||||||
|
quasar.notify({ type: 'positive', message: t(label, component) });
|
||||||
|
}
|
||||||
|
return { copyText };
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ export function useState() {
|
||||||
lang: user.value.lang,
|
lang: user.value.lang,
|
||||||
darkMode: user.value.darkMode,
|
darkMode: user.value.darkMode,
|
||||||
companyFk: user.value.companyFk,
|
companyFk: user.value.companyFk,
|
||||||
|
warehouseFk: user.value.warehouseFk,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -37,6 +38,7 @@ export function useState() {
|
||||||
lang: data.lang,
|
lang: data.lang,
|
||||||
darkMode: data.darkMode,
|
darkMode: data.darkMode,
|
||||||
companyFk: data.companyFk,
|
companyFk: data.companyFk,
|
||||||
|
warehouseFk: data.warehouseFk,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ export function useUserConfig() {
|
||||||
const user = state.getUser().value;
|
const user = state.getUser().value;
|
||||||
user.darkMode = data.darkMode;
|
user.darkMode = data.darkMode;
|
||||||
user.companyFk = data.companyFk;
|
user.companyFk = data.companyFk;
|
||||||
|
user.warehouseFk = data.warehouseFk;
|
||||||
state.setUser(user);
|
state.setUser(user);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
@ -52,6 +52,10 @@ body.body--dark {
|
||||||
color: var(--vn-text);
|
color: var(--vn-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.color-vn-white {
|
||||||
|
color: $white;
|
||||||
|
}
|
||||||
|
|
||||||
.vn-card {
|
.vn-card {
|
||||||
background-color: var(--vn-gray);
|
background-color: var(--vn-gray);
|
||||||
color: var(--vn-text);
|
color: var(--vn-text);
|
||||||
|
|
|
@ -1098,6 +1098,25 @@ export default {
|
||||||
totalEntries: 'Total entries',
|
totalEntries: 'Total entries',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
item: {
|
||||||
|
pageTitles: {
|
||||||
|
items: 'Items',
|
||||||
|
list: 'List',
|
||||||
|
diary: 'Diary',
|
||||||
|
tags: 'Tags',
|
||||||
|
},
|
||||||
|
descriptor: {
|
||||||
|
item: 'Item',
|
||||||
|
buyer: 'Buyer',
|
||||||
|
color: 'Color',
|
||||||
|
category: 'Category',
|
||||||
|
stems: 'Stems',
|
||||||
|
visible: 'Visible',
|
||||||
|
available: 'Available',
|
||||||
|
warehouseText: 'Calculated on the warehouse of { warehouseName }',
|
||||||
|
itemDiary: 'Item diary',
|
||||||
|
},
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
topbar: {},
|
topbar: {},
|
||||||
userPanel: {
|
userPanel: {
|
||||||
|
@ -1121,5 +1140,12 @@ export default {
|
||||||
addToPinned: 'Add to pinned',
|
addToPinned: 'Add to pinned',
|
||||||
removeFromPinned: 'Remove from pinned',
|
removeFromPinned: 'Remove from pinned',
|
||||||
},
|
},
|
||||||
|
editPictureForm: {
|
||||||
|
allowedFilesText: 'Allowed file types: { allowedContentTypes }',
|
||||||
|
},
|
||||||
|
VnLv: {
|
||||||
|
copyText: '{copyValue} has been copied to the clipboard',
|
||||||
|
},
|
||||||
|
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1098,6 +1098,25 @@ export default {
|
||||||
totalEntries: 'Ent. totales',
|
totalEntries: 'Ent. totales',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
item: {
|
||||||
|
pageTitles: {
|
||||||
|
items: 'Artículos',
|
||||||
|
list: 'Listado',
|
||||||
|
diary: 'Histórico',
|
||||||
|
tags: 'Etiquetas',
|
||||||
|
},
|
||||||
|
descriptor: {
|
||||||
|
item: 'Artículo',
|
||||||
|
buyer: 'Comprador',
|
||||||
|
color: 'Color',
|
||||||
|
category: 'Categoría',
|
||||||
|
stems: 'Tallos',
|
||||||
|
visible: 'Visible',
|
||||||
|
available: 'Disponible',
|
||||||
|
warehouseText: 'Calculado sobre el almacén de { warehouseName }',
|
||||||
|
itemDiary: 'Registro de compra-venta',
|
||||||
|
},
|
||||||
|
},
|
||||||
components: {
|
components: {
|
||||||
topbar: {},
|
topbar: {},
|
||||||
userPanel: {
|
userPanel: {
|
||||||
|
@ -1121,5 +1140,12 @@ export default {
|
||||||
addToPinned: 'Añadir a fijados',
|
addToPinned: 'Añadir a fijados',
|
||||||
removeFromPinned: 'Eliminar de fijados',
|
removeFromPinned: 'Eliminar de fijados',
|
||||||
},
|
},
|
||||||
|
editPictureForm: {
|
||||||
|
allowedFilesText: 'Tipos de archivo permitidos: { allowedContentTypes }',
|
||||||
|
},
|
||||||
|
VnLv: {
|
||||||
|
copyText: '{copyValue} se ha copiado al portapepeles',
|
||||||
|
},
|
||||||
|
iban_tooltip: 'IBAN: ES21 1234 5678 90 0123456789',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,6 +37,7 @@ const marker_labels = [
|
||||||
{ value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.summary.company') },
|
{ value: DEFAULT_MIN_RESPONSABILITY, label: t('claim.summary.company') },
|
||||||
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.summary.person') },
|
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.summary.person') },
|
||||||
];
|
];
|
||||||
|
const multiplicatorValue = ref();
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
|
@ -134,17 +135,7 @@ async function regularizeClaim() {
|
||||||
message: t('globals.dataSaved'),
|
message: t('globals.dataSaved'),
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
});
|
});
|
||||||
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
|
await onUpdateGreugeAccept();
|
||||||
quasar
|
|
||||||
.dialog({
|
|
||||||
component: VnConfirm,
|
|
||||||
componentProps: {
|
|
||||||
title: t('confirmGreuges'),
|
|
||||||
message: t('confirmGreugesMessage'),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.onOk(async () => await onUpdateGreugeAccept());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onUpdateGreugeAccept() {
|
async function onUpdateGreugeAccept() {
|
||||||
|
@ -153,9 +144,9 @@ async function onUpdateGreugeAccept() {
|
||||||
filter: { where: { code: 'freightPickUp' } },
|
filter: { where: { code: 'freightPickUp' } },
|
||||||
})
|
})
|
||||||
).data.id;
|
).data.id;
|
||||||
const freightPickUpPrice = (await axios.get(`GreugeConfigs/findOne`)).data
|
const freightPickUpPrice =
|
||||||
.freightPickUpPrice;
|
(await axios.get(`GreugeConfigs/findOne`)).data.freightPickUpPrice *
|
||||||
|
multiplicatorValue.value;
|
||||||
await axios.post(`Greuges`, {
|
await axios.post(`Greuges`, {
|
||||||
clientFk: claim.value.clientFk,
|
clientFk: claim.value.clientFk,
|
||||||
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
|
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
|
||||||
|
@ -226,10 +217,10 @@ async function importToNewRefundTicket() {
|
||||||
show-if-above
|
show-if-above
|
||||||
v-if="claim"
|
v-if="claim"
|
||||||
>
|
>
|
||||||
<QCard class="totalClaim vn-card q-my-md q-pa-sm">
|
<QCard class="totalClaim q-my-md q-pa-sm no-box-shadow">
|
||||||
{{ `${t('Total claimed')}: ${toCurrency(totalClaimed)}` }}
|
{{ `${t('Total claimed')}: ${toCurrency(totalClaimed)}` }}
|
||||||
</QCard>
|
</QCard>
|
||||||
<QCard class="vn-card q-mb-md q-pa-sm">
|
<QCard class="q-mb-md q-pa-sm no-box-shadow">
|
||||||
<QItem class="justify-between">
|
<QItem class="justify-between">
|
||||||
<QItemLabel class="slider-container">
|
<QItemLabel class="slider-container">
|
||||||
<p class="text-primary">
|
<p class="text-primary">
|
||||||
|
@ -250,6 +241,7 @@ async function importToNewRefundTicket() {
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
</QItem>
|
</QItem>
|
||||||
</QCard>
|
</QCard>
|
||||||
|
<QCard class="q-mb-md q-pa-sm no-box-shadow" style="margin-bottom: 1em">
|
||||||
<QItemLabel class="mana q-mb-md">
|
<QItemLabel class="mana q-mb-md">
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
v-model="claim.isChargedToMana"
|
v-model="claim.isChargedToMana"
|
||||||
|
@ -257,6 +249,23 @@ async function importToNewRefundTicket() {
|
||||||
/>
|
/>
|
||||||
<span>{{ t('mana') }}</span>
|
<span>{{ t('mana') }}</span>
|
||||||
</QItemLabel>
|
</QItemLabel>
|
||||||
|
</QCard>
|
||||||
|
<QCard class="q-mb-md q-pa-sm no-box-shadow" style="position: static">
|
||||||
|
<QInput
|
||||||
|
:disable="
|
||||||
|
!(claim.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2)
|
||||||
|
"
|
||||||
|
:label="t('confirmGreuges')"
|
||||||
|
class="q-field__native text-grey-2"
|
||||||
|
type="number"
|
||||||
|
placeholder="0"
|
||||||
|
id="multiplicatorValue"
|
||||||
|
name="multiplicatorValue"
|
||||||
|
min="0"
|
||||||
|
max="50"
|
||||||
|
v-model="multiplicatorValue"
|
||||||
|
/>
|
||||||
|
</QCard>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()"> </Teleport>
|
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()"> </Teleport>
|
||||||
<CrudModel
|
<CrudModel
|
||||||
|
@ -494,4 +503,5 @@ es:
|
||||||
Id item: Id artículo
|
Id item: Id artículo
|
||||||
confirmGreuges: ¿Desea insertar greuges?
|
confirmGreuges: ¿Desea insertar greuges?
|
||||||
confirmGreugesMessage: Insertar greuges en la ficha del cliente
|
confirmGreugesMessage: Insertar greuges en la ficha del cliente
|
||||||
|
Apply Greuges: Aplicar Greuges
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,27 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
import { getUrl } from 'composables/getUrl';
|
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import ClaimDescriptor from './ClaimDescriptor.vue';
|
import ClaimDescriptor from './ClaimDescriptor.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
|
||||||
const $props = defineProps({
|
|
||||||
id: {
|
|
||||||
type: Number,
|
|
||||||
required: false,
|
|
||||||
default: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const entityId = computed(() => {
|
|
||||||
return $props.id || route.params.id;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate, toPercentage } from 'src/filters';
|
||||||
import { useState } from 'src/composables/useState';
|
import { useState } from 'src/composables/useState';
|
||||||
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||||
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
||||||
|
@ -32,7 +32,16 @@ const filter = {
|
||||||
{
|
{
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
scope: {
|
scope: {
|
||||||
include: { relation: 'salesPersonUser' },
|
include: [
|
||||||
|
{ relation: 'salesPersonUser' },
|
||||||
|
{
|
||||||
|
relation: 'claimsRatio',
|
||||||
|
scope: {
|
||||||
|
fields: ['claimingRate'],
|
||||||
|
limit: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -135,6 +144,10 @@ const setData = (entity) => {
|
||||||
:value="entity.ticket?.address?.province?.name"
|
:value="entity.ticket?.address?.province?.name"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('claim.card.zone')" :value="entity.ticket?.zone?.name" />
|
<VnLv :label="t('claim.card.zone')" :value="entity.ticket?.zone?.name" />
|
||||||
|
<VnLv
|
||||||
|
:label="t('claimRate')"
|
||||||
|
:value="toPercentage(entity.client?.claimsRatio?.claimingRate)"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #actions="{ entity }">
|
<template #actions="{ entity }">
|
||||||
<QCardActions>
|
<QCardActions>
|
||||||
|
@ -163,3 +176,9 @@ const setData = (entity) => {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
claimRate: Claming rate
|
||||||
|
es:
|
||||||
|
claimRate: Ratio de reclamación
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -4,12 +4,11 @@ import { ref, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
import { toDate, toCurrency, toPercentage } from 'filters/index';
|
||||||
import CrudModel from 'components/CrudModel.vue';
|
import CrudModel from 'components/CrudModel.vue';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
import { toDate, toCurrency, toPercentage } from 'filters/index';
|
|
||||||
import VnDiscount from 'components/common/vnDiscount.vue';
|
import VnDiscount from 'components/common/vnDiscount.vue';
|
||||||
import ClaimLinesImport from './ClaimLinesImport.vue';
|
import ClaimLinesImport from './ClaimLinesImport.vue';
|
||||||
|
|
||||||
|
@ -158,7 +157,6 @@ function showImportDialog() {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
|
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
|
||||||
<QToolbar>
|
|
||||||
<div class="row q-gutter-md">
|
<div class="row q-gutter-md">
|
||||||
<div>
|
<div>
|
||||||
{{ t('Amount') }}
|
{{ t('Amount') }}
|
||||||
|
@ -174,7 +172,6 @@ function showImportDialog() {
|
||||||
</QChip>
|
</QChip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</QToolbar>
|
|
||||||
</Teleport>
|
</Teleport>
|
||||||
|
|
||||||
<FetchData
|
<FetchData
|
||||||
|
|
|
@ -30,7 +30,7 @@ const body = {
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="column items-center">
|
<div class="column items-center">
|
||||||
<VnNotes
|
<VnNotes style="overflow-y: scroll;"
|
||||||
:add-note="$props.addNote"
|
:add-note="$props.addNote"
|
||||||
:id="id"
|
:id="id"
|
||||||
url="claimObservations"
|
url="claimObservations"
|
||||||
|
|
|
@ -87,20 +87,22 @@ function viewSummary(id) {
|
||||||
v-for="row of rows"
|
v-for="row of rows"
|
||||||
>
|
>
|
||||||
<template #list-items>
|
<template #list-items>
|
||||||
<VnLv :label="t('claim.list.customer')" @click.stop>
|
<VnLv :label="t('claim.list.customer')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<span class="link">
|
<span class="link" @click.stop>
|
||||||
{{ row.clientName }}
|
{{ row.clientName }}
|
||||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('claim.list.assignedTo')" @click.stop>
|
<VnLv :label="t('claim.list.assignedTo')">
|
||||||
<template #value>
|
<template #value>
|
||||||
|
<span @click.stop>
|
||||||
<VnUserLink
|
<VnUserLink
|
||||||
:name="row.workerName"
|
:name="row.workerName"
|
||||||
:worker-id="row.workerFk"
|
:worker-id="row.workerFk"
|
||||||
/>
|
/>
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv
|
<VnLv
|
||||||
|
|
|
@ -18,18 +18,28 @@ const route = useRoute();
|
||||||
|
|
||||||
const payMethods = ref([]);
|
const payMethods = ref([]);
|
||||||
const bankEntitiesOptions = ref([]);
|
const bankEntitiesOptions = ref([]);
|
||||||
|
const bankEntitiesRef = ref(null);
|
||||||
|
|
||||||
onMounted(() => getBankEntities());
|
const filter = {
|
||||||
|
fields: ['id', 'bic', 'name'],
|
||||||
|
order: 'bic ASC',
|
||||||
|
limit: 30,
|
||||||
|
};
|
||||||
|
|
||||||
const getBankEntities = async () => {
|
const getBankEntities = () => {
|
||||||
const filter = { fields: ['id', 'bic', 'name'], order: 'bic ASC', limit: 30 };
|
bankEntitiesRef.value.fetch();
|
||||||
const { data } = await axios.get('BankEntities', { filter });
|
|
||||||
bankEntitiesOptions.value = data;
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
|
<fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
|
||||||
|
<fetch-data
|
||||||
|
ref="bankEntitiesRef"
|
||||||
|
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
||||||
|
:filter="filter"
|
||||||
|
auto-load
|
||||||
|
url="BankEntities"
|
||||||
|
/>
|
||||||
|
|
||||||
<FormModel
|
<FormModel
|
||||||
:url-update="`Clients/${route.params.id}`"
|
:url-update="`Clients/${route.params.id}`"
|
||||||
|
@ -60,7 +70,13 @@ const getBankEntities = async () => {
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput :label="t('IBAN')" v-model="data.iban" />
|
<VnInput :label="t('IBAN')" v-model="data.iban">
|
||||||
|
<template #append>
|
||||||
|
<QIcon name="info" class="cursor-info">
|
||||||
|
<QTooltip>{{ t('components.iban_tooltip') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
|
|
|
@ -38,7 +38,7 @@ const balanceDue = computed(() => {
|
||||||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
||||||
|
|
||||||
const claimRate = computed(() => {
|
const claimRate = computed(() => {
|
||||||
return customer.value.claimsRatio.claimingRate * 100;
|
return customer.value.claimsRatio.claimingRate;
|
||||||
});
|
});
|
||||||
|
|
||||||
const priceIncreasingRate = computed(() => {
|
const priceIncreasingRate = computed(() => {
|
||||||
|
@ -81,7 +81,7 @@ const creditWarning = computed(() => {
|
||||||
<VnLinkPhone :phone-number="entity.mobile" />
|
<VnLinkPhone :phone-number="entity.mobile" />
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv :label="t('customer.summary.email')" :value="entity.email" />
|
<VnLv :label="t('customer.summary.email')" :value="entity.email" copy />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('customer.summary.salesPerson')"
|
:label="t('customer.summary.salesPerson')"
|
||||||
:value="entity?.salesPersonUser?.name"
|
:value="entity?.salesPersonUser?.name"
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -29,23 +28,17 @@ const newClientForm = reactive({
|
||||||
isEqualizated: false,
|
isEqualizated: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const postcodeFetchDataRef = ref(null);
|
|
||||||
const townsFetchDataRef = ref(null);
|
|
||||||
const workersOptions = ref([]);
|
const workersOptions = ref([]);
|
||||||
const businessTypesOptions = ref([]);
|
const businessTypesOptions = ref([]);
|
||||||
const citiesLocationOptions = ref([]);
|
|
||||||
const provincesLocationOptions = ref([]);
|
|
||||||
const countriesOptions = ref([]);
|
|
||||||
const postcodesOptions = ref([]);
|
const postcodesOptions = ref([]);
|
||||||
|
|
||||||
const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formData) => {
|
function handleLocation(data, location) {
|
||||||
await postcodeFetchDataRef.value.fetch();
|
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||||
await townsFetchDataRef.value.fetch();
|
data.postcode = code;
|
||||||
formData.postcode = code;
|
data.city = town;
|
||||||
formData.provinceFk = provinceFk;
|
data.provinceFk = provinceFk;
|
||||||
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
|
data.countryFk = countryFk;
|
||||||
formData.countryFk = countryFk;
|
}
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -54,33 +47,11 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
||||||
auto-load
|
auto-load
|
||||||
url="Workers/search?departmentCodes"
|
url="Workers/search?departmentCodes"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
|
||||||
ref="postcodeFetchDataRef"
|
|
||||||
url="Postcodes/location"
|
|
||||||
@on-fetch="(data) => (postcodesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
@on-fetch="(data) => (businessTypesOptions = data)"
|
@on-fetch="(data) => (businessTypesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
url="BusinessTypes"
|
url="BusinessTypes"
|
||||||
/>
|
/>
|
||||||
<FetchData
|
|
||||||
ref="townsFetchDataRef"
|
|
||||||
@on-fetch="(data) => (citiesLocationOptions = data)"
|
|
||||||
auto-load
|
|
||||||
url="Towns/location"
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
@on-fetch="(data) => (provincesLocationOptions = data)"
|
|
||||||
auto-load
|
|
||||||
url="Provinces/location"
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
@on-fetch="(data) => (countriesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
url="Countries"
|
|
||||||
/>
|
|
||||||
<QPage>
|
<QPage>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
<FormModel
|
<FormModel
|
||||||
|
@ -139,96 +110,19 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelectDialog
|
<VnLocation
|
||||||
v-model="data.postcode"
|
|
||||||
:label="t('Postcode')"
|
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
:options="postcodesOptions"
|
:options="postcodesOptions"
|
||||||
option-label="code"
|
v-model="data.location"
|
||||||
option-value="code"
|
@update:model-value="
|
||||||
hide-selected
|
(location) => handleLocation(data, location)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #form>
|
</VnLocation>
|
||||||
<CustomerCreateNewPostcode
|
|
||||||
@on-data-saved="onPostcodeCreated($event, data)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection v-if="scope.opt">
|
|
||||||
<QItemLabel>{{ scope.opt.code }}</QItemLabel>
|
|
||||||
<QItemLabel caption
|
|
||||||
>{{ scope.opt.code }} -
|
|
||||||
{{ scope.opt.town.name }} ({{
|
|
||||||
scope.opt.town.province.name
|
|
||||||
}},
|
|
||||||
{{
|
|
||||||
scope.opt.town.province.country.country
|
|
||||||
}})</QItemLabel
|
|
||||||
>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelectDialog>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<!-- ciudades -->
|
|
||||||
<VnSelectFilter
|
|
||||||
:label="t('City')"
|
|
||||||
:options="citiesLocationOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="name"
|
|
||||||
v-model="data.city"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption>
|
|
||||||
{{
|
|
||||||
`${scope.opt.name}, ${scope.opt.province.name} (${scope.opt.province.country.country})`
|
|
||||||
}}
|
|
||||||
</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelectFilter>
|
|
||||||
</div>
|
|
||||||
</VnRow>
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
|
||||||
<div class="col">
|
|
||||||
<VnSelectFilter
|
|
||||||
:label="t('Province')"
|
|
||||||
:options="provincesLocationOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.provinceFk"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{
|
|
||||||
`${scope.opt.name} (${scope.opt.country.country})`
|
|
||||||
}}</QItemLabel>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelectFilter>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<VnSelectFilter
|
|
||||||
:label="t('Country')"
|
|
||||||
:options="countriesOptions"
|
|
||||||
hide-selected
|
|
||||||
option-label="country"
|
|
||||||
option-value="id"
|
|
||||||
v-model="data.countryFk"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<QInput v-model="data.userName" :label="t('Web user')" />
|
<QInput v-model="data.userName" :label="t('Web user')" />
|
||||||
|
|
|
@ -12,6 +12,7 @@ import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
|
||||||
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
|
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
|
||||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -206,8 +207,8 @@ const refreshData = () => {
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
|
|
||||||
<QToolbar class="bg-vn-dark">
|
<VnSubToolbar class="bg-vn-dark">
|
||||||
<div id="st-data" class="row">
|
<template #st-data>
|
||||||
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
|
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
|
||||||
<div class="flex items-center q-ml-lg">
|
<div class="flex items-center q-ml-lg">
|
||||||
<QBtn
|
<QBtn
|
||||||
|
@ -217,8 +218,8 @@ const refreshData = () => {
|
||||||
@click.stop="viewAddObservation(selected)"
|
@click.stop="viewAddObservation(selected)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</QToolbar>
|
</VnSubToolbar>
|
||||||
|
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<QTable
|
||||||
|
|
|
@ -9,6 +9,7 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
|
||||||
import CustomerExtendedListActions from './CustomerExtendedListActions.vue';
|
import CustomerExtendedListActions from './CustomerExtendedListActions.vue';
|
||||||
import CustomerExtendedListFilter from './CustomerExtendedListFilter.vue';
|
import CustomerExtendedListFilter from './CustomerExtendedListFilter.vue';
|
||||||
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
|
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
@ -499,9 +500,8 @@ const selectSalesPersonId = (id) => {
|
||||||
/>
|
/>
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
|
<VnSubToolbar>
|
||||||
<QToolbar class="bg-vn-dark">
|
<template #st-actions>
|
||||||
<div id="st-data">
|
|
||||||
<TableVisibleColumns
|
<TableVisibleColumns
|
||||||
:all-columns="allColumnNames"
|
:all-columns="allColumnNames"
|
||||||
table-code="clientsDetail"
|
table-code="clientsDetail"
|
||||||
|
@ -510,10 +510,8 @@ const selectSalesPersonId = (id) => {
|
||||||
visibleColumns = ['customerStatus', ...$event, 'actions']
|
visibleColumns = ['customerStatus', ...$event, 'actions']
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</template>
|
||||||
<QSpace />
|
</VnSubToolbar>
|
||||||
<div id="st-actions"></div>
|
|
||||||
</QToolbar>
|
|
||||||
|
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QTable
|
<QTable
|
||||||
|
|
|
@ -44,7 +44,6 @@ const setData = (entity) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeDepartment = () => {
|
const removeDepartment = () => {
|
||||||
console.log('entityId: ', entityId.value);
|
|
||||||
quasar
|
quasar
|
||||||
.dialog({
|
.dialog({
|
||||||
title: 'Are you sure you want to delete it?',
|
title: 'Are you sure you want to delete it?',
|
||||||
|
@ -90,17 +89,15 @@ const removeDepartment = () => {
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('department.chat')" :value="entity.chatName" dash />
|
<VnLv :label="t('department.chat')" :value="entity.chatName" />
|
||||||
<VnLv :label="t('department.email')" :value="entity.notificationEmail" dash />
|
<VnLv :label="t('department.email')" :value="entity.notificationEmail" copy />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('department.selfConsumptionCustomer')"
|
:label="t('department.selfConsumptionCustomer')"
|
||||||
:value="entity.client?.name"
|
:value="entity.client?.name"
|
||||||
dash
|
|
||||||
/>
|
/>
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('department.bossDepartment')"
|
:label="t('department.bossDepartment')"
|
||||||
:value="entity.worker?.user?.name"
|
:value="entity.worker?.user?.name"
|
||||||
dash
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
|
|
|
@ -211,7 +211,6 @@ const columns = computed(() => [
|
||||||
|
|
||||||
const openEditTableCellDialog = () => {
|
const openEditTableCellDialog = () => {
|
||||||
editTableCellDialogRef.value.show();
|
editTableCellDialogRef.value.show();
|
||||||
console.log('open edit row form: ', rowsSelected.value);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onEditCellDataSaved = async () => {
|
const onEditCellDataSaved = async () => {
|
||||||
|
|
|
@ -4,11 +4,12 @@ import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
import { downloadFile } from 'src/composables/downloadFile';
|
import { downloadFile } from 'src/composables/downloadFile';
|
||||||
import FetchData from 'src/components/FetchData.vue';
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
|
import FetchData from 'src/components/FetchData.vue';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
@ -21,9 +22,6 @@ const arrayData = useArrayData('InvoiceIn');
|
||||||
const invoiceIn = computed(() => arrayData.store.data);
|
const invoiceIn = computed(() => arrayData.store.data);
|
||||||
const userConfig = ref(null);
|
const userConfig = ref(null);
|
||||||
|
|
||||||
const suppliers = ref([]);
|
|
||||||
const suppliersRef = ref();
|
|
||||||
const suppliersRefFilter = ref({ fields: ['id', 'nickname'], limit: 30 });
|
|
||||||
const currencies = ref([]);
|
const currencies = ref([]);
|
||||||
const currenciesRef = ref();
|
const currenciesRef = ref();
|
||||||
const companies = ref([]);
|
const companies = ref([]);
|
||||||
|
@ -131,31 +129,13 @@ async function upsert() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function supplierRefFilter(val) {
|
|
||||||
let where = { limit: 30 };
|
|
||||||
let params = {};
|
|
||||||
let key = 'nickname';
|
|
||||||
|
|
||||||
if (new RegExp(/\d/g).test(val)) {
|
|
||||||
key = 'id';
|
|
||||||
}
|
|
||||||
params = { [key]: { like: `%${val}%` } };
|
|
||||||
where = Object.assign(where, params);
|
|
||||||
suppliersRef.value.fetch({ where });
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
|
||||||
ref="suppliersRef"
|
|
||||||
url="Suppliers"
|
|
||||||
@on-fetch="(data) => (suppliers = data)"
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="currenciesRef"
|
ref="currenciesRef"
|
||||||
url="Currencies"
|
url="Currencies"
|
||||||
:filter="{ fields: ['id', 'code'] }"
|
:filter="{ fields: ['id', 'code'] }"
|
||||||
order="code"
|
sort-by="code"
|
||||||
@on-fetch="(data) => (currencies = data)"
|
@on-fetch="(data) => (currencies = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -163,7 +143,7 @@ function supplierRefFilter(val) {
|
||||||
ref="companiesRef"
|
ref="companiesRef"
|
||||||
url="Companies"
|
url="Companies"
|
||||||
:filter="{ fields: ['id', 'code'] }"
|
:filter="{ fields: ['id', 'code'] }"
|
||||||
order="code"
|
sort-by="code"
|
||||||
@on-fetch="(data) => (companies = data)"
|
@on-fetch="(data) => (companies = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -171,7 +151,7 @@ function supplierRefFilter(val) {
|
||||||
ref="dmsTypesRef"
|
ref="dmsTypesRef"
|
||||||
url="DmsTypes"
|
url="DmsTypes"
|
||||||
:filter="{ fields: ['id', 'name'] }"
|
:filter="{ fields: ['id', 'name'] }"
|
||||||
order="name"
|
sort-by="name"
|
||||||
@on-fetch="(data) => (dmsTypes = data)"
|
@on-fetch="(data) => (dmsTypes = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -179,7 +159,7 @@ function supplierRefFilter(val) {
|
||||||
ref="warehousesRef"
|
ref="warehousesRef"
|
||||||
url="Warehouses"
|
url="Warehouses"
|
||||||
:filter="{ fields: ['id', 'name'] }"
|
:filter="{ fields: ['id', 'name'] }"
|
||||||
order="name"
|
sort-by="name"
|
||||||
@on-fetch="(data) => (warehouses = data)"
|
@on-fetch="(data) => (warehouses = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
|
@ -199,15 +179,13 @@ function supplierRefFilter(val) {
|
||||||
<div class="row q-gutter-md q-mb-md">
|
<div class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
v-if="suppliersRef"
|
|
||||||
:label="t('supplierFk')"
|
:label="t('supplierFk')"
|
||||||
v-model="data.supplierFk"
|
v-model="data.supplierFk"
|
||||||
:options="suppliers"
|
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
:input-debounce="100"
|
url="Suppliers"
|
||||||
@input-value="supplierRefFilter"
|
:fields="['id', 'nickname']"
|
||||||
:default-filter="false"
|
sort-by="nickname"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -418,7 +396,6 @@ function supplierRefFilter(val) {
|
||||||
<div class="row q-gutter-md q-mb-md">
|
<div class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
v-if="currenciesRef"
|
|
||||||
:label="t('Currency')"
|
:label="t('Currency')"
|
||||||
v-model="data.currencyFk"
|
v-model="data.currencyFk"
|
||||||
:options="currencies"
|
:options="currencies"
|
||||||
|
|
|
@ -76,7 +76,6 @@ function viewSummary(id) {
|
||||||
data-key="InvoiceInList"
|
data-key="InvoiceInList"
|
||||||
url="InvoiceIns/filter"
|
url="InvoiceIns/filter"
|
||||||
order="issued DESC, id DESC"
|
order="issued DESC, id DESC"
|
||||||
auto-load
|
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<CardList
|
<CardList
|
||||||
|
|
|
@ -11,6 +11,7 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import InvoiceOutFilter from './InvoiceOutFilter.vue';
|
import InvoiceOutFilter from './InvoiceOutFilter.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
import CardList from 'src/components/ui/CardList.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const selectedCards = ref(new Map());
|
const selectedCards = ref(new Map());
|
||||||
|
@ -129,8 +130,8 @@ const downloadCsv = () => {
|
||||||
url="InvoiceOuts/filter"
|
url="InvoiceOuts/filter"
|
||||||
>
|
>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
<QToolbar class="bg-vn-dark justify-end">
|
<VnSubToolbar class="bg-vn-dark justify-end">
|
||||||
<div id="st-actions">
|
<template #st-actions>
|
||||||
<QBtn
|
<QBtn
|
||||||
@click="downloadCsv()"
|
@click="downloadCsv()"
|
||||||
class="q-mr-xl"
|
class="q-mr-xl"
|
||||||
|
@ -178,8 +179,8 @@ const downloadCsv = () => {
|
||||||
:model-value="selectedCards.size === rows.length"
|
:model-value="selectedCards.size === rows.length"
|
||||||
class="q-mr-md"
|
class="q-mr-md"
|
||||||
/>
|
/>
|
||||||
</div>
|
</template>
|
||||||
</QToolbar>
|
</VnSubToolbar>
|
||||||
<div class="flex flex-center q-pa-md">
|
<div class="flex flex-center q-pa-md">
|
||||||
<div class="vn-card-list">
|
<div class="vn-card-list">
|
||||||
<CardList
|
<CardList
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<script setup>
|
||||||
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
import ItemDescriptor from './ItemDescriptor.vue';
|
||||||
|
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
|
const stateStore = useStateStore();
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||||
|
<QScrollArea class="fit">
|
||||||
|
<ItemDescriptor />
|
||||||
|
<QSeparator />
|
||||||
|
<LeftMenu source="card" />
|
||||||
|
</QScrollArea>
|
||||||
|
</QDrawer>
|
||||||
|
<QPageContainer>
|
||||||
|
<QPage>
|
||||||
|
<VnSubToolbar />
|
||||||
|
|
||||||
|
<div class="q-pa-md"><RouterView></RouterView></div>
|
||||||
|
</QPage>
|
||||||
|
</QPageContainer>
|
||||||
|
</template>
|
|
@ -0,0 +1,316 @@
|
||||||
|
<script setup>
|
||||||
|
import { computed, ref, onMounted, onUnmounted } from 'vue';
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
|
import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
|
||||||
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
|
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||||
|
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||||
|
import RegularizeStockForm from 'components/RegularizeStockForm.vue';
|
||||||
|
import EditPictureForm from 'components/EditPictureForm.vue';
|
||||||
|
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
|
import { useSession } from 'src/composables/useSession';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
summary: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
dated: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const quasar = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
const { t } = useI18n();
|
||||||
|
const { getToken } = useSession();
|
||||||
|
const state = useState();
|
||||||
|
const user = state.getUser();
|
||||||
|
|
||||||
|
const entityId = computed(() => {
|
||||||
|
return $props.id || route.params.id;
|
||||||
|
});
|
||||||
|
const image = ref(null);
|
||||||
|
const regularizeStockFormDialog = ref(null);
|
||||||
|
const editPhotoFormDialog = ref(null);
|
||||||
|
const item = ref(null);
|
||||||
|
const available = ref(null);
|
||||||
|
const visible = ref(null);
|
||||||
|
const _warehouseFk = ref(null);
|
||||||
|
const warehouseText = ref(null);
|
||||||
|
const warehouseFk = computed({
|
||||||
|
get() {
|
||||||
|
return _warehouseFk.value;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
_warehouseFk.value = val;
|
||||||
|
if (val) {
|
||||||
|
updateStock();
|
||||||
|
getWarehouseName(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const showWarehouseIconTooltip = ref(true);
|
||||||
|
const showEditPhotoForm = ref(false);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
await getItemAvatar();
|
||||||
|
warehouseFk.value = user.value.warehouseFk;
|
||||||
|
});
|
||||||
|
|
||||||
|
const getItemAvatar = async () => {
|
||||||
|
const token = getToken();
|
||||||
|
const timeStamp = `timestamp=${Date.now()}`;
|
||||||
|
image.value = `/api/Images/catalog/200x200/${entityId.value}/download?access_token=${token}&${timeStamp}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const data = ref(useCardDescription());
|
||||||
|
const setData = (entity) => {
|
||||||
|
if (!entity) return;
|
||||||
|
data.value = useCardDescription(entity.name, entity.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getWarehouseName = async (warehouseFk) => {
|
||||||
|
try {
|
||||||
|
showWarehouseIconTooltip.value = false;
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
where: { id: warehouseFk },
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await axios.get('Warehouses/findOne', { filter });
|
||||||
|
|
||||||
|
warehouseText.value = t('item.descriptor.warehouseText', {
|
||||||
|
warehouseName: data.name,
|
||||||
|
});
|
||||||
|
|
||||||
|
showWarehouseIconTooltip.value = true;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error finding warehouse');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateStock = async () => {
|
||||||
|
try {
|
||||||
|
available.value = null;
|
||||||
|
visible.value = null;
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
warehouseFk: warehouseFk.value,
|
||||||
|
dated: $props.dated,
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data } = await axios.get(`Items/${entityId.value}/getVisibleAvailable`, {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
|
||||||
|
available.value = data.available;
|
||||||
|
visible.value = data.visible;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error updating stock');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const openRegularizeStockForm = () => {
|
||||||
|
regularizeStockFormDialog.value.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleEditPictureForm = () => {
|
||||||
|
showEditPhotoForm.value = !showEditPhotoForm.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const cloneItem = async () => {
|
||||||
|
try {
|
||||||
|
const { data } = await axios.post(`Items/${entityId.value}/clone`);
|
||||||
|
router.push({ name: 'ItemTags', params: { id: data.id } });
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error cloning item');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const openCloneDialog = async () => {
|
||||||
|
quasar
|
||||||
|
.dialog({
|
||||||
|
component: VnConfirm,
|
||||||
|
componentProps: {
|
||||||
|
title: t("All it's properties will be copied"),
|
||||||
|
message: t('Do you want to clone this item?'),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.onOk(async () => {
|
||||||
|
await cloneItem();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<CardDescriptor
|
||||||
|
data-key="ItemData"
|
||||||
|
module="Item"
|
||||||
|
:title="data.title"
|
||||||
|
:subtitle="data.subtitle"
|
||||||
|
:summary="$props.summary"
|
||||||
|
:url="`Items/${entityId}/getCard`"
|
||||||
|
@on-fetch="
|
||||||
|
(data) => {
|
||||||
|
item = data;
|
||||||
|
setData(data);
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #menu="{}">
|
||||||
|
<QItem v-ripple clickable @click="openRegularizeStockForm()">
|
||||||
|
<QItemSection>
|
||||||
|
{{ t('Regularize stock') }}
|
||||||
|
<QDialog ref="regularizeStockFormDialog">
|
||||||
|
<RegularizeStockForm
|
||||||
|
:item-fk="entityId"
|
||||||
|
:warehouse-fk="warehouseFk"
|
||||||
|
@on-data-saved="updateStock()"
|
||||||
|
/>
|
||||||
|
</QDialog>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem v-ripple clickable @click="openCloneDialog()">
|
||||||
|
<QItemSection>
|
||||||
|
{{ t('Clone') }}
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
<template #before>
|
||||||
|
<div class="relative-position">
|
||||||
|
<QImg :src="image" spinner-color="primary" class="photo">
|
||||||
|
<template #error>
|
||||||
|
<div
|
||||||
|
class="absolute-full picture text-center q-pa-md flex flex-center"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="text-grey-5"
|
||||||
|
style="opacity: 0.4; font-size: 5vh"
|
||||||
|
>
|
||||||
|
<QIcon name="vn:item" />
|
||||||
|
</div>
|
||||||
|
<div class="text-grey-5" style="opacity: 0.4">
|
||||||
|
{{ t('item.descriptor.item') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</QImg>
|
||||||
|
<QBtn
|
||||||
|
color="primary"
|
||||||
|
size="lg"
|
||||||
|
round
|
||||||
|
class="edit-photo-btn"
|
||||||
|
@click="toggleEditPictureForm()"
|
||||||
|
>
|
||||||
|
<QIcon name="edit" size="sm" />
|
||||||
|
<QDialog ref="editPhotoFormDialog" v-model="showEditPhotoForm">
|
||||||
|
<EditPictureForm
|
||||||
|
collection="catalog"
|
||||||
|
:id="entityId"
|
||||||
|
@close-form="toggleEditPictureForm()"
|
||||||
|
@on-photo-uploaded="getItemAvatar()"
|
||||||
|
/>
|
||||||
|
</QDialog>
|
||||||
|
</QBtn>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="row justify-between items-center full-width bg-primary"
|
||||||
|
style="height: 54px"
|
||||||
|
>
|
||||||
|
<div class="col column items-center">
|
||||||
|
<span class="text-uppercase color-vn-white" style="font-size: 11px">
|
||||||
|
{{ t('item.descriptor.visible') }}
|
||||||
|
</span>
|
||||||
|
<span class="text-weight-bold text-h5 color-vn-white">{{
|
||||||
|
visible
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="col column items-center separation-borders"
|
||||||
|
style="font-size: 11px"
|
||||||
|
>
|
||||||
|
<span class="text-uppercase color-vn-white">
|
||||||
|
{{ t('item.descriptor.available') }}
|
||||||
|
</span>
|
||||||
|
<span class="text-weight-bold text-h5 color-vn-white">{{
|
||||||
|
available
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="col column items-center justify-center">
|
||||||
|
<QIcon name="info" class="cursor-pointer color-vn-white" size="md">
|
||||||
|
<QTooltip>{{ warehouseText }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #body="{ entity }">
|
||||||
|
<VnLv :label="t('item.descriptor.buyer')">
|
||||||
|
<template #value>
|
||||||
|
<span class="link">
|
||||||
|
{{ t('item.descriptor.buyer') }}
|
||||||
|
<WorkerDescriptorProxy :id="entity.itemType?.worker?.id" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</VnLv>
|
||||||
|
<VnLv :label="t('item.descriptor.color')" :value="entity.value5"> </VnLv>
|
||||||
|
<VnLv :label="t('item.descriptor.color')" :value="entity.value6" />
|
||||||
|
<VnLv :label="t('item.descriptor.stems')" :value="entity.value7" />
|
||||||
|
</template>
|
||||||
|
<template #actions="{}">
|
||||||
|
<QCardActions class="row justify-center">
|
||||||
|
<QBtn
|
||||||
|
:to="{ name: 'ItemDiary' }"
|
||||||
|
size="md"
|
||||||
|
icon="vn:transaction"
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('item.descriptor.itemDiary') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</QCardActions>
|
||||||
|
</template>
|
||||||
|
</CardDescriptor>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Regularize stock: Regularizar stock
|
||||||
|
Clone: Clonar
|
||||||
|
All it's properties will be copied: Todas sus propiedades serán copiadas
|
||||||
|
Do you want to clone this item?: ¿Desea clonar este artículo?
|
||||||
|
</i18n>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.photo {
|
||||||
|
height: 256px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-photo-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 12px;
|
||||||
|
bottom: 12px;
|
||||||
|
z-index: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.separation-borders {
|
||||||
|
border-left: 1px solid $white;
|
||||||
|
border-right: 1px solid $white;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<script setup>
|
||||||
|
import ItemDescriptor from './ItemDescriptor.vue';
|
||||||
|
import ItemSummaryDialog from './ItemSummaryDialog.vue';
|
||||||
|
|
||||||
|
const $props = defineProps({
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
dated: {
|
||||||
|
type: String,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QPopupProxy>
|
||||||
|
<ItemDescriptor
|
||||||
|
v-if="$props.id"
|
||||||
|
:id="$props.id"
|
||||||
|
:summary="ItemSummaryDialog"
|
||||||
|
:dated="dated"
|
||||||
|
/>
|
||||||
|
</QPopupProxy>
|
||||||
|
</template>
|
|
@ -0,0 +1 @@
|
||||||
|
<template>Item diary (CREAR CUANDO SE DESARROLLE EL MODULO DE ITEMS)</template>
|
|
@ -0,0 +1 @@
|
||||||
|
<template>Item summary</template>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<template>
|
||||||
|
<QDialog
|
||||||
|
>Item summary dialog (A DESARROLLAR CUANDO SE CREE EL MODULO DE ITEMS)</QDialog
|
||||||
|
>
|
||||||
|
</template>
|
|
@ -0,0 +1 @@
|
||||||
|
<template>Item tags (CREAR CUANDO SE DESARROLLE EL MODULO DE ITEMS)</template>
|
|
@ -0,0 +1 @@
|
||||||
|
<template>Item list</template>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<script setup>
|
||||||
|
import LeftMenu from 'src/components/LeftMenu.vue';
|
||||||
|
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
|
const stateStore = useStateStore();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||||
|
<QScrollArea class="fit text-grey-8">
|
||||||
|
<LeftMenu />
|
||||||
|
</QScrollArea>
|
||||||
|
</QDrawer>
|
||||||
|
<QPageContainer>
|
||||||
|
<RouterView></RouterView>
|
||||||
|
</QPageContainer>
|
||||||
|
</template>
|
|
@ -1,10 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useSession } from 'composables/useSession';
|
|
||||||
import VnLv from 'components/ui/VnLv.vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue';
|
|
||||||
import toCurrency from '../../../filters/toCurrency';
|
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import VnLv from 'components/ui/VnLv.vue';
|
||||||
|
import OrderCatalogItemDialog from 'pages/Order/Card/OrderCatalogItemDialog.vue';
|
||||||
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
|
||||||
|
import { useSession } from 'composables/useSession';
|
||||||
|
import toCurrency from '../../../filters/toCurrency';
|
||||||
|
|
||||||
const DEFAULT_PRICE_KG = 0;
|
const DEFAULT_PRICE_KG = 0;
|
||||||
|
|
||||||
|
@ -42,7 +45,10 @@ const dialog = ref(null);
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<span class="link">{{ item.name }}</span>
|
<span class="link">
|
||||||
|
{{ item.name }}
|
||||||
|
<ItemDescriptorProxy :id="item.id" />
|
||||||
|
</span>
|
||||||
<p class="subName">{{ item.subName }}</p>
|
<p class="subName">{{ item.subName }}</p>
|
||||||
<template v-for="index in 4" :key="`tag-${index}`">
|
<template v-for="index in 4" :key="`tag-${index}`">
|
||||||
<VnLv
|
<VnLv
|
||||||
|
@ -51,13 +57,6 @@ const dialog = ref(null);
|
||||||
:value="item?.[`value${index + 4}`]"
|
:value="item?.[`value${index + 4}`]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<QRating
|
|
||||||
:model-value="item.stars"
|
|
||||||
icon="star"
|
|
||||||
icon-selected="star"
|
|
||||||
color="primary"
|
|
||||||
readonly
|
|
||||||
/>
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="price">
|
<div class="price">
|
||||||
<p>{{ item.available }} {{ t('to') }} {{ item.price }}</p>
|
<p>{{ item.available }} {{ t('to') }} {{ item.price }}</p>
|
||||||
|
@ -72,7 +71,8 @@ const dialog = ref(null);
|
||||||
</QIcon>
|
</QIcon>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="item.priceKg" class="price-kg">
|
<p v-if="item.priceKg" class="price-kg">
|
||||||
{{ t('price-kg') }} {{ toCurrency(item.priceKg) || DEFAULT_PRICE_KG }}
|
{{ t('price-kg') }}
|
||||||
|
{{ toCurrency(item.priceKg) || DEFAULT_PRICE_KG }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@ import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import RouteSummaryDialog from 'pages/Route/Card/RouteSummaryDialog.vue';
|
import RouteSummaryDialog from 'pages/Route/Card/RouteSummaryDialog.vue';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -228,8 +229,8 @@ function previewRoute(id) {
|
||||||
<FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load />
|
<FetchData url="AgencyModes" @on-fetch="(data) => (agencyList = data)" auto-load />
|
||||||
<FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load />
|
<FetchData url="Vehicles" @on-fetch="(data) => (vehicleList = data)" auto-load />
|
||||||
<QPage class="column items-center">
|
<QPage class="column items-center">
|
||||||
<QToolbar class="bg-vn-dark justify-end">
|
<VnSubToolbar class="bg-vn-dark justify-end">
|
||||||
<div id="st-actions" class="q-pa-sm">
|
<template #st-actions>
|
||||||
<QBtn
|
<QBtn
|
||||||
icon="vn:clone"
|
icon="vn:clone"
|
||||||
color="primary"
|
color="primary"
|
||||||
|
@ -249,8 +250,8 @@ function previewRoute(id) {
|
||||||
>
|
>
|
||||||
<QTooltip>{{ t('Mark as served') }}</QTooltip>
|
<QTooltip>{{ t('Mark as served') }}</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</div>
|
</template>
|
||||||
</QToolbar>
|
</VnSubToolbar>
|
||||||
<div class="route-list">
|
<div class="route-list">
|
||||||
<VnPaginate
|
<VnPaginate
|
||||||
:key="refreshKey"
|
:key="refreshKey"
|
||||||
|
|
|
@ -99,10 +99,15 @@ onMounted(() => {
|
||||||
class="row q-gutter-md q-mb-md"
|
class="row q-gutter-md q-mb-md"
|
||||||
>
|
>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput :label="t('supplier.accounts.iban')" v-model="row.iban">
|
||||||
:label="t('supplier.accounts.iban')"
|
<template #append>
|
||||||
v-model="row.iban"
|
<QIcon name="info" class="cursor-info">
|
||||||
/>
|
<QTooltip>{{
|
||||||
|
t('components.iban_tooltip')
|
||||||
|
}}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
|
@ -135,7 +140,17 @@ onMounted(() => {
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('supplier.accounts.beneficiary')"
|
:label="t('supplier.accounts.beneficiary')"
|
||||||
v-model="row.beneficiary"
|
v-model="row.beneficiary"
|
||||||
/>
|
>
|
||||||
|
<template #append>
|
||||||
|
<QIcon name="info" class="cursor-pointer">
|
||||||
|
<QTooltip>{{
|
||||||
|
t(
|
||||||
|
'Name of the bank account holder if different from the provider'
|
||||||
|
)
|
||||||
|
}}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-1 row justify-center items-center">
|
<div class="col-1 row justify-center items-center">
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -174,4 +189,5 @@ onMounted(() => {
|
||||||
Do you want to change the pay method to wire transfer?: ¿Quieres modificar la forma de pago a transferencia?
|
Do you want to change the pay method to wire transfer?: ¿Quieres modificar la forma de pago a transferencia?
|
||||||
Add account: Añadir cuenta
|
Add account: Añadir cuenta
|
||||||
Remove account: Remover cuenta
|
Remove account: Remover cuenta
|
||||||
|
Name of the bank account holder if different from the provider: Nombre del titular de la cuenta bancaria en caso de ser diferente del proveedor
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -147,8 +147,6 @@ onMounted(() => {
|
||||||
option-value="id"
|
option-value="id"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
:label="t('supplier.addresses.province')"
|
:label="t('supplier.addresses.province')"
|
||||||
|
@ -160,21 +158,20 @@ onMounted(() => {
|
||||||
v-model="data.provinceFk"
|
v-model="data.provinceFk"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.phone"
|
v-model="data.phone"
|
||||||
:label="t('supplier.addresses.phone')"
|
:label="t('supplier.addresses.phone')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
v-model="data.mobile"
|
v-model="data.mobile"
|
||||||
:label="t('supplier.addresses.mobile')"
|
:label="t('supplier.addresses.mobile')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col" />
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
|
|
@ -80,8 +80,6 @@ const onDataSaved = () => {
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<QInput
|
<QInput
|
||||||
:label="t('supplier.agencyTerms.m3Price')"
|
:label="t('supplier.agencyTerms.m3Price')"
|
||||||
|
@ -89,6 +87,8 @@ const onDataSaved = () => {
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</VnRow>
|
||||||
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<QInput
|
<QInput
|
||||||
:label="t('supplier.agencyTerms.routePrice')"
|
:label="t('supplier.agencyTerms.routePrice')"
|
||||||
|
@ -96,8 +96,6 @@ const onDataSaved = () => {
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<QInput
|
<QInput
|
||||||
:label="t('supplier.agencyTerms.minimumKm')"
|
:label="t('supplier.agencyTerms.minimumKm')"
|
||||||
|
@ -105,7 +103,6 @@ const onDataSaved = () => {
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col" />
|
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
|
|
|
@ -48,6 +48,13 @@ const workersOptions = ref([]);
|
||||||
map-options
|
map-options
|
||||||
:rules="validate('supplier.workerFk')"
|
:rules="validate('supplier.workerFk')"
|
||||||
>
|
>
|
||||||
|
<template #append>
|
||||||
|
<QIcon name="info" class="cursor-pointer">
|
||||||
|
<QTooltip>{{
|
||||||
|
t('Responsible for approving invoices')
|
||||||
|
}}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
|
@ -88,10 +95,14 @@ const workersOptions = ref([]);
|
||||||
type="textarea"
|
type="textarea"
|
||||||
v-model="data.note"
|
v-model="data.note"
|
||||||
fill-input
|
fill-input
|
||||||
autogrow
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Responsible for approving invoices: Responsable de aprobar las facturas
|
||||||
|
</i18n>
|
||||||
|
|
|
@ -13,6 +13,13 @@ const { t } = useI18n();
|
||||||
|
|
||||||
const paymethodsOptions = ref([]);
|
const paymethodsOptions = ref([]);
|
||||||
const payDemsOptions = ref([]);
|
const payDemsOptions = ref([]);
|
||||||
|
|
||||||
|
const formatPayDems = (data) => {
|
||||||
|
payDemsOptions.value = data.map(({ id, payDem }) => ({
|
||||||
|
id: id,
|
||||||
|
payDem: payDem || '0',
|
||||||
|
}));
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -20,7 +27,7 @@ const payDemsOptions = ref([]);
|
||||||
@on-fetch="(data) => (paymethodsOptions = data)"
|
@on-fetch="(data) => (paymethodsOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData url="PayDems" @on-fetch="(data) => (payDemsOptions = data)" auto-load />
|
<FetchData url="PayDems" @on-fetch="(data) => formatPayDems(data)" auto-load />
|
||||||
<FormModel
|
<FormModel
|
||||||
:url="`Suppliers/${route.params.id}`"
|
:url="`Suppliers/${route.params.id}`"
|
||||||
:url-update="`Suppliers/${route.params.id}`"
|
:url-update="`Suppliers/${route.params.id}`"
|
||||||
|
@ -37,7 +44,6 @@ const payDemsOptions = ref([]);
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
hide-selected
|
hide-selected
|
||||||
map-options
|
|
||||||
:rules="validate('supplier.payMethodFk')"
|
:rules="validate('supplier.payMethodFk')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +55,6 @@ const payDemsOptions = ref([]);
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="payDem"
|
option-label="payDem"
|
||||||
hide-selected
|
hide-selected
|
||||||
map-options
|
|
||||||
:rules="validate('supplier.payDemFk')"
|
:rules="validate('supplier.payDemFk')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,8 +7,9 @@ import { useQuasar } from 'quasar';
|
||||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||||
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
|
import SupplierConsumptionFilter from './SupplierConsumptionFilter.vue';
|
||||||
|
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||||
|
|
||||||
import { toDate, toDateString } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import { dashIfEmpty } from 'src/filters';
|
import { dashIfEmpty } from 'src/filters';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
|
@ -31,23 +32,26 @@ const arrayData = useArrayData('SupplierConsumption', {
|
||||||
|
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
|
|
||||||
const userParams = computed(() => {
|
const dateRanges = computed(() => {
|
||||||
const minDate = Date.vnNew();
|
const ranges = {
|
||||||
minDate.setHours(0, 0, 0, 0);
|
from: null,
|
||||||
minDate.setMonth(minDate.getMonth() - 2);
|
to: null,
|
||||||
|
|
||||||
const maxDate = Date.vnNew();
|
|
||||||
maxDate.setHours(23, 59, 59, 59);
|
|
||||||
|
|
||||||
return {
|
|
||||||
from: toDateString(minDate),
|
|
||||||
to: toDateString(maxDate),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (route.query && route.query.params) {
|
||||||
|
const params = JSON.parse(route.query.params);
|
||||||
|
if (params.from && params.to) {
|
||||||
|
ranges.from = params.from;
|
||||||
|
ranges.to = params.to;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ranges;
|
||||||
});
|
});
|
||||||
|
|
||||||
const reportParams = computed(() => ({
|
const reportParams = computed(() => ({
|
||||||
recipientId: Number(route.params.id),
|
recipientId: Number(route.params.id),
|
||||||
...userParams.value,
|
...dateRanges.value,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
async function getSupplierConsumptionData() {
|
async function getSupplierConsumptionData() {
|
||||||
|
@ -101,10 +105,8 @@ const sendCampaignMetricsEmail = ({ address }) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const calculateTotal = (buysArray) => {
|
const calculateTotal = (buysArray = []) =>
|
||||||
if (!buysArray || !buysArray.length > 0) return;
|
buysArray.reduce((accumulator, { total }) => accumulator + total, 0);
|
||||||
return buysArray.reduce((accumulator, { total }) => accumulator + total, 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
stateStore.rightDrawer = true;
|
stateStore.rightDrawer = true;
|
||||||
|
@ -113,10 +115,9 @@ onMounted(async () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<QToolbar class="bg-vn-dark justify-end">
|
<Teleport to="#st-actions" v-if="stateStore.isSubToolbarShown()">
|
||||||
<div id="st-data">
|
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="userParams.from && userParams.to"
|
:disabled="!dateRanges.from && !dateRanges.to"
|
||||||
color="primary"
|
color="primary"
|
||||||
icon-right="picture_as_pdf"
|
icon-right="picture_as_pdf"
|
||||||
no-caps
|
no-caps
|
||||||
|
@ -128,7 +129,7 @@ onMounted(async () => {
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
<QBtn
|
<QBtn
|
||||||
v-if="userParams.from && userParams.to"
|
:disabled="!dateRanges.from && !dateRanges.to"
|
||||||
color="primary"
|
color="primary"
|
||||||
icon-right="email"
|
icon-right="email"
|
||||||
no-caps
|
no-caps
|
||||||
|
@ -138,10 +139,7 @@ onMounted(async () => {
|
||||||
{{ t('Send to email') }}
|
{{ t('Send to email') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</div>
|
</Teleport>
|
||||||
<QSpace />
|
|
||||||
<div id="st-actions"></div>
|
|
||||||
</QToolbar>
|
|
||||||
|
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
|
@ -151,11 +149,11 @@ onMounted(async () => {
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
<QTable
|
<QTable
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
hide-bottom
|
|
||||||
row-key="id"
|
row-key="id"
|
||||||
hide-header
|
hide-header
|
||||||
:pagination="{ rowsPerPage: 0 }"
|
:pagination="{ rowsPerPage: 0 }"
|
||||||
class="full-width q-mt-md"
|
class="full-width q-mt-md"
|
||||||
|
:no-data-label="t('No results')"
|
||||||
>
|
>
|
||||||
<template #body="{ row }">
|
<template #body="{ row }">
|
||||||
<QTr>
|
<QTr>
|
||||||
|
@ -171,7 +169,10 @@ onMounted(async () => {
|
||||||
<QTd no-hover>{{ row.invoiceNumber }}</QTd>
|
<QTd no-hover>{{ row.invoiceNumber }}</QTd>
|
||||||
</QTr>
|
</QTr>
|
||||||
<QTr v-for="(buy, index) in row.buys" :key="index">
|
<QTr v-for="(buy, index) in row.buys" :key="index">
|
||||||
<QTd no-hover> {{ buy.itemName }}</QTd>
|
<QTd no-hover>
|
||||||
|
<QBtn flat color="blue" dense>{{ buy.itemName }}</QBtn>
|
||||||
|
<ItemDescriptorProxy :id="buy.itemFk" />
|
||||||
|
</QTd>
|
||||||
|
|
||||||
<QTd no-hover>
|
<QTd no-hover>
|
||||||
<span>{{ buy.subName }}</span>
|
<span>{{ buy.subName }}</span>
|
||||||
|
|
|
@ -50,18 +50,14 @@ const itemCategoriesOptions = ref([]);
|
||||||
@on-fetch="(data) => (itemCategoriesOptions = data)"
|
@on-fetch="(data) => (itemCategoriesOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<VnFilterPanel
|
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||||
:data-key="props.dataKey"
|
|
||||||
:search-button="true"
|
|
||||||
:unremovable-params="['supplierFk']"
|
|
||||||
>
|
|
||||||
<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(`params.${tag.label}`) }}: </strong>
|
||||||
<span>{{ formatFn(tag.value) }}</span>
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ params }">
|
<template #body="{ params, searchFn }">
|
||||||
<QItem>
|
<QItem>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInput
|
<VnInput
|
||||||
|
@ -85,6 +81,7 @@ const itemCategoriesOptions = ref([]);
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
:label="t('params.buyerId')"
|
:label="t('params.buyerId')"
|
||||||
v-model="params.buyerId"
|
v-model="params.buyerId"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
:options="buyersOptions"
|
:options="buyersOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
|
@ -100,6 +97,7 @@ const itemCategoriesOptions = ref([]);
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
:label="t('params.typeId')"
|
:label="t('params.typeId')"
|
||||||
v-model="params.typeId"
|
v-model="params.typeId"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
:options="itemTypesOptions"
|
:options="itemTypesOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -126,6 +124,7 @@ const itemCategoriesOptions = ref([]);
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
:label="t('params.categoryId')"
|
:label="t('params.categoryId')"
|
||||||
v-model="params.categoryId"
|
v-model="params.categoryId"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
:options="itemCategoriesOptions"
|
:options="itemCategoriesOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -140,8 +139,9 @@ const itemCategoriesOptions = ref([]);
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('params.from')"
|
:label="t('params.from')"
|
||||||
is-outlined
|
|
||||||
v-model="params.from"
|
v-model="params.from"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
is-outlined
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
@ -149,8 +149,9 @@ const itemCategoriesOptions = ref([]);
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnInputDate
|
<VnInputDate
|
||||||
:label="t('params.to')"
|
:label="t('params.to')"
|
||||||
is-outlined
|
|
||||||
v-model="params.to"
|
v-model="params.to"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
is-outlined
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
<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';
|
||||||
|
|
||||||
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 { toDateString } from 'src/filters';
|
||||||
import useCardDescription from 'src/composables/useCardDescription';
|
import useCardDescription from 'src/composables/useCardDescription';
|
||||||
|
import { getUrl } from 'src/composables/getUrl';
|
||||||
|
|
||||||
const $props = defineProps({
|
const $props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
|
@ -16,6 +20,7 @@ const $props = defineProps({
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const url = ref();
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: [
|
fields: [
|
||||||
|
@ -53,6 +58,10 @@ const filter = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
url.value = await getUrl('');
|
||||||
|
});
|
||||||
|
|
||||||
const entityId = computed(() => {
|
const entityId = computed(() => {
|
||||||
return $props.id || route.params.id;
|
return $props.id || route.params.id;
|
||||||
});
|
});
|
||||||
|
@ -61,6 +70,27 @@ const data = ref(useCardDescription());
|
||||||
const setData = (entity) => {
|
const setData = (entity) => {
|
||||||
data.value = useCardDescription(entity.ref, entity.id);
|
data.value = useCardDescription(entity.ref, entity.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getEntryQueryParams = (supplier) => {
|
||||||
|
if (!supplier) return null;
|
||||||
|
|
||||||
|
const date = Date.vnNew();
|
||||||
|
date.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
|
const from = new Date(date.getTime());
|
||||||
|
from.setDate(from.getDate() - 10);
|
||||||
|
|
||||||
|
const to = new Date(date.getTime());
|
||||||
|
to.setDate(to.getDate() + 10);
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
supplierFk: supplier.id,
|
||||||
|
from: toDateString(from),
|
||||||
|
to: toDateString(to),
|
||||||
|
};
|
||||||
|
|
||||||
|
return params;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -73,6 +103,22 @@ const setData = (entity) => {
|
||||||
@on-fetch="setData"
|
@on-fetch="setData"
|
||||||
data-key="Supplier"
|
data-key="Supplier"
|
||||||
>
|
>
|
||||||
|
<template #header-extra-action>
|
||||||
|
<QBtn
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
size="md"
|
||||||
|
icon="vn:supplier"
|
||||||
|
color="white"
|
||||||
|
class="link"
|
||||||
|
:to="{ name: 'SupplierList' }"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('Go to module index') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('supplier.summary.taxNumber')" :value="entity.nif" />
|
<VnLv :label="t('supplier.summary.taxNumber')" :value="entity.nif" />
|
||||||
<VnLv label="Alias" :value="entity.nickname" />
|
<VnLv label="Alias" :value="entity.nickname" />
|
||||||
|
@ -87,8 +133,69 @@ const setData = (entity) => {
|
||||||
<VnLv :label="t('supplier.summary.payDay')" :value="entity.payDay" />
|
<VnLv :label="t('supplier.summary.payDay')" :value="entity.payDay" />
|
||||||
<VnLv :label="t('supplier.summary.account')" :value="entity.account" />
|
<VnLv :label="t('supplier.summary.account')" :value="entity.account" />
|
||||||
</template>
|
</template>
|
||||||
|
<template #icons="{ entity }">
|
||||||
|
<QCardActions class="q-gutter-x-md">
|
||||||
|
<QIcon
|
||||||
|
v-if="!entity.isActive"
|
||||||
|
name="vn:disabled"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('Inactive supplier') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="!entity.isSerious"
|
||||||
|
name="vn:supplierfalse"
|
||||||
|
color="primary"
|
||||||
|
size="xs"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('Unverified supplier') }}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</QCardActions>
|
||||||
|
</template>
|
||||||
|
<template #actions="{ entity }">
|
||||||
|
<QCardActions>
|
||||||
|
<QBtn
|
||||||
|
:to="{
|
||||||
|
name: 'EntryList',
|
||||||
|
query: { params: JSON.stringify(getEntryQueryParams(entity)) },
|
||||||
|
}"
|
||||||
|
size="md"
|
||||||
|
icon="vn:entry"
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('All entries with current supplier') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
:to="{
|
||||||
|
name: 'CustomerCard',
|
||||||
|
params: { id: entity.client?.id },
|
||||||
|
}"
|
||||||
|
size="md"
|
||||||
|
icon="vn:Person"
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('Go to client') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
:href="`${url}invoice-in/create?supplierFk=${entity.id}`"
|
||||||
|
size="md"
|
||||||
|
icon="vn:invoice-in-create"
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
|
<QTooltip>{{ t('Create invoiceIn') }}</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
</QCardActions>
|
||||||
|
</template>
|
||||||
</CardDescriptor>
|
</CardDescriptor>
|
||||||
</template>
|
</template>
|
||||||
<i18n>
|
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
All entries with current supplier: Todas las entradas con proveedor actual
|
||||||
|
Go to client: Ir a cliente
|
||||||
|
Create invoiceIn: Crear factura recibida
|
||||||
|
Go to module index: Ir al índice del módulo
|
||||||
|
Inactive supplier: Proveedor inactivo
|
||||||
|
Unverified supplier: Proveedor no verificado
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive } from 'vue';
|
import { reactive } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
@ -9,12 +11,17 @@ import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
|
||||||
const newSupplierForm = reactive({
|
const newSupplierForm = reactive({
|
||||||
name: null,
|
name: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const redirectToSupplierFiscalData = (_, responseData) => {
|
||||||
|
router.push({ name: 'SupplierFiscalData', params: { id: responseData.id } });
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -34,6 +41,7 @@ const newSupplierForm = reactive({
|
||||||
url-create="Suppliers/newSupplier"
|
url-create="Suppliers/newSupplier"
|
||||||
model="supplier"
|
model="supplier"
|
||||||
:form-initial-data="newSupplierForm"
|
:form-initial-data="newSupplierForm"
|
||||||
|
@on-data-saved="redirectToSupplierFiscalData"
|
||||||
>
|
>
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useQuasar } from 'quasar';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import CardList from 'src/components/ui/CardList.vue';
|
import CardList from 'src/components/ui/CardList.vue';
|
||||||
import VnLv from 'src/components/ui/VnLv.vue';
|
import VnLv from 'src/components/ui/VnLv.vue';
|
||||||
import { useQuasar } from 'quasar';
|
|
||||||
import SupplierSummaryDialog from './Card/SupplierSummaryDialog.vue';
|
import SupplierSummaryDialog from './Card/SupplierSummaryDialog.vue';
|
||||||
|
import SupplierListFilter from './SupplierListFilter.vue';
|
||||||
|
|
||||||
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
|
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -44,6 +47,11 @@ const viewSummary = (id) => {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<QPage class="column items-center q-pa-md">
|
<QPage class="column items-center q-pa-md">
|
||||||
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
|
<QScrollArea class="fit text-grey-8">
|
||||||
|
<SupplierListFilter data-key="SuppliersList" />
|
||||||
|
</QScrollArea>
|
||||||
|
</QDrawer>
|
||||||
<div class="vn-card-list">
|
<div class="vn-card-list">
|
||||||
<VnPaginate data-key="SuppliersList" url="Suppliers/filter" auto-load>
|
<VnPaginate data-key="SuppliersList" url="Suppliers/filter" auto-load>
|
||||||
<template #body="{ rows }">
|
<template #body="{ rows }">
|
||||||
|
@ -56,7 +64,7 @@ const viewSummary = (id) => {
|
||||||
>
|
>
|
||||||
<template #list-items>
|
<template #list-items>
|
||||||
<VnLv label="NIF/CIF" :value="row.nif" />
|
<VnLv label="NIF/CIF" :value="row.nif" />
|
||||||
<VnLv label="Alias" :value="row.nickname" />
|
<VnLv label="Alias" :value="row.alias" />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('supplier.list.payMethod')"
|
:label="t('supplier.list.payMethod')"
|
||||||
:value="row.payMethod"
|
:value="row.payMethod"
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
<script setup>
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
|
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
import FetchData from 'components/FetchData.vue';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
dataKey: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const provincesOptions = ref([]);
|
||||||
|
const countriesOptions = ref([]);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<FetchData
|
||||||
|
url="Provinces"
|
||||||
|
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||||
|
@on-fetch="(data) => (provincesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="countries"
|
||||||
|
:filter="{ fields: ['id', 'country'], order: 'country ASC', limit: 30 }"
|
||||||
|
@on-fetch="(data) => (countriesOptions = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
|
<VnFilterPanel
|
||||||
|
:data-key="props.dataKey"
|
||||||
|
:search-button="true"
|
||||||
|
:unremovable-params="['supplierFk']"
|
||||||
|
>
|
||||||
|
<template #tags="{ tag, formatFn }">
|
||||||
|
<div class="q-gutter-x-xs">
|
||||||
|
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||||
|
<span>{{ formatFn(tag.value) }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #body="{ params, searchFn }">
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput
|
||||||
|
v-model="params.search"
|
||||||
|
:label="t('params.search')"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput
|
||||||
|
v-model="params.nickname"
|
||||||
|
:label="t('params.nickname')"
|
||||||
|
is-outlined
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnInput v-model="params.nif" :label="t('params.nif')" is-outlined />
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelectFilter
|
||||||
|
:label="t('params.provinceFk')"
|
||||||
|
v-model="params.provinceFk"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
:options="provincesOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
hide-selected
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem>
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelectFilter
|
||||||
|
:label="t('params.countryFk')"
|
||||||
|
v-model="params.countryFk"
|
||||||
|
@update:model-value="searchFn()"
|
||||||
|
:options="countriesOptions"
|
||||||
|
option-value="id"
|
||||||
|
option-label="country"
|
||||||
|
hide-selected
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
</template>
|
||||||
|
</VnFilterPanel>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<i18n>
|
||||||
|
en:
|
||||||
|
params:
|
||||||
|
search: General search
|
||||||
|
nickname: Alias
|
||||||
|
nif: Tax number
|
||||||
|
provinceFk: Province
|
||||||
|
countryFk: Country
|
||||||
|
es:
|
||||||
|
params:
|
||||||
|
search: Búsqueda general
|
||||||
|
nickname: Alias
|
||||||
|
nif: NIF/CIF
|
||||||
|
provinceFk: Provincia
|
||||||
|
countryFk: País
|
||||||
|
</i18n>
|
|
@ -58,7 +58,7 @@ function formattedAddress() {
|
||||||
|
|
||||||
function isEditable() {
|
function isEditable() {
|
||||||
try {
|
try {
|
||||||
return !ticket.value.ticketState.state.alertLevel;
|
return !ticket.value.ticketState?.state?.alertLevel;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
@ -153,8 +153,8 @@ async function changeState(value) {
|
||||||
</a>
|
</a>
|
||||||
<VnLv :label="t('ticket.summary.state')">
|
<VnLv :label="t('ticket.summary.state')">
|
||||||
<template #value>
|
<template #value>
|
||||||
<QChip :color="ticket.ticketState.state.classColor ?? 'dark'">
|
<QChip :color="ticket.ticketState?.state?.classColor ?? 'dark'">
|
||||||
{{ ticket.ticketState.state.name }}
|
{{ ticket.ticketState?.state?.name }}
|
||||||
</QChip>
|
</QChip>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { useArrayData } from 'composables/useArrayData';
|
||||||
import { toDate } from 'src/filters';
|
import { toDate } from 'src/filters';
|
||||||
import { usePrintService } from 'composables/usePrintService';
|
import { usePrintService } from 'composables/usePrintService';
|
||||||
import travelService from 'src/services/travel.service';
|
import travelService from 'src/services/travel.service';
|
||||||
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const stateStore = useStateStore();
|
const stateStore = useStateStore();
|
||||||
|
@ -259,10 +260,8 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
</template>
|
</template>
|
||||||
<QToolbar class="bg-vn-dark justify-end">
|
<VnSubToolbar class="bg-vn-dark justify-end">
|
||||||
<div id="st-data"></div>
|
<template #st-actions>
|
||||||
<QSpace />
|
|
||||||
<div id="st-actions">
|
|
||||||
<QBtn
|
<QBtn
|
||||||
color="primary"
|
color="primary"
|
||||||
icon-right="picture_as_pdf"
|
icon-right="picture_as_pdf"
|
||||||
|
@ -273,8 +272,8 @@ onMounted(async () => {
|
||||||
{{ t('Open as PDF') }}
|
{{ t('Open as PDF') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</div>
|
</template>
|
||||||
</QToolbar>
|
</VnSubToolbar>
|
||||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
<ExtraCommunityFilter data-key="ExtraCommunity" />
|
<ExtraCommunityFilter data-key="ExtraCommunity" />
|
||||||
|
|
|
@ -101,7 +101,7 @@ const setData = (entity) => {
|
||||||
</template>
|
</template>
|
||||||
<template #body="{ entity }">
|
<template #body="{ entity }">
|
||||||
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />
|
<VnLv :label="t('worker.card.name')" :value="entity.user?.nickname" />
|
||||||
<VnLv :label="t('worker.card.email')" :value="entity.user?.email"> </VnLv>
|
<VnLv :label="t('worker.card.email')" :value="entity.user?.email" copy />
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('worker.list.department')"
|
:label="t('worker.list.department')"
|
||||||
:value="entity.department ? entity.department.department.name : null"
|
:value="entity.department ? entity.department.department.name : null"
|
||||||
|
|
|
@ -80,7 +80,7 @@ const filter = {
|
||||||
:label="t('worker.list.department')"
|
:label="t('worker.list.department')"
|
||||||
:value="worker.department.department.name"
|
:value="worker.department.department.name"
|
||||||
/>
|
/>
|
||||||
<VnLv :label="t('worker.list.email')" :value="worker.user.email" />
|
<VnLv :label="t('worker.list.email')" :value="worker.user.email" copy />
|
||||||
<VnLv :label="t('worker.summary.boss')" link>
|
<VnLv :label="t('worker.summary.boss')" link>
|
||||||
<template #value>
|
<template #value>
|
||||||
<VnUserLink
|
<VnUserLink
|
||||||
|
|
|
@ -10,6 +10,7 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||||
|
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
|
@ -21,14 +22,6 @@ const workerConfigFilter = {
|
||||||
field: ['payMethodFk'],
|
field: ['payMethodFk'],
|
||||||
};
|
};
|
||||||
|
|
||||||
const provincesFilter = {
|
|
||||||
fields: ['id', 'name', 'countryFk'],
|
|
||||||
};
|
|
||||||
|
|
||||||
const townsFilter = {
|
|
||||||
fields: ['id', 'name', 'provinceFk'],
|
|
||||||
};
|
|
||||||
|
|
||||||
const newWorkerForm = ref({
|
const newWorkerForm = ref({
|
||||||
companyFk: null,
|
companyFk: null,
|
||||||
payMethodFk: null,
|
payMethodFk: null,
|
||||||
|
@ -49,10 +42,6 @@ const newWorkerForm = ref({
|
||||||
bankEntityFk: null,
|
bankEntityFk: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const postcodeFetchDataRef = ref(null);
|
|
||||||
const townsFetchDataRef = ref(null);
|
|
||||||
const provincesOptions = ref([]);
|
|
||||||
const townsOptions = ref([]);
|
|
||||||
const companiesOptions = ref([]);
|
const companiesOptions = ref([]);
|
||||||
const workersOptions = ref([]);
|
const workersOptions = ref([]);
|
||||||
const payMethodsOptions = ref([]);
|
const payMethodsOptions = ref([]);
|
||||||
|
@ -67,13 +56,13 @@ const onBankEntityCreated = (data) => {
|
||||||
bankEntitiesOptions.value.push(data);
|
bankEntitiesOptions.value.push(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPostcodeCreated = async ({ code, provinceFk, townFk }, formData) => {
|
function handleLocation(data, location) {
|
||||||
await postcodeFetchDataRef.value.fetch();
|
const { town, postcode: code, provinceFk, countryFk } = location ?? {};
|
||||||
await townsFetchDataRef.value.fetch();
|
data.postcode = code;
|
||||||
formData.postcode = code;
|
data.city = town;
|
||||||
formData.provinceFk = provinceFk;
|
data.provinceFk = provinceFk;
|
||||||
formData.city = townsOptions.value.find((town) => town.id === townFk).name;
|
data.countryFk = countryFk;
|
||||||
};
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const userInfo = await useUserConfig().fetch();
|
const userInfo = await useUserConfig().fetch();
|
||||||
|
@ -88,25 +77,7 @@ onMounted(async () => {
|
||||||
:filter="workerConfigFilter"
|
:filter="workerConfigFilter"
|
||||||
auto-load
|
auto-load
|
||||||
/>
|
/>
|
||||||
<FetchData
|
|
||||||
ref="postcodeFetchDataRef"
|
|
||||||
url="Postcodes/location"
|
|
||||||
@on-fetch="(data) => (postcodesOptions = data)"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
url="Provinces/location"
|
|
||||||
@on-fetch="(data) => (provincesOptions = data)"
|
|
||||||
:filter="provincesFilter"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
|
||||||
ref="townsFetchDataRef"
|
|
||||||
url="Towns/location"
|
|
||||||
@on-fetch="(data) => (townsOptions = data)"
|
|
||||||
:filter="townsFilter"
|
|
||||||
auto-load
|
|
||||||
/>
|
|
||||||
<FetchData
|
<FetchData
|
||||||
url="Companies"
|
url="Companies"
|
||||||
@on-fetch="(data) => (companiesOptions = data)"
|
@on-fetch="(data) => (companiesOptions = data)"
|
||||||
|
@ -184,77 +155,19 @@ onMounted(async () => {
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnSelectDialog
|
<VnLocation
|
||||||
v-model="data.postcode"
|
|
||||||
:label="t('worker.create.postcode')"
|
|
||||||
:rules="validate('Worker.postcode')"
|
:rules="validate('Worker.postcode')"
|
||||||
:roles-allowed-to-create="['deliveryAssistant']"
|
:roles-allowed-to-create="['deliveryAssistant']"
|
||||||
:options="postcodesOptions"
|
:options="postcodesOptions"
|
||||||
option-label="code"
|
v-model="data.location"
|
||||||
option-value="code"
|
@update:model-value="
|
||||||
hide-selected
|
(location) => handleLocation(data, location)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #form>
|
</VnLocation>
|
||||||
<CustomerCreateNewPostcode
|
|
||||||
@on-data-saved="onPostcodeCreated($event, data)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection v-if="scope.opt">
|
|
||||||
<QItemLabel>{{ scope.opt.code }}</QItemLabel>
|
|
||||||
<QItemLabel caption
|
|
||||||
>{{ scope.opt.code }} -
|
|
||||||
{{ scope.opt.town.name }} ({{
|
|
||||||
scope.opt.town.province.name
|
|
||||||
}},
|
|
||||||
{{
|
|
||||||
scope.opt.town.province.country.country
|
|
||||||
}})</QItemLabel
|
|
||||||
>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelectDialog>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<VnSelectFilter
|
|
||||||
:label="t('worker.create.province')"
|
|
||||||
v-model="data.provinceFk"
|
|
||||||
:options="provincesOptions"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
hide-selected
|
|
||||||
:rules="validate('Worker.provinceFk')"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<div class="col">
|
|
||||||
<VnSelectFilter
|
|
||||||
:label="t('worker.create.city')"
|
|
||||||
v-model="data.city"
|
|
||||||
:options="townsOptions"
|
|
||||||
option-value="name"
|
|
||||||
option-label="name"
|
|
||||||
hide-selected
|
|
||||||
:rules="validate('Worker.city')"
|
|
||||||
>
|
|
||||||
<template #option="scope">
|
|
||||||
<QItem v-bind="scope.itemProps">
|
|
||||||
<QItemSection>
|
|
||||||
<QItemLabel>{{ scope.opt.name }}</QItemLabel>
|
|
||||||
<QItemLabel caption
|
|
||||||
>{{ scope.opt.name }},
|
|
||||||
{{ scope.opt.province.name }} ({{
|
|
||||||
scope.opt.province.country.country
|
|
||||||
}})</QItemLabel
|
|
||||||
>
|
|
||||||
</QItemSection>
|
|
||||||
</QItem>
|
|
||||||
</template>
|
|
||||||
</VnSelectFilter>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('worker.create.street')"
|
:label="t('worker.create.street')"
|
||||||
|
@ -334,7 +247,15 @@ onMounted(async () => {
|
||||||
v-model="data.iban"
|
v-model="data.iban"
|
||||||
:label="t('worker.create.iban')"
|
:label="t('worker.create.iban')"
|
||||||
:rules="validate('Worker.iban')"
|
:rules="validate('Worker.iban')"
|
||||||
/>
|
>
|
||||||
|
<template #append>
|
||||||
|
<QIcon name="info" class="cursor-info">
|
||||||
|
<QTooltip>{{
|
||||||
|
t('components.iban_tooltip')
|
||||||
|
}}</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
</template>
|
||||||
|
</VnInput>
|
||||||
</div>
|
</div>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
:label="t('worker.create.bankEntity')"
|
:label="t('worker.create.bankEntity')"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import Item from './item';
|
||||||
import Customer from './customer';
|
import Customer from './customer';
|
||||||
import Ticket from './ticket';
|
import Ticket from './ticket';
|
||||||
import Claim from './claim';
|
import Claim from './claim';
|
||||||
|
@ -14,6 +15,7 @@ import Department from './department';
|
||||||
import Entry from './entry';
|
import Entry from './entry';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
Item,
|
||||||
Customer,
|
Customer,
|
||||||
Ticket,
|
Ticket,
|
||||||
Claim,
|
Claim,
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
import { RouterView } from 'vue-router';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
path: '/item',
|
||||||
|
name: 'Item',
|
||||||
|
meta: {
|
||||||
|
title: 'items',
|
||||||
|
icon: 'vn:item',
|
||||||
|
},
|
||||||
|
component: RouterView,
|
||||||
|
redirect: { name: 'ItemMain' },
|
||||||
|
menus: {
|
||||||
|
main: [],
|
||||||
|
card: [],
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
name: 'ItemMain',
|
||||||
|
component: () => import('src/pages/Item/ItemMain.vue'),
|
||||||
|
redirect: { name: 'Itemlist' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'list',
|
||||||
|
name: 'ItemList',
|
||||||
|
meta: {
|
||||||
|
title: 'list',
|
||||||
|
icon: 'view_list',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Item/ItemList.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ItemCard',
|
||||||
|
path: ':id',
|
||||||
|
component: () => import('src/pages/Item/Card/ItemCard.vue'),
|
||||||
|
redirect: { name: 'ItemSummary' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: 'ItemSummary',
|
||||||
|
path: 'summary',
|
||||||
|
meta: {
|
||||||
|
title: 'summary',
|
||||||
|
icon: 'launch',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Item/Card/ItemSummary.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'diary',
|
||||||
|
name: 'ItemDiary',
|
||||||
|
meta: {
|
||||||
|
title: 'diary',
|
||||||
|
icon: 'vn:transaction',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Item/Card/ItemDiary.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'tags',
|
||||||
|
name: 'ItemTags',
|
||||||
|
meta: {
|
||||||
|
title: 'Tags',
|
||||||
|
icon: 'vn:tags',
|
||||||
|
},
|
||||||
|
component: () => import('src/pages/Item/Card/ItemTags.vue'),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
|
@ -1,3 +1,4 @@
|
||||||
|
import item from './modules/item';
|
||||||
import customer from './modules/customer';
|
import customer from './modules/customer';
|
||||||
import ticket from './modules/ticket';
|
import ticket from './modules/ticket';
|
||||||
import claim from './modules/claim';
|
import claim from './modules/claim';
|
||||||
|
@ -51,6 +52,7 @@ const routes = [
|
||||||
component: () => import('../pages/Dashboard/DashboardMain.vue'),
|
component: () => import('../pages/Dashboard/DashboardMain.vue'),
|
||||||
},
|
},
|
||||||
// Module routes
|
// Module routes
|
||||||
|
item,
|
||||||
customer,
|
customer,
|
||||||
ticket,
|
ticket,
|
||||||
claim,
|
claim,
|
||||||
|
|
|
@ -19,6 +19,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
|
||||||
order: '',
|
order: '',
|
||||||
data: ref(),
|
data: ref(),
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
|
userParamsChanged: false,
|
||||||
exprBuilder: null,
|
exprBuilder: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,19 +7,19 @@ import routes from 'src/router/modules';
|
||||||
|
|
||||||
export const useNavigationStore = defineStore('navigationStore', () => {
|
export const useNavigationStore = defineStore('navigationStore', () => {
|
||||||
const modules = [
|
const modules = [
|
||||||
'customer',
|
|
||||||
'claim',
|
|
||||||
'ticket',
|
|
||||||
'invoiceOut',
|
|
||||||
'invoiceIn',
|
|
||||||
'worker',
|
|
||||||
'shelving',
|
'shelving',
|
||||||
'order',
|
'order',
|
||||||
'wagon',
|
'customer',
|
||||||
'route',
|
|
||||||
'supplier',
|
|
||||||
'travel',
|
|
||||||
'entry',
|
'entry',
|
||||||
|
'travel',
|
||||||
|
'invoiceOut',
|
||||||
|
'invoiceIn',
|
||||||
|
'supplier',
|
||||||
|
'claim',
|
||||||
|
'route',
|
||||||
|
'ticket',
|
||||||
|
'worker',
|
||||||
|
'wagon',
|
||||||
];
|
];
|
||||||
const pinnedModules = ref([]);
|
const pinnedModules = ref([]);
|
||||||
const role = useRole();
|
const role = useRole();
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
const inputLocation = ':nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control';
|
||||||
|
const locationOptions ='[role="listbox"] > div.q-virtual-scroll__content > .q-item'
|
||||||
|
describe('VnLocation', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.viewport(1280, 720);
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/#/worker/create');
|
||||||
|
cy.waitForElement('.q-card');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Show all options', function() {
|
||||||
|
cy.get(inputLocation).click();
|
||||||
|
cy.get(locationOptions).should('have.length',5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('input filter location as "al"', function() {
|
||||||
|
cy.get(inputLocation).click();
|
||||||
|
cy.get(inputLocation).clear();
|
||||||
|
cy.get(inputLocation).type('al');
|
||||||
|
cy.get(locationOptions).should('have.length',3);
|
||||||
|
});
|
||||||
|
it('input filter location as "ecuador"', function() {
|
||||||
|
cy.get(inputLocation).click();
|
||||||
|
cy.get(inputLocation).clear();
|
||||||
|
cy.get(inputLocation).type('ecuador');
|
||||||
|
cy.get(locationOptions).should('have.length',1);
|
||||||
|
cy.get(`${locationOptions}:nth-child(1)`).click();
|
||||||
|
cy.get(':nth-child(3) > :nth-child(1) > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .q-icon').click();
|
||||||
|
|
||||||
|
});
|
||||||
|
})
|
|
@ -31,7 +31,6 @@ describe('ClaimAction', () => {
|
||||||
|
|
||||||
it('should regularize', () => {
|
it('should regularize', () => {
|
||||||
cy.get('[title="Regularize"]').click();
|
cy.get('[title="Regularize"]').click();
|
||||||
cy.clickConfirm();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove the line', () => {
|
it('should remove the line', () => {
|
||||||
|
|
|
@ -16,11 +16,12 @@ describe('InvoiceInBasicData', () => {
|
||||||
cy.get(selects).eq(0).type('Bros');
|
cy.get(selects).eq(0).type('Bros');
|
||||||
cy.get(selects).eq(0).type('{enter}');
|
cy.get(selects).eq(0).type('{enter}');
|
||||||
|
|
||||||
|
cy.get('[title="Reset"]').click();
|
||||||
cy.get(appendBtns).eq(0).click();
|
cy.get(appendBtns).eq(0).click();
|
||||||
cy.get('input').eq(2).type(4739);
|
cy.get('input').eq(2).type(4739);
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
|
|
||||||
cy.get(`${selects} input`).eq(0).invoke('val').should('eq', 'Bros nick');
|
cy.get(`${selects} input`).eq(0).invoke('val').should('eq', 'Plants nick');
|
||||||
cy.get('input').eq(2).invoke('val').should('eq', '4739');
|
cy.get('input').eq(2).invoke('val').should('eq', '4739');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ describe('InvoiceInList', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login('developer');
|
cy.login('developer');
|
||||||
cy.visit(`/#/invoice-in`);
|
cy.visit(`/#/invoice-in`);
|
||||||
|
cy.clickFilterSearchBtn();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect on clicking a invoice', () => {
|
it('should redirect on clicking a invoice', () => {
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('VnSearchBar', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should redirect to new customer', () => {
|
||||||
|
cy.visit('#/customer/1112/basic-data')
|
||||||
|
cy.openLeftMenu();
|
||||||
|
cy.get('.q-item > .q-item__label').should('have.text',' #1112')
|
||||||
|
cy.closeLeftMenu();
|
||||||
|
cy.clearSearchbar();
|
||||||
|
cy.writeSearchbar('1{enter}');
|
||||||
|
cy.openLeftMenu();
|
||||||
|
cy.get('.q-item > .q-item__label').should('have.text',' #1')
|
||||||
|
cy.closeLeftMenu();
|
||||||
|
});
|
||||||
|
});
|
|
@ -163,7 +163,28 @@ Cypress.Commands.add('openRightMenu', (element) => {
|
||||||
cy.get('#actions-append').click();
|
cy.get('#actions-append').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('openLeftMenu', (element) => {
|
||||||
|
if (element) cy.waitForElement(element);
|
||||||
|
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
|
||||||
|
});
|
||||||
|
Cypress.Commands.add('closeLeftMenu', (element) => {
|
||||||
|
if (element) cy.waitForElement(element);
|
||||||
|
cy.get('.fullscreen').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('clearSearchbar', (element) => {
|
||||||
|
if (element) cy.waitForElement(element);
|
||||||
|
cy.get('#searchbar > form > label > div:nth-child(1) input').clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('writeSearchbar', (value) => {
|
||||||
|
cy.get('#searchbar > form > label > div:nth-child(1) input').type(value);
|
||||||
|
});
|
||||||
Cypress.Commands.add('validateContent', (selector, expectedValue) => {
|
Cypress.Commands.add('validateContent', (selector, expectedValue) => {
|
||||||
cy.get(selector).should('have.text', expectedValue);
|
cy.get(selector).should('have.text', expectedValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('clickFilterSearchBtn', () => {
|
||||||
|
cy.get('.q-item__section > .q-btn > .q-btn__content > .q-icon').click();
|
||||||
|
});
|
||||||
// registerCommands();
|
// registerCommands();
|
||||||
|
|
|
@ -119,7 +119,7 @@ describe('VnPaginate', () => {
|
||||||
await vm.onLoad(index, done);
|
await vm.onLoad(index, done);
|
||||||
|
|
||||||
expect(vm.pagination.page).toEqual(2);
|
expect(vm.pagination.page).toEqual(2);
|
||||||
expect(done).toHaveBeenCalledWith(true);
|
expect(done).toHaveBeenCalledWith(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
|
||||||
|
import { createWrapper, axios } from 'app/test/vitest/helper';
|
||||||
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
|
|
||||||
|
|
||||||
|
describe('VnSearchBar', () => {
|
||||||
|
let vm;
|
||||||
|
let wrapper;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
wrapper = createWrapper(VnSearchbar, {
|
||||||
|
propsData: {
|
||||||
|
dataKey: 'CustomerList',
|
||||||
|
label: 'Search customer',
|
||||||
|
info: 'Info customer',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
vm = wrapper.vm;
|
||||||
|
vm.route.matched = [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/customer',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/customer/:id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/customer/:id/basic-data',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
it('should be defined', async () => {
|
||||||
|
expect(vm.searchText).toBeDefined();
|
||||||
|
expect(vm.searchText).toEqual('');
|
||||||
|
});
|
||||||
|
it('should redirect', async () => {
|
||||||
|
vi.spyOn(vm.router,'push');
|
||||||
|
vm.searchText = '1';
|
||||||
|
await vm.search();
|
||||||
|
expect(vm.router.push).toHaveBeenCalledWith('/customer/1/basic-data');
|
||||||
|
vm.searchText = '1112';
|
||||||
|
expect(vm.searchText).toEqual('1112');
|
||||||
|
vi.spyOn(vm.router,'push');
|
||||||
|
await vm.search();
|
||||||
|
expect(vm.router.push).toHaveBeenCalledWith('/customer/1112/basic-data');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue