forked from verdnatura/salix-front
Merge remote-tracking branch 'salix/dev' into bugfix/shelving-154
# Conflicts: # src/components/ui/VnSearchbar.vue # src/pages/Route/RouteList.vue
This commit is contained in:
commit
15f7f85734
|
@ -58,7 +58,7 @@ module.exports = {
|
|||
rules: {
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
'no-unused-vars': 'warn',
|
||||
|
||||
"vue/no-multiple-template-root": "off" ,
|
||||
// allow debugger during development only
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
},
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"@quasar/extras": "^1.16.4",
|
||||
"axios": "^1.4.0",
|
||||
"chromium": "^3.0.3",
|
||||
"croppie": "^2.6.5",
|
||||
"pinia": "^2.1.3",
|
||||
"quasar": "^2.12.0",
|
||||
"validator": "^13.9.0",
|
||||
|
@ -3169,6 +3170,11 @@
|
|||
"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": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "24.02.01",
|
||||
"version": "24.8.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
@ -19,13 +19,13 @@
|
|||
"@quasar/extras": "^1.16.4",
|
||||
"axios": "^1.4.0",
|
||||
"chromium": "^3.0.3",
|
||||
"croppie": "^2.6.5",
|
||||
"pinia": "^2.1.3",
|
||||
"quasar": "^2.12.0",
|
||||
"validator": "^13.9.0",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.2.2",
|
||||
"vue-router": "^4.2.1",
|
||||
"vue-router-mock": "^0.2.0"
|
||||
"vue-router": "^4.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -54,16 +55,18 @@ const onDataSaved = (data) => {
|
|||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
<VnInput
|
||||
:label="t('name')"
|
||||
v-model="data.name"
|
||||
:required="true"
|
||||
:rules="validate('bankEntity.name')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
<VnInput
|
||||
:label="t('swift')"
|
||||
v-model="data.bic"
|
||||
:required="true"
|
||||
:rules="validate('bankEntity.bic')"
|
||||
/>
|
||||
</div>
|
||||
|
@ -77,11 +80,17 @@ const onDataSaved = (data) => {
|
|||
option-value="id"
|
||||
option-label="country"
|
||||
hide-selected
|
||||
:required="true"
|
||||
:rules="validate('bankEntity.countryFk')"
|
||||
/>
|
||||
</div>
|
||||
<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>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
@ -92,15 +101,15 @@ const onDataSaved = (data) => {
|
|||
en:
|
||||
title: New bank entity
|
||||
subtitle: Please, ensure you put the correct data!
|
||||
name: Name *
|
||||
swift: Swift *
|
||||
name: Name
|
||||
swift: Swift
|
||||
country: Country
|
||||
id: Entity code
|
||||
es:
|
||||
title: Nueva entidad bancaria
|
||||
subtitle: ¡Por favor, asegúrate de poner los datos correctos!
|
||||
name: Nombre *
|
||||
swift: Swift *
|
||||
name: Nombre
|
||||
swift: Swift
|
||||
country: País
|
||||
id: Código de la entidad
|
||||
</i18n>
|
||||
|
|
|
@ -8,7 +8,7 @@ import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CreateNewCityForm from './CreateNewCityForm.vue';
|
||||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||
import VnSelectCreate from 'components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'components/common/VnSelectDialog.vue';
|
||||
import FormModelPopup from './FormModelPopup.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
@ -85,7 +85,7 @@ const onProvinceCreated = async ({ name }, formData) => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('City')"
|
||||
:options="townsLocationOptions"
|
||||
v-model="data.townFk"
|
||||
|
@ -100,12 +100,12 @@ const onProvinceCreated = async ({ name }, formData) => {
|
|||
@on-data-saved="onCityCreated($event, data)"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-xl">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Province')"
|
||||
:options="provincesOptions"
|
||||
hide-selected
|
||||
|
@ -120,7 +120,7 @@ const onProvinceCreated = async ({ name }, formData) => {
|
|||
@on-data-saved="onProvinceCreated($event, data)"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
|
|
|
@ -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>
|
|
@ -0,0 +1,141 @@
|
|||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
||||
const $props = defineProps({
|
||||
rows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
fieldsOptions: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
editUrl: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const formData = reactive({
|
||||
field: null,
|
||||
newValue: null,
|
||||
});
|
||||
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
|
||||
const onDataSaved = () => {
|
||||
notify('globals.dataSaved', 'positive');
|
||||
emit('onDataSaved');
|
||||
closeForm();
|
||||
};
|
||||
|
||||
const submitData = async () => {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
const rowsToEdit = $props.rows.map((row) => ({ id: row.id, itemFk: row.itemFk }));
|
||||
const payload = {
|
||||
field: formData.field,
|
||||
newValue: formData.newValue,
|
||||
lines: rowsToEdit,
|
||||
};
|
||||
|
||||
await axios.post($props.editUrl, payload);
|
||||
onDataSaved();
|
||||
isLoading.value = false;
|
||||
} catch (err) {
|
||||
console.error('Error submitting table cell edit');
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QForm @submit="submitData()" 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('editBuyTitle', {
|
||||
buysAmount: rows.length,
|
||||
})
|
||||
}}
|
||||
</h1>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Field to edit')"
|
||||
:options="fieldsOptions"
|
||||
hide-selected
|
||||
option-label="label"
|
||||
option-value="field"
|
||||
v-model="formData.field"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput :label="t('Value')" v-model="formData.newValue" />
|
||||
</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>
|
||||
</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>
|
||||
en:
|
||||
editBuyTitle: Edit {buysAmount} buy(s)
|
||||
es:
|
||||
editBuyTitle: Editar {buysAmount} compra(s)
|
||||
Field to edit: Campo a editar
|
||||
Value: Valor
|
||||
</i18n>
|
|
@ -45,7 +45,7 @@ onMounted(async () => {
|
|||
async function fetch(fetchFilter = {}) {
|
||||
try {
|
||||
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.limit) filter.limit = $props.limit;
|
||||
|
||||
|
@ -54,6 +54,7 @@ async function fetch(fetchFilter = {}) {
|
|||
});
|
||||
|
||||
emit('onFetch', data);
|
||||
return data;
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
<script setup>
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
const emit = defineEmits(['itemSelected']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const itemFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'producer',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'ink',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const itemFilterParams = reactive({});
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const producersOptions = ref([]);
|
||||
const ItemTypesOptions = ref([]);
|
||||
const InksOptions = ref([]);
|
||||
const tableRows = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const tableColumns = computed(() => [
|
||||
{
|
||||
label: t('entry.buys.id'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.buys.name'),
|
||||
name: 'name',
|
||||
field: 'name',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.buys.size'),
|
||||
name: 'size',
|
||||
field: 'size',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.buys.producer'),
|
||||
name: 'producerName',
|
||||
field: 'producer',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
|
||||
{
|
||||
label: t('entry.buys.color'),
|
||||
name: 'ink',
|
||||
field: 'inkName',
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const fetchResults = async () => {
|
||||
try {
|
||||
let filter = itemFilter;
|
||||
const params = itemFilterParams;
|
||||
const where = {};
|
||||
for (let key in params) {
|
||||
const value = params[key];
|
||||
if (!value) continue;
|
||||
|
||||
switch (key) {
|
||||
case 'name':
|
||||
where[key] = { like: `%${value}%` };
|
||||
break;
|
||||
case 'producerFk':
|
||||
case 'typeFk':
|
||||
case 'size':
|
||||
case 'inkFk':
|
||||
where[key] = value;
|
||||
}
|
||||
}
|
||||
filter.where = where;
|
||||
|
||||
const { data } = await axios.get(`Entries/${route.params.id}/lastItemBuys`, {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
tableRows.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching entries items');
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
};
|
||||
|
||||
const selectItem = ({ id }) => {
|
||||
emit('itemSelected', id);
|
||||
closeForm();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Producers"
|
||||
@on-fetch="(data) => (producersOptions = data)"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="ItemTypes"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||
order="name"
|
||||
@on-fetch="(data) => (ItemTypesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Inks"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||
order="name"
|
||||
@on-fetch="(data) => (InksOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QForm @submit="fetchResults()" class="all-pointer-events">
|
||||
<QCard class="column" style="padding: 32px; z-index: 100">
|
||||
<span ref="closeButton" class="close-icon" v-close-popup>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
<h1 class="title">{{ t('Filter item') }}</h1>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('entry.buys.name')"
|
||||
v-model="itemFilterParams.name"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('entry.buys.size')"
|
||||
v-model="itemFilterParams.size"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.buys.producer')"
|
||||
:options="producersOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="itemFilterParams.producerFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.buys.type')"
|
||||
:options="ItemTypesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="itemFilterParams.typeFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.buys.color')"
|
||||
:options="InksOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="itemFilterParams.inkFk"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:label="t('globals.search')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
</div>
|
||||
<QTable
|
||||
:columns="tableColumns"
|
||||
:rows="tableRows"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:loading="loading"
|
||||
:hide-header="!tableRows || !tableRows.length > 0"
|
||||
:no-data-label="t('Enter a new search')"
|
||||
class="q-mt-lg"
|
||||
@row-click="(_, row) => selectItem(row)"
|
||||
>
|
||||
<template #body-cell-id="{ row }">
|
||||
<QTd auto-width @click.stop>
|
||||
<QBtn flat color="blue">{{ row.id }}</QBtn>
|
||||
<ItemDescriptorProxy :id="row.id" />
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</QForm>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Filter item: Filtrar artículo
|
||||
Enter a new search: Introduce una nueva búsqueda
|
||||
</i18n>
|
||||
|
||||
<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>
|
|
@ -0,0 +1,240 @@
|
|||
<script setup>
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const emit = defineEmits(['travelSelected']);
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const travelFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'agency',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'warehouseOut',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const travelFilterParams = reactive({});
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const agenciesOptions = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const tableRows = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
const tableColumns = computed(() => [
|
||||
{
|
||||
label: t('entry.basicData.id'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.warehouseOut'),
|
||||
name: 'warehouseOutFk',
|
||||
field: 'warehouseOutFk',
|
||||
align: 'left',
|
||||
format: (val) =>
|
||||
warehousesOptions.value.find((warehouse) => warehouse.id === val).name,
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.warehouseIn'),
|
||||
name: 'warehouseInFk',
|
||||
field: 'warehouseInFk',
|
||||
align: 'left',
|
||||
format: (val) =>
|
||||
warehousesOptions.value.find((warehouse) => warehouse.id === val).name,
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.shipped'),
|
||||
name: 'shipped',
|
||||
field: 'shipped',
|
||||
align: 'left',
|
||||
format: (val) => toDate(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.basicData.landed'),
|
||||
name: 'landed',
|
||||
field: 'landed',
|
||||
align: 'left',
|
||||
format: (val) => toDate(val),
|
||||
},
|
||||
]);
|
||||
|
||||
const fetchResults = async () => {
|
||||
try {
|
||||
let filter = travelFilter;
|
||||
const params = travelFilterParams;
|
||||
const where = {};
|
||||
for (let key in params) {
|
||||
const value = params[key];
|
||||
if (!value) continue;
|
||||
|
||||
switch (key) {
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseInFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'shipped':
|
||||
case 'landed':
|
||||
where[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
filter.where = where;
|
||||
const { data } = await axios.get('Travels', {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
tableRows.value = data;
|
||||
} catch (err) {
|
||||
console.error('Error fetching travels');
|
||||
}
|
||||
};
|
||||
|
||||
const closeForm = () => {
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
};
|
||||
|
||||
const selectTravel = ({ id }) => {
|
||||
emit('travelSelected', id);
|
||||
closeForm();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
order="name"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QForm @submit="fetchResults()" class="all-pointer-events">
|
||||
<QCard class="column" style="padding: 32px; z-index: 100">
|
||||
<span ref="closeButton" class="close-icon" v-close-popup>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
<h1 class="title">{{ t('Filter travels') }}</h1>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.basicData.agency')"
|
||||
:options="agenciesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.agencyModeFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.basicData.warehouseOut')"
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseOutFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('entry.basicData.warehouseIn')"
|
||||
:options="warehousesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="travelFilterParams.warehouseInFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInputDate
|
||||
:label="t('entry.basicData.shipped')"
|
||||
v-model="travelFilterParams.shipped"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInputDate
|
||||
:label="t('entry.basicData.landed')"
|
||||
v-model="travelFilterParams.landed"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:label="t('globals.search')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
/>
|
||||
</div>
|
||||
<QTable
|
||||
:columns="tableColumns"
|
||||
:rows="tableRows"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
:loading="loading"
|
||||
:hide-header="!tableRows || !tableRows.length > 0"
|
||||
:no-data-label="t('Enter a new search')"
|
||||
class="q-mt-lg"
|
||||
@row-click="(_, row) => selectTravel(row)"
|
||||
>
|
||||
<template #body-cell-id="{ row }">
|
||||
<QTd auto-width @click.stop>
|
||||
<QBtn flat color="blue">{{ row.id }}</QBtn>
|
||||
<TravelDescriptorProxy :id="row.id" />
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</QForm>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Filter travels: Filtro envíos
|
||||
Enter a new search: Introduce una nueva búsqueda
|
||||
</i18n>
|
||||
|
||||
<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>
|
|
@ -81,9 +81,12 @@ onMounted(async () => {
|
|||
await fetch();
|
||||
}
|
||||
|
||||
// Disparamos el watcher del form después de que se haya cargado la data inicial, si así se desea
|
||||
// Si así se desea disparamos el watcher del form después de 100ms, asi darle tiempo de que se haya cargado la data inicial
|
||||
// para evitar que detecte cambios cuando es data inicial default
|
||||
if ($props.observeFormChanges) {
|
||||
setTimeout(() => {
|
||||
startFormWatcher();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -134,7 +137,7 @@ async function save() {
|
|||
|
||||
try {
|
||||
const body = $props.mapper ? $props.mapper(formData.value) : formData.value;
|
||||
let response
|
||||
let response;
|
||||
if ($props.urlCreate) {
|
||||
response = await axios.post($props.urlCreate, body);
|
||||
notify('globals.dataCreated', 'positive');
|
||||
|
@ -183,13 +186,6 @@ watch(formUrl, async () => {
|
|||
});
|
||||
</script>
|
||||
<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">
|
||||
<QForm
|
||||
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>
|
||||
import { onMounted, computed } from 'vue';
|
||||
import { Dark, Quasar, useQuasar } from 'quasar';
|
||||
import { Dark, Quasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import { localeEquivalence } from "src/i18n/index";
|
||||
import { localeEquivalence } from 'src/i18n/index';
|
||||
|
||||
const state = useState();
|
||||
const session = useSession();
|
||||
const router = useRouter();
|
||||
const { t, locale } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
|
||||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
const { copyText } = useClipboard();
|
||||
const userLocale = computed({
|
||||
get() {
|
||||
return locale.value;
|
||||
|
@ -21,7 +21,7 @@ const userLocale = computed({
|
|||
set(value) {
|
||||
locale.value = value;
|
||||
|
||||
value = localeEquivalence[value] ?? value
|
||||
value = localeEquivalence[value] ?? value;
|
||||
|
||||
try {
|
||||
/* @vite-ignore */
|
||||
|
@ -81,12 +81,8 @@ function logout() {
|
|||
router.push('/login');
|
||||
}
|
||||
|
||||
function copyUserToken(){
|
||||
navigator.clipboard.writeText(session.getToken());
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('components.userPanel.copyToken'),
|
||||
});
|
||||
function copyUserToken() {
|
||||
copyText(session.getToken(), { label: 'components.userPanel.copyToken' });
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -129,7 +125,11 @@ function copyUserToken(){
|
|||
<div class="text-subtitle1 q-mt-md">
|
||||
<strong>{{ user.nickname }}</strong>
|
||||
</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>
|
||||
|
||||
<QBtn
|
||||
|
@ -152,8 +152,8 @@ function copyUserToken(){
|
|||
width: 150px;
|
||||
}
|
||||
|
||||
.copyUserToken {
|
||||
&:hover{
|
||||
.copyText {
|
||||
&:hover {
|
||||
cursor: alias;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ const setUserConfigViewData = (data) => {
|
|||
// Importante: El name de las columnas de la tabla debe conincidir con el name de las variables que devuelve la view config
|
||||
formattedCols.value = $props.allColumns.map((col) => ({
|
||||
name: col,
|
||||
active: data[col],
|
||||
active: data[col] == undefined ? true : data[col],
|
||||
}));
|
||||
emitSavedConfig();
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<script setup>
|
||||
import {computed, ref} from 'vue';
|
||||
import { toHour} from 'src/filters';
|
||||
import {useI18n} from "vue-i18n";
|
||||
import isValidDate from "filters/isValidDate";
|
||||
import { computed, ref } from 'vue';
|
||||
import { toHour } from 'src/filters';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import isValidDate from 'filters/isValidDate';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
|
@ -25,9 +25,14 @@ const value = computed({
|
|||
return props.modelValue;
|
||||
},
|
||||
set(value) {
|
||||
const [hours, minutes] = value.split(':')
|
||||
const date = new Date()
|
||||
date.setUTCHours(Number.parseInt(hours) || 0, Number.parseInt(minutes) || 0, 0, 0)
|
||||
const [hours, minutes] = value.split(':');
|
||||
const date = new Date();
|
||||
date.setUTCHours(
|
||||
Number.parseInt(hours) || 0,
|
||||
Number.parseInt(minutes) || 0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
emit('update:modelValue', value ? date.toISOString() : null);
|
||||
},
|
||||
});
|
||||
|
@ -40,14 +45,18 @@ const save = () => {
|
|||
value.value = internalValue.value;
|
||||
};
|
||||
const formatTime = (dateString) => {
|
||||
if (!isValidDate(dateString)){
|
||||
return ''
|
||||
if (!isValidDate(dateString)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const date = new Date(dateString || '');
|
||||
return `${date.getUTCHours().toString().padStart(2, '0')}:${date.getUTCMinutes().toString().padStart(2, '0')}`;
|
||||
return date.toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
};
|
||||
|
||||
const internalValue = ref(formatTime(value))
|
||||
const internalValue = ref(formatTime(value));
|
||||
|
||||
const styleAttrs = computed(() => {
|
||||
return props.isOutlined
|
||||
|
@ -82,8 +91,19 @@ const styleAttrs = computed(() => {
|
|||
@update:model-value="onDateUpdate"
|
||||
>
|
||||
<div class="row items-center justify-end q-gutter-sm">
|
||||
<QBtn :label="t('Cancel')" color="primary" flat v-close-popup />
|
||||
<QBtn label="Ok" color="primary" flat @click="save" v-close-popup />
|
||||
<QBtn
|
||||
:label="t('Cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
label="Ok"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QTime>
|
||||
</QPopupProxy>
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
<script setup>
|
||||
import { ref, toRefs, computed, watch, onMounted } from 'vue';
|
||||
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import VnSelectDialog from 'components/common/VnSelectDialog.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($props.modelValue);
|
||||
});
|
||||
|
||||
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 = '') {
|
||||
if (
|
||||
search &&
|
||||
(search.includes('undefined') || search.startsWith(`${$props.modelValue} - `))
|
||||
)
|
||||
return;
|
||||
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)"
|
||||
/>
|
||||
<VnSelectDialog
|
||||
v-if="postcodesRef"
|
||||
:option-label="(opt) => showLabel(opt) ?? 'code'"
|
||||
:option-value="(opt) => opt.code"
|
||||
v-model="value"
|
||||
:options="postcodesOptions"
|
||||
:label="t('Location')"
|
||||
:placeholder="t('search_by_postalcode')"
|
||||
@input-value="locationFilter"
|
||||
:default-filter="true"
|
||||
: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>
|
||||
</VnSelectDialog>
|
||||
</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 userLog = null;
|
||||
let modelLog = null;
|
||||
let prevLog;
|
||||
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 || {};
|
||||
|
||||
// Origin
|
||||
const originChanged = !prevLog || log.originFk != prevLog.originFk;
|
||||
if (originChanged) {
|
||||
logs.push((originLog = { originFk: log.originFk, logs: [] }));
|
||||
prevLog = log;
|
||||
}
|
||||
// User
|
||||
const userChanged = originChanged || log.userFk != prevLog.userFk;
|
||||
|
@ -197,6 +197,7 @@ function getLogTree(data) {
|
|||
log.changedModel != prevLog.changedModel ||
|
||||
log.changedModelId != prevLog.changedModelId ||
|
||||
nLogs >= 6;
|
||||
|
||||
if (modelChanged) {
|
||||
userLog.logs.push(
|
||||
(modelLog = {
|
||||
|
@ -221,7 +222,7 @@ function getLogTree(data) {
|
|||
propNames = [...new Set(propNames)];
|
||||
|
||||
log.props = parseProps(propNames, locale, vals, olds);
|
||||
});
|
||||
}
|
||||
return logs;
|
||||
}
|
||||
|
||||
|
@ -320,7 +321,6 @@ function selectFilter(type, dateType) {
|
|||
}
|
||||
if (type === 'action' && selectedFilters.value.changedModel === null) {
|
||||
selectedFilters.value.changedModel = undefined;
|
||||
reload = false;
|
||||
}
|
||||
if (type === 'userRadio') {
|
||||
selectedFilters.value.userFk = userRadio.value;
|
||||
|
@ -415,18 +415,19 @@ setLogTree();
|
|||
<div class="line bg-grey"></div>
|
||||
</QItem>
|
||||
<div
|
||||
class="user-log q-mb-sm row"
|
||||
class="user-log q-mb-sm"
|
||||
v-for="(userLog, userIndex) in originLog.logs"
|
||||
:key="userIndex"
|
||||
>
|
||||
<div class="timeline">
|
||||
<div class="user-avatar">
|
||||
<VnUserLink v-if="userLog.user.image" :worker-id="userLog.user.id">
|
||||
<VnUserLink :worker-id="userLog.user.id">
|
||||
<template #link>
|
||||
<VnAvatar
|
||||
:class="{ 'cursor-pointer': userLog.user.id }"
|
||||
:worker-id="userLog.user.id"
|
||||
:title="userLog.user.nickname"
|
||||
size="lg"
|
||||
/>
|
||||
</template>
|
||||
</VnUserLink>
|
||||
|
@ -663,9 +664,9 @@ setLogTree();
|
|||
:label="t('globals.entity')"
|
||||
v-model="selectedFilters.changedModel"
|
||||
option-label="locale"
|
||||
option-value="value"
|
||||
:options="actions"
|
||||
@update:model-value="selectFilter('action')"
|
||||
@clear="() => selectFilter('action')"
|
||||
hide-selected
|
||||
/>
|
||||
</QItem>
|
||||
|
@ -823,14 +824,30 @@ setLogTree();
|
|||
.q-item {
|
||||
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 {
|
||||
&:first-child > .origin-info {
|
||||
margin-top: 0;
|
||||
}
|
||||
& > .origin-info {
|
||||
width: 100%;
|
||||
max-width: 42em;
|
||||
margin-top: 28px;
|
||||
gap: 6px;
|
||||
|
||||
|
@ -847,14 +864,15 @@ setLogTree();
|
|||
}
|
||||
}
|
||||
.user-log {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
max-width: 40em;
|
||||
|
||||
& > .timeline {
|
||||
position: relative;
|
||||
padding-right: 5px;
|
||||
width: 50px;
|
||||
padding-right: 1px;
|
||||
width: 38px;
|
||||
min-width: 38px;
|
||||
flex-grow: auto;
|
||||
& > .arrow {
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
|
@ -874,7 +892,7 @@ setLogTree();
|
|||
position: absolute;
|
||||
background-color: $primary;
|
||||
width: 2px;
|
||||
left: 23px;
|
||||
left: 19px;
|
||||
z-index: -1;
|
||||
top: 0;
|
||||
bottom: -8px;
|
||||
|
@ -893,6 +911,7 @@ setLogTree();
|
|||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
min-height: 22px;
|
||||
.model-value {
|
||||
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>
|
||||
<i18n>
|
||||
en:
|
||||
|
|
|
@ -38,7 +38,6 @@ const workers = ref();
|
|||
minimal
|
||||
>
|
||||
</QDate>
|
||||
<QList dense>
|
||||
<QSeparator />
|
||||
<QItem>
|
||||
<QItemSection v-if="!workers">
|
||||
|
@ -59,7 +58,6 @@ const workers = ref();
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
|
@ -20,6 +20,10 @@ const $props = defineProps({
|
|||
type: Array,
|
||||
default: () => ['developer'],
|
||||
},
|
||||
actionIcon: {
|
||||
type: String,
|
||||
default: 'add',
|
||||
},
|
||||
});
|
||||
|
||||
const role = useRole();
|
||||
|
@ -48,9 +52,9 @@ const toggleForm = () => {
|
|||
<template v-if="isAllowedToCreate" #append>
|
||||
<QIcon
|
||||
@click.stop.prevent="toggleForm()"
|
||||
name="add"
|
||||
size="xs"
|
||||
class="add-icon"
|
||||
:name="actionIcon"
|
||||
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
||||
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
|
||||
/>
|
||||
<QDialog v-model="showForm" transition-show="scale" transition-hide="scale">
|
||||
<slot name="form" />
|
||||
|
@ -63,9 +67,14 @@ const toggleForm = () => {
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.add-icon {
|
||||
.default-icon {
|
||||
cursor: pointer;
|
||||
background-color: $primary;
|
||||
color: $primary;
|
||||
border-radius: 50px;
|
||||
|
||||
&.--add-icon {
|
||||
color: var(--vn-text);
|
||||
background-color: $primary;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,4 +1,6 @@
|
|||
<script setup>
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { onMounted } from 'vue';
|
||||
import { ref, toRefs, computed, watch } from 'vue';
|
||||
const emit = defineEmits(['update:modelValue', 'update:options']);
|
||||
|
||||
|
@ -12,11 +14,19 @@ const $props = defineProps({
|
|||
default: () => [],
|
||||
},
|
||||
optionLabel: {
|
||||
type: [String],
|
||||
default: '',
|
||||
},
|
||||
optionValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
filterOptions: {
|
||||
type: Array,
|
||||
type: [Array],
|
||||
default: () => [],
|
||||
},
|
||||
isClearable: {
|
||||
|
@ -27,12 +37,29 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
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 myOptionsOriginal = ref([]);
|
||||
const vnSelectRef = ref();
|
||||
const dataRef = ref();
|
||||
|
||||
const value = computed({
|
||||
get() {
|
||||
|
@ -47,8 +74,12 @@ function setOptions(data) {
|
|||
myOptions.value = JSON.parse(JSON.stringify(data));
|
||||
myOptionsOriginal.value = JSON.parse(JSON.stringify(data));
|
||||
}
|
||||
setOptions(options.value);
|
||||
const filter = (val, options) => {
|
||||
onMounted(() => {
|
||||
setOptions(options.value);
|
||||
if ($props.url && $props.modelValue) fetchFilter($props.modelValue);
|
||||
});
|
||||
|
||||
async function filter(val, options) {
|
||||
const search = val.toString().toLowerCase();
|
||||
|
||||
if (!search) return options;
|
||||
|
@ -66,13 +97,29 @@ const filter = (val, options) => {
|
|||
|
||||
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(
|
||||
() => {
|
||||
if ($props.defaultFilter)
|
||||
myOptions.value = filter(val, myOptionsOriginal.value);
|
||||
async () => {
|
||||
if (!$props.defaultFilter) return;
|
||||
if ($props.url) {
|
||||
myOptions.value = await fetchFilter(val);
|
||||
return;
|
||||
}
|
||||
myOptions.value = await filter(val, myOptionsOriginal.value);
|
||||
},
|
||||
(ref) => {
|
||||
if (val !== '' && ref.options.length > 0) {
|
||||
|
@ -81,18 +128,33 @@ const filterHandler = (val, update) => {
|
|||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
watch(options, (newValue) => {
|
||||
setOptions(newValue);
|
||||
});
|
||||
|
||||
watch(modelValue, (newValue) => {
|
||||
if (!myOptions.value.some((option) => option[optionValue.value] == newValue))
|
||||
fetchFilter(newValue);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="dataRef"
|
||||
:url="$props.url"
|
||||
@on-fetch="(data) => setOptions(data)"
|
||||
:where="where || { [optionValue]: value }"
|
||||
:limit="limit"
|
||||
:order-by="orderBy"
|
||||
:fields="fields"
|
||||
/>
|
||||
<QSelect
|
||||
v-model="value"
|
||||
:options="myOptions"
|
||||
:option-label="optionLabel"
|
||||
:option-value="optionValue"
|
||||
v-bind="$attrs"
|
||||
emit-value
|
||||
map-options
|
||||
|
@ -116,3 +178,9 @@ watch(options, (newValue) => {
|
|||
</template>
|
||||
</QSelect>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.q-field--outlined {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -49,7 +49,6 @@ onMounted(async () => {
|
|||
() => $props.url,
|
||||
async (newUrl, lastUrl) => {
|
||||
if (newUrl == lastUrl) return;
|
||||
entity.value = null;
|
||||
await getData();
|
||||
}
|
||||
);
|
||||
|
@ -62,7 +61,6 @@ async function getData() {
|
|||
skip: 0,
|
||||
});
|
||||
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
|
||||
entity.value = data;
|
||||
emit('onFetch', data);
|
||||
}
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
@ -81,6 +79,7 @@ function viewSummary(id) {
|
|||
<div class="descriptor">
|
||||
<template v-if="entity">
|
||||
<div class="header bg-primary q-pa-sm justify-between">
|
||||
<slot name="header-extra-action" />
|
||||
<QBtn
|
||||
@click.stop="viewSummary(entity.id)"
|
||||
round
|
||||
|
@ -118,7 +117,7 @@ function viewSummary(id) {
|
|||
icon="more_vert"
|
||||
round
|
||||
size="md"
|
||||
v-if="slots.menu"
|
||||
:class="{ invisible: !slots.menu }"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
|
|
|
@ -1,19 +1,37 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import { useColor } from 'src/composables/useColor';
|
||||
|
||||
const $props = defineProps({
|
||||
workerId: { type: Number, required: true },
|
||||
description: { type: String, default: null },
|
||||
size: { type: String, default: null },
|
||||
title: { type: String, default: null },
|
||||
});
|
||||
const session = useSession();
|
||||
const token = session.getToken();
|
||||
const { t } = useI18n();
|
||||
|
||||
const title = computed(() => $props.title ?? t('globals.system'));
|
||||
const showLetter = ref(false);
|
||||
</script>
|
||||
<template>
|
||||
<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
|
||||
v-else
|
||||
:src="`/api/Images/user/160x160/${$props.workerId}/download?access_token=${token}`"
|
||||
spinner-color="white"
|
||||
@error="showLetter = true"
|
||||
/>
|
||||
</QAvatar>
|
||||
<div class="description">
|
||||
|
|
|
@ -64,10 +64,12 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
const isLoading = ref(false);
|
||||
|
||||
async function search() {
|
||||
isLoading.value = true;
|
||||
const params = { ...userParams.value };
|
||||
store.userParamsChanged = true;
|
||||
store.filter.skip = 0;
|
||||
store.skip = 0;
|
||||
const { params: newParams } = await arrayData.addFilter({ params });
|
||||
userParams.value = newParams;
|
||||
|
||||
|
@ -89,7 +91,9 @@ async function reload() {
|
|||
|
||||
async function clearFilters() {
|
||||
isLoading.value = true;
|
||||
|
||||
store.userParamsChanged = true;
|
||||
store.filter.skip = 0;
|
||||
store.skip = 0;
|
||||
// Filtrar los params no removibles
|
||||
const removableFilters = Object.keys(userParams.value).filter((param) =>
|
||||
props.unremovableParams.includes(param)
|
||||
|
@ -216,7 +220,9 @@ function formatValue(value) {
|
|||
</QItem>
|
||||
<QSeparator />
|
||||
</QList>
|
||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||
<slot name="body" :params="userParams" :search-fn="search"></slot>
|
||||
</QList>
|
||||
<template v-if="props.searchButton">
|
||||
<QItem>
|
||||
<QItemSection class="q-py-sm">
|
||||
|
@ -242,6 +248,12 @@ function formatValue(value) {
|
|||
/>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
No filters applied: No se han aplicado filtros
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { computed } from 'vue';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
const $props = defineProps({
|
||||
label: { type: String, default: null },
|
||||
value: {
|
||||
|
@ -10,8 +11,19 @@ const $props = defineProps({
|
|||
},
|
||||
info: { type: String, default: null },
|
||||
dash: { type: Boolean, default: true },
|
||||
copy: { type: Boolean, default: false },
|
||||
});
|
||||
const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
||||
|
||||
const { copyText } = useClipboard();
|
||||
|
||||
function copyValueText() {
|
||||
copyText($props.value, {
|
||||
component: {
|
||||
copyValue: $props.value,
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.label,
|
||||
|
@ -48,5 +60,16 @@ const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
|||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
<div class="copy" v-if="$props.copy && $props.value" @click="copyValueText()">
|
||||
<QIcon name="Content_Copy" color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.copy {
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -104,6 +104,8 @@ async function paginate() {
|
|||
await arrayData.loadMore();
|
||||
|
||||
if (!arrayData.hasMoreData.value) {
|
||||
if (store.userParamsChanged) arrayData.hasMoreData.value = true;
|
||||
store.userParamsChanged = false;
|
||||
isLoading.value = false;
|
||||
return;
|
||||
}
|
||||
|
@ -129,9 +131,9 @@ async function onLoad(...params) {
|
|||
pagination.value.page = pagination.value.page + 1;
|
||||
|
||||
await paginate();
|
||||
|
||||
const endOfPages = !arrayData.hasMoreData.value;
|
||||
done(endOfPages);
|
||||
let isDone = false;
|
||||
if (store.userParamsChanged) isDone = !arrayData.hasMoreData.value;
|
||||
done(isDone);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -172,7 +174,7 @@ async function onLoad(...params) {
|
|||
v-if="store.data"
|
||||
@load="onLoad"
|
||||
:offset="offset"
|
||||
class="full-width full-height overflow-auto"
|
||||
class="full-width full-height"
|
||||
>
|
||||
<slot name="body" :rows="store.data"></slot>
|
||||
<div v-if="isLoading" class="info-row q-pa-md text-center">
|
||||
|
|
|
@ -61,6 +61,10 @@ const props = defineProps({
|
|||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
customRouteRedirectName: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
|
@ -87,15 +91,18 @@ async function search() {
|
|||
});
|
||||
if (!props.redirect) return;
|
||||
|
||||
const rows = store.data;
|
||||
const module = route.matched[1];
|
||||
if (rows.length === 1) {
|
||||
const [firstRow] = rows;
|
||||
await router.push({ path: `${module.path}/${firstRow.id}` });
|
||||
} else if (route.matched.length > 3) {
|
||||
await router.push({ path: `${module.path}` });
|
||||
arrayData.updateStateParams();
|
||||
if (props.customRouteRedirectName) {
|
||||
router.push({
|
||||
name: props.customRouteRedirectName,
|
||||
params: { id: searchText.value },
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const { matched: matches } = route;
|
||||
const { path } = matches[matches.length - 1];
|
||||
const newRoute = path.replace(':id', searchText.value);
|
||||
await router.push(newRoute);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -13,9 +14,25 @@ onUnmounted(() => {
|
|||
</script>
|
||||
|
||||
<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>
|
||||
</slot>
|
||||
<QSpace />
|
||||
<slot name="st-actions">
|
||||
<div id="st-actions"></div>
|
||||
</slot>
|
||||
</QToolbar>
|
||||
</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) {
|
||||
const quasar = useQuasar();
|
||||
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);
|
||||
|
||||
store.userParams = userParams;
|
||||
|
||||
store.skip = 0;
|
||||
store.filter.skip = 0;
|
||||
await fetch({ append: false });
|
||||
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,
|
||||
darkMode: user.value.darkMode,
|
||||
companyFk: user.value.companyFk,
|
||||
warehouseFk: user.value.warehouseFk,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -37,6 +38,7 @@ export function useState() {
|
|||
lang: data.lang,
|
||||
darkMode: data.darkMode,
|
||||
companyFk: data.companyFk,
|
||||
warehouseFk: data.warehouseFk,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ export function useUserConfig() {
|
|||
const user = state.getUser().value;
|
||||
user.darkMode = data.darkMode;
|
||||
user.companyFk = data.companyFk;
|
||||
user.warehouseFk = data.warehouseFk;
|
||||
state.setUser(user);
|
||||
|
||||
return data;
|
||||
|
|
|
@ -30,6 +30,15 @@ export function useValidator() {
|
|||
const { t } = useI18n();
|
||||
const validations = function (validation) {
|
||||
return {
|
||||
format: (value) => {
|
||||
const { allowNull, with: format, allowBlank } = validation;
|
||||
const message = t(validation.message) || validation.message;
|
||||
if (!allowBlank && value === '') return message;
|
||||
if (!allowNull && value === null) return message;
|
||||
|
||||
const isValid = new RegExp(format).test(value);
|
||||
if (!isValid) return message;
|
||||
},
|
||||
presence: (value) => {
|
||||
let message = `Value can't be empty`;
|
||||
if (validation.message)
|
||||
|
|
|
@ -52,13 +52,32 @@ body.body--dark {
|
|||
color: var(--vn-text);
|
||||
}
|
||||
|
||||
.color-vn-white {
|
||||
color: $white;
|
||||
}
|
||||
|
||||
.vn-card {
|
||||
background-color: var(--vn-gray);
|
||||
color: var(--vn-text);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.vn-card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
|
||||
/* Estilo para el asterisco en campos requeridos */
|
||||
.q-field.required .q-field__label:after {
|
||||
content: ' *';
|
||||
}
|
||||
|
||||
input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
input::-webkit-outer-spin-button,
|
||||
input::-webkit-inner-spin-button {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
|
|
|
@ -4,13 +4,8 @@ export default function toHour(date) {
|
|||
if (!isValidDate(date)) {
|
||||
return '--:--';
|
||||
}
|
||||
const dateHour = new Date(date);
|
||||
let hours = dateHour.getUTCHours();
|
||||
hours = hours % 12;
|
||||
hours = hours ? hours : 12;
|
||||
|
||||
let minutes = dateHour.getUTCMinutes();
|
||||
minutes = minutes < 10 ? minutes.toString().padStart(2, '0') : minutes;
|
||||
|
||||
return `${hours}:${minutes} ${dateHour.getUTCHours() >= 12 ? 'PM' : 'AM'}`;
|
||||
return (new Date(date || '')).toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -268,6 +268,8 @@ export default {
|
|||
buys: 'Buys',
|
||||
notes: 'Notes',
|
||||
log: 'Log',
|
||||
create: 'Create',
|
||||
latestBuys: 'Latest buys',
|
||||
},
|
||||
list: {
|
||||
newEntry: 'New entry',
|
||||
|
@ -323,6 +325,12 @@ export default {
|
|||
booked: 'Booked',
|
||||
raid: 'Raid',
|
||||
excludedFromAvailable: 'Inventory',
|
||||
agency: 'Agency',
|
||||
warehouseOut: 'Warehouse Out',
|
||||
warehouseIn: 'Warehouse In',
|
||||
shipped: 'Shipped',
|
||||
landed: 'Landed',
|
||||
id: 'ID',
|
||||
},
|
||||
buys: {
|
||||
groupingPrice: 'Grouping price',
|
||||
|
@ -336,6 +344,12 @@ export default {
|
|||
grouping: 'Grouping',
|
||||
buyingValue: 'Buying value',
|
||||
packagingFk: 'Box',
|
||||
file: 'File',
|
||||
name: 'Name',
|
||||
producer: 'Producer',
|
||||
type: 'Type',
|
||||
color: 'Color',
|
||||
id: 'ID',
|
||||
},
|
||||
notes: {
|
||||
observationType: 'Observation type',
|
||||
|
@ -346,6 +360,36 @@ export default {
|
|||
landed: 'Landed',
|
||||
warehouseOut: 'Warehouse Out',
|
||||
},
|
||||
latestBuys: {
|
||||
picture: 'Picture',
|
||||
itemFk: 'Item ID',
|
||||
packing: 'Packing',
|
||||
grouping: 'Grouping',
|
||||
quantity: 'Quantity',
|
||||
description: 'Description',
|
||||
size: 'Size',
|
||||
tags: 'Tags',
|
||||
type: 'Type',
|
||||
intrastat: 'Intrastat',
|
||||
origin: 'Origin',
|
||||
weightByPiece: 'Weight/Piece',
|
||||
isActive: 'Active',
|
||||
family: 'Family',
|
||||
entryFk: 'Entry',
|
||||
buyingValue: 'Buying value',
|
||||
freightValue: 'Freight value',
|
||||
comissionValue: 'Commission value',
|
||||
packageValue: 'Package value',
|
||||
isIgnored: 'Is ignored',
|
||||
price2: 'Grouping',
|
||||
price3: 'Packing',
|
||||
minPrice: 'Min',
|
||||
ektFk: 'Ekt',
|
||||
weight: 'Weight',
|
||||
packagingFk: 'Package',
|
||||
packingOut: 'Package out',
|
||||
landing: 'Landing',
|
||||
},
|
||||
},
|
||||
ticket: {
|
||||
pageTitles: {
|
||||
|
@ -1018,6 +1062,7 @@ export default {
|
|||
m3Price: 'M3 Price',
|
||||
routePrice: 'Route price',
|
||||
minimumKm: 'Minimum Km',
|
||||
addRow: 'Add row',
|
||||
},
|
||||
consumption: {
|
||||
entry: 'Entry',
|
||||
|
@ -1060,6 +1105,25 @@ export default {
|
|||
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: {
|
||||
topbar: {},
|
||||
userPanel: {
|
||||
|
@ -1083,5 +1147,12 @@ export default {
|
|||
addToPinned: 'Add to 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',
|
||||
},
|
||||
};
|
||||
|
|
|
@ -267,6 +267,8 @@ export default {
|
|||
buys: 'Compras',
|
||||
notes: 'Notas',
|
||||
log: 'Historial',
|
||||
create: 'Crear',
|
||||
latestBuys: 'Últimas compras',
|
||||
},
|
||||
list: {
|
||||
newEntry: 'Nueva entrada',
|
||||
|
@ -322,6 +324,12 @@ export default {
|
|||
booked: 'Asentado',
|
||||
raid: 'Redada',
|
||||
excludedFromAvailable: 'Inventario',
|
||||
agency: 'Agencia',
|
||||
warehouseOut: 'Alm. salida',
|
||||
warehouseIn: 'Alm. entrada',
|
||||
shipped: 'F. envío',
|
||||
landed: 'F. entrega',
|
||||
id: 'ID',
|
||||
},
|
||||
buys: {
|
||||
groupingPrice: 'Precio grouping',
|
||||
|
@ -335,6 +343,12 @@ export default {
|
|||
grouping: 'Grouping',
|
||||
buyingValue: 'Coste',
|
||||
packagingFk: 'Embalaje',
|
||||
file: 'Fichero',
|
||||
name: 'Nombre',
|
||||
producer: 'Productor',
|
||||
type: 'Tipo',
|
||||
color: 'Color',
|
||||
id: 'ID',
|
||||
},
|
||||
notes: {
|
||||
observationType: 'Tipo de observación',
|
||||
|
@ -345,6 +359,36 @@ export default {
|
|||
landed: 'F. entrega',
|
||||
warehouseOut: 'Alm. salida',
|
||||
},
|
||||
latestBuys: {
|
||||
picture: 'Foto',
|
||||
itemFk: 'ID Artículo',
|
||||
packing: 'Packing',
|
||||
grouping: 'Grouping',
|
||||
quantity: 'Cantidad',
|
||||
description: 'Descripción',
|
||||
size: 'Medida',
|
||||
tags: 'Etiquetas',
|
||||
type: 'Tipo',
|
||||
intrastat: 'Intrastat',
|
||||
origin: 'Origen',
|
||||
weightByPiece: 'Peso (gramos)/tallo',
|
||||
isActive: 'Activo',
|
||||
family: 'Familia',
|
||||
entryFk: 'Entrada',
|
||||
buyingValue: 'Coste',
|
||||
freightValue: 'Porte',
|
||||
comissionValue: 'Comisión',
|
||||
packageValue: 'Embalaje',
|
||||
isIgnored: 'Ignorado',
|
||||
price2: 'Grouping',
|
||||
price3: 'Packing',
|
||||
minPrice: 'Min',
|
||||
ektFk: 'Ekt',
|
||||
weight: 'Peso',
|
||||
packagingFk: 'Embalaje',
|
||||
packingOut: 'Embalaje envíos',
|
||||
landing: 'Llegada',
|
||||
},
|
||||
},
|
||||
ticket: {
|
||||
pageTitles: {
|
||||
|
@ -1018,6 +1062,7 @@ export default {
|
|||
m3Price: 'Precio M3',
|
||||
routePrice: 'Precio ruta',
|
||||
minimumKm: 'Km mínimos',
|
||||
addRow: 'Añadir fila',
|
||||
},
|
||||
consumption: {
|
||||
entry: 'Entrada',
|
||||
|
@ -1060,6 +1105,25 @@ export default {
|
|||
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: {
|
||||
topbar: {},
|
||||
userPanel: {
|
||||
|
@ -1083,5 +1147,12 @@ export default {
|
|||
addToPinned: 'Añadir a 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_MAX_RESPONSABILITY, label: t('claim.summary.person') },
|
||||
];
|
||||
const multiplicatorValue = ref();
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
|
@ -134,17 +135,7 @@ async function regularizeClaim() {
|
|||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
if (claim.value.responsibility >= Math.ceil(DEFAULT_MAX_RESPONSABILITY) / 2) {
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('confirmGreuges'),
|
||||
message: t('confirmGreugesMessage'),
|
||||
},
|
||||
})
|
||||
.onOk(async () => await onUpdateGreugeAccept());
|
||||
}
|
||||
await onUpdateGreugeAccept();
|
||||
}
|
||||
|
||||
async function onUpdateGreugeAccept() {
|
||||
|
@ -153,9 +144,9 @@ async function onUpdateGreugeAccept() {
|
|||
filter: { where: { code: 'freightPickUp' } },
|
||||
})
|
||||
).data.id;
|
||||
const freightPickUpPrice = (await axios.get(`GreugeConfigs/findOne`)).data
|
||||
.freightPickUpPrice;
|
||||
|
||||
const freightPickUpPrice =
|
||||
(await axios.get(`GreugeConfigs/findOne`)).data.freightPickUpPrice *
|
||||
multiplicatorValue.value;
|
||||
await axios.post(`Greuges`, {
|
||||
clientFk: claim.value.clientFk,
|
||||
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
|
||||
|
@ -226,10 +217,10 @@ async function importToNewRefundTicket() {
|
|||
show-if-above
|
||||
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)}` }}
|
||||
</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">
|
||||
<QItemLabel class="slider-container">
|
||||
<p class="text-primary">
|
||||
|
@ -250,6 +241,7 @@ async function importToNewRefundTicket() {
|
|||
</QItemLabel>
|
||||
</QItem>
|
||||
</QCard>
|
||||
<QCard class="q-mb-md q-pa-sm no-box-shadow" style="margin-bottom: 1em">
|
||||
<QItemLabel class="mana q-mb-md">
|
||||
<QCheckbox
|
||||
v-model="claim.isChargedToMana"
|
||||
|
@ -257,6 +249,23 @@ async function importToNewRefundTicket() {
|
|||
/>
|
||||
<span>{{ t('mana') }}</span>
|
||||
</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>
|
||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()"> </Teleport>
|
||||
<CrudModel
|
||||
|
@ -494,4 +503,5 @@ es:
|
|||
Id item: Id artículo
|
||||
confirmGreuges: ¿Desea insertar greuges?
|
||||
confirmGreugesMessage: Insertar greuges en la ficha del cliente
|
||||
Apply Greuges: Aplicar Greuges
|
||||
</i18n>
|
||||
|
|
|
@ -1,27 +1,13 @@
|
|||
<script setup>
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import { getUrl } from 'composables/getUrl';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import ClaimDescriptor from './ClaimDescriptor.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
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>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'src/filters';
|
||||
import { toDate, toPercentage } from 'src/filters';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
||||
|
@ -32,7 +32,16 @@ const filter = {
|
|||
{
|
||||
relation: 'client',
|
||||
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"
|
||||
/>
|
||||
<VnLv :label="t('claim.card.zone')" :value="entity.ticket?.zone?.name" />
|
||||
<VnLv
|
||||
:label="t('claimRate')"
|
||||
:value="toPercentage(entity.client?.claimsRatio?.claimingRate)"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions>
|
||||
|
@ -163,3 +176,9 @@ const setData = (entity) => {
|
|||
margin-top: 0;
|
||||
}
|
||||
</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 { useQuasar } from 'quasar';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toDate, toCurrency, toPercentage } from 'filters/index';
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import { toDate, toCurrency, toPercentage } from 'filters/index';
|
||||
import VnDiscount from 'components/common/vnDiscount.vue';
|
||||
import ClaimLinesImport from './ClaimLinesImport.vue';
|
||||
|
||||
|
@ -158,7 +157,6 @@ function showImportDialog() {
|
|||
</script>
|
||||
<template>
|
||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
|
||||
<QToolbar>
|
||||
<div class="row q-gutter-md">
|
||||
<div>
|
||||
{{ t('Amount') }}
|
||||
|
@ -174,7 +172,6 @@ function showImportDialog() {
|
|||
</QChip>
|
||||
</div>
|
||||
</div>
|
||||
</QToolbar>
|
||||
</Teleport>
|
||||
|
||||
<FetchData
|
||||
|
|
|
@ -30,7 +30,7 @@ const body = {
|
|||
</script>
|
||||
<template>
|
||||
<div class="column items-center">
|
||||
<VnNotes
|
||||
<VnNotes style="overflow-y: scroll;"
|
||||
:add-note="$props.addNote"
|
||||
:id="id"
|
||||
url="claimObservations"
|
||||
|
|
|
@ -36,7 +36,6 @@ const states = ref();
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense class="list">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -178,20 +177,10 @@ const states = ref();
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -71,7 +71,7 @@ function viewSummary(id) {
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
data-key="ClaimList"
|
||||
url="Claims/filter"
|
||||
|
@ -87,20 +87,22 @@ function viewSummary(id) {
|
|||
v-for="row of rows"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv :label="t('claim.list.customer')" @click.stop>
|
||||
<VnLv :label="t('claim.list.customer')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.clientName }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('claim.list.assignedTo')" @click.stop>
|
||||
<VnLv :label="t('claim.list.assignedTo')">
|
||||
<template #value>
|
||||
<span @click.stop>
|
||||
<VnUserLink
|
||||
:name="row.workerName"
|
||||
:worker-id="row.workerFk"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
|
@ -145,13 +147,6 @@ function viewSummary(id) {
|
|||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search claim: Buscar reclamación
|
||||
|
|
|
@ -84,7 +84,7 @@ async function remove({ id }) {
|
|||
</QForm>
|
||||
</QCard>
|
||||
</QPageSticky>
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
data-key="ClaimRmaList"
|
||||
url="ClaimRmas"
|
||||
|
@ -160,7 +160,6 @@ async function remove({ id }) {
|
|||
padding-top: 156px;
|
||||
}
|
||||
|
||||
.card-list,
|
||||
.card {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CreateBankEntityForm from 'src/components/CreateBankEntityForm.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -16,16 +18,25 @@ const route = useRoute();
|
|||
|
||||
const payMethods = ref([]);
|
||||
const bankEntitiesOptions = ref([]);
|
||||
const bankEntitiesRef = ref(null);
|
||||
|
||||
const onBankEntityCreated = (data) => {
|
||||
bankEntitiesOptions.value.push(data);
|
||||
const filter = {
|
||||
fields: ['id', 'bic', 'name'],
|
||||
order: 'bic ASC',
|
||||
limit: 30,
|
||||
};
|
||||
|
||||
const getBankEntities = () => {
|
||||
bankEntitiesRef.value.fetch();
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<fetch-data @on-fetch="(data) => (payMethods = data)" auto-load url="PayMethods" />
|
||||
<FetchData
|
||||
<fetch-data
|
||||
ref="bankEntitiesRef"
|
||||
@on-fetch="(data) => (bankEntitiesOptions = data)"
|
||||
:filter="filter"
|
||||
auto-load
|
||||
url="BankEntities"
|
||||
/>
|
||||
|
@ -59,10 +70,16 @@ const onBankEntityCreated = (data) => {
|
|||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<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 class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Swift / BIC')"
|
||||
:options="bankEntitiesOptions"
|
||||
:roles-allowed-to-create="['salesAssistant', 'hr']"
|
||||
|
@ -73,9 +90,7 @@ const onBankEntityCreated = (data) => {
|
|||
v-model="data.bankEntityFk"
|
||||
>
|
||||
<template #form>
|
||||
<CreateBankEntityForm
|
||||
@on-data-saved="onBankEntityCreated($event)"
|
||||
/>
|
||||
<CreateBankEntityForm @on-data-saved="getBankEntities()" />
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -87,7 +102,7 @@ const onBankEntityCreated = (data) => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ const toCustomerConsigneeEdit = (consigneeId) => {
|
|||
}"
|
||||
@click="toCustomerConsigneeEdit(item.id)"
|
||||
>
|
||||
<div class="consignees-card-icon">
|
||||
<div class="q-ml-xs q-mr-md flex items-center">
|
||||
<QIcon name="star" size="md" color="primary" />
|
||||
</div>
|
||||
<div>
|
||||
|
@ -160,11 +160,6 @@ const toCustomerConsigneeEdit = (consigneeId) => {
|
|||
background-color: var(--vn-light-gray);
|
||||
}
|
||||
}
|
||||
.consignees-card-icon {
|
||||
margin: 0 15px 0 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
|
|
|
@ -109,9 +109,9 @@ const toCustomerCreditCreate = () => {
|
|||
<QTr :props="props" class="cursor-pointer">
|
||||
<component
|
||||
:is="tableColumnComponents[props.col.name].component"
|
||||
class="col-content"
|
||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
||||
@click="tableColumnComponents[props.col.name].event(props)"
|
||||
class="rounded-borders q-pa-sm"
|
||||
v-bind="tableColumnComponents[props.col.name].props(props)"
|
||||
>
|
||||
{{ props.value }}
|
||||
<WorkerDescriptorProxy :id="workerId" />
|
||||
|
@ -130,13 +130,6 @@ const toCustomerCreditCreate = () => {
|
|||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.col-content {
|
||||
border-radius: 4px;
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Since: Desde
|
||||
|
|
|
@ -8,60 +8,31 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const townsFetchDataRef = ref(null);
|
||||
const postcodeFetchDataRef = ref(null);
|
||||
const typesTaxes = ref([]);
|
||||
const typesTransactions = ref([]);
|
||||
const citiesLocationOptions = ref([]);
|
||||
const provincesLocationOptions = ref([]);
|
||||
const countriesOptions = ref([]);
|
||||
const postcodesOptions = ref([]);
|
||||
|
||||
const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formData) => {
|
||||
await postcodeFetchDataRef.value.fetch();
|
||||
await townsFetchDataRef.value.fetch();
|
||||
formData.postcode = code;
|
||||
formData.provinceFk = provinceFk;
|
||||
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
|
||||
formData.countryFk = countryFk;
|
||||
};
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
data.postcode = code;
|
||||
data.city = town;
|
||||
data.provinceFk = provinceFk;
|
||||
data.countryFk = countryFk;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<fetch-data auto-load @on-fetch="(data) => (typesTaxes = data)" url="SageTaxTypes" />
|
||||
<fetch-data
|
||||
<FetchData auto-load @on-fetch="(data) => (typesTaxes = data)" url="SageTaxTypes" />
|
||||
<FetchData
|
||||
auto-load
|
||||
@on-fetch="(data) => (typesTransactions = data)"
|
||||
url="SageTransactionTypes"
|
||||
/>
|
||||
<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"
|
||||
/>
|
||||
<FetchData
|
||||
ref="postcodeFetchDataRef"
|
||||
url="Postcodes/location"
|
||||
@on-fetch="(data) => (postcodesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FormModel
|
||||
:url-update="`Clients/${route.params.id}/updateFiscalData`"
|
||||
:url="`Clients/${route.params.id}/getCard`"
|
||||
|
@ -114,94 +85,14 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
:label="t('Postcode')"
|
||||
:options="postcodesOptions"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
<VnLocation
|
||||
:rules="validate('Worker.postcode')"
|
||||
hide-selected
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
:options="postcodesOptions"
|
||||
v-model="data.postcode"
|
||||
@update:model-value="(location) => handleLocation(data, location)"
|
||||
>
|
||||
<template #form>
|
||||
<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>
|
||||
</VnSelectCreate>
|
||||
</div>
|
||||
<div class="col">
|
||||
<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"
|
||||
/>
|
||||
</VnLocation>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
|
|
|
@ -36,7 +36,9 @@ const toCustomerNoteCreate = () => {
|
|||
v-for="(item, index) in rows"
|
||||
:key="index"
|
||||
:class="{
|
||||
'consignees-card': true,
|
||||
'q-pa-md': true,
|
||||
'q-rounded': true,
|
||||
'custom-border': true,
|
||||
'q-mb-md': index < rows.length - 1,
|
||||
}"
|
||||
>
|
||||
|
@ -82,7 +84,7 @@ const toCustomerNoteCreate = () => {
|
|||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.consignees-card {
|
||||
.custom-border {
|
||||
border: 2px solid var(--vn-light-gray);
|
||||
border-radius: 10px;
|
||||
padding: 10px;
|
||||
|
|
|
@ -38,7 +38,7 @@ const balanceDue = computed(() => {
|
|||
const balanceDueWarning = computed(() => (balanceDue.value ? 'negative' : ''));
|
||||
|
||||
const claimRate = computed(() => {
|
||||
return customer.value.claimsRatio.claimingRate * 100;
|
||||
return customer.value.claimsRatio.claimingRate;
|
||||
});
|
||||
|
||||
const priceIncreasingRate = computed(() => {
|
||||
|
@ -81,7 +81,7 @@ const creditWarning = computed(() => {
|
|||
<VnLinkPhone :phone-number="entity.mobile" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('customer.summary.email')" :value="entity.email" />
|
||||
<VnLv :label="t('customer.summary.email')" :value="entity.email" copy />
|
||||
<VnLv
|
||||
:label="t('customer.summary.salesPerson')"
|
||||
:value="entity?.salesPersonUser?.name"
|
||||
|
|
|
@ -2,12 +2,11 @@
|
|||
import { reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnLocation from 'src/components/common/VnLocation.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -29,23 +28,17 @@ const newClientForm = reactive({
|
|||
isEqualizated: false,
|
||||
});
|
||||
|
||||
const postcodeFetchDataRef = ref(null);
|
||||
const townsFetchDataRef = ref(null);
|
||||
const workersOptions = ref([]);
|
||||
const businessTypesOptions = ref([]);
|
||||
const citiesLocationOptions = ref([]);
|
||||
const provincesLocationOptions = ref([]);
|
||||
const countriesOptions = ref([]);
|
||||
const postcodesOptions = ref([]);
|
||||
|
||||
const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formData) => {
|
||||
await postcodeFetchDataRef.value.fetch();
|
||||
await townsFetchDataRef.value.fetch();
|
||||
formData.postcode = code;
|
||||
formData.provinceFk = provinceFk;
|
||||
formData.city = citiesLocationOptions.value.find((town) => town.id === townFk).name;
|
||||
formData.countryFk = countryFk;
|
||||
};
|
||||
function handleLocation(data, location) {
|
||||
const { town, code, provinceFk, countryFk } = location ?? {};
|
||||
data.postcode = code;
|
||||
data.city = town;
|
||||
data.provinceFk = provinceFk;
|
||||
data.countryFk = countryFk;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -54,33 +47,11 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
auto-load
|
||||
url="Workers/search?departmentCodes"
|
||||
/>
|
||||
<FetchData
|
||||
ref="postcodeFetchDataRef"
|
||||
url="Postcodes/location"
|
||||
@on-fetch="(data) => (postcodesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (businessTypesOptions = data)"
|
||||
auto-load
|
||||
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>
|
||||
<VnSubToolbar />
|
||||
<FormModel
|
||||
|
@ -139,96 +110,19 @@ const onPostcodeCreated = async ({ code, provinceFk, townFk, countryFk }, formDa
|
|||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
v-model="data.postcode"
|
||||
:label="t('Postcode')"
|
||||
<VnLocation
|
||||
:rules="validate('Worker.postcode')"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
:options="postcodesOptions"
|
||||
option-label="code"
|
||||
option-value="code"
|
||||
hide-selected
|
||||
v-model="data.location"
|
||||
@update:model-value="
|
||||
(location) => handleLocation(data, location)
|
||||
"
|
||||
>
|
||||
<template #form>
|
||||
<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>
|
||||
</VnSelectCreate>
|
||||
</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"
|
||||
/>
|
||||
</VnLocation>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput v-model="data.userName" :label="t('Web user')" />
|
||||
|
|
|
@ -37,7 +37,6 @@ const zones = ref();
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense class="list">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInput :label="t('FI')" v-model="params.fi" is-outlined>
|
||||
|
@ -115,11 +114,7 @@ const zones = ref();
|
|||
<QExpansionItem :label="t('More options')" expand-separator>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('Phone')"
|
||||
v-model="params.phone"
|
||||
is-outlined
|
||||
>
|
||||
<VnInput :label="t('Phone')" v-model="params.phone" is-outlined>
|
||||
<template #prepend>
|
||||
<QIcon name="phone" size="xs" />
|
||||
</template>
|
||||
|
@ -128,11 +123,7 @@ const zones = ref();
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('Email')"
|
||||
v-model="params.email"
|
||||
is-outlined
|
||||
>
|
||||
<VnInput :label="t('Email')" v-model="params.email" is-outlined>
|
||||
<template #prepend>
|
||||
<QIcon name="email" size="sm" />
|
||||
</template>
|
||||
|
@ -170,20 +161,10 @@ const zones = ref();
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -65,7 +65,7 @@ const redirectToCreateView = () => {
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
auto-load
|
||||
data-key="CustomerList"
|
||||
|
@ -116,13 +116,6 @@ const redirectToCreateView = () => {
|
|||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search customer: Buscar cliente
|
||||
|
|
|
@ -12,6 +12,7 @@ import CustomerNotificationsFilter from './CustomerDefaulterFilter.vue';
|
|||
import CustomerBalanceDueTotal from './CustomerBalanceDueTotal.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import CustomerDefaulterAddObservation from './CustomerDefaulterAddObservation.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -206,8 +207,8 @@ const refreshData = () => {
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
|
||||
<QToolbar class="bg-vn-dark">
|
||||
<div id="st-data" class="row">
|
||||
<VnSubToolbar class="bg-vn-dark">
|
||||
<template #st-data>
|
||||
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
|
||||
<div class="flex items-center q-ml-lg">
|
||||
<QBtn
|
||||
|
@ -217,8 +218,8 @@ const refreshData = () => {
|
|||
@click.stop="viewAddObservation(selected)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</QToolbar>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
|
|
|
@ -46,7 +46,6 @@ const authors = ref();
|
|||
</template>
|
||||
|
||||
<template #body="{ params }">
|
||||
<QList dense class="list">
|
||||
<QItem class="q-mb-sm q-mt-sm">
|
||||
<QItemSection v-if="clients">
|
||||
<VnSelectFilter
|
||||
|
@ -161,11 +160,7 @@ const authors = ref();
|
|||
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('L. O. Date')"
|
||||
is-outlined
|
||||
v-model="params.date"
|
||||
/>
|
||||
<VnInput :label="t('L. O. Date')" is-outlined v-model="params.date" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
|
@ -189,20 +184,10 @@ const authors = ref();
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -9,6 +9,7 @@ import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorP
|
|||
import CustomerExtendedListActions from './CustomerExtendedListActions.vue';
|
||||
import CustomerExtendedListFilter from './CustomerExtendedListFilter.vue';
|
||||
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
@ -499,9 +500,8 @@ const selectSalesPersonId = (id) => {
|
|||
/>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
|
||||
<QToolbar class="bg-vn-dark">
|
||||
<div id="st-data">
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<TableVisibleColumns
|
||||
:all-columns="allColumnNames"
|
||||
table-code="clientsDetail"
|
||||
|
@ -510,10 +510,8 @@ const selectSalesPersonId = (id) => {
|
|||
visibleColumns = ['customerStatus', ...$event, 'actions']
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
|
|
|
@ -145,7 +145,6 @@ const shouldRenderColumn = (colName) => {
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||
<QItem v-if="shouldRenderColumn('id')">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -204,9 +203,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItemSection v-if="workers">
|
||||
<VnSelectFilter
|
||||
:label="
|
||||
t(
|
||||
'customer.extendedList.tableVisibleColumns.salesPersonFk'
|
||||
)
|
||||
t('customer.extendedList.tableVisibleColumns.salesPersonFk')
|
||||
"
|
||||
v-model="params.salesPersonFk"
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -237,9 +234,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItemSection>
|
||||
<VnInput
|
||||
:label="
|
||||
t(
|
||||
'customer.extendedList.tableVisibleColumns.creditInsurance'
|
||||
)
|
||||
t('customer.extendedList.tableVisibleColumns.creditInsurance')
|
||||
"
|
||||
v-model="params.creditInsurance"
|
||||
is-outlined
|
||||
|
@ -276,9 +271,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItem v-if="shouldRenderColumn('countryFk')">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.countryFk')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.countryFk')"
|
||||
v-model="params.countryFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="countriesOptions"
|
||||
|
@ -295,9 +288,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItem v-if="shouldRenderColumn('provinceFk')">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.provinceFk')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.provinceFk')"
|
||||
v-model="params.provinceFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="provincesOptions"
|
||||
|
@ -323,9 +314,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItem v-if="shouldRenderColumn('postcode')">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.postcode')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.postcode')"
|
||||
v-model="params.postcode"
|
||||
is-outlined
|
||||
/>
|
||||
|
@ -345,9 +334,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.created"
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.created')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.created')"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
|
@ -357,9 +344,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="
|
||||
t(
|
||||
'customer.extendedList.tableVisibleColumns.businessTypeFk'
|
||||
)
|
||||
t('customer.extendedList.tableVisibleColumns.businessTypeFk')
|
||||
"
|
||||
v-model="params.businessTypeFk"
|
||||
:options="businessTypesOptions"
|
||||
|
@ -397,9 +382,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="
|
||||
t(
|
||||
'customer.extendedList.tableVisibleColumns.sageTaxTypeFk'
|
||||
)
|
||||
t('customer.extendedList.tableVisibleColumns.sageTaxTypeFk')
|
||||
"
|
||||
v-model="params.sageTaxTypeFk"
|
||||
@update:model-value="searchFn()"
|
||||
|
@ -435,16 +418,12 @@ const shouldRenderColumn = (colName) => {
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="shouldRenderColumn('isActive') || shouldRenderColumn('isVies')"
|
||||
>
|
||||
<QItem v-if="shouldRenderColumn('isActive') || shouldRenderColumn('isVies')">
|
||||
<QItemSection v-if="shouldRenderColumn('isActive')">
|
||||
<QCheckbox
|
||||
v-model="params.isActive"
|
||||
@update:model-value="searchFn()"
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.isActive')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.isActive')"
|
||||
toggle-indeterminate
|
||||
:false-value="undefined"
|
||||
/>
|
||||
|
@ -483,9 +462,7 @@ const shouldRenderColumn = (colName) => {
|
|||
v-model="params.isEqualizated"
|
||||
@update:model-value="searchFn()"
|
||||
:label="
|
||||
t(
|
||||
'customer.extendedList.tableVisibleColumns.isEqualizated'
|
||||
)
|
||||
t('customer.extendedList.tableVisibleColumns.isEqualizated')
|
||||
"
|
||||
toggle-indeterminate
|
||||
:false-value="undefined"
|
||||
|
@ -494,17 +471,14 @@ const shouldRenderColumn = (colName) => {
|
|||
</QItem>
|
||||
<QItem
|
||||
v-if="
|
||||
shouldRenderColumn('hasToInvoice') ||
|
||||
shouldRenderColumn('isFreezed')
|
||||
shouldRenderColumn('hasToInvoice') || shouldRenderColumn('isFreezed')
|
||||
"
|
||||
>
|
||||
<QItemSection v-if="shouldRenderColumn('isFreezed')">
|
||||
<QCheckbox
|
||||
v-model="params.isFreezed"
|
||||
@update:model-value="searchFn()"
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.isFreezed')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.isFreezed')"
|
||||
toggle-indeterminate
|
||||
:false-value="undefined"
|
||||
/>
|
||||
|
@ -514,9 +488,7 @@ const shouldRenderColumn = (colName) => {
|
|||
v-model="params.hasToInvoice"
|
||||
@update:model-value="searchFn()"
|
||||
:label="
|
||||
t(
|
||||
'customer.extendedList.tableVisibleColumns.hasToInvoice'
|
||||
)
|
||||
t('customer.extendedList.tableVisibleColumns.hasToInvoice')
|
||||
"
|
||||
toggle-indeterminate
|
||||
:false-value="undefined"
|
||||
|
@ -547,9 +519,7 @@ const shouldRenderColumn = (colName) => {
|
|||
v-model="params.isToBeMailed"
|
||||
@update:model-value="searchFn()"
|
||||
:label="
|
||||
t(
|
||||
'customer.extendedList.tableVisibleColumns.isToBeMailed'
|
||||
)
|
||||
t('customer.extendedList.tableVisibleColumns.isToBeMailed')
|
||||
"
|
||||
toggle-indeterminate
|
||||
:false-value="undefined"
|
||||
|
@ -557,9 +527,7 @@ const shouldRenderColumn = (colName) => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="
|
||||
shouldRenderColumn('hasLcr') || shouldRenderColumn('hasCoreVnl')
|
||||
"
|
||||
v-if="shouldRenderColumn('hasLcr') || shouldRenderColumn('hasCoreVnl')"
|
||||
>
|
||||
<QItemSection v-if="shouldRenderColumn('hasLcr')">
|
||||
<QCheckbox
|
||||
|
@ -574,9 +542,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QCheckbox
|
||||
v-model="params.hasCoreVnl"
|
||||
@update:model-value="searchFn()"
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.hasCoreVnl')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.hasCoreVnl')"
|
||||
toggle-indeterminate
|
||||
:false-value="undefined"
|
||||
/>
|
||||
|
@ -587,9 +553,7 @@ const shouldRenderColumn = (colName) => {
|
|||
<QCheckbox
|
||||
v-model="params.hasSepaVnl"
|
||||
@update:model-value="searchFn()"
|
||||
:label="
|
||||
t('customer.extendedList.tableVisibleColumns.hasSepaVnl')
|
||||
"
|
||||
:label="t('customer.extendedList.tableVisibleColumns.hasSepaVnl')"
|
||||
toggle-indeterminate
|
||||
:false-value="undefined"
|
||||
/>
|
||||
|
@ -597,20 +561,10 @@ const shouldRenderColumn = (colName) => {
|
|||
</QItem>
|
||||
|
||||
<QSeparator />
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Social name: Razón social
|
||||
|
|
|
@ -36,7 +36,6 @@ const clients = ref();
|
|||
</template>
|
||||
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense class="list">
|
||||
<QItem class="q-mb-sm q-mt-sm">
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -107,20 +106,10 @@ const clients = ref();
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -122,7 +122,7 @@ function stateColor(row) {
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md customer-payments">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<QToolbar class="q-pa-none justify-end">
|
||||
<QBtn
|
||||
@click="arrayData.refresh()"
|
||||
|
@ -278,10 +278,6 @@ function stateColor(row) {
|
|||
|
||||
<style lang="scss">
|
||||
.customer-payments {
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
|
||||
.q-table--dense .q-table th:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
@ -290,7 +286,6 @@ function stateColor(row) {
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -27,14 +27,9 @@ function isValidNumber(value) {
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense class="q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('Order ID')"
|
||||
v-model="params.orderFk"
|
||||
is-outlined
|
||||
>
|
||||
<VnInput :label="t('Order ID')" v-model="params.orderFk" is-outlined>
|
||||
<template #prepend>
|
||||
<QIcon name="vn:basket" size="xs" />
|
||||
</template>
|
||||
|
@ -67,8 +62,7 @@ function isValidNumber(value) {
|
|||
}
|
||||
"
|
||||
:rules="[
|
||||
(val) =>
|
||||
isValidNumber(val) || !val || 'Please type a number',
|
||||
(val) => isValidNumber(val) || !val || 'Please type a number',
|
||||
]"
|
||||
lazy-rules
|
||||
>
|
||||
|
@ -81,17 +75,12 @@ function isValidNumber(value) {
|
|||
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.from"
|
||||
:label="t('From')"
|
||||
is-outlined
|
||||
/>
|
||||
<VnInputDate v-model="params.from" :label="t('From')" is-outlined />
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<VnInputDate v-model="params.to" :label="t('To')" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
|
@ -10,26 +10,15 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const formInitialData = reactive({
|
||||
isDefaultAddress: false,
|
||||
nickname: null,
|
||||
street: null,
|
||||
postalCode: null,
|
||||
city: null,
|
||||
provinceFk: null,
|
||||
agencyModeFk: null,
|
||||
phone: null,
|
||||
mobile: null,
|
||||
incotermsFk: null,
|
||||
customsAgentFk: null,
|
||||
});
|
||||
const formInitialData = reactive({ isDefaultAddress: false });
|
||||
|
||||
const townsFetchDataRef = ref(null);
|
||||
const postcodeFetchDataRef = ref(null);
|
||||
|
@ -63,19 +52,28 @@ const getCustomsAgents = async () => {
|
|||
const refreshData = () => {
|
||||
getCustomsAgents();
|
||||
};
|
||||
|
||||
const toCustomerConsignees = () => {
|
||||
router.push({
|
||||
name: 'CustomerConsignees',
|
||||
params: {
|
||||
id: route.params.id,
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="postcodeFetchDataRef"
|
||||
@on-fetch="(data) => (postcodesOptions = data)"
|
||||
auto-load
|
||||
ref="postcodeFetchDataRef"
|
||||
url="Postcodes/location"
|
||||
/>
|
||||
<FetchData
|
||||
ref="townsFetchDataRef"
|
||||
@on-fetch="(data) => (citiesLocationOptions = data)"
|
||||
auto-load
|
||||
ref="townsFetchDataRef"
|
||||
url="Towns/location"
|
||||
/>
|
||||
<FetchData
|
||||
|
@ -94,6 +92,7 @@ const refreshData = () => {
|
|||
:form-initial-data="formInitialData"
|
||||
:observe-form-changes="false"
|
||||
:url-create="urlCreate"
|
||||
@on-data-saved="toCustomerConsignees()"
|
||||
model="client"
|
||||
>
|
||||
<template #form="{ data, validate }">
|
||||
|
@ -114,7 +113,7 @@ const refreshData = () => {
|
|||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Postcode')"
|
||||
:options="postcodesOptions"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
|
@ -142,7 +141,7 @@ const refreshData = () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<!-- ciudades -->
|
||||
|
@ -224,7 +223,7 @@ const refreshData = () => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Customs agent')"
|
||||
:options="customsAgents"
|
||||
hide-selected
|
||||
|
@ -235,7 +234,7 @@ const refreshData = () => {
|
|||
<template #form>
|
||||
<CustomerNewCustomsAgent @on-data-saved="refreshData()" />
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
|
|
|
@ -10,7 +10,7 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectCreate from 'src/components/common/VnSelectCreate.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import CustomerCreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
|
||||
import CustomsNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||
|
||||
|
@ -168,7 +168,7 @@ const onDataSaved = () => {
|
|||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Postcode')"
|
||||
:options="postcodesOptions"
|
||||
:roles-allowed-to-create="['deliveryAssistant']"
|
||||
|
@ -196,7 +196,7 @@ const onDataSaved = () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<!-- ciudades -->
|
||||
|
@ -278,7 +278,7 @@ const onDataSaved = () => {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectCreate
|
||||
<VnSelectDialog
|
||||
:label="t('Customs agent')"
|
||||
:options="customsAgents"
|
||||
hide-selected
|
||||
|
@ -289,7 +289,7 @@ const onDataSaved = () => {
|
|||
<template #form>
|
||||
<CustomsNewCustomsAgent />
|
||||
</template>
|
||||
</VnSelectCreate>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ const setData = (entity) => {
|
|||
};
|
||||
|
||||
const removeDepartment = () => {
|
||||
console.log('entityId: ', entityId.value);
|
||||
quasar
|
||||
.dialog({
|
||||
title: 'Are you sure you want to delete it?',
|
||||
|
@ -90,17 +89,15 @@ const removeDepartment = () => {
|
|||
</QItem>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('department.chat')" :value="entity.chatName" dash />
|
||||
<VnLv :label="t('department.email')" :value="entity.notificationEmail" dash />
|
||||
<VnLv :label="t('department.chat')" :value="entity.chatName" />
|
||||
<VnLv :label="t('department.email')" :value="entity.notificationEmail" copy />
|
||||
<VnLv
|
||||
:label="t('department.selfConsumptionCustomer')"
|
||||
:value="entity.client?.name"
|
||||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('department.bossDepartment')"
|
||||
:value="entity.worker?.user?.name"
|
||||
dash
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
|
|
|
@ -8,6 +8,8 @@ import FormModel from 'components/FormModel.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import FilterTravelForm from 'src/components/FilterTravelForm.vue';
|
||||
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
|
@ -18,6 +20,10 @@ const suppliersOptions = ref([]);
|
|||
const travelsOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const currenciesOptions = ref([]);
|
||||
|
||||
const onFilterTravelSelected = (formData, id) => {
|
||||
formData.travelFk = id;
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -82,7 +88,7 @@ const currenciesOptions = ref([]);
|
|||
</VnSelectFilter>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
<VnSelectDialog
|
||||
:label="t('entry.basicData.travel')"
|
||||
v-model="data.travelFk"
|
||||
:options="travelsOptions"
|
||||
|
@ -91,7 +97,13 @@ const currenciesOptions = ref([]);
|
|||
map-options
|
||||
hide-selected
|
||||
:required="true"
|
||||
action-icon="filter_alt"
|
||||
>
|
||||
<template #form>
|
||||
<FilterTravelForm
|
||||
@travel-selected="onFilterTravelSelected(data, $event)"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
|
@ -106,7 +118,7 @@ const currenciesOptions = ref([]);
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</VnSelectDialog>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
@ -163,8 +175,9 @@ const currenciesOptions = ref([]);
|
|||
:label="t('entry.basicData.observation')"
|
||||
type="textarea"
|
||||
v-model="data.observation"
|
||||
:maxlength="45"
|
||||
counter
|
||||
fill-input
|
||||
autogrow
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { QBtn } from 'quasar';
|
||||
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
|
@ -9,6 +10,7 @@ import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
|||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
@ -26,28 +28,38 @@ const { notify } = useNotify();
|
|||
const rowsSelected = ref([]);
|
||||
const entryBuysPaginateRef = ref(null);
|
||||
const packagingsOptions = ref(null);
|
||||
const originalRowDataCopy = ref(null);
|
||||
|
||||
const getInputEvents = (colField, props) => {
|
||||
return colField === 'packagingFk'
|
||||
? { 'update:modelValue': () => saveChange(colField, props) }
|
||||
: {
|
||||
'keyup.enter': () => saveChange(colField, props),
|
||||
blur: () => saveChange(colField, props),
|
||||
};
|
||||
};
|
||||
|
||||
const tableColumnComponents = computed(() => ({
|
||||
item: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
component: QBtn,
|
||||
props: {
|
||||
color: 'blue',
|
||||
flat: true,
|
||||
},
|
||||
event: () => ({}),
|
||||
},
|
||||
quantity: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
class: 'input-number',
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
packagingFk: {
|
||||
component: () => VnSelectFilter,
|
||||
props: () => ({
|
||||
component: VnSelectFilter,
|
||||
props: {
|
||||
'option-value': 'id',
|
||||
'option-label': 'id',
|
||||
'emit-value': true,
|
||||
|
@ -55,92 +67,69 @@ const tableColumnComponents = computed(() => ({
|
|||
'use-input': true,
|
||||
'hide-selected': true,
|
||||
options: packagingsOptions.value,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'update:modelValue': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
stickers: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
class: 'input-number',
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
weight: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
packing: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
grouping: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
buyingValue: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
price2: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
price3: {
|
||||
component: () => VnInput,
|
||||
props: (col) => ({
|
||||
component: VnInput,
|
||||
props: {
|
||||
type: 'number',
|
||||
min: 0,
|
||||
label: col.label,
|
||||
}),
|
||||
event: (props) => ({
|
||||
'keyup.enter': () => saveChange(props.row),
|
||||
}),
|
||||
},
|
||||
event: getInputEvents,
|
||||
},
|
||||
import: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
component: 'span',
|
||||
props: {},
|
||||
event: () => ({}),
|
||||
},
|
||||
}));
|
||||
|
@ -217,8 +206,19 @@ const entriesTableColumns = computed(() => {
|
|||
];
|
||||
});
|
||||
|
||||
const saveChange = async (rowData) => {
|
||||
await axios.patch(`Buys/${rowData.id}`, rowData);
|
||||
const copyOriginalRowsData = (rows) => {
|
||||
// el objetivo de esto es guardar los valores iniciales de todas las rows para evitar guardar cambios si la data no cambió al disparar los eventos
|
||||
originalRowDataCopy.value = JSON.parse(JSON.stringify(rows));
|
||||
};
|
||||
|
||||
const saveChange = async (field, { rowIndex, row }) => {
|
||||
try {
|
||||
if (originalRowDataCopy.value[rowIndex][field] == row[field]) return;
|
||||
await axios.patch(`Buys/${row.id}`, row);
|
||||
originalRowDataCopy.value[rowIndex][field] = row[field];
|
||||
} catch (err) {
|
||||
console.error('Error saving changes', err);
|
||||
}
|
||||
};
|
||||
|
||||
const openRemoveDialog = async () => {
|
||||
|
@ -227,18 +227,20 @@ const openRemoveDialog = async () => {
|
|||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Confirm deletion'),
|
||||
message:
|
||||
rowsSelected.value.length > 1
|
||||
? t('Are you sure you want to delete this buys?')
|
||||
: t('Are you sure you want to delete this buy?'),
|
||||
message: t(
|
||||
`Are you sure you want to delete this buy${
|
||||
rowsSelected.value.length > 1 ? 's' : ''
|
||||
}?`
|
||||
),
|
||||
data: rowsSelected.value,
|
||||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await deleteBuys();
|
||||
const notifyMessage =
|
||||
rowsSelected.value.length > 1 ? t('Buys deleted') : t('Buy deleted');
|
||||
const notifyMessage = t(
|
||||
`Buy${rowsSelected.value.length > 1 ? 's' : ''} deleted`
|
||||
);
|
||||
notify(notifyMessage, 'positive');
|
||||
} catch (err) {
|
||||
console.error('Error deleting buys');
|
||||
|
@ -254,6 +256,33 @@ const deleteBuys = async () => {
|
|||
const importBuys = () => {
|
||||
router.push({ name: 'EntryBuysImport' });
|
||||
};
|
||||
|
||||
const toggleGroupingMode = async (buy, mode) => {
|
||||
try {
|
||||
const grouping = 1;
|
||||
const packing = 2;
|
||||
const groupingMode = mode === 'grouping' ? grouping : packing;
|
||||
|
||||
const newGroupingMode = buy.groupingMode === groupingMode ? 0 : groupingMode;
|
||||
|
||||
const params = {
|
||||
groupingMode: newGroupingMode,
|
||||
};
|
||||
|
||||
await axios.patch(`Buys/${buy.id}`, params);
|
||||
buy.groupingMode = newGroupingMode;
|
||||
} catch (err) {
|
||||
console.error('Error toggling grouping mode');
|
||||
}
|
||||
};
|
||||
|
||||
const showLockIcon = (groupingMode, mode) => {
|
||||
if (mode === 'packing') {
|
||||
return groupingMode === 2 ? 'lock' : 'lock_open';
|
||||
} else {
|
||||
return groupingMode === 1 ? 'lock' : 'lock_open';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -282,6 +311,7 @@ const importBuys = () => {
|
|||
ref="entryBuysPaginateRef"
|
||||
data-key="EntryBuys"
|
||||
:url="`Entries/${route.params.id}/getBuys`"
|
||||
@on-fetch="copyOriginalRowsData($event)"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
|
@ -302,16 +332,44 @@ const importBuys = () => {
|
|||
</QTd>
|
||||
<QTd v-for="col in props.cols" :key="col.name">
|
||||
<component
|
||||
:is="tableColumnComponents[col.name].component()"
|
||||
v-bind="tableColumnComponents[col.name].props(col)"
|
||||
:is="tableColumnComponents[col.name].component"
|
||||
v-bind="tableColumnComponents[col.name].props"
|
||||
v-model="props.row[col.field]"
|
||||
v-on="tableColumnComponents[col.name].event(props)"
|
||||
v-on="
|
||||
tableColumnComponents[col.name].event(
|
||||
col.field,
|
||||
props
|
||||
)
|
||||
"
|
||||
>
|
||||
<template
|
||||
v-if="
|
||||
col.name === 'grouping' || col.name === 'packing'
|
||||
"
|
||||
#append
|
||||
>
|
||||
<QBtn
|
||||
:icon="
|
||||
showLockIcon(props.row.groupingMode, col.name)
|
||||
"
|
||||
@click="toggleGroupingMode(props.row, col.name)"
|
||||
class="cursor-pointer"
|
||||
size="sm"
|
||||
flat
|
||||
dense
|
||||
unelevated
|
||||
push
|
||||
/>
|
||||
</template>
|
||||
<template
|
||||
v-if="col.name === 'item' || col.name === 'import'"
|
||||
>
|
||||
{{ col.value }}
|
||||
</template>
|
||||
<ItemDescriptorProxy
|
||||
v-if="col.name === 'item'"
|
||||
:id="props.row.id"
|
||||
/>
|
||||
</component>
|
||||
</QTd>
|
||||
</QTr>
|
||||
|
@ -352,13 +410,14 @@ const importBuys = () => {
|
|||
<QList dense>
|
||||
<QItem v-for="col in props.cols" :key="col.name">
|
||||
<component
|
||||
:is="tableColumnComponents[col.name].component()"
|
||||
v-bind="
|
||||
tableColumnComponents[col.name].props(col)
|
||||
"
|
||||
:is="tableColumnComponents[col.name].component"
|
||||
v-bind="tableColumnComponents[col.name].props"
|
||||
v-model="props.row[col.field]"
|
||||
v-on="
|
||||
tableColumnComponents[col.name].event(props)
|
||||
tableColumnComponents[col.name].event(
|
||||
col.field,
|
||||
props
|
||||
)
|
||||
"
|
||||
class="full-width"
|
||||
>
|
||||
|
@ -379,9 +438,10 @@ const importBuys = () => {
|
|||
</QTable>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn fab icon="upload" color="primary" @click="importBuys()" />
|
||||
<QTooltip>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('Import buys') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
|
|
|
@ -7,6 +7,8 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||
import FilterItemForm from 'src/components/FilterItemForm.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import axios from 'axios';
|
||||
|
@ -27,6 +29,7 @@ const importData = ref({
|
|||
ref: null,
|
||||
});
|
||||
|
||||
const inputFileRef = ref(null);
|
||||
const lastItemBuysOptions = ref([]);
|
||||
const packagingsOptions = ref([]);
|
||||
|
||||
|
@ -197,13 +200,20 @@ const redirectToBuysView = () => {
|
|||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QFile
|
||||
label="Standard"
|
||||
:multiple="false"
|
||||
ref="inputFileRef"
|
||||
:label="t('entry.buys.file')"
|
||||
v-model="importData.file"
|
||||
:multiple="false"
|
||||
accept=".json"
|
||||
@update:model-value="onFileChange($event)"
|
||||
class="required"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="vn:attach" class="cursor-pointer">
|
||||
<QIcon
|
||||
name="vn:attach"
|
||||
class="cursor-pointer"
|
||||
@click="inputFileRef.pickFiles()"
|
||||
>
|
||||
<QTooltip>{{ t('Select a file') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
|
@ -236,13 +246,19 @@ const redirectToBuysView = () => {
|
|||
>
|
||||
<template #body-cell-item="{ row, col }">
|
||||
<QTd auto-width>
|
||||
<VnSelectFilter
|
||||
<VnSelectDialog
|
||||
v-model="row[col.field]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
hide-selected
|
||||
action-icon="filter_alt"
|
||||
>
|
||||
<template #form>
|
||||
<FilterItemForm
|
||||
@item-selected="row[col.field] = $event"
|
||||
/>
|
||||
</template>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
|
@ -253,7 +269,7 @@ const redirectToBuysView = () => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</VnSelectDialog>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-packagingFk="{ row, col }">
|
||||
|
|
|
@ -16,6 +16,7 @@ const stateStore = useStateStore();
|
|||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="EntryList"
|
||||
url="Entries/filter"
|
||||
:label="t('Search entries')"
|
||||
:info="t('You can search by entry reference')"
|
||||
/>
|
||||
|
|
|
@ -111,26 +111,19 @@ const showEntryReport = () => {
|
|||
<QItem v-ripple clickable @click="showEntryReport(entity)">
|
||||
<QItemSection>{{ t('Show entry report') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>
|
||||
<RouterLink :to="{ name: 'EntryList' }" class="color-vn-text">
|
||||
{{ t('Go to module index') }}
|
||||
</RouterLink>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv
|
||||
:label="t('entry.descriptor.agency')"
|
||||
:value="entity.travel.agency.name"
|
||||
:value="entity.travel?.agency?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.descriptor.landed')"
|
||||
:value="toDate(entity.travel.landed)"
|
||||
:value="toDate(entity.travel?.landed)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('entry.descriptor.warehouseOut')"
|
||||
:value="entity.travel.warehouseOut.name"
|
||||
:value="entity.travel?.warehouseOut?.name"
|
||||
/>
|
||||
</template>
|
||||
<template #icons="{ entity }">
|
||||
|
|
|
@ -15,6 +15,12 @@ const { t } = useI18n();
|
|||
const entryObservationsRef = ref(null);
|
||||
const entryObservationsOptions = ref([]);
|
||||
|
||||
const sortEntryObservationOptions = (data) => {
|
||||
entryObservationsOptions.value = [...data].sort((a, b) =>
|
||||
a.description.localeCompare(b.description)
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (entryObservationsRef.value) entryObservationsRef.value.reload();
|
||||
});
|
||||
|
@ -22,7 +28,7 @@ onMounted(() => {
|
|||
<template>
|
||||
<FetchData
|
||||
url="ObservationTypes"
|
||||
@on-fetch="(data) => (entryObservationsOptions = data)"
|
||||
@on-fetch="(data) => sortEntryObservationOptions(data)"
|
||||
auto-load
|
||||
/>
|
||||
<CrudModel
|
||||
|
@ -37,7 +43,7 @@ onMounted(() => {
|
|||
:default-remove="false"
|
||||
:data-required="{ entryFk: route.params.id }"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<template #body="{ rows, validate }">
|
||||
<QCard class="q-pa-md">
|
||||
<VnRow
|
||||
v-for="(row, index) in rows"
|
||||
|
@ -49,6 +55,7 @@ onMounted(() => {
|
|||
:label="t('entry.notes.observationType')"
|
||||
v-model="row.observationTypeFk"
|
||||
:options="entryObservationsOptions"
|
||||
:disable="!!row.id"
|
||||
option-label="description"
|
||||
option-value="id"
|
||||
hide-selected
|
||||
|
@ -58,6 +65,7 @@ onMounted(() => {
|
|||
<VnInput
|
||||
:label="t('entry.notes.description')"
|
||||
v-model="row.description"
|
||||
:rules="validate('EntryObservation.description')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-1 row justify-center items-center">
|
||||
|
|
|
@ -1,28 +1,38 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const state = useState();
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const user = state.getUser();
|
||||
const newEntryForm = reactive({
|
||||
supplierFk: null,
|
||||
travelFk: route.query?.travelFk || null,
|
||||
companyFk: null,
|
||||
companyFk: user.value.companyFk || null,
|
||||
});
|
||||
|
||||
const suppliersOptions = ref([]);
|
||||
const travelsOptionsOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
|
||||
const redirectToEntryBasicData = (_, { id }) => {
|
||||
router.push({ name: 'EntryBasicData', params: { id } });
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -48,14 +58,28 @@ const companiesOptions = ref([]);
|
|||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<!-- Agregar searchbar de entries -->
|
||||
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
url="Entries/filter"
|
||||
custom-route-redirect-name="EntrySummary"
|
||||
data-key="EntrySummary"
|
||||
:label="t('Search entries')"
|
||||
:info="t('You can search by entry reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QPage>
|
||||
<VnSubToolbar />
|
||||
<FormModel url-create="Entries" model="entry" :form-initial-data="newEntryForm">
|
||||
<FormModel
|
||||
url-create="Entries"
|
||||
model="entry"
|
||||
:form-initial-data="newEntryForm"
|
||||
@on-data-saved="redirectToEntryBasicData"
|
||||
>
|
||||
<template #form="{ data, validate }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Supplier')"
|
||||
class="full-width"
|
||||
|
@ -78,8 +102,10 @@ const companiesOptions = ref([]);
|
|||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Travel')"
|
||||
class="full-width"
|
||||
|
@ -99,7 +125,8 @@ const companiesOptions = ref([]);
|
|||
>{{ scope.opt?.agencyModeName }} -
|
||||
{{ scope.opt?.warehouseInName }} ({{
|
||||
toDate(scope.opt?.shipped)
|
||||
}}) → {{ scope.opt?.warehouseOutName }} ({{
|
||||
}}) →
|
||||
{{ scope.opt?.warehouseOutName }} ({{
|
||||
toDate(scope.opt?.landed)
|
||||
}})</QItemLabel
|
||||
>
|
||||
|
@ -107,8 +134,10 @@ const companiesOptions = ref([]);
|
|||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Company')"
|
||||
class="full-width"
|
||||
|
@ -121,6 +150,7 @@ const companiesOptions = ref([]);
|
|||
:required="true"
|
||||
:rules="validate('entry.companyFk')"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
|
|
|
@ -53,8 +53,7 @@ const suppliersOptions = ref([]);
|
|||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||
<template #body="{ params, searchFn }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -96,6 +95,7 @@ const suppliersOptions = ref([]);
|
|||
<VnSelectFilter
|
||||
:label="t('params.companyFk')"
|
||||
v-model="params.companyFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="companiesOptions"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
|
@ -111,6 +111,7 @@ const suppliersOptions = ref([]);
|
|||
<VnSelectFilter
|
||||
:label="t('params.currencyFk')"
|
||||
v-model="params.currencyFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="currenciesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
@ -126,6 +127,7 @@ const suppliersOptions = ref([]);
|
|||
<VnSelectFilter
|
||||
:label="t('params.supplierFk')"
|
||||
v-model="params.supplierFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="suppliersOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
|
@ -150,8 +152,9 @@ const suppliersOptions = ref([]);
|
|||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.created')"
|
||||
is-outlined
|
||||
v-model="params.created"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -159,8 +162,9 @@ const suppliersOptions = ref([]);
|
|||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.from')"
|
||||
is-outlined
|
||||
v-model="params.from"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -168,8 +172,9 @@ const suppliersOptions = ref([]);
|
|||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.to')"
|
||||
is-outlined
|
||||
v-model="params.to"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -198,20 +203,10 @@ const suppliersOptions = ref([]);
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -0,0 +1,348 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import EntryDescriptorProxy from './Card/EntryDescriptorProxy.vue';
|
||||
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
|
||||
import EditTableCellValueForm from 'src/components/EditTableCellValueForm.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate, toCurrency } from 'src/filters';
|
||||
import { useSession } from 'composables/useSession';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
const router = useRouter();
|
||||
const session = useSession();
|
||||
const token = session.getToken();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
|
||||
const rowsFetchDataRef = ref(null);
|
||||
const editTableCellDialogRef = ref(null);
|
||||
const visibleColumns = ref([]);
|
||||
const allColumnNames = ref([]);
|
||||
const rows = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: t('entry.latestBuys.picture'),
|
||||
name: 'picture',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.itemFk'),
|
||||
name: 'itemFk',
|
||||
field: 'itemFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.packing'),
|
||||
field: 'packing',
|
||||
name: 'packing',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.grouping'),
|
||||
field: 'grouping',
|
||||
name: 'grouping',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.quantity'),
|
||||
field: 'quantity',
|
||||
name: 'quantity',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.description'),
|
||||
field: 'description',
|
||||
name: 'description',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.size'),
|
||||
field: 'size',
|
||||
name: 'size',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.tags'),
|
||||
name: 'tags',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.type'),
|
||||
field: 'code',
|
||||
name: 'type',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.intrastat'),
|
||||
field: 'intrastat',
|
||||
name: 'intrastat',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.origin'),
|
||||
field: 'origin',
|
||||
name: 'origin',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.weightByPiece'),
|
||||
field: 'weightByPiece',
|
||||
name: 'weightByPiece',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.isActive'),
|
||||
field: 'isActive',
|
||||
name: 'isActive',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.family'),
|
||||
field: 'family',
|
||||
name: 'family',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.entryFk'),
|
||||
field: 'entryFk',
|
||||
name: 'entryFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.buyingValue'),
|
||||
field: 'buyingValue',
|
||||
name: 'buyingValue',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.freightValue'),
|
||||
field: 'freightValue',
|
||||
name: 'freightValue',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.comissionValue'),
|
||||
field: 'comissionValue',
|
||||
name: 'comissionValue',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.packageValue'),
|
||||
field: 'packageValue',
|
||||
name: 'packageValue',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.isIgnored'),
|
||||
field: 'isIgnored',
|
||||
name: 'isIgnored',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.price2'),
|
||||
field: 'price2',
|
||||
name: 'price2',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.price3'),
|
||||
field: 'price3',
|
||||
name: 'price3',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.minPrice'),
|
||||
field: 'minPrice',
|
||||
name: 'minPrice',
|
||||
align: 'left',
|
||||
format: (val) => toCurrency(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.ektFk'),
|
||||
field: 'ektFk',
|
||||
name: 'ektFk',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.weight'),
|
||||
field: 'weight',
|
||||
name: 'weight',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.packagingFk'),
|
||||
field: 'packagingFk',
|
||||
name: 'packagingFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.packingOut'),
|
||||
field: 'packingOut',
|
||||
name: 'packingOut',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
},
|
||||
{
|
||||
label: t('entry.latestBuys.landing'),
|
||||
field: 'landing',
|
||||
name: 'landing',
|
||||
align: 'left',
|
||||
format: (val) => toDate(val),
|
||||
},
|
||||
]);
|
||||
|
||||
const editTableCellFormFieldsOptions = [
|
||||
{ field: 'packing', label: t('entry.latestBuys.packing') },
|
||||
{ field: 'grouping', label: t('entry.latestBuys.grouping') },
|
||||
{ field: 'packageValue', label: t('entry.latestBuys.packageValue') },
|
||||
{ field: 'weight', label: t('entry.latestBuys.weight') },
|
||||
{ field: 'description', label: t('entry.latestBuys.description') },
|
||||
{ field: 'size', label: t('entry.latestBuys.size') },
|
||||
{ field: 'weightByPiece', label: t('entry.latestBuys.weightByPiece') },
|
||||
{ field: 'packingOut', label: t('entry.latestBuys.packingOut') },
|
||||
{ field: 'landing', label: t('entry.latestBuys.landing') },
|
||||
];
|
||||
|
||||
const openEditTableCellDialog = () => {
|
||||
editTableCellDialogRef.value.show();
|
||||
};
|
||||
|
||||
const onEditCellDataSaved = async () => {
|
||||
rowsSelected.value = [];
|
||||
await rowsFetchDataRef.value.fetch();
|
||||
};
|
||||
|
||||
const redirectToEntryBuys = (entryFk) => {
|
||||
router.push({ name: 'EntryBuys', params: { id: entryFk } });
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
const filteredColumns = columns.value.filter((col) => col.name !== 'picture');
|
||||
allColumnNames.value = filteredColumns.map((col) => col.name);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="rowsFetchDataRef"
|
||||
url="Buys/latestBuysFilter"
|
||||
:filter="{ order: 'itemFk DESC', limit: 20 }"
|
||||
@on-fetch="(data) => (rows = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data">
|
||||
<TableVisibleColumns
|
||||
:all-columns="allColumnNames"
|
||||
table-code="latestBuys"
|
||||
labels-traductions-path="entry.latestBuys"
|
||||
@on-config-saved="visibleColumns = ['picture', ...$event]"
|
||||
/>
|
||||
</div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
hide-bottom
|
||||
selection="multiple"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:visible-columns="visibleColumns"
|
||||
v-model:selected="rowsSelected"
|
||||
@row-click="(_, row) => redirectToEntryBuys(row.entryFk)"
|
||||
>
|
||||
<template #body-cell-picture="{ row }">
|
||||
<QTd>
|
||||
<QImg
|
||||
:src="`/api/Images/catalog/50x50/${row.itemFk}/download?access_token=${token}`"
|
||||
spinner-color="primary"
|
||||
:ratio="1"
|
||||
height="50px"
|
||||
width="50px"
|
||||
class="image"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-itemFk="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="blue">
|
||||
{{ row.itemFk }}
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-tags="{ row }">
|
||||
<QTd>
|
||||
<fetched-tags :item="row" :max-length="6" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-entryFk="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="blue">
|
||||
<EntryDescriptorProxy :id="row.entryFk" />
|
||||
{{ row.entryFk }}
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-isIgnored="{ row }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
:name="row.isIgnored ? `check` : `close`"
|
||||
:color="row.isIgnored ? `positive` : `negative`"
|
||||
size="sm"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-isActive="{ row }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
:name="row.isActive ? `check` : `close`"
|
||||
:color="row.isActive ? `positive` : `negative`"
|
||||
size="sm"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<QPageSticky v-if="rowsSelected.length > 0" :offset="[20, 20]">
|
||||
<QBtn @click="openEditTableCellDialog()" color="primary" fab icon="edit" />
|
||||
<QTooltip>
|
||||
{{ t('Edit buy(s)') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
<QDialog ref="editTableCellDialogRef">
|
||||
<EditTableCellValueForm
|
||||
edit-url="Buys/editLatestBuys"
|
||||
:rows="rowsSelected"
|
||||
:fields-options="editTableCellFormFieldsOptions"
|
||||
@on-data-saved="onEditCellDataSaved()"
|
||||
/>
|
||||
</QDialog>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Edit buy(s): Editar compra(s)
|
||||
</i18n>
|
|
@ -9,6 +9,7 @@ import VnLv from 'src/components/ui/VnLv.vue';
|
|||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import EntrySummaryDialog from './Card/EntrySummaryDialog.vue';
|
||||
import EntryFilter from './EntryFilter.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate } from 'src/filters/index';
|
||||
|
@ -41,17 +42,27 @@ onMounted(async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="EntryList"
|
||||
url="Entries/filter"
|
||||
:label="t('Search entries')"
|
||||
:info="t('You can search by entry reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<EntryFilter data-key="EntryList" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
data-key="EntryList"
|
||||
url="Entries/filter"
|
||||
order="landed DESC, id DESC"
|
||||
:order="['landed DESC', 'id DESC']"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
|
@ -128,17 +139,10 @@ onMounted(async () => {
|
|||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search entries: Buscar entradas
|
||||
You can search by entry reference: Puedes buscar por referencia de la entrada
|
||||
Inventory entry: Es inventario
|
||||
Virtual entry: Es una redada
|
||||
Search entries: Buscar entradas
|
||||
You can search by entry reference: Puedes buscar por referencia de la entrada
|
||||
</i18n>
|
||||
|
|
|
@ -1,24 +1,12 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import LeftMenu from 'src/components/LeftMenu.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="EntryList"
|
||||
:label="t('Search entries')"
|
||||
:info="t('You can search by entry reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<LeftMenu />
|
||||
|
@ -28,9 +16,3 @@ const stateStore = useStateStore();
|
|||
<RouterView></RouterView>
|
||||
</QPageContainer>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search entries: Buscar entradas
|
||||
You can search by entry reference: Puedes buscar por referencia de la entrada
|
||||
</i18n>
|
||||
|
|
|
@ -4,11 +4,12 @@ import { useRoute } from 'vue-router';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
const quasar = useQuasar();
|
||||
|
@ -21,9 +22,6 @@ const arrayData = useArrayData('InvoiceIn');
|
|||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
const userConfig = ref(null);
|
||||
|
||||
const suppliers = ref([]);
|
||||
const suppliersRef = ref();
|
||||
const suppliersRefFilter = ref({ fields: ['id', 'nickname'], limit: 30 });
|
||||
const currencies = ref([]);
|
||||
const currenciesRef = 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>
|
||||
<template>
|
||||
<FetchData
|
||||
ref="suppliersRef"
|
||||
url="Suppliers"
|
||||
@on-fetch="(data) => (suppliers = data)"
|
||||
/>
|
||||
<FetchData
|
||||
ref="currenciesRef"
|
||||
url="Currencies"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
order="code"
|
||||
sort-by="code"
|
||||
@on-fetch="(data) => (currencies = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
@ -163,7 +143,7 @@ function supplierRefFilter(val) {
|
|||
ref="companiesRef"
|
||||
url="Companies"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
order="code"
|
||||
sort-by="code"
|
||||
@on-fetch="(data) => (companies = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
@ -171,7 +151,7 @@ function supplierRefFilter(val) {
|
|||
ref="dmsTypesRef"
|
||||
url="DmsTypes"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
order="name"
|
||||
sort-by="name"
|
||||
@on-fetch="(data) => (dmsTypes = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
@ -179,7 +159,7 @@ function supplierRefFilter(val) {
|
|||
ref="warehousesRef"
|
||||
url="Warehouses"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
order="name"
|
||||
sort-by="name"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
@ -199,15 +179,13 @@ function supplierRefFilter(val) {
|
|||
<div class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
v-if="suppliersRef"
|
||||
:label="t('supplierFk')"
|
||||
v-model="data.supplierFk"
|
||||
:options="suppliers"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
:input-debounce="100"
|
||||
@input-value="supplierRefFilter"
|
||||
:default-filter="false"
|
||||
url="Suppliers"
|
||||
:fields="['id', 'nickname']"
|
||||
sort-by="nickname"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -418,7 +396,6 @@ function supplierRefFilter(val) {
|
|||
<div class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
v-if="currenciesRef"
|
||||
:label="t('Currency')"
|
||||
v-model="data.currencyFk"
|
||||
:options="currencies"
|
||||
|
|
|
@ -36,7 +36,6 @@ const suppliersRef = ref();
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense class="list q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -186,11 +185,7 @@ const suppliersRef = ref();
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('To')"
|
||||
v-model="params.to"
|
||||
is-outlined
|
||||
/>
|
||||
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -203,20 +198,10 @@ const suppliersRef = ref();
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list {
|
||||
width: 256px;
|
||||
}
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -71,12 +71,11 @@ function viewSummary(id) {
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
data-key="InvoiceInList"
|
||||
url="InvoiceIns/filter"
|
||||
order="issued DESC, id DESC"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
|
@ -157,13 +156,6 @@ function viewSummary(id) {
|
|||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search invoice: Buscar factura emitida
|
||||
|
|
|
@ -41,7 +41,6 @@ function setWorkers(data) {
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense class="q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -58,11 +57,7 @@ function setWorkers(data) {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('Amount')"
|
||||
v-model="params.amount"
|
||||
is-outlined
|
||||
/>
|
||||
<VnInput :label="t('Amount')" v-model="params.amount" is-outlined />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
@ -129,7 +124,6 @@ function setWorkers(data) {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
|
@ -11,6 +11,7 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|||
import InvoiceOutFilter from './InvoiceOutFilter.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const selectedCards = ref(new Map());
|
||||
|
@ -129,8 +130,8 @@ const downloadCsv = () => {
|
|||
url="InvoiceOuts/filter"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-actions">
|
||||
<VnSubToolbar class="bg-vn-dark justify-end">
|
||||
<template #st-actions>
|
||||
<QBtn
|
||||
@click="downloadCsv()"
|
||||
class="q-mr-xl"
|
||||
|
@ -178,10 +179,10 @@ const downloadCsv = () => {
|
|||
:model-value="selectedCards.size === rows.length"
|
||||
class="q-mr-md"
|
||||
/>
|
||||
</div>
|
||||
</QToolbar>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<div class="flex flex-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<CardList
|
||||
:element="row"
|
||||
:id="row.id"
|
||||
|
@ -246,13 +247,6 @@ const downloadCsv = () => {
|
|||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
searchInvoice: Search issued invoice
|
||||
|
|
|
@ -27,7 +27,6 @@ const props = defineProps({
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense class="q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
|
@ -101,13 +100,10 @@ const props = defineProps({
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -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>
|
|
@ -219,7 +219,6 @@ const getCategoryClass = (category, params) => {
|
|||
</template>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense style="max-width: 256px">
|
||||
<QItem class="category-filter q-mt-md">
|
||||
<div
|
||||
v-for="category in categoryList"
|
||||
|
@ -395,7 +394,6 @@ const getCategoryClass = (category, params) => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
<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 { 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;
|
||||
|
||||
|
@ -42,7 +45,10 @@ const dialog = ref(null);
|
|||
</div>
|
||||
</div>
|
||||
<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>
|
||||
<template v-for="index in 4" :key="`tag-${index}`">
|
||||
<VnLv
|
||||
|
@ -51,13 +57,6 @@ const dialog = ref(null);
|
|||
:value="item?.[`value${index + 4}`]"
|
||||
/>
|
||||
</template>
|
||||
<QRating
|
||||
:model-value="item.stars"
|
||||
icon="star"
|
||||
icon-selected="star"
|
||||
color="primary"
|
||||
readonly
|
||||
/>
|
||||
<div class="footer">
|
||||
<div class="price">
|
||||
<p>{{ item.available }} {{ t('to') }} {{ item.price }}</p>
|
||||
|
@ -72,7 +71,8 @@ const dialog = ref(null);
|
|||
</QIcon>
|
||||
</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -59,7 +59,6 @@ const sourceList = ref(null);
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList id="orderFilter" dense>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -202,19 +201,10 @@ const sourceList = ref(null);
|
|||
<QCheckbox v-model="params.showEmpty" :label="t('showEmpty')" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
#orderFilter {
|
||||
.q-item {
|
||||
padding-top: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useRoute } from 'vue-router';
|
||||
import {onMounted, onUnmounted, ref} from 'vue';
|
||||
import { onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
|
@ -20,7 +20,7 @@ const catalogParams = {
|
|||
orderBy: JSON.stringify({ field: 'relevancy DESC, name', way: 'ASC', isTag: false }),
|
||||
};
|
||||
|
||||
const tags = ref([])
|
||||
const tags = ref([]);
|
||||
|
||||
function extractTags(items) {
|
||||
const resultTags = [];
|
||||
|
@ -34,7 +34,7 @@ function extractTags(items) {
|
|||
}
|
||||
});
|
||||
});
|
||||
tags.value = resultTags
|
||||
tags.value = resultTags;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -70,7 +70,7 @@ function extractTags(items) {
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="full-width">
|
||||
<VnPaginate
|
||||
data-key="OrderCatalogList"
|
||||
url="Orders/CatalogFilter"
|
||||
|
@ -93,10 +93,6 @@ function extractTags(items) {
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.catalog-list {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
|
|
|
@ -83,7 +83,7 @@ async function confirmOrder() {
|
|||
auto-load
|
||||
/>
|
||||
<QPage :key="componentKey" class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<div v-if="!orderSummary.total" class="no-result">
|
||||
{{ t('globals.noResults') }}
|
||||
</div>
|
||||
|
@ -228,11 +228,6 @@ async function confirmOrder() {
|
|||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
|
||||
.header {
|
||||
color: $primary;
|
||||
font-weight: bold;
|
||||
|
|
|
@ -4,7 +4,7 @@ import { onMounted, onUnmounted } from 'vue';
|
|||
import { useRouter } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
import {useQuasar} from "quasar";
|
||||
import { useQuasar } from 'quasar';
|
||||
import CardList from 'components/ui/CardList.vue';
|
||||
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
|
@ -12,7 +12,7 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
|
|||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import OrderSearchbar from 'pages/Order/Card/OrderSearchbar.vue';
|
||||
import OrderFilter from 'pages/Order/Card/OrderFilter.vue';
|
||||
import OrderSummaryDialog from "pages/Order/Card/OrderSummaryDialog.vue";
|
||||
import OrderSummaryDialog from 'pages/Order/Card/OrderSummaryDialog.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const quasar = useQuasar();
|
||||
|
@ -63,7 +63,7 @@ function viewSummary(id) {
|
|||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
data-key="OrderList"
|
||||
url="Orders/filter"
|
||||
|
@ -153,10 +153,3 @@ function viewSummary(id) {
|
|||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -35,7 +35,7 @@ const loadVolumes = async (rows) => {
|
|||
auto-load
|
||||
/>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<div class="vn-card-list">
|
||||
<div
|
||||
v-if="!volumeSummary?.totalVolume && !volumeSummary?.totalBoxes"
|
||||
class="no-result"
|
||||
|
@ -121,11 +121,6 @@ const loadVolumes = async (rows) => {
|
|||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
|
||||
.header {
|
||||
color: $primary;
|
||||
font-weight: bold;
|
||||
|
|
|
@ -61,7 +61,6 @@ const warehouseList = ref([]);
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense>
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection v-if="workerList">
|
||||
<VnSelectFilter
|
||||
|
@ -198,7 +197,6 @@ const warehouseList = ref([]);
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
|
@ -198,6 +198,13 @@ const onSave = (data, response) => {
|
|||
clearable
|
||||
/>
|
||||
</div>
|
||||
<div class="col flex items-center">
|
||||
<QCheckbox
|
||||
size="sm"
|
||||
v-model="data.isOk"
|
||||
:label="t('Is served')"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
@ -212,3 +219,15 @@ const onSave = (data, response) => {
|
|||
</template>
|
||||
</FormModel>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Worker: Trabajador
|
||||
Vehicle: Vehículo
|
||||
Agency: Agencia
|
||||
Km Start: Km de inicio
|
||||
Km End: Km de fin
|
||||
Hour started: Hora inicio
|
||||
Hour finished: Hora fin
|
||||
Description: Descripción
|
||||
Is served: Se ha servido
|
||||
</i18n>
|
||||
|
|
|
@ -28,7 +28,6 @@ const countries = ref();
|
|||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense class="q-gutter-y-sm q-mt-sm">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
|
@ -124,7 +123,6 @@ const countries = ref();
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue