Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into test
This commit is contained in:
commit
f5cf47b60d
|
@ -8,7 +8,7 @@ module.exports = defineConfig({
|
|||
supportFile: 'test/cypress/support/index.js',
|
||||
videosFolder: 'test/cypress/videos',
|
||||
video: false,
|
||||
specPattern: 'test/cypress/integration/*.spec.js',
|
||||
specPattern: 'test/cypress/integration/**/*.spec.js',
|
||||
experimentalRunAllSpecs: true,
|
||||
component: {
|
||||
componentFolder: 'src',
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "23.40.01",
|
||||
"version": "23.52.01",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "salix-front",
|
||||
"version": "0.0.1",
|
||||
"version": "23.52.01",
|
||||
"dependencies": {
|
||||
"@quasar/cli": "^2.2.1",
|
||||
"@quasar/cli": "^2.3.0",
|
||||
"@quasar/extras": "^1.16.4",
|
||||
"axios": "^1.4.0",
|
||||
"chromium": "^3.0.3",
|
||||
|
@ -946,9 +946,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@quasar/cli": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@quasar/cli/-/cli-2.2.1.tgz",
|
||||
"integrity": "sha512-PMwJ76IeeNRRBw+08hUMjhqGC6JKJ/t1zIb+IOiyR5D4rkBR26Ha/Z46OD3KfwUprq4Q8s4ieB1+d3VY8FhPKg==",
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@quasar/cli/-/cli-2.3.0.tgz",
|
||||
"integrity": "sha512-DNFDemicj3jXe5+Ib+5w9Bwj1U3yoHQkqn0bU/qysIl/p0MmGA1yqOfUF0V4fw/5or1dfCvStIA/oZxUcC+2pQ==",
|
||||
"dependencies": {
|
||||
"@quasar/ssl-certificate": "^1.0.0",
|
||||
"ci-info": "^3.8.0",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"lint": "eslint --ext .js,.vue ./",
|
||||
"format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore",
|
||||
"test:e2e": "cypress open",
|
||||
"test:e2e:ci": "cd ../salix && gulp docker && cd ../salix-front && cypress run --browser chromium",
|
||||
"test:e2e:ci": "cd ../salix && gulp docker && cd ../salix-front && cypress run",
|
||||
"test": "echo \"See package.json => scripts for available tests.\" && exit 0",
|
||||
"test:unit": "vitest",
|
||||
"test:unit:ci": "vitest run"
|
||||
|
|
|
@ -29,7 +29,7 @@ module.exports = configure(function (/* ctx */) {
|
|||
// app boot file (/src/boot)
|
||||
// --> boot files are part of "main.js"
|
||||
// https://v2.quasar.dev/quasar-cli/boot-files
|
||||
boot: ['i18n', 'axios', 'vnDate'],
|
||||
boot: ['i18n', 'axios', 'vnDate', 'validations'],
|
||||
|
||||
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
|
||||
css: ['app.scss'],
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
import { boot } from 'quasar/wrappers';
|
||||
import { useValidationsStore } from 'src/stores/useValidationsStore';
|
||||
|
||||
export default boot(async ({ store }) => {
|
||||
await useValidationsStore(store).fetchModels();
|
||||
});
|
|
@ -15,4 +15,14 @@ export default boot(() => {
|
|||
Date.vnNow = () => {
|
||||
return new Date(Date.vnUTC()).getTime();
|
||||
};
|
||||
|
||||
Date.vnFirstDayOfMonth = () => {
|
||||
const date = new Date(Date.vnUTC());
|
||||
return new Date(date.getFullYear(), date.getMonth(), 1);
|
||||
};
|
||||
|
||||
Date.vnLastDayOfMonth = () => {
|
||||
const date = new Date(Date.vnUTC());
|
||||
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
||||
};
|
||||
});
|
||||
|
|
|
@ -136,6 +136,10 @@ async function saveChanges(data) {
|
|||
hasChanges.value = false;
|
||||
isLoading.value = false;
|
||||
emit('saveChanges', data);
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('globals.dataSaved'),
|
||||
});
|
||||
}
|
||||
|
||||
async function insert() {
|
||||
|
|
|
@ -46,7 +46,7 @@ async function fetch() {
|
|||
if ($props.limit) filter.limit = $props.limit;
|
||||
|
||||
const { data } = await axios.get($props.url, {
|
||||
params: { filter },
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
|
||||
emit('onFetch', data);
|
||||
|
|
|
@ -6,6 +6,7 @@ import { useQuasar } from 'quasar';
|
|||
import { useState } from 'src/composables/useState';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import SkeletonForm from 'components/ui/SkeletonForm.vue';
|
||||
|
||||
const quasar = useQuasar();
|
||||
|
@ -13,6 +14,7 @@ const state = useState();
|
|||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { validate } = useValidator();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const $props = defineProps({
|
||||
url: {
|
||||
|
@ -31,10 +33,28 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: null,
|
||||
},
|
||||
urlCreate: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
defaultActions: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
autoLoad: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
formInitialData: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
observeFormChanges: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
description:
|
||||
'Esto se usa principalmente para permitir guardar sin hacer cambios (Útil para la feature de clonar ya que en este caso queremos poder guardar de primeras)',
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
@ -43,44 +63,73 @@ defineExpose({
|
|||
save,
|
||||
});
|
||||
|
||||
onMounted(async () => await fetch());
|
||||
onMounted(async () => {
|
||||
// Podemos enviarle al form la estructura de data inicial sin necesidad de fetchearla
|
||||
if ($props.formInitialData && !$props.autoLoad) {
|
||||
state.set($props.model, $props.formInitialData);
|
||||
} else {
|
||||
await fetch();
|
||||
}
|
||||
|
||||
// Disparamos el watcher del form después de que se haya cargado la data inicial, si así se desea
|
||||
if ($props.observeFormChanges) {
|
||||
startFormWatcher();
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
state.unset($props.model);
|
||||
});
|
||||
|
||||
const isLoading = ref(false);
|
||||
const hasChanges = ref(false);
|
||||
const originalData = ref();
|
||||
// Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas
|
||||
const hasChanges = ref(!$props.observeFormChanges);
|
||||
const originalData = ref({...$props.formInitialData});
|
||||
const formData = computed(() => state.get($props.model));
|
||||
const formUrl = computed(() => $props.url);
|
||||
|
||||
const startFormWatcher = () => {
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
if (val) hasChanges.value = true;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
};
|
||||
|
||||
function tMobile(...args) {
|
||||
if (!quasar.platform.is.mobile) return t(...args);
|
||||
}
|
||||
|
||||
async function fetch() {
|
||||
const { data } = await axios.get($props.url, {
|
||||
params: { filter: $props.filter },
|
||||
params: { filter: JSON.stringify($props.filter) },
|
||||
});
|
||||
|
||||
state.set($props.model, data);
|
||||
originalData.value = data && JSON.parse(JSON.stringify(data));
|
||||
|
||||
watch(formData.value, () => (hasChanges.value = true));
|
||||
|
||||
emit('onFetch', state.get($props.model));
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (!hasChanges.value) {
|
||||
return quasar.notify({
|
||||
type: 'negative',
|
||||
message: t('globals.noChanges'),
|
||||
});
|
||||
notify('globals.noChanges', 'negative');
|
||||
return;
|
||||
}
|
||||
isLoading.value = true;
|
||||
await axios.patch($props.urlUpdate || $props.url, formData.value);
|
||||
|
||||
try {
|
||||
if ($props.urlCreate) {
|
||||
await axios.post($props.urlCreate, formData.value);
|
||||
notify('globals.dataCreated', 'positive');
|
||||
} else {
|
||||
await axios.patch($props.urlUpdate || $props.url, formData.value);
|
||||
}
|
||||
} catch (err) {
|
||||
notify('errors.create', 'negative');
|
||||
}
|
||||
|
||||
originalData.value = JSON.parse(JSON.stringify(formData.value));
|
||||
hasChanges.value = false;
|
||||
|
@ -91,11 +140,12 @@ function reset() {
|
|||
state.set($props.model, originalData.value);
|
||||
originalData.value = JSON.parse(JSON.stringify(originalData.value));
|
||||
|
||||
watch(formData.value, () => (hasChanges.value = true));
|
||||
|
||||
emit('onFetch', state.get($props.model));
|
||||
hasChanges.value = false;
|
||||
if ($props.observeFormChanges) {
|
||||
hasChanges.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line vue/no-dupe-keys
|
||||
function filter(value, update, filterOptions) {
|
||||
update(
|
||||
|
@ -118,7 +168,7 @@ watch(formUrl, async () => {
|
|||
});
|
||||
</script>
|
||||
<template>
|
||||
<QBanner v-if="hasChanges" class="text-white bg-warning">
|
||||
<QBanner v-if="$props.observeFormChanges && hasChanges" class="text-white bg-warning">
|
||||
<QIcon name="warning" size="md" class="q-mr-md" />
|
||||
<span>{{ t('globals.changesToSave') }}</span>
|
||||
</QBanner>
|
||||
|
@ -176,6 +226,7 @@ watch(formUrl, async () => {
|
|||
max-width: 800px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.q-card {
|
||||
padding: 32px;
|
||||
}
|
||||
|
|
|
@ -24,12 +24,13 @@ const address = ref(props.data.address);
|
|||
const isLoading = ref(false);
|
||||
|
||||
async function confirm() {
|
||||
const response = { address };
|
||||
|
||||
const response = { address: address.value };
|
||||
if (props.promise) {
|
||||
isLoading.value = true;
|
||||
const { address: _address, ...restData } = props.data;
|
||||
|
||||
try {
|
||||
Object.assign(response, props.data);
|
||||
Object.assign(response, restData);
|
||||
await props.promise(response);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { QInput } from 'quasar';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'accountShortToStandard']);
|
||||
|
||||
let internalValue = ref(props.modelValue);
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
internalValue.value = newVal;
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => internalValue.value,
|
||||
(newVal) => {
|
||||
emit('update:modelValue', newVal);
|
||||
accountShortToStandard();
|
||||
}
|
||||
);
|
||||
|
||||
function accountShortToStandard() {
|
||||
internalValue.value = internalValue.value.replace(
|
||||
'.',
|
||||
'0'.repeat(11 - internalValue.value.length)
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-input v-model="internalValue" />
|
||||
</template>
|
|
@ -0,0 +1,76 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
readonly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
}
|
||||
});
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const value = computed({
|
||||
get() {
|
||||
return props.modelValue;
|
||||
},
|
||||
set(value) {
|
||||
emit('update:modelValue', value ? new Date(value).toISOString() : null);
|
||||
},
|
||||
});
|
||||
|
||||
const isPopupOpen = ref(false);
|
||||
|
||||
const onDateUpdate = (date) => {
|
||||
value.value = date;
|
||||
isPopupOpen.value = false;
|
||||
};
|
||||
|
||||
const padDate = (value) => value.toString().padStart(2, '0');
|
||||
const formatDate = (dateString) => {
|
||||
const date = new Date(dateString || '');
|
||||
return `${date.getFullYear()}/${padDate(date.getMonth() + 1)}/${padDate(
|
||||
date.getDate()
|
||||
)}`;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QInput
|
||||
class="vn-input-date"
|
||||
rounded
|
||||
readonly
|
||||
:model-value="toDate(value)"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
v-model="isPopupOpen"
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
:no-parent-event="props.readonly"
|
||||
>
|
||||
<QDate
|
||||
:model-value="formatDate(value)"
|
||||
@update:model-value="onDateUpdate"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
.vn-input-date.q-field--outlined.q-field--readonly .q-field__control:before {
|
||||
border-style: solid;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,88 @@
|
|||
<script setup>
|
||||
import { watch } from 'vue';
|
||||
import { toDateString } from 'src/filters';
|
||||
|
||||
const props = defineProps({
|
||||
value: { type: [String, Number, Boolean, Object], default: undefined },
|
||||
});
|
||||
|
||||
const maxStrLen = 512;
|
||||
let t = '';
|
||||
let cssClass = '';
|
||||
let type;
|
||||
const updateValue = () => {
|
||||
type = typeof props.value;
|
||||
|
||||
if (props.value == null) {
|
||||
t = '∅';
|
||||
cssClass = 'json-null';
|
||||
} else {
|
||||
cssClass = `json-${type}`;
|
||||
switch (type) {
|
||||
case 'number':
|
||||
if (Number.isInteger(props.value)) {
|
||||
t = props.value.toString();
|
||||
} else {
|
||||
t = (
|
||||
Math.round((props.value + Number.EPSILON) * 1000) / 1000
|
||||
).toString();
|
||||
}
|
||||
break;
|
||||
case 'boolean':
|
||||
t = props.value ? '✓' : '✗';
|
||||
cssClass = `json-${props.value ? 'true' : 'false'}`;
|
||||
break;
|
||||
case 'string':
|
||||
t =
|
||||
props.value.length <= maxStrLen
|
||||
? props.value
|
||||
: props.value.substring(0, maxStrLen) + '...';
|
||||
break;
|
||||
case 'object':
|
||||
if (props.value instanceof Date) {
|
||||
t = toDateString(props.value);
|
||||
} else {
|
||||
t = props.value.toString();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
t = props.value.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
watch(() => props.value, updateValue);
|
||||
|
||||
updateValue();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
:title="type === 'string' && props.value.length > maxStrLen ? props.value : ''"
|
||||
:class="{ [cssClass]: t !== '' }"
|
||||
>
|
||||
{{ t }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.json-string {
|
||||
color: #d172cc;
|
||||
}
|
||||
.json-object {
|
||||
color: #d1a572;
|
||||
}
|
||||
.json-number {
|
||||
color: #85d0ff;
|
||||
}
|
||||
.json-true {
|
||||
color: #7dc489;
|
||||
}
|
||||
.json-false {
|
||||
color: #c74949;
|
||||
}
|
||||
.json-null {
|
||||
color: #cd7c7c;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -15,6 +15,10 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
filterOptions: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
isClearable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
@ -32,18 +36,22 @@ function setOptions(data) {
|
|||
setOptions(options.value);
|
||||
|
||||
const filter = (val, options) => {
|
||||
const search = val.toLowerCase();
|
||||
const search = val.toString().toLowerCase();
|
||||
|
||||
if (val === '') return options;
|
||||
if (!search) return options;
|
||||
|
||||
return options.filter((row) => {
|
||||
if ($props.filterOptions.length) {
|
||||
return $props.filterOptions.some((prop) => {
|
||||
const propValue = String(row[prop]).toLowerCase();
|
||||
return propValue.includes(search);
|
||||
});
|
||||
}
|
||||
|
||||
const id = row.id;
|
||||
const name = row[$props.optionLabel].toLowerCase();
|
||||
const optionLabel = String(row[$props.optionLabel]).toLowerCase();
|
||||
|
||||
const idMatches = id == search;
|
||||
const nameMatches = name.indexOf(search) > -1;
|
||||
|
||||
return idMatches || nameMatches;
|
||||
return id == search || optionLabel.includes(search);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -85,14 +93,20 @@ const value = computed({
|
|||
map-options
|
||||
use-input
|
||||
@filter="filterHandler"
|
||||
hide-selected
|
||||
fill-input
|
||||
ref="vnSelectRef"
|
||||
>
|
||||
<template v-if="isClearable" #append>
|
||||
<QIcon name="close" @click.stop="value = null" class="cursor-pointer" />
|
||||
<QIcon
|
||||
name="close"
|
||||
@click.stop="value = null"
|
||||
class="cursor-pointer"
|
||||
size="18px"
|
||||
/>
|
||||
</template>
|
||||
<template v-for="(_, slotName) in $slots" #[slotName]="slotData">
|
||||
<slot :name="slotName" v-bind="slotData" />
|
||||
<slot :name="slotName" v-bind="slotData ?? {}" />
|
||||
</template>
|
||||
</QSelect>
|
||||
</template>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { onMounted, useSlots, ref, watch, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
|
@ -30,11 +31,19 @@ const $props = defineProps({
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
summary: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const quasar = useQuasar();
|
||||
const slots = useSlots();
|
||||
const { t } = useI18n();
|
||||
const entity = computed(() => useArrayData($props.dataKey).store.data);
|
||||
|
||||
defineExpose({
|
||||
getData,
|
||||
});
|
||||
onMounted(async () => {
|
||||
await getData();
|
||||
watch(
|
||||
|
@ -54,54 +63,63 @@ async function getData() {
|
|||
skip: 0,
|
||||
});
|
||||
const { data } = await arrayData.fetch({ append: false });
|
||||
entity.value = data;
|
||||
emit('onFetch', data);
|
||||
}
|
||||
const emit = defineEmits(['onFetch']);
|
||||
|
||||
function viewSummary(id) {
|
||||
quasar.dialog({
|
||||
component: $props.summary,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="descriptor">
|
||||
<template v-if="entity">
|
||||
<div class="header bg-primary q-pa-sm">
|
||||
<RouterLink :to="{ name: `${module}List` }">
|
||||
<QBtn
|
||||
round
|
||||
flat
|
||||
dense
|
||||
size="md"
|
||||
icon="view_list"
|
||||
color="white"
|
||||
class="link"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.mainList') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</RouterLink>
|
||||
<div class="header bg-primary q-pa-sm justify-between">
|
||||
<QBtn
|
||||
@click.stop="viewSummary(entity.id)"
|
||||
round
|
||||
flat
|
||||
dense
|
||||
size="md"
|
||||
icon="preview"
|
||||
color="white"
|
||||
class="link"
|
||||
v-if="summary"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openSummary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<RouterLink :to="{ name: `${module}Summary`, params: { id: entity.id } }">
|
||||
<QBtn
|
||||
round
|
||||
flat
|
||||
dense
|
||||
size="md"
|
||||
icon="launch"
|
||||
color="white"
|
||||
class="link"
|
||||
color="white"
|
||||
dense
|
||||
flat
|
||||
icon="launch"
|
||||
round
|
||||
size="md"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.summary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</RouterLink>
|
||||
|
||||
<QBtn
|
||||
v-if="slots.menu"
|
||||
size="md"
|
||||
icon="more_vert"
|
||||
color="white"
|
||||
round
|
||||
flat
|
||||
dense
|
||||
flat
|
||||
icon="more_vert"
|
||||
round
|
||||
size="md"
|
||||
v-if="slots.menu"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
|
@ -216,8 +234,6 @@ const emit = defineEmits(['onFetch']);
|
|||
width: 256px;
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: stretch;
|
||||
}
|
||||
.icons {
|
||||
margin: 0 10px;
|
||||
|
|
|
@ -1,66 +1,109 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
element: { type: Object, default: null },
|
||||
id: { type: Number, default: null },
|
||||
isSelected: { type: Boolean, default: false },
|
||||
title: { type: String, default: null },
|
||||
showCheckbox: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['toggleCardCheck']);
|
||||
|
||||
const toggleCardCheck = (item) => {
|
||||
emit('toggleCardCheck', item);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QCard class="card q-mb-md cursor-pointer q-hoverable bg-white-7 q-pa-lg">
|
||||
<div>
|
||||
<slot name="title">
|
||||
<div class="title text-primary text-weight-bold text-h5">
|
||||
{{ $props.title ?? `#${$props.id}` }}
|
||||
<div class="flex justify-between">
|
||||
<div class="flex items-center">
|
||||
<div class="title text-primary text-weight-bold text-h5">
|
||||
{{ $props.title }}
|
||||
</div>
|
||||
<QChip class="q-chip-color" outline size="sm">
|
||||
{{ t('ID') }}: {{ $props.id }}
|
||||
</QChip>
|
||||
</div>
|
||||
<QCheckbox
|
||||
v-if="showCheckbox"
|
||||
:model-value="isSelected"
|
||||
@click="toggleCardCheck($props.element)"
|
||||
/>
|
||||
</div>
|
||||
</slot>
|
||||
<div class="card-list-body row">
|
||||
<div class="list-items row flex-wrap-wrap q-mt-md">
|
||||
<div class="card-list-body">
|
||||
<div class="list-items row flex-wrap-wrap">
|
||||
<slot name="list-items" />
|
||||
</div>
|
||||
|
||||
<div class="actions column justify-center">
|
||||
<div class="actions">
|
||||
<slot name="actions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</QCard>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.title {
|
||||
margin-right: 25px;
|
||||
}
|
||||
|
||||
.q-chip-color {
|
||||
color: var(--vn-label);
|
||||
}
|
||||
|
||||
.card-list-body {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 10px;
|
||||
.vn-label-value {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
gap: 2%;
|
||||
width: 50%;
|
||||
.label {
|
||||
width: 30%;
|
||||
width: 35%;
|
||||
color: var(--vn-label);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.value {
|
||||
width: 60%;
|
||||
width: 65%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.actions {
|
||||
.q-btn {
|
||||
width: 30px;
|
||||
}
|
||||
.q-icon {
|
||||
color: $primary;
|
||||
font-size: 25px;
|
||||
}
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
width: 25%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
.card-list-body {
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
.vn-label-value {
|
||||
width: 100%;
|
||||
}
|
||||
.actions {
|
||||
width: 100%;
|
||||
margin-top: 15px;
|
||||
padding: 0 15%;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -73,11 +116,11 @@ const $props = defineProps({
|
|||
background-color: var(--vn-gray);
|
||||
}
|
||||
.list-items {
|
||||
width: 90%;
|
||||
}
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
.list-items {
|
||||
width: 85%;
|
||||
}
|
||||
width: 75%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
ID: ID
|
||||
</i18n>
|
||||
|
|
|
@ -27,7 +27,7 @@ defineExpose({
|
|||
async function fetch() {
|
||||
const params = {};
|
||||
|
||||
if (props.filter) params.filter = props.filter;
|
||||
if (props.filter) params.filter = JSON.stringify(props.filter);
|
||||
|
||||
const { data } = await axios.get(props.url, { params });
|
||||
entity.value = data;
|
||||
|
@ -73,6 +73,7 @@ watch(props, async () => {
|
|||
|
||||
.cardSummary {
|
||||
width: 100%;
|
||||
|
||||
.summaryHeader {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
|
@ -82,11 +83,14 @@ watch(props, async () => {
|
|||
.summaryBody {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-evenly;
|
||||
gap: 15px;
|
||||
padding: 15px;
|
||||
background-color: var(--vn-gray);
|
||||
|
||||
> .q-card.vn-one {
|
||||
width: 350px;
|
||||
flex: 1;
|
||||
}
|
||||
> .q-card.vn-two {
|
||||
|
@ -123,7 +127,6 @@ watch(props, async () => {
|
|||
width: max-content;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
.header {
|
||||
|
|
|
@ -26,7 +26,7 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['refresh', 'clear']);
|
||||
const emit = defineEmits(['refresh', 'clear', 'search']);
|
||||
|
||||
const arrayData = useArrayData(props.dataKey);
|
||||
const store = arrayData.store;
|
||||
|
@ -49,6 +49,7 @@ async function search() {
|
|||
if (!props.showAll && !Object.values(params).length) store.data = [];
|
||||
|
||||
isLoading.value = false;
|
||||
emit('search');
|
||||
}
|
||||
|
||||
async function reload() {
|
||||
|
@ -102,6 +103,7 @@ function formatValue(value) {
|
|||
return `"${value}"`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QForm @submit="search">
|
||||
<QList dense>
|
||||
|
@ -115,32 +117,32 @@ function formatValue(value) {
|
|||
<div class="q-gutter-xs">
|
||||
<QBtn
|
||||
@click="clearFilters"
|
||||
icon="filter_list_off"
|
||||
color="primary"
|
||||
size="sm"
|
||||
dense
|
||||
flat
|
||||
icon="filter_list_off"
|
||||
padding="none"
|
||||
round
|
||||
flat
|
||||
dense
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>{{ t('Remove filters') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
@click="reload"
|
||||
icon="refresh"
|
||||
color="primary"
|
||||
size="sm"
|
||||
dense
|
||||
flat
|
||||
icon="refresh"
|
||||
padding="none"
|
||||
round
|
||||
flat
|
||||
dense
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>{{ t('Refresh') }}</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<div
|
||||
v-if="tags.length === 0"
|
||||
class="text-grey font-xs text-center full-width"
|
||||
|
@ -149,14 +151,14 @@ function formatValue(value) {
|
|||
</div>
|
||||
<div>
|
||||
<QChip
|
||||
v-for="chip of tags"
|
||||
:key="chip.label"
|
||||
@remove="remove(chip.label)"
|
||||
icon="label"
|
||||
color="primary"
|
||||
class="text-dark"
|
||||
size="sm"
|
||||
color="primary"
|
||||
icon="label"
|
||||
removable
|
||||
size="sm"
|
||||
v-for="chip of tags"
|
||||
>
|
||||
<slot name="tags" :tag="chip" :format-fn="formatValue">
|
||||
<div class="q-gutter-x-xs">
|
||||
|
@ -168,29 +170,29 @@ function formatValue(value) {
|
|||
</div>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
<template v-if="props.searchButton">
|
||||
<QItem>
|
||||
<QItemSection class="q-py-sm">
|
||||
<QBtn
|
||||
:label="t('Search')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
class="full-width"
|
||||
icon="search"
|
||||
unelevated
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
</template>
|
||||
</QList>
|
||||
<slot name="body" :params="userParams" :search-fn="search"></slot>
|
||||
<template v-if="props.searchButton">
|
||||
<QItem>
|
||||
<QItemSection class="q-py-sm">
|
||||
<QBtn
|
||||
:label="t('Search')"
|
||||
class="full-width"
|
||||
color="primary"
|
||||
dense
|
||||
icon="search"
|
||||
rounded
|
||||
type="submit"
|
||||
unelevated
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QSeparator />
|
||||
</template>
|
||||
</QForm>
|
||||
<QInnerLoading
|
||||
:showing="isLoading"
|
||||
:label="t('globals.pleaseWait')"
|
||||
:showing="isLoading"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const props = defineProps({
|
||||
phoneNumber: { type: [String, Number], default: null },
|
||||
});
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<QBtn
|
||||
v-if="props.phoneNumber"
|
||||
flat
|
||||
round
|
||||
icon="phone"
|
||||
size="sm"
|
||||
color="primary"
|
||||
padding="none"
|
||||
:href="`sip:${props.phoneNumber}`"
|
||||
:title="t('globals.microsip')"
|
||||
@click.stop
|
||||
/>
|
||||
</template>
|
||||
<style scoped></style>
|
|
@ -4,9 +4,10 @@ import { dashIfEmpty } from 'src/filters';
|
|||
|
||||
const $props = defineProps({
|
||||
label: { type: String, default: null },
|
||||
value: { type: [Number, String, Boolean], default: null },
|
||||
titleLabel: { type: String, default: null },
|
||||
titleValue: { type: [Number, String, Boolean], default: null },
|
||||
value: {
|
||||
type: [String, Boolean],
|
||||
default: null,
|
||||
},
|
||||
info: { type: String, default: null },
|
||||
dash: { type: Boolean, default: true },
|
||||
});
|
||||
|
@ -16,7 +17,7 @@ const isBooleanValue = computed(() => typeof $props.value === 'boolean');
|
|||
<div class="vn-label-value">
|
||||
<div v-if="$props.label || $slots.label" class="label">
|
||||
<slot name="label">
|
||||
<span :title="$props.titleLabel ?? $props.label">{{ $props.label }}</span>
|
||||
<span>{{ $props.label }}</span>
|
||||
</slot>
|
||||
</div>
|
||||
<div class="value">
|
||||
|
|
|
@ -76,9 +76,9 @@ async function search() {
|
|||
const module = route.matched[1];
|
||||
if (rows.length === 1) {
|
||||
const [firstRow] = rows;
|
||||
await router.push({ path: `/${module.name}/${firstRow.id}` });
|
||||
await router.push({ path: `${module.path}/${firstRow.id}` });
|
||||
} else if (route.matched.length > 3) {
|
||||
await router.push({ path: `/${module.name}` });
|
||||
await router.push({ path: `/${module.path}` });
|
||||
arrayData.updateStateParams();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { useSession } from 'src/composables/useSession';
|
||||
import { getUrl } from './getUrl';
|
||||
|
||||
const session = useSession();
|
||||
const token = session.getToken();
|
||||
|
||||
export async function downloadFile(dmsId) {
|
||||
let appUrl = await getUrl('', 'lilium');
|
||||
appUrl = appUrl.replace('/#/', '');
|
||||
window.open(`${appUrl}/api/dms/${dmsId}/downloadFile?access_token=${token}`);
|
||||
}
|
|
@ -1,11 +1,10 @@
|
|||
import axios from 'axios';
|
||||
|
||||
export async function getUrl(route, appName = 'salix') {
|
||||
const filter = {
|
||||
where: { and: [{ appName: appName }, { environment: process.env.NODE_ENV }] },
|
||||
};
|
||||
export async function getUrl(route, app = 'salix') {
|
||||
let url;
|
||||
|
||||
const { data } = await axios.get('Urls/findOne', { params: { filter } });
|
||||
const url = data.url;
|
||||
return route ? url + route : url;
|
||||
await axios.get('Urls/getUrl', { params: { app } }).then((res) => {
|
||||
url = res.data + route;
|
||||
});
|
||||
return url;
|
||||
}
|
||||
|
|
|
@ -149,13 +149,13 @@ export function useArrayData(key, userOptions) {
|
|||
return { filter, params };
|
||||
}
|
||||
|
||||
function sanitizerParams(params) {
|
||||
function sanitizerParams(params, exprBuilder) {
|
||||
for (const param in params) {
|
||||
if (params[param] === '' || params[param] === null) {
|
||||
delete store.userParams[param];
|
||||
delete params[param];
|
||||
if (store.filter?.where) {
|
||||
delete store.filter.where[Object.keys(store?.exprBuilder(param))[0]];
|
||||
delete store.filter.where[Object.keys(exprBuilder ? exprBuilder(param) : param)[0]];
|
||||
if (Object.keys(store.filter.where).length === 0) {
|
||||
delete store.filter.where;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
export function djb2a(string) {
|
||||
let hash = 5381;
|
||||
for (let i = 0; i < string.length; i++)
|
||||
hash = ((hash << 5) + hash) ^ string.charCodeAt(i);
|
||||
return hash >>> 0;
|
||||
}
|
||||
|
||||
export function useColor(value) {
|
||||
return '#' + colors[djb2a(value || '') % colors.length];
|
||||
}
|
||||
|
||||
const colors = [
|
||||
'b5b941', // Yellow
|
||||
'ae9681', // Peach
|
||||
'd78767', // Salmon
|
||||
'cc7000', // Orange bright
|
||||
'e2553d', // Coral
|
||||
'8B0000', // Red dark
|
||||
'de4362', // Red crimson
|
||||
'FF1493', // Ping intense
|
||||
'be39a2', // Pink light
|
||||
'b754cf', // Purple middle
|
||||
'a87ba8', // Pink
|
||||
'8a69cd', // Blue lavender
|
||||
'ab20ab', // Purple dark
|
||||
'00b5b8', // Turquoise
|
||||
'1fa8a1', // Green ocean
|
||||
'5681cf', // Blue steel
|
||||
'3399fe', // Blue sky
|
||||
'6d9c3e', // Green chartreuse
|
||||
'51bb51', // Green lime
|
||||
'518b8b', // Gray board
|
||||
'7e7e7e', // Gray
|
||||
'5d5d5d', // Gray dark
|
||||
];
|
|
@ -0,0 +1,22 @@
|
|||
import { Notify } from 'quasar';
|
||||
import { i18n } from 'src/boot/i18n';
|
||||
|
||||
export default function useNotify() {
|
||||
const notify = (message, type, icon) => {
|
||||
const defaultIcons = {
|
||||
warning: 'warning',
|
||||
negative: 'error',
|
||||
positive: 'check',
|
||||
};
|
||||
|
||||
Notify.create({
|
||||
message: i18n.global.t(message),
|
||||
type: type,
|
||||
icon: icon ? icon : defaultIcons[type],
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
notify,
|
||||
};
|
||||
}
|
|
@ -8,6 +8,7 @@ const user = ref({
|
|||
nickname: '',
|
||||
lang: '',
|
||||
darkMode: null,
|
||||
companyFk: null,
|
||||
});
|
||||
|
||||
const roles = ref([]);
|
||||
|
@ -23,6 +24,7 @@ export function useState() {
|
|||
nickname: user.value.nickname,
|
||||
lang: user.value.lang,
|
||||
darkMode: user.value.darkMode,
|
||||
companyFk: user.value.companyFk,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -34,6 +36,7 @@ export function useState() {
|
|||
nickname: data.nickname,
|
||||
lang: data.lang,
|
||||
darkMode: data.darkMode,
|
||||
companyFk: data.companyFk,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -59,7 +62,6 @@ export function useState() {
|
|||
delete state.value[name];
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
getUser,
|
||||
setUser,
|
||||
|
@ -69,6 +71,6 @@ export function useState() {
|
|||
get,
|
||||
unset,
|
||||
drawer,
|
||||
headerMounted
|
||||
headerMounted,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,14 +1,24 @@
|
|||
import axios from 'axios';
|
||||
import { useState } from './useState';
|
||||
import useNotify from './useNotify';
|
||||
|
||||
export function useUserConfig() {
|
||||
const state = useState();
|
||||
const { notify } = useNotify();
|
||||
|
||||
async function fetch() {
|
||||
const { data } = await axios.get('UserConfigs/getUserConfig');
|
||||
const user = state.getUser().value;
|
||||
user.darkMode = data.darkMode;
|
||||
state.setUser(user);
|
||||
try {
|
||||
const { data } = await axios.get('UserConfigs/getUserConfig');
|
||||
const user = state.getUser().value;
|
||||
user.darkMode = data.darkMode;
|
||||
user.companyFk = data.companyFk;
|
||||
state.setUser(user);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
notify('globals.errors.userConfig', 'negative');
|
||||
console.error('Error fetching user config:', error);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -1,19 +1,12 @@
|
|||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import validator from 'validator';
|
||||
|
||||
const models = ref(null);
|
||||
import { useValidationsStore } from 'src/stores/useValidationsStore';
|
||||
|
||||
export function useValidator() {
|
||||
if (!models.value) fetch();
|
||||
|
||||
function fetch() {
|
||||
axios.get('Schemas/ModelInfo').then((response) => (models.value = response.data));
|
||||
}
|
||||
const models = useValidationsStore().validations;
|
||||
|
||||
function validate(propertyRule) {
|
||||
const modelInfo = models.value;
|
||||
const modelInfo = models;
|
||||
if (!modelInfo || !propertyRule) return;
|
||||
|
||||
const rule = propertyRule.split('.');
|
||||
|
@ -75,5 +68,6 @@ export function useValidator() {
|
|||
|
||||
return {
|
||||
validate,
|
||||
models,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ body.body--light {
|
|||
--vn-gray: #f5f5f5;
|
||||
--vn-label: #5f5f5f;
|
||||
--vn-dark: white;
|
||||
--vn-light-gray: #e7e3e3;
|
||||
}
|
||||
|
||||
body.body--dark {
|
||||
|
@ -40,6 +41,7 @@ body.body--dark {
|
|||
--vn-gray: #313131;
|
||||
--vn-label: #a8a8a8;
|
||||
--vn-dark: #292929;
|
||||
--vn-light-gray: #424242;
|
||||
}
|
||||
|
||||
.bg-vn-dark {
|
||||
|
|
|
@ -2,6 +2,7 @@ import toLowerCase from './toLowerCase';
|
|||
import toDate from './toDate';
|
||||
import toDateString from './toDateString';
|
||||
import toDateHour from './toDateHour';
|
||||
import toRelativeDate from './toRelativeDate';
|
||||
import toCurrency from './toCurrency';
|
||||
import toPercentage from './toPercentage';
|
||||
import toLowerCamel from './toLowerCamel';
|
||||
|
@ -13,6 +14,7 @@ export {
|
|||
toDate,
|
||||
toDateString,
|
||||
toDateHour,
|
||||
toRelativeDate,
|
||||
toCurrency,
|
||||
toPercentage,
|
||||
dashIfEmpty,
|
||||
|
|
|
@ -9,13 +9,10 @@ export default function (value, symbol = 'EUR', fractionSize = 2) {
|
|||
style: 'currency',
|
||||
currency: symbol,
|
||||
minimumFractionDigits: fractionSize,
|
||||
maximumFractionDigits: fractionSize
|
||||
maximumFractionDigits: fractionSize,
|
||||
};
|
||||
|
||||
const lang = locale.value == 'es' ? 'de' : locale.value;
|
||||
|
||||
return new Intl.NumberFormat(lang, options)
|
||||
.format(value);
|
||||
|
||||
|
||||
return new Intl.NumberFormat(lang, options).format(value);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
export default function formatDate(dateVal) {
|
||||
const { t } = useI18n();
|
||||
const today = new Date();
|
||||
if (dateVal == null) return '';
|
||||
|
||||
const date = new Date(dateVal);
|
||||
const dateZeroTime = new Date(dateVal);
|
||||
dateZeroTime.setHours(0, 0, 0, 0);
|
||||
const diff = Math.trunc(
|
||||
(today.getTime() - dateZeroTime.getTime()) / (1000 * 3600 * 24)
|
||||
);
|
||||
let format;
|
||||
if (diff === 0) format = t('globals.today');
|
||||
else if (diff === 1) format = t('globals.yesterday');
|
||||
else if (diff > 1 && diff < 7) {
|
||||
const options = { weekday: 'short' };
|
||||
format = date.toLocaleDateString(t('globals.dateFormat'), options);
|
||||
} else if (today.getFullYear() === date.getFullYear()) {
|
||||
const options = { day: 'numeric', month: 'short' };
|
||||
format = date.toLocaleDateString(t('globals.dateFormat'), options);
|
||||
} else {
|
||||
const options = { year: 'numeric', month: '2-digit', day: '2-digit' };
|
||||
format = date.toLocaleDateString(t('globals.dateFormat'), options);
|
||||
}
|
||||
|
||||
// Formatear la hora en HH:mm
|
||||
const hours = date.getHours().toString().padStart(2, '0');
|
||||
const minutes = date.getMinutes().toString().padStart(2, '0');
|
||||
return `${format} ${hours}:${minutes}`;
|
||||
}
|
|
@ -5,6 +5,9 @@ export default {
|
|||
en: 'English',
|
||||
},
|
||||
language: 'Language',
|
||||
entity: 'Entity',
|
||||
user: 'User',
|
||||
details: 'Details',
|
||||
collapseMenu: 'Collapse left menu',
|
||||
backToDashboard: 'Return to dashboard',
|
||||
notifications: 'Notifications',
|
||||
|
@ -13,8 +16,12 @@ export default {
|
|||
pinnedModules: 'Pinned modules',
|
||||
darkMode: 'Dark mode',
|
||||
logOut: 'Log out',
|
||||
date: 'Date',
|
||||
dataSaved: 'Data saved',
|
||||
dataDeleted: 'Data deleted',
|
||||
search: 'Search',
|
||||
changes: 'Changes',
|
||||
dataCreated: 'Data created',
|
||||
add: 'Add',
|
||||
create: 'Create',
|
||||
save: 'Save',
|
||||
|
@ -36,13 +43,34 @@ export default {
|
|||
summary: {
|
||||
basicData: 'Basic data',
|
||||
},
|
||||
today: 'Today',
|
||||
yesterday: 'Yesterday',
|
||||
dateFormat: 'en-GB',
|
||||
microsip: 'Open in MicroSIP',
|
||||
noSelectedRows: `You don't have any line selected`,
|
||||
downloadCSVSuccess: 'CSV downloaded successfully',
|
||||
// labels compartidos entre vistas
|
||||
reference: 'Reference',
|
||||
agency: 'Agency',
|
||||
wareHouseOut: 'Warehouse Out',
|
||||
wareHouseIn: 'Warehouse In',
|
||||
landed: 'Landed',
|
||||
shipped: 'Shipped',
|
||||
totalEntries: 'Total entries',
|
||||
amount: 'Amount',
|
||||
packages: 'Packages',
|
||||
download: 'Download',
|
||||
selectRows: 'Select all { numberRows } row(s)',
|
||||
allRows: 'All { numberRows } row(s)',
|
||||
markAll: 'Mark all',
|
||||
},
|
||||
errors: {
|
||||
statusUnauthorized: 'Access denied',
|
||||
statusInternalServerError: 'An internal server error has ocurred',
|
||||
statusBadGateway: 'It seems that the server has fall down',
|
||||
statusGatewayTimeout: 'Could not contact the server',
|
||||
userConfig: 'Error fetching user config',
|
||||
create: 'Error during creation',
|
||||
},
|
||||
login: {
|
||||
title: 'Login',
|
||||
|
@ -225,7 +253,6 @@ export default {
|
|||
invoice: 'Invoice',
|
||||
shipped: 'Shipped',
|
||||
landed: 'Landed',
|
||||
packages: 'Packages',
|
||||
consigneePhone: 'Consignee phone',
|
||||
consigneeMobile: 'Consignee mobile',
|
||||
clientPhone: 'Client phone',
|
||||
|
@ -242,7 +269,6 @@ export default {
|
|||
description: 'Description',
|
||||
price: 'Price',
|
||||
discount: 'Discount',
|
||||
amount: 'Amount',
|
||||
packing: 'Packing',
|
||||
hasComponentLack: 'Component lack',
|
||||
itemShortage: 'Not visible',
|
||||
|
@ -335,7 +361,6 @@ export default {
|
|||
assignedTo: 'Assigned',
|
||||
created: 'Created',
|
||||
state: 'State',
|
||||
packages: 'Packages',
|
||||
picked: 'Picked',
|
||||
returnOfMaterial: 'Return of material authorization (RMA)',
|
||||
},
|
||||
|
@ -347,8 +372,10 @@ export default {
|
|||
},
|
||||
invoiceOut: {
|
||||
pageTitles: {
|
||||
invoiceOuts: 'Invoices Out',
|
||||
invoiceOuts: 'Invoice out',
|
||||
list: 'List',
|
||||
negativeBases: 'Negative Bases',
|
||||
globalInvoicing: 'Global invoicing',
|
||||
createInvoiceOut: 'Create invoice out',
|
||||
summary: 'Summary',
|
||||
basicData: 'Basic Data',
|
||||
|
@ -357,7 +384,6 @@ export default {
|
|||
ref: 'Reference',
|
||||
issued: 'Issued',
|
||||
shortIssued: 'Issued',
|
||||
amount: 'Amount',
|
||||
client: 'Client',
|
||||
created: 'Created',
|
||||
shortCreated: 'Created',
|
||||
|
@ -367,7 +393,6 @@ export default {
|
|||
},
|
||||
card: {
|
||||
issued: 'Issued',
|
||||
amount: 'Amount',
|
||||
client: 'Client',
|
||||
company: 'Company',
|
||||
customerCard: 'Customer card',
|
||||
|
@ -390,6 +415,138 @@ export default {
|
|||
shipped: 'Shipped',
|
||||
totalWithVat: 'Amount',
|
||||
},
|
||||
globalInvoices: {
|
||||
errors: {
|
||||
chooseValidClient: 'Choose a valid client',
|
||||
chooseValidCompany: 'Choose a valid company',
|
||||
chooseValidPrinter: 'Choose a valid printer',
|
||||
fillDates: 'Invoice date and the max date should be filled',
|
||||
invoiceDateLessThanMaxDate: 'Invoice date can not be less than max date',
|
||||
invoiceWithFutureDate: 'Exists an invoice with a future date',
|
||||
noTicketsToInvoice: 'There are not clients to invoice',
|
||||
criticalInvoiceError: 'Critical invoicing error, process stopped',
|
||||
},
|
||||
table: {
|
||||
client: 'Client',
|
||||
addressId: 'Address id',
|
||||
streetAddress: 'Street',
|
||||
},
|
||||
statusCard: {
|
||||
percentageText: '{getPercentage}% {getAddressNumber} of {getNAddresses}',
|
||||
pdfsNumberText: '{nPdfs} of {totalPdfs} PDFs',
|
||||
},
|
||||
},
|
||||
negativeBases: {
|
||||
from: 'From',
|
||||
to: 'To',
|
||||
company: 'Company',
|
||||
country: 'Country',
|
||||
clientId: 'Client Id',
|
||||
client: 'Client',
|
||||
amount: 'Amount',
|
||||
base: 'Base',
|
||||
ticketId: 'Ticket Id',
|
||||
active: 'Active',
|
||||
hasToInvoice: 'Has to Invoice',
|
||||
verifiedData: 'Verified Data',
|
||||
comercial: 'Comercial',
|
||||
errors: {
|
||||
downloadCsvFailed: 'CSV download failed',
|
||||
},
|
||||
},
|
||||
},
|
||||
shelving: {
|
||||
pageTitles: {
|
||||
shelving: 'Shelving',
|
||||
shelvingList: 'Shelving List',
|
||||
create: 'Create',
|
||||
summary: 'Summary',
|
||||
basicData: 'Basic Data',
|
||||
log: 'Logs',
|
||||
},
|
||||
list: {
|
||||
parking: 'Parking',
|
||||
priority: 'Priority',
|
||||
newShelving: 'New Shelving',
|
||||
},
|
||||
summary: {
|
||||
code: 'Code',
|
||||
parking: 'Parking',
|
||||
priority: 'Priority',
|
||||
worker: 'Worker',
|
||||
recyclable: 'Recyclable',
|
||||
},
|
||||
basicData: {
|
||||
code: 'Code',
|
||||
parking: 'Parking',
|
||||
priority: 'Priority',
|
||||
recyclable: 'Recyclable',
|
||||
},
|
||||
},
|
||||
invoiceIn: {
|
||||
pageTitles: {
|
||||
invoiceIns: 'Invoices In',
|
||||
list: 'List',
|
||||
createInvoiceIn: 'Create invoice in',
|
||||
summary: 'Summary',
|
||||
basicData: 'Basic data',
|
||||
vat: 'VAT',
|
||||
dueDay: 'Due day',
|
||||
intrastat: 'Intrastat',
|
||||
log: 'Logs',
|
||||
},
|
||||
list: {
|
||||
ref: 'Reference',
|
||||
supplier: 'Supplier',
|
||||
supplierRef: 'Supplier ref.',
|
||||
serialNumber: 'Serial number',
|
||||
serial: 'Serial',
|
||||
file: 'File',
|
||||
issued: 'Issued',
|
||||
isBooked: 'Is booked',
|
||||
awb: 'AWB',
|
||||
amount: 'Amount',
|
||||
},
|
||||
card: {
|
||||
issued: 'Issued',
|
||||
amount: 'Amount',
|
||||
client: 'Client',
|
||||
company: 'Company',
|
||||
customerCard: 'Customer card',
|
||||
ticketList: 'Ticket List',
|
||||
vat: 'Vat',
|
||||
dueDay: 'Due day',
|
||||
intrastat: 'Intrastat',
|
||||
},
|
||||
summary: {
|
||||
supplier: 'Supplier',
|
||||
supplierRef: 'Supplier ref.',
|
||||
currency: 'Currency',
|
||||
docNumber: 'Doc number',
|
||||
issued: 'Expedition date',
|
||||
operated: 'Operation date',
|
||||
bookEntried: 'Entry date',
|
||||
bookedDate: 'Booked date',
|
||||
sage: 'Sage withholding',
|
||||
vat: 'Undeductible VAT',
|
||||
company: 'Company',
|
||||
booked: 'Booked',
|
||||
expense: 'Expense',
|
||||
taxableBase: 'Taxable base',
|
||||
rate: 'Rate',
|
||||
sageVat: 'Sage vat',
|
||||
sageTransaction: 'Sage transaction',
|
||||
dueDay: 'Date',
|
||||
bank: 'Bank',
|
||||
amount: 'Amount',
|
||||
foreignValue: 'Foreign value',
|
||||
dueTotal: 'Due day',
|
||||
noMatch: 'Do not match',
|
||||
code: 'Code',
|
||||
net: 'Net',
|
||||
stems: 'Stems',
|
||||
country: 'Country',
|
||||
},
|
||||
},
|
||||
worker: {
|
||||
pageTitles: {
|
||||
|
@ -506,6 +663,81 @@ export default {
|
|||
},
|
||||
},
|
||||
},
|
||||
supplier: {
|
||||
pageTitles: {
|
||||
suppliers: 'Suppliers',
|
||||
supplier: 'Supplier',
|
||||
list: 'List',
|
||||
create: 'Create',
|
||||
summary: 'Summary',
|
||||
},
|
||||
list: {
|
||||
payMethod: 'Pay method',
|
||||
payDeadline: 'Pay deadline',
|
||||
payDay: 'Pay day',
|
||||
account: 'Account',
|
||||
newSupplier: 'New supplier',
|
||||
},
|
||||
summary: {
|
||||
responsible: 'Responsible',
|
||||
notes: 'Notes',
|
||||
verified: 'Verified',
|
||||
isActive: 'Is active',
|
||||
billingData: 'Billing data',
|
||||
payMethod: 'Pay method',
|
||||
payDeadline: 'Pay deadline',
|
||||
payDay: 'Día de pago',
|
||||
account: 'Account',
|
||||
fiscalData: 'Fiscal data',
|
||||
sageTaxType: 'Sage tax type',
|
||||
sageTransactionType: 'Sage transaction type',
|
||||
sageWithholding: 'Sage withholding',
|
||||
supplierActivity: 'Supplier activity',
|
||||
healthRegister: 'Healt register',
|
||||
fiscalAddress: 'Fiscal address',
|
||||
socialName: 'Social name',
|
||||
taxNumber: 'Tax number',
|
||||
street: 'Street',
|
||||
city: 'City',
|
||||
postCode: 'Postcode',
|
||||
province: 'Province',
|
||||
country: 'Country',
|
||||
},
|
||||
create: {
|
||||
supplierName: 'Supplier name',
|
||||
},
|
||||
},
|
||||
travel: {
|
||||
pageTitles: {
|
||||
travel: 'Travels',
|
||||
list: 'List',
|
||||
create: 'Create',
|
||||
summary: 'Summary',
|
||||
extraCommunity: 'Extra community',
|
||||
},
|
||||
summary: {
|
||||
confirmed: 'Confirmed',
|
||||
entryId: 'Entry Id',
|
||||
freight: 'Freight',
|
||||
package: 'Package',
|
||||
delivered: 'Delivered',
|
||||
received: 'Received',
|
||||
entries: 'Entries',
|
||||
cloneShipping: 'Clone travel',
|
||||
CloneTravelAndEntries: 'Clone travel and his entries',
|
||||
AddEntry: 'Add entry',
|
||||
},
|
||||
variables: {
|
||||
search: 'Id/Reference',
|
||||
agencyModeFk: 'Agency',
|
||||
warehouseInFk: ' Warehouse In',
|
||||
warehouseOutFk: 'Warehouse Out',
|
||||
landedFrom: 'Landed from',
|
||||
landedTo: 'Landed to',
|
||||
continent: 'Continent out',
|
||||
totalEntries: 'Total entries',
|
||||
},
|
||||
},
|
||||
components: {
|
||||
topbar: {},
|
||||
userPanel: {
|
||||
|
@ -513,9 +745,11 @@ export default {
|
|||
logOut: 'Log Out',
|
||||
},
|
||||
smartCard: {
|
||||
openCard: 'View card',
|
||||
openSummary: 'Open summary',
|
||||
viewDescription: 'View description',
|
||||
downloadFile: 'Download file',
|
||||
clone: 'Clone',
|
||||
openCard: 'View',
|
||||
openSummary: 'Summary',
|
||||
viewDescription: 'Description',
|
||||
},
|
||||
cardDescriptor: {
|
||||
mainList: 'Main list',
|
||||
|
|
|
@ -5,6 +5,9 @@ export default {
|
|||
en: 'Inglés',
|
||||
},
|
||||
language: 'Idioma',
|
||||
entity: 'Entidad',
|
||||
user: 'Usuario',
|
||||
details: 'Detalles',
|
||||
collapseMenu: 'Contraer menú lateral',
|
||||
backToDashboard: 'Volver al tablón',
|
||||
notifications: 'Notificaciones',
|
||||
|
@ -13,8 +16,12 @@ export default {
|
|||
pinnedModules: 'Módulos fijados',
|
||||
darkMode: 'Modo oscuro',
|
||||
logOut: 'Cerrar sesión',
|
||||
date: 'Fecha',
|
||||
dataSaved: 'Datos guardados',
|
||||
dataDeleted: 'Datos eliminados',
|
||||
search: 'Buscar',
|
||||
changes: 'Cambios',
|
||||
dataCreated: 'Datos creados',
|
||||
add: 'Añadir',
|
||||
create: 'Crear',
|
||||
save: 'Guardar',
|
||||
|
@ -36,13 +43,33 @@ export default {
|
|||
summary: {
|
||||
basicData: 'Datos básicos',
|
||||
},
|
||||
today: 'Hoy',
|
||||
yesterday: 'Ayer',
|
||||
dateFormat: 'es-ES',
|
||||
noSelectedRows: `No tienes ninguna línea seleccionada`,
|
||||
microsip: 'Abrir en MicroSIP',
|
||||
downloadCSVSuccess: 'Descarga de CSV exitosa',
|
||||
reference: 'Referencia',
|
||||
agency: 'Agencia',
|
||||
wareHouseOut: 'Alm. salida',
|
||||
wareHouseIn: 'Alm. entrada',
|
||||
landed: 'F. entrega',
|
||||
shipped: 'F. envío',
|
||||
totalEntries: 'Ent. totales',
|
||||
amount: 'Importe',
|
||||
packages: 'Bultos',
|
||||
download: 'Descargar',
|
||||
selectRows: 'Seleccionar las { numberRows } filas(s)',
|
||||
allRows: 'Todo { numberRows } filas(s)',
|
||||
markAll: 'Marcar todo',
|
||||
},
|
||||
errors: {
|
||||
statusUnauthorized: 'Acceso denegado',
|
||||
statusInternalServerError: 'Ha ocurrido un error interno del servidor',
|
||||
statusBadGateway: 'Parece ser que el servidor ha caído',
|
||||
statusGatewayTimeout: 'No se ha podido contactar con el servidor',
|
||||
userConfig: 'Error al obtener configuración de usuario',
|
||||
create: 'Error al crear',
|
||||
},
|
||||
login: {
|
||||
title: 'Inicio de sesión',
|
||||
|
@ -224,7 +251,6 @@ export default {
|
|||
invoice: 'Factura',
|
||||
shipped: 'Enviado',
|
||||
landed: 'Entregado',
|
||||
packages: 'Bultos',
|
||||
consigneePhone: 'Tel. consignatario',
|
||||
consigneeMobile: 'Móv. consignatario',
|
||||
clientPhone: 'Tel. cliente',
|
||||
|
@ -241,7 +267,6 @@ export default {
|
|||
description: 'Descripción',
|
||||
price: 'Precio',
|
||||
discount: 'Descuento',
|
||||
amount: 'Importe',
|
||||
packing: 'Encajado',
|
||||
hasComponentLack: 'Faltan componentes',
|
||||
itemShortage: 'No visible',
|
||||
|
@ -334,7 +359,6 @@ export default {
|
|||
assignedTo: 'Asignada a',
|
||||
created: 'Creada',
|
||||
state: 'Estado',
|
||||
packages: 'Bultos',
|
||||
picked: 'Recogida',
|
||||
returnOfMaterial: 'Autorización de retorno de materiales (RMA)',
|
||||
},
|
||||
|
@ -349,6 +373,8 @@ export default {
|
|||
pageTitles: {
|
||||
invoiceOuts: 'Fact. emitidas',
|
||||
list: 'Listado',
|
||||
negativeBases: 'Bases Negativas',
|
||||
globalInvoicing: 'Facturación global',
|
||||
createInvoiceOut: 'Crear fact. emitida',
|
||||
summary: 'Resumen',
|
||||
basicData: 'Datos básicos',
|
||||
|
@ -357,7 +383,6 @@ export default {
|
|||
ref: 'Referencia',
|
||||
issued: 'Fecha emisión',
|
||||
shortIssued: 'F. emisión',
|
||||
amount: 'Importe',
|
||||
client: 'Cliente',
|
||||
created: 'Fecha creación',
|
||||
shortCreated: 'F. creación',
|
||||
|
@ -367,7 +392,6 @@ export default {
|
|||
},
|
||||
card: {
|
||||
issued: 'Fecha emisión',
|
||||
amount: 'Importe',
|
||||
client: 'Cliente',
|
||||
company: 'Empresa',
|
||||
customerCard: 'Ficha del cliente',
|
||||
|
@ -390,6 +414,138 @@ export default {
|
|||
shipped: 'F. envío',
|
||||
totalWithVat: 'Importe',
|
||||
},
|
||||
globalInvoices: {
|
||||
errors: {
|
||||
chooseValidClient: 'Selecciona un cliente válido',
|
||||
chooseValidCompany: 'Selecciona una empresa válida',
|
||||
chooseValidPrinter: 'Selecciona una impresora válida',
|
||||
fillDates:
|
||||
'La fecha de la factura y la fecha máxima deben estar completas',
|
||||
invoiceDateLessThanMaxDate:
|
||||
'La fecha de la factura no puede ser menor que la fecha máxima',
|
||||
invoiceWithFutureDate: 'Existe una factura con una fecha futura',
|
||||
noTicketsToInvoice: 'No hay clientes para facturar',
|
||||
criticalInvoiceError: 'Error crítico en la facturación, proceso detenido',
|
||||
},
|
||||
table: {
|
||||
client: 'Cliente',
|
||||
addressId: 'Id dirección',
|
||||
streetAddress: 'Dirección fiscal',
|
||||
},
|
||||
statusCard: {
|
||||
percentageText: '{getPercentage}% {getAddressNumber} de {getNAddresses}',
|
||||
pdfsNumberText: '{nPdfs} de {totalPdfs} PDFs',
|
||||
},
|
||||
},
|
||||
negativeBases: {
|
||||
from: 'Desde',
|
||||
to: 'Hasta',
|
||||
company: 'Empresa',
|
||||
country: 'País',
|
||||
clientId: 'Id cliente',
|
||||
client: 'Cliente',
|
||||
amount: 'Importe',
|
||||
base: 'Base',
|
||||
ticketId: 'Id ticket',
|
||||
active: 'Activo',
|
||||
hasToInvoice: 'Facturar',
|
||||
verifiedData: 'Datos comprobados',
|
||||
comercial: 'Comercial',
|
||||
errors: {
|
||||
downloadCsvFailed: 'Error al descargar CSV',
|
||||
},
|
||||
},
|
||||
},
|
||||
shelving: {
|
||||
pageTitles: {
|
||||
shelving: 'Carros',
|
||||
shelvingList: 'Listado de carros',
|
||||
create: 'Crear',
|
||||
summary: 'Resumen',
|
||||
basicData: 'Datos básicos',
|
||||
log: 'Registros de auditoría',
|
||||
},
|
||||
list: {
|
||||
parking: 'Parking',
|
||||
priority: 'Prioridad',
|
||||
newShelving: 'Nuevo Carro',
|
||||
},
|
||||
summary: {
|
||||
code: 'Código',
|
||||
parking: 'Parking',
|
||||
priority: 'Prioridad',
|
||||
worker: 'Trabajador',
|
||||
recyclable: 'Reciclable',
|
||||
},
|
||||
basicData: {
|
||||
code: 'Código',
|
||||
parking: 'Parking',
|
||||
priority: 'Prioridad',
|
||||
recyclable: 'Reciclable',
|
||||
},
|
||||
},
|
||||
invoiceIn: {
|
||||
pageTitles: {
|
||||
invoiceIns: 'Fact. recibidas',
|
||||
list: 'Listado',
|
||||
createInvoiceIn: 'Crear fact. recibida',
|
||||
summary: 'Resumen',
|
||||
basicData: 'Datos básicos',
|
||||
vat: 'IVA',
|
||||
dueDay: 'Vencimiento',
|
||||
intrastat: 'Intrastat',
|
||||
log: 'Registros de auditoría',
|
||||
},
|
||||
list: {
|
||||
ref: 'Referencia',
|
||||
supplier: 'Proveedor',
|
||||
supplierRef: 'Ref. proveedor',
|
||||
serialNumber: 'Num. serie',
|
||||
shortIssued: 'F. emisión',
|
||||
serial: 'Serie',
|
||||
file: 'Fichero',
|
||||
issued: 'Fecha emisión',
|
||||
isBooked: 'Conciliada',
|
||||
awb: 'AWB',
|
||||
amount: 'Importe',
|
||||
},
|
||||
card: {
|
||||
issued: 'Fecha emisión',
|
||||
amount: 'Importe',
|
||||
client: 'Cliente',
|
||||
company: 'Empresa',
|
||||
customerCard: 'Ficha del cliente',
|
||||
ticketList: 'Listado de tickets',
|
||||
vat: 'Iva',
|
||||
dueDay: 'Fecha de vencimiento',
|
||||
},
|
||||
summary: {
|
||||
supplier: 'Proveedor',
|
||||
supplierRef: 'Ref. proveedor',
|
||||
currency: 'Divisa',
|
||||
docNumber: 'Número documento',
|
||||
issued: 'Fecha de expedición',
|
||||
operated: 'Fecha operación',
|
||||
bookEntried: 'Fecha asiento',
|
||||
bookedDate: 'Fecha contable',
|
||||
sage: 'Retención sage',
|
||||
vat: 'Iva no deducible',
|
||||
company: 'Empresa',
|
||||
booked: 'Contabilizada',
|
||||
expense: 'Gasto',
|
||||
taxableBase: 'Base imp.',
|
||||
rate: 'Tasa',
|
||||
sageTransaction: 'Sage transación',
|
||||
dueDay: 'Fecha',
|
||||
bank: 'Caja',
|
||||
amount: 'Importe',
|
||||
foreignValue: 'Divisa',
|
||||
dueTotal: 'Vencimiento',
|
||||
code: 'Código',
|
||||
net: 'Neto',
|
||||
stems: 'Tallos',
|
||||
country: 'País',
|
||||
},
|
||||
},
|
||||
worker: {
|
||||
pageTitles: {
|
||||
|
@ -506,6 +662,81 @@ export default {
|
|||
},
|
||||
},
|
||||
},
|
||||
supplier: {
|
||||
pageTitles: {
|
||||
suppliers: 'Proveedores',
|
||||
supplier: 'Proveedor',
|
||||
list: 'Listado',
|
||||
create: 'Crear',
|
||||
summary: 'Resumen',
|
||||
},
|
||||
list: {
|
||||
payMethod: 'Método de pago',
|
||||
payDeadline: 'Plazo de pago',
|
||||
payDay: 'Día de pago',
|
||||
account: 'Cuenta',
|
||||
newSupplier: 'Nuevo proveedor',
|
||||
},
|
||||
summary: {
|
||||
responsible: 'Responsable',
|
||||
notes: 'Notas',
|
||||
verified: 'Verificado',
|
||||
isActive: 'Está activo',
|
||||
billingData: 'Forma de pago',
|
||||
payMethod: 'Método de pago',
|
||||
payDeadline: 'Plazo de pago',
|
||||
payDay: 'Día de pago',
|
||||
account: 'Cuenta',
|
||||
fiscalData: 'Data fiscal',
|
||||
sageTaxType: 'Tipo de impuesto Sage',
|
||||
sageTransactionType: 'Tipo de transacción Sage',
|
||||
sageWithholding: 'Retención sage',
|
||||
supplierActivity: 'Actividad proveedor',
|
||||
healthRegister: 'Pasaporte sanitario',
|
||||
fiscalAddress: 'Dirección fiscal',
|
||||
socialName: 'Razón social',
|
||||
taxNumber: 'NIF/CIF',
|
||||
street: 'Dirección',
|
||||
city: 'Población',
|
||||
postCode: 'Código postal',
|
||||
province: 'Provincia',
|
||||
country: 'País',
|
||||
},
|
||||
create: {
|
||||
supplierName: 'Nombre del proveedor',
|
||||
},
|
||||
},
|
||||
travel: {
|
||||
pageTitles: {
|
||||
travel: 'Envíos',
|
||||
list: 'Listado',
|
||||
create: 'Crear',
|
||||
summary: 'Resumen',
|
||||
extraCommunity: 'Extra comunitarios',
|
||||
},
|
||||
summary: {
|
||||
confirmed: 'Confirmado',
|
||||
entryId: 'Id entrada',
|
||||
freight: 'Porte',
|
||||
package: 'Embalaje',
|
||||
delivered: 'Enviada',
|
||||
received: 'Recibida',
|
||||
entries: 'Entradas',
|
||||
cloneShipping: 'Clonar envío',
|
||||
CloneTravelAndEntries: 'Clonar travel y sus entradas',
|
||||
AddEntry: 'Añadir entrada',
|
||||
},
|
||||
variables: {
|
||||
search: 'Id/Referencia',
|
||||
agencyModeFk: 'Agencia',
|
||||
warehouseInFk: 'Alm. entrada',
|
||||
warehouseOutFk: ' Alm. salida',
|
||||
landedFrom: 'Llegada desde',
|
||||
landedTo: 'Llegada hasta',
|
||||
continent: 'Cont. Salida',
|
||||
totalEntries: 'Ent. totales',
|
||||
},
|
||||
},
|
||||
components: {
|
||||
topbar: {},
|
||||
userPanel: {
|
||||
|
@ -513,9 +744,11 @@ export default {
|
|||
logOut: 'Cerrar sesión',
|
||||
},
|
||||
smartCard: {
|
||||
openCard: 'Ver ficha',
|
||||
openSummary: 'Abrir detalles',
|
||||
viewDescription: 'Ver descripción',
|
||||
downloadFile: 'Descargar archivo',
|
||||
clone: 'Clonar',
|
||||
openCard: 'Ficha',
|
||||
openSummary: 'Detalles',
|
||||
viewDescription: 'Descripción',
|
||||
},
|
||||
cardDescriptor: {
|
||||
mainList: 'Listado principal',
|
||||
|
|
|
@ -7,6 +7,7 @@ import { useSession } from 'src/composables/useSession';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInputDate from "components/common/VnInputDate.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -96,6 +97,7 @@ const statesFilter = {
|
|||
:url-update="`Claims/updateClaim/${route.params.id}`"
|
||||
:filter="claimFilter"
|
||||
model="claim"
|
||||
auto-load
|
||||
>
|
||||
<template #form="{ data, validate, filter }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
@ -107,33 +109,7 @@ const statesFilter = {
|
|||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
v-model="data.created"
|
||||
mask="####-##-##"
|
||||
fill-mask="_"
|
||||
autofocus
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="data.created" mask="YYYY-MM-DD">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
label="Close"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
<VnInputDate v-model="data.created" :label="t('claim.basicData.created')" />
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
|
@ -183,7 +159,7 @@ const statesFilter = {
|
|||
<div class="col">
|
||||
<QInput
|
||||
v-model.number="data.packages"
|
||||
:label="t('claim.basicData.packages')"
|
||||
:label="t('globals.packages')"
|
||||
:rules="validate('claim.packages')"
|
||||
type="number"
|
||||
/>
|
||||
|
|
|
@ -7,6 +7,7 @@ import { useState } from 'src/composables/useState';
|
|||
|
||||
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import ClaimDescriptorMenu from 'pages/Claim/Card/ClaimDescriptorMenu.vue';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
@ -119,7 +120,7 @@ const setData = (entity) => {
|
|||
<template #value>
|
||||
<span class="link">
|
||||
{{ entity.worker.user.name }}
|
||||
<WorkerDescriptorProxy :id="entity.worker.userFk" />
|
||||
<WorkerDescriptorProxy :id="entity.worker.user.id" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
|
|
|
@ -37,7 +37,7 @@ function confirmPickupOrder() {
|
|||
data: {
|
||||
address: customer.email,
|
||||
},
|
||||
send: sendPickupOrder,
|
||||
promise: sendPickupOrder,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ const client = ref({});
|
|||
const inputFile = ref();
|
||||
const files = ref({});
|
||||
|
||||
const spinnerRef = ref();
|
||||
const claimDmsRef = ref();
|
||||
const dmsType = ref({});
|
||||
const config = ref({});
|
||||
|
@ -118,11 +119,11 @@ async function create() {
|
|||
clientId: client.value.id,
|
||||
}).toUpperCase(),
|
||||
};
|
||||
|
||||
spinnerRef.value.show();
|
||||
await axios.post(query, formData, {
|
||||
params: dms,
|
||||
});
|
||||
|
||||
spinnerRef.value.hide();
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
|
@ -234,7 +235,9 @@ function onDrag() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<QDialog ref="spinnerRef">
|
||||
<QSpinner color="primary" size="xl" />
|
||||
</QDialog>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<label for="fileInput">
|
||||
<QBtn fab @click="inputFile.nativeEl.click()" icon="add" color="primary">
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -150,33 +151,7 @@ const states = ref();
|
|||
</QItem> -->
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
v-model="params.created"
|
||||
:label="t('Created')"
|
||||
autofocus
|
||||
readonly
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.created">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
label="Close"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
<VnInputDate v-model="params.created" :label="t('Created')" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
|
|
|
@ -5,12 +5,13 @@ import { useQuasar } from 'quasar';
|
|||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toDate } from 'filters/index';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue';
|
||||
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import ClaimFilter from './ClaimFilter.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
|
@ -37,6 +38,15 @@ function viewSummary(id) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
function viewDescriptor(id) {
|
||||
quasar.dialog({
|
||||
component: CustomerDescriptorProxy,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -79,32 +89,37 @@ function viewSummary(id) {
|
|||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:id="row.id"
|
||||
:key="row.id"
|
||||
:title="row.clientName"
|
||||
@click="navigate(row.id)"
|
||||
v-for="row of rows"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv label="ID" :value="row.id" />
|
||||
<VnLv
|
||||
:label="t('claim.list.customer')"
|
||||
:value="row.clientName"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('claim.list.assignedTo')"
|
||||
:value="row.workerName"
|
||||
/>
|
||||
<VnLv :label="t('claim.list.customer')" @click.stop>
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ row.clientName }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('claim.list.assignedTo')" @click.stop>
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ row.workerName }}
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('claim.list.created')"
|
||||
:value="toDate(row.created)"
|
||||
/>
|
||||
<VnLv :label="t('claim.list.state')">
|
||||
<template #value>
|
||||
<QBadge
|
||||
:color="stateColor(row.stateCode)"
|
||||
class="q-ma-none"
|
||||
dense
|
||||
>
|
||||
<QBadge :color="stateColor(row.stateCode)" dense>
|
||||
{{ row.stateDescription }}
|
||||
</QBadge>
|
||||
</template>
|
||||
|
@ -112,26 +127,26 @@ function viewSummary(id) {
|
|||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
flat
|
||||
icon="arrow_circle_right"
|
||||
:label="t('components.smartCard.openCard')"
|
||||
@click.stop="navigate(row.id)"
|
||||
class="bg-vn-dark"
|
||||
outline
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.viewDescription')"
|
||||
@click.stop
|
||||
class="bg-vn-dark"
|
||||
outline
|
||||
style="margin-top: 15px"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openCard') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openSummary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn flat icon="vn:client" @click.stop>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.viewDescription') }}
|
||||
</QTooltip>
|
||||
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
|
|
|
@ -60,7 +60,7 @@ const filterOptions = {
|
|||
auto-load
|
||||
/>
|
||||
|
||||
<FormModel :url="`Clients/${route.params.id}`" model="customer">
|
||||
<FormModel :url="`Clients/${route.params.id}`" model="customer" auto-load>
|
||||
<template #form="{ data, validate, filter }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
|
|
|
@ -14,6 +14,10 @@ const $props = defineProps({
|
|||
required: false,
|
||||
default: null,
|
||||
},
|
||||
summary: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -34,6 +38,7 @@ const setData = (entity) => (data.value = useCardDescription(entity.name, entity
|
|||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
@on-fetch="setData"
|
||||
:summary="$props.summary"
|
||||
data-key="customerData"
|
||||
>
|
||||
<template #body="{ entity }">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import CustomerDescriptor from './CustomerDescriptor.vue';
|
||||
import CustomerSummaryDialog from './CustomerSummaryDialog.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -8,8 +9,13 @@ const $props = defineProps({
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<CustomerDescriptor v-if="$props.id" :id="$props.id" />
|
||||
<CustomerDescriptor
|
||||
v-if="$props.id"
|
||||
:id="$props.id"
|
||||
:summary="CustomerSummaryDialog"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -6,6 +6,7 @@ import { toCurrency, toPercentage, toDate } from 'src/filters';
|
|||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -68,8 +69,18 @@ const creditWarning = computed(() => {
|
|||
<VnLv :label="t('customer.summary.customerId')" :value="entity.id" />
|
||||
<VnLv :label="t('customer.summary.name')" :value="entity.name" />
|
||||
<VnLv :label="t('customer.summary.contact')" :value="entity.contact" />
|
||||
<VnLv :label="t('customer.summary.phone')" :value="entity.phone" />
|
||||
<VnLv :label="t('customer.summary.mobile')" :value="entity.mobile" />
|
||||
<VnLv :value="entity.phone">
|
||||
<template #label>
|
||||
{{ t('customer.summary.phone') }}
|
||||
<VnLinkPhone :phone-number="entity.phone" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="entity.mobile">
|
||||
<template #label>
|
||||
{{ t('customer.summary.mobile') }}
|
||||
<VnLinkPhone :phone-number="entity.mobile" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('customer.summary.email')" :value="entity.email" />
|
||||
<VnLv
|
||||
:label="t('customer.summary.salesPerson')"
|
||||
|
|
|
@ -9,6 +9,7 @@ import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
|||
import CustomerFilter from './CustomerFilter.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
|
@ -72,34 +73,31 @@ function viewSummary(id) {
|
|||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:title="row.name"
|
||||
:id="row.id"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv label="ID" :value="row.id" />
|
||||
<VnLv :label="t('customer.list.email')" :value="row.email" />
|
||||
<VnLv :label="t('customer.list.phone')" :value="row.phone" />
|
||||
<VnLv :value="row.phone">
|
||||
<template #label>
|
||||
{{ t('customer.list.phone') }}
|
||||
<VnLinkPhone :phone-number="row.phone" />
|
||||
</template>
|
||||
</VnLv>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
flat
|
||||
color="primary"
|
||||
icon="arrow_circle_right"
|
||||
:label="t('components.smartCard.openCard')"
|
||||
@click.stop="navigate(row.id)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openCard') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
class="bg-vn-dark"
|
||||
outline
|
||||
/>
|
||||
<QBtn
|
||||
flat
|
||||
color="grey-7"
|
||||
icon="preview"
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openSummary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -76,78 +77,16 @@ function isValidNumber(value) {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
<VnInputDate
|
||||
v-model="params.from"
|
||||
:label="t('From')"
|
||||
mask="date"
|
||||
placeholder="yyyy/mm/dd"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.from" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
<VnInputDate
|
||||
v-model="params.to"
|
||||
:label="t('To')"
|
||||
mask="date"
|
||||
placeholder="yyyy/mm/dd"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.to" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
|
|
|
@ -0,0 +1,710 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
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 axios from 'axios';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const dms = ref({});
|
||||
const editDownloadDisabled = ref(false);
|
||||
const arrayData = useArrayData('InvoiceIn');
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
const userConfig = ref(null);
|
||||
|
||||
const suppliers = ref([]);
|
||||
const suppliersRef = ref();
|
||||
const currencies = ref([]);
|
||||
const currenciesRef = ref();
|
||||
const companies = ref([]);
|
||||
const companiesRef = ref();
|
||||
const dmsTypes = ref([]);
|
||||
const dmsTypesRef = ref();
|
||||
const warehouses = ref([]);
|
||||
const warehousesRef = ref();
|
||||
const allowTypesRef = ref();
|
||||
const allowedContentTypes = ref([]);
|
||||
const inputFileRef = ref();
|
||||
const editDmsRef = ref();
|
||||
const createDmsRef = ref();
|
||||
|
||||
const requiredFieldRule = (val) => val || t('Required field');
|
||||
const dateMask = '####-##-##';
|
||||
const fillMask = '_';
|
||||
|
||||
async function checkFileExists(dmsId) {
|
||||
if (!dmsId) return;
|
||||
try {
|
||||
await axios.get(`Dms/${dmsId}`, { fields: ['id'] });
|
||||
editDownloadDisabled.value = false;
|
||||
} catch (e) {
|
||||
editDownloadDisabled.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
async function setEditDms(dmsId) {
|
||||
const { data } = await axios.get(`Dms/${dmsId}`);
|
||||
dms.value = {
|
||||
warehouseId: data.warehouseFk,
|
||||
companyId: data.companyFk,
|
||||
dmsTypeId: data.dmsTypeFk,
|
||||
...data,
|
||||
};
|
||||
|
||||
if (!allowedContentTypes.value.length) await allowTypesRef.value.fetch();
|
||||
|
||||
editDmsRef.value.show();
|
||||
}
|
||||
|
||||
async function setCreateDms() {
|
||||
const { data } = await axios.get('DmsTypes/findOne', {
|
||||
where: { code: 'invoiceIn' },
|
||||
});
|
||||
dms.value = {
|
||||
reference: invoiceIn.value.supplierRef,
|
||||
warehouseId: userConfig.value.warehouseFk,
|
||||
companyId: userConfig.value.companyFk,
|
||||
dmsTypeId: data.id,
|
||||
description: invoiceIn.value.supplier.name,
|
||||
hasFile: true,
|
||||
hasFileAttached: true,
|
||||
files: null,
|
||||
};
|
||||
|
||||
createDmsRef.value.show();
|
||||
}
|
||||
|
||||
async function upsert() {
|
||||
try {
|
||||
const isEdit = !!dms.value.id;
|
||||
const errors = {
|
||||
companyId: `The company can't be empty`,
|
||||
warehouseId: `The warehouse can't be empty`,
|
||||
dmsTypeId: `The DMS Type can't be empty`,
|
||||
description: `The description can't be empty`,
|
||||
};
|
||||
|
||||
Object.keys(errors).forEach((key) => {
|
||||
if (!dms.value[key]) throw Error(t(errors[key]));
|
||||
});
|
||||
|
||||
if (!isEdit && !dms.value.files) throw Error(t(`The files can't be empty`));
|
||||
|
||||
const formData = new FormData();
|
||||
|
||||
if (dms.value.files) {
|
||||
for (let i = 0; i < dms.value.files.length; i++)
|
||||
formData.append(dms.value.files[i].name, dms.value.files[i]);
|
||||
dms.value.hasFileAttached = true;
|
||||
}
|
||||
const url = isEdit ? `dms/${dms.value.id}/updateFile` : 'Dms/uploadFile';
|
||||
const { data } = await axios.post(url, formData, {
|
||||
params: dms.value,
|
||||
});
|
||||
|
||||
if (data.length) invoiceIn.value.dmsFk = data[0].id;
|
||||
|
||||
if (!isEdit) {
|
||||
createDmsRef.value.hide();
|
||||
} else {
|
||||
editDmsRef.value.hide();
|
||||
}
|
||||
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
} catch (error) {
|
||||
quasar.notify({
|
||||
message: t(`${error.message}`),
|
||||
type: 'negative',
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
ref="suppliersRef"
|
||||
url="Suppliers"
|
||||
:filter="{ fields: ['id', 'nickname'] }"
|
||||
limit="30"
|
||||
@on-fetch="(data) => (suppliers = data)"
|
||||
/>
|
||||
<FetchData
|
||||
ref="currenciesRef"
|
||||
url="Currencies"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
order="code"
|
||||
@on-fetch="(data) => (currencies = data)"
|
||||
/>
|
||||
<FetchData
|
||||
ref="companiesRef"
|
||||
url="Companies"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
order="code"
|
||||
@on-fetch="(data) => (companies = data)"
|
||||
/>
|
||||
<FetchData
|
||||
ref="dmsTypesRef"
|
||||
url="DmsTypes"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
order="name"
|
||||
@on-fetch="(data) => (dmsTypes = data)"
|
||||
/>
|
||||
<FetchData
|
||||
ref="warehousesRef"
|
||||
url="Warehouses"
|
||||
:filter="{ fields: ['id', 'name'] }"
|
||||
order="name"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
/>
|
||||
<FetchData
|
||||
ref="allowTypesRef"
|
||||
url="DmsContainers/allowedContentTypes"
|
||||
@on-fetch="(data) => (allowedContentTypes = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="UserConfigs/getUserConfig"
|
||||
@on-fetch="(data) => (userConfig = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FormModel v-if="invoiceIn" :url="`InvoiceIns/${route.params.id}`" model="invoiceIn">
|
||||
<template #form="{ data }">
|
||||
<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="suppliersRef.fetch()"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
`${scope.opt.id} - ${scope.opt.nickname}`
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
clearable
|
||||
clear-icon="close"
|
||||
:label="t('Supplier ref')"
|
||||
v-model="data.supplierRef"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('Expedition date')"
|
||||
v-model="data.issued"
|
||||
:mask="dateMask"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon
|
||||
name="event"
|
||||
class="cursor-pointer"
|
||||
:fill-mask="fillMask"
|
||||
>
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="data.issued">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
label="Close"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('Operation date')"
|
||||
v-model="data.operated"
|
||||
:mask="dateMask"
|
||||
:fill-mask="fillMask"
|
||||
autofocus
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="data.operated" :mask="dateMask">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
label="Close"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('Undeductible VAT')"
|
||||
v-model="data.deductibleExpenseFk"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('Document')"
|
||||
v-model="data.dmsFk"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
@update:model-value="checkFileExists(data.dmsFk)"
|
||||
>
|
||||
<template #prepend>
|
||||
<QBtn
|
||||
v-if="data.dmsFk"
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
:disable="editDownloadDisabled"
|
||||
icon="cloud_download"
|
||||
:title="t('Download file')"
|
||||
padding="xs"
|
||||
round
|
||||
@click="downloadFile(data.dmsFk)"
|
||||
/>
|
||||
</template>
|
||||
<template #append>
|
||||
<QBtn
|
||||
:class="{
|
||||
'no-pointer-events': editDownloadDisabled,
|
||||
}"
|
||||
:disable="editDownloadDisabled"
|
||||
v-if="data.dmsFk"
|
||||
icon="edit"
|
||||
round
|
||||
padding="xs"
|
||||
@click="setEditDms(data.dmsFk)"
|
||||
>
|
||||
<QTooltip>{{ t('Edit document') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
v-else
|
||||
icon="add_circle"
|
||||
round
|
||||
padding="xs"
|
||||
@click="setCreateDms()"
|
||||
>
|
||||
<QTooltip>{{ t('Create document') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('Entry date')"
|
||||
v-model="data.bookEntried"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
:mask="dateMask"
|
||||
:fill-mask="fillMask"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="data.bookEntried" :mask="dateMask">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
label="Close"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
:label="t('Accounted date')"
|
||||
v-model="data.booked"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
:mask="dateMask"
|
||||
:fill-mask="fillMask"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="data.booked" :mask="maskDate">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
label="Close"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
</div>
|
||||
<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"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
@input-value="currenciesRef.fetch()"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
v-if="companiesRef"
|
||||
:label="t('Company')"
|
||||
v-model="data.companyFk"
|
||||
:options="companies"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
@input-value="companiesRef.fetch()"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QCheckbox
|
||||
:label="t('invoiceIn.summary.booked')"
|
||||
v-model="data.isBooked"
|
||||
/>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
</template>
|
||||
</FormModel>
|
||||
<QDialog ref="editDmsRef">
|
||||
<QCard>
|
||||
<QCardSection class="q-pb-none">
|
||||
<QItem class="q-px-none">
|
||||
<span class="text-primary text-h6 full-width">
|
||||
<QIcon name="edit" class="q-mr-xs" />
|
||||
{{ t('Edit document') }}
|
||||
</span>
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-py-none">
|
||||
<QItem>
|
||||
<QInput
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('Reference')"
|
||||
v-model="dms.reference"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Company')}*`"
|
||||
v-model="dms.companyId"
|
||||
:options="companies"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
@input-value="companiesRef.fetch()"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Warehouse')}*`"
|
||||
v-model="dms.warehouseId"
|
||||
:options="warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@input-value="warehousesRef.fetch()"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Type')}*`"
|
||||
v-model="dms.dmsTypeId"
|
||||
:options="dmsTypes"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@input-value="dmsTypesRef.fetch()"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QInput
|
||||
class="full-width q-pa-xs"
|
||||
type="textarea"
|
||||
size="lg"
|
||||
autogrow
|
||||
:label="`${t('Description')}*`"
|
||||
v-model="dms.description"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
:rules="[(val) => val.length || t('Required field')]"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QFile
|
||||
ref="inputFileRef"
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('File')"
|
||||
v-model="dms.files"
|
||||
multiple
|
||||
:accept="allowedContentTypes.join(',')"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="attach_file_add"
|
||||
flat
|
||||
round
|
||||
padding="xs"
|
||||
@click="inputFileRef.pickFiles()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Select a file') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn icon="info" flat round padding="xs">
|
||||
<QTooltip max-width="30rem">
|
||||
{{
|
||||
`${t(
|
||||
'Allowed content types'
|
||||
)}: ${allowedContentTypes.join(', ')}`
|
||||
}}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QFile>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QCheckbox
|
||||
:label="t('Generate identifier for original file')"
|
||||
v-model="dms.hasFile"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardActions class="justify-end">
|
||||
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
|
||||
<QBtn :label="t('globals.save')" color="primary" @click="upsert" />
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<QDialog ref="createDmsRef">
|
||||
<QCard>
|
||||
<QCardSection class="q-pb-none">
|
||||
<QItem>
|
||||
<span class="text-primary text-h6 full-width">
|
||||
<QIcon name="edit" class="q-mr-xs" />
|
||||
{{ t('Create document') }}
|
||||
</span>
|
||||
<QBtn icon="close" flat round dense v-close-popup align="right" />
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pb-none">
|
||||
<QItem>
|
||||
<QInput
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('Reference')"
|
||||
v-model="dms.reference"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Company')}*`"
|
||||
v-model="dms.companyId"
|
||||
:options="companies"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
@input-value="companiesRef.fetch()"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Warehouse')}*`"
|
||||
v-model="dms.warehouseId"
|
||||
:options="warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@input-value="warehousesRef.fetch()"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
class="full-width q-pa-xs"
|
||||
:label="`${t('Type')}*`"
|
||||
v-model="dms.dmsTypeId"
|
||||
:options="dmsTypes"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
@input-value="dmsTypesRef.fetch()"
|
||||
:rules="[requiredFieldRule]"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QInput
|
||||
class="full-width q-pa-xs"
|
||||
type="textarea"
|
||||
size="lg"
|
||||
autogrow
|
||||
:label="`${t('Description')}*`"
|
||||
v-model="dms.description"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
:rules="[(val) => val.length || t('Required field')]"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QFile
|
||||
ref="inputFileRef"
|
||||
class="full-width q-pa-xs"
|
||||
:label="t('File')"
|
||||
v-model="dms.files"
|
||||
multiple
|
||||
:accept="allowedContentTypes.join(',')"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="attach_file_add"
|
||||
flat
|
||||
round
|
||||
padding="xs"
|
||||
@click="inputFileRef.pickFiles()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Select a file') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn icon="info" flat round padding="xs">
|
||||
<QTooltip max-width="30rem">
|
||||
{{
|
||||
`${t(
|
||||
'Allowed content types'
|
||||
)}: ${allowedContentTypes.join(', ')}`
|
||||
}}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QFile>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QCheckbox
|
||||
:label="t('Generate identifier for original file')"
|
||||
v-model="dms.hasFile"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
|
||||
<QBtn :label="t('globals.save')" color="primary" @click="upsert" />
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
.column {
|
||||
.row:not(:last-child) {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
.q-dialog {
|
||||
.q-card {
|
||||
&__section:not(:first-child) {
|
||||
.q-item {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
supplierFk: Supplier
|
||||
es:
|
||||
supplierFk: Proveedor
|
||||
Supplier ref: Ref. proveedor
|
||||
Expedition date: Fecha expedición
|
||||
Operation date: Fecha operación
|
||||
Undeductible VAT: Iva no deducible
|
||||
Document: Documento
|
||||
Download file: Descargar archivo
|
||||
Entry date: Fecha asiento
|
||||
Accounted date: Fecha contable
|
||||
Currency: Moneda
|
||||
Company: Empresa
|
||||
Edit document: Editar documento
|
||||
Reference: Referencia
|
||||
Type: Tipo
|
||||
Description: Descripción
|
||||
Generate identifier for original file: Generar identificador para archivo original
|
||||
Required field: Campo obligatorio
|
||||
File: Fichero
|
||||
Create document: Crear documento
|
||||
Select a file: Seleccione un fichero
|
||||
Allowed content types: Tipos de archivo permitidos
|
||||
The company can't be empty: La empresa no puede estar vacía
|
||||
The warehouse can't be empty: El almacén no puede estar vacío
|
||||
The DMS Type can't be empty: El dms no puede estar vacío
|
||||
The description can't be empty: La descripción no puede estar vacía
|
||||
The files can't be empty: Los archivos no pueden estar vacíos
|
||||
</i18n>
|
|
@ -0,0 +1,91 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import InvoiceInDescriptor from './InvoiceInDescriptor.vue';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { onMounted, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'supplier',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'contacts',
|
||||
scope: {
|
||||
where: {
|
||||
email: { neq: null },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'invoiceInDueDay',
|
||||
},
|
||||
{
|
||||
relation: 'company',
|
||||
},
|
||||
{
|
||||
relation: 'currency',
|
||||
},
|
||||
],
|
||||
};
|
||||
const arrayData = useArrayData('InvoiceIn', {
|
||||
url: `InvoiceIns/${route.params.id}`,
|
||||
filter,
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
await arrayData.fetch({ append: false });
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async (newId, oldId) => {
|
||||
if (newId) {
|
||||
arrayData.store.url = `InvoiceIns/${newId}`;
|
||||
await arrayData.fetch({ append: false });
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
|
||||
<VnSearchbar
|
||||
data-key="InvoiceInList"
|
||||
url="InvoiceIns/filter"
|
||||
:label="t('Search invoice')"
|
||||
:info="t('You can search by invoice reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<InvoiceInDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
<div class="q-pa-md"><RouterView></RouterView></div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search invoice: Buscar factura emitida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||
</i18n>
|
|
@ -0,0 +1,327 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const quasar = useQuasar();
|
||||
const { hasAny } = useRole();
|
||||
const { t } = useI18n();
|
||||
const { openReport, sendEmail } = usePrintService();
|
||||
const arrayData = useArrayData('InvoiceIn');
|
||||
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
const cardDescriptorRef = ref();
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const totalAmount = ref();
|
||||
const currentAction = ref();
|
||||
const config = ref();
|
||||
|
||||
const actions = {
|
||||
book: {
|
||||
title: 'Are you sure you want to book this invoice?',
|
||||
cb: checkToBook,
|
||||
action: toBook,
|
||||
},
|
||||
delete: {
|
||||
title: 'Are you sure you want to delete this invoice?',
|
||||
action: deleteInvoice,
|
||||
},
|
||||
clone: {
|
||||
title: 'Are you sure you want to clone this invoice?',
|
||||
action: cloneInvoice,
|
||||
},
|
||||
showPdf: {
|
||||
cb: showPdfInvoice,
|
||||
},
|
||||
sendPdf: {
|
||||
cb: sendPdfInvoiceConfirmation,
|
||||
},
|
||||
};
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'supplier',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'contacts',
|
||||
scope: {
|
||||
where: {
|
||||
email: { neq: null },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'invoiceInDueDay',
|
||||
},
|
||||
{
|
||||
relation: 'company',
|
||||
},
|
||||
{
|
||||
relation: 'currency',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
|
||||
async function setData(entity) {
|
||||
data.value = useCardDescription(entity.supplierRef, entity.id);
|
||||
const { totalDueDay } = await getTotals();
|
||||
totalAmount.value = totalDueDay;
|
||||
}
|
||||
|
||||
async function getTotals() {
|
||||
const { data } = await axios.get(`InvoiceIns/${entityId.value}/getTotals`);
|
||||
return data;
|
||||
}
|
||||
|
||||
function openDialog() {
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: currentAction.value.title,
|
||||
promise: currentAction.value.action,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function checkToBook() {
|
||||
let directBooking = true;
|
||||
|
||||
const totals = await getTotals();
|
||||
const taxableBaseNotEqualDueDay = totals.totalDueDay != totals.totalTaxableBase;
|
||||
const vatNotEqualDueDay = totals.totalDueDay != totals.totalVat;
|
||||
|
||||
if (taxableBaseNotEqualDueDay && vatNotEqualDueDay) directBooking = false;
|
||||
|
||||
const { data: dueDaysCount } = await axios.get('InvoiceInDueDays/count', {
|
||||
where: {
|
||||
invoiceInFk: entityId.value,
|
||||
dueDated: { gte: Date.vnNew() },
|
||||
},
|
||||
});
|
||||
|
||||
if (dueDaysCount) directBooking = false;
|
||||
|
||||
if (!directBooking) openDialog();
|
||||
else toBook();
|
||||
}
|
||||
|
||||
async function toBook() {
|
||||
await axios.post(`InvoiceIns/${entityId.value}/toBook`);
|
||||
|
||||
// Pendiente de sincronizar todo con arrayData
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('globals.dataSaved'),
|
||||
});
|
||||
|
||||
await cardDescriptorRef.value.getData();
|
||||
setTimeout(() => location.reload(), 500);
|
||||
}
|
||||
|
||||
async function deleteInvoice() {
|
||||
await axios.delete(`InvoiceIns/${entityId.value}`);
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('Invoice deleted'),
|
||||
});
|
||||
router.push({ path: '/invoice-in' });
|
||||
}
|
||||
|
||||
async function cloneInvoice() {
|
||||
const { data } = await axios.post(`InvoiceIns/${entityId.value}/clone`);
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('Invoice cloned'),
|
||||
});
|
||||
router.push({ path: `/invoice-in/${data.id}/summary` });
|
||||
}
|
||||
|
||||
const isAdministrative = () => hasAny(['administrative']);
|
||||
|
||||
const isAgricultural = () =>
|
||||
invoiceIn.value.supplier.sageWithholdingFk == config.value[0].sageWithholdingFk;
|
||||
|
||||
function showPdfInvoice() {
|
||||
if (isAgricultural()) openReport(`InvoiceIns/${entityId.value}/invoice-in-pdf`);
|
||||
}
|
||||
|
||||
function sendPdfInvoiceConfirmation() {
|
||||
quasar.dialog({
|
||||
component: SendEmailDialog,
|
||||
componentProps: {
|
||||
data: {
|
||||
address: invoiceIn.value.supplier.contacts[0].email,
|
||||
},
|
||||
promise: sendPdfInvoice,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function sendPdfInvoice({ address }) {
|
||||
if (!address)
|
||||
quasar.notify({
|
||||
type: 'negative',
|
||||
message: t(`The email can't be empty`),
|
||||
});
|
||||
else
|
||||
return sendEmail(`InvoiceIns/${entityId.value}/invoice-in-email`, {
|
||||
recipientId: invoiceIn.value.supplier.id,
|
||||
recipient: address,
|
||||
});
|
||||
}
|
||||
|
||||
function triggerMenu(type) {
|
||||
currentAction.value = actions[type];
|
||||
if (currentAction.value.cb) currentAction.value.cb();
|
||||
else openDialog(type);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="InvoiceInConfigs"
|
||||
:where="{ fields: ['sageWithholdingFk'] }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (config = data)"
|
||||
/>
|
||||
<!--Refactor para añadir en el arrayData-->
|
||||
<CardDescriptor
|
||||
ref="cardDescriptorRef"
|
||||
module="InvoiceIn"
|
||||
:url="`InvoiceIns/${entityId}`"
|
||||
:filter="filter"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
@on-fetch="setData"
|
||||
data-key="invoiceInData"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<QItem
|
||||
v-if="!entity.isBooked && isAdministrative()"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="triggerMenu('book')"
|
||||
>
|
||||
<QItemSection>{{ t('To book') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isAdministrative()"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="triggerMenu('delete')"
|
||||
>
|
||||
<QItemSection>{{ t('Delete invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isAdministrative()"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="triggerMenu('clone')"
|
||||
>
|
||||
<QItemSection>{{ t('Clone invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isAgricultural()"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="triggerMenu('showPdf')"
|
||||
>
|
||||
<QItemSection>{{ t('Show agricultural receipt as PDF') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isAgricultural()"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="triggerMenu('sendPdf')"
|
||||
>
|
||||
<QItemSection
|
||||
>{{ t('Send agricultural receipt as PDF') }}...</QItemSection
|
||||
>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="entity.dmsFk"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="downloadFile(entity.dmsFk)"
|
||||
>
|
||||
<QItemSection>{{ t('components.smartCard.downloadFile') }}</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
|
||||
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
|
||||
<VnLv :label="t('invoiceIn.card.amount')" :value="toCurrency(totalAmount)" />
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.supplier')"
|
||||
:value="entity.supplier?.nickname"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions>
|
||||
<!--Sección proveedores no disponible-->
|
||||
<!--Sección entradas no disponible-->
|
||||
<QBtn
|
||||
size="md"
|
||||
icon="vn:ticket"
|
||||
color="primary"
|
||||
:to="{
|
||||
name: 'InvoiceInList',
|
||||
query: {
|
||||
params: JSON.stringify({ supplierFk: entity.supplierFk }),
|
||||
},
|
||||
}"
|
||||
>
|
||||
<QTooltip>{{ t('invoiceOut.card.ticketList') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.q-dialog {
|
||||
.q-card {
|
||||
width: 35em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
To book: Contabilizar
|
||||
Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura?
|
||||
Delete invoice: Eliminar factura
|
||||
Are you sure you want to delete this invoice?: Estas seguro de querer eliminar esta factura?
|
||||
Invoice deleted: Factura eliminada
|
||||
Clone invoice: Clonar factura
|
||||
Invoice cloned: Factura clonada
|
||||
Show agricultural receipt as PDF: Ver recibo agrícola como PDF
|
||||
Send agricultural receipt as PDF: Enviar recibo agrícola como PDF
|
||||
Are you sure you want to send it?: Estás seguro que quieres enviarlo?
|
||||
Send PDF invoice: Enviar factura a PDF
|
||||
</i18n>
|
|
@ -0,0 +1,294 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import axios from 'axios';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const arrayData = useArrayData('InvoiceIn');
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
|
||||
const rowsSelected = ref([]);
|
||||
const banks = ref([]);
|
||||
const invoiceInFormRef = ref();
|
||||
const invoiceId = route.params.id;
|
||||
|
||||
const placeholder = 'yyyy/mm/dd';
|
||||
|
||||
const filter = {
|
||||
where: {
|
||||
invoiceInFk: invoiceId,
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'duedate',
|
||||
label: t('Date'),
|
||||
field: (row) => toDate(row.dueDated),
|
||||
sortable: true,
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'bank',
|
||||
label: t('Bank'),
|
||||
field: (row) => row.bankFk,
|
||||
options: banks.value,
|
||||
model: 'bankFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'bank',
|
||||
sortable: true,
|
||||
tabIndex: 2,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'amount',
|
||||
label: t('Amount'),
|
||||
field: (row) => row.amount,
|
||||
sortable: true,
|
||||
tabIndex: 3,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'foreignvalue',
|
||||
label: t('Foreign value'),
|
||||
field: (row) => row.foreignValue,
|
||||
sortable: true,
|
||||
tabIndex: 4,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const isNotEuro = (code) => code != 'EUR';
|
||||
|
||||
async function insert() {
|
||||
await axios.post('/InvoiceInDueDays/new ', { id: +invoiceId });
|
||||
await invoiceInFormRef.value.reload();
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData url="Banks" auto-load limit="30" @on-fetch="(data) => (banks = data)" />
|
||||
<CrudModel
|
||||
v-if="invoiceIn"
|
||||
ref="invoiceInFormRef"
|
||||
data-key="InvoiceInDueDays"
|
||||
url="InvoiceInDueDays"
|
||||
:filter="filter"
|
||||
auto-load
|
||||
:data-required="{ invoiceInFk: invoiceId }"
|
||||
v-model:selected="rowsSelected"
|
||||
@on-fetch="(data) => (areRows = !!data.length)"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
v-model:selected="rowsSelected"
|
||||
selection="multiple"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="$index"
|
||||
hide-pagination
|
||||
:grid="$q.screen.lt.sm"
|
||||
>
|
||||
<template #body-cell-duedate="{ row }">
|
||||
<QTd>
|
||||
<QInput
|
||||
v-model="row.dueDated"
|
||||
mask="date"
|
||||
:placeholder="placeholder"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="row.dueDated" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-bank="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
`${scope.opt.id}: ${scope.opt.bank}`
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-amount="{ row }">
|
||||
<QTd>
|
||||
<QInput v-model="row.amount" clearable clear-icon="close" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-foreignvalue="{ row }">
|
||||
<QTd>
|
||||
<QInput
|
||||
:class="{
|
||||
'no-pointer-events': !isNotEuro(invoiceIn.currency.code),
|
||||
}"
|
||||
:disable="!isNotEuro(invoiceIn.currency.code)"
|
||||
v-model="row.foreignValue"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
|
||||
<QCard>
|
||||
<QCardSection>
|
||||
<QCheckbox v-model="props.selected" dense />
|
||||
</QCardSection>
|
||||
<QSeparator />
|
||||
<QList>
|
||||
<QItem>
|
||||
<QInput
|
||||
class="full-width"
|
||||
:label="t('Date')"
|
||||
v-model="props.row.dueDated"
|
||||
mask="date"
|
||||
:placeholder="placeholder"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate
|
||||
v-model="props.row.dueDated"
|
||||
landscape
|
||||
>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="
|
||||
t('globals.cancel')
|
||||
"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="
|
||||
t('globals.confirm')
|
||||
"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
:label="t('Bank')"
|
||||
class="full-width"
|
||||
v-model="props.row['bankFk']"
|
||||
:options="banks"
|
||||
option-value="id"
|
||||
option-label="bank"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
`${scope.opt.id}: ${scope.opt.bank}`
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QInput
|
||||
:label="t('Amount')"
|
||||
class="full-width"
|
||||
v-model="props.row.amount"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QInput
|
||||
:label="t('Foreign value')"
|
||||
class="full-width"
|
||||
:class="{
|
||||
'no-pointer-events': !isNotEuro(
|
||||
invoiceIn.currency.code
|
||||
),
|
||||
}"
|
||||
:disable="!isNotEuro(invoiceIn.currency.code)"
|
||||
v-model="props.row.foreignValue"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn color="primary" icon="add" size="lg" round @click="insert" />
|
||||
</QPageSticky>
|
||||
</template>
|
||||
<style lang="scss" scoped></style>
|
||||
<i18n>
|
||||
es:
|
||||
Date: Fecha
|
||||
Bank: Caja
|
||||
Amount: Importe
|
||||
Foreign value: Divisa
|
||||
</i18n>
|
|
@ -0,0 +1,280 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const invoceInIntrastat = ref([]);
|
||||
const amountTotal = computed(() => getTotal('amount'));
|
||||
const netTotal = computed(() => getTotal('net'));
|
||||
const stemsTotal = computed(() => getTotal('stems'));
|
||||
const rowsSelected = ref([]);
|
||||
const countries = ref([]);
|
||||
const intrastats = ref([]);
|
||||
const invoiceInFormRef = ref();
|
||||
|
||||
const filter = {
|
||||
where: {
|
||||
invoiceInFk: route.params.id,
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'code',
|
||||
label: t('Code'),
|
||||
field: (row) => row.intrastatFk,
|
||||
options: intrastats.value,
|
||||
model: 'intrastatFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
sortable: true,
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'amount',
|
||||
label: t('amount'),
|
||||
field: (row) => row.amount,
|
||||
sortable: true,
|
||||
tabIndex: 2,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'net',
|
||||
label: t('net'),
|
||||
field: (row) => row.net,
|
||||
sortable: true,
|
||||
tabIndex: 3,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'stems',
|
||||
label: t('stems'),
|
||||
field: (row) => row.stems,
|
||||
sortable: true,
|
||||
tabIndex: 4,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'country',
|
||||
label: t('country'),
|
||||
field: (row) => row.countryFk,
|
||||
options: countries.value,
|
||||
model: 'countryFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'code',
|
||||
sortable: true,
|
||||
tabIndex: 5,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
function getTotal(type) {
|
||||
if (!invoceInIntrastat.value.length) return 0.0;
|
||||
return invoceInIntrastat.value.reduce(
|
||||
(total, intrastat) => total + intrastat[type],
|
||||
0.0
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Countries"
|
||||
auto-load
|
||||
@on-fetch="(data) => (countries = data)"
|
||||
sort-by="country"
|
||||
/>
|
||||
<FetchData
|
||||
url="Intrastats"
|
||||
sort-by="id"
|
||||
auto-load
|
||||
@on-fetch="(data) => (intrastats = data)"
|
||||
/>
|
||||
<div class="invoiceIn-intrastat">
|
||||
<QCard v-if="invoceInIntrastat.length" class="full-width q-mb-md q-pa-sm">
|
||||
<QItem class="justify-end">
|
||||
<div>
|
||||
<QItemLabel>
|
||||
<VnLv
|
||||
:label="t('Total amount')"
|
||||
:value="toCurrency(amountTotal)"
|
||||
/>
|
||||
</QItemLabel>
|
||||
<QItemLabel>
|
||||
<VnLv :label="t('Total net')" :value="netTotal" />
|
||||
</QItemLabel>
|
||||
<QItemLabel>
|
||||
<VnLv :label="t('Total stems')" :value="stemsTotal" />
|
||||
</QItemLabel>
|
||||
</div>
|
||||
</QItem>
|
||||
</QCard>
|
||||
<CrudModel
|
||||
ref="invoiceInFormRef"
|
||||
data-key="InvoiceInIntrastats"
|
||||
url="InvoiceInIntrastats"
|
||||
auto-load
|
||||
:data-required="{ invoiceInFk: route.params.id }"
|
||||
:filter="filter"
|
||||
v-model:selected="rowsSelected"
|
||||
@on-fetch="(data) => (invoceInIntrastat = data)"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
v-model:selected="rowsSelected"
|
||||
selection="multiple"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="$index"
|
||||
hide-pagination
|
||||
:grid="$q.screen.lt.sm"
|
||||
>
|
||||
<template #body-cell="{ row, col }">
|
||||
<QTd>
|
||||
<QInput
|
||||
v-model="row[col.name]"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-code="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
option-value="id"
|
||||
option-label="description"
|
||||
:filter-options="['id', 'description']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
{{ `${scope.opt.id}: ${scope.opt.description}` }}
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-country="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
|
||||
<QCard>
|
||||
<QCardSection>
|
||||
<QCheckbox v-model="props.selected" dense />
|
||||
</QCardSection>
|
||||
<QSeparator />
|
||||
<QList>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
:label="t('code')"
|
||||
class="full-width"
|
||||
v-model="props.row['intrastatFk']"
|
||||
:options="intrastats"
|
||||
option-value="id"
|
||||
option-label="description"
|
||||
:filter-options="['id', 'description']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
{{
|
||||
`${scope.opt.id}: ${scope.opt.description}`
|
||||
}}
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-for="(value, index) of [
|
||||
'amount',
|
||||
'net',
|
||||
'stems',
|
||||
]"
|
||||
:key="index"
|
||||
>
|
||||
<QInput
|
||||
:label="t(value)"
|
||||
class="full-width"
|
||||
v-model="props.row[value]"
|
||||
clearable
|
||||
clear-icon="close"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
:label="t('country')"
|
||||
class="full-width"
|
||||
v-model="props.row['countryFk']"
|
||||
:options="countries"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
/>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</div>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon="add"
|
||||
size="lg"
|
||||
round
|
||||
@click="invoiceInFormRef.insert()"
|
||||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
<style lang="scss">
|
||||
.invoiceIn-intrastat {
|
||||
> .q-card {
|
||||
.vn-label-value {
|
||||
display: flex;
|
||||
gap: 1em;
|
||||
|
||||
.label {
|
||||
flex: 1;
|
||||
}
|
||||
.value {
|
||||
flex: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
<i18n>
|
||||
en:
|
||||
amount: Amount
|
||||
net: Net
|
||||
stems: Stems
|
||||
country: Country
|
||||
es:
|
||||
Code: Código
|
||||
amount: Cantidad
|
||||
net: Neto
|
||||
stems: Tallos
|
||||
country: País
|
||||
Total amount: Total importe
|
||||
Total net: Total neto
|
||||
Total stems: Total tallos
|
||||
</i18n>
|
|
@ -0,0 +1,428 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
onMounted(async () => {
|
||||
salixUrl.value = await getUrl('');
|
||||
invoiceInUrl.value = salixUrl.value + `invoiceIn/${entityId.value}/`;
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
|
||||
const salixUrl = ref();
|
||||
const invoiceInUrl = ref();
|
||||
const amountsNotMatch = ref(null);
|
||||
const intrastatTotals = ref({});
|
||||
|
||||
const vatColumns = ref([
|
||||
{
|
||||
name: 'expense',
|
||||
label: 'invoiceIn.summary.expense',
|
||||
field: (row) => row.expenseFk,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'landed',
|
||||
label: 'invoiceIn.summary.taxableBase',
|
||||
field: (row) => row.taxableBase,
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'vat',
|
||||
label: 'invoiceIn.summary.sageVat',
|
||||
field: (row) => row.taxTypeSage?.vat,
|
||||
format: (value) => value,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'transaction',
|
||||
label: 'invoiceIn.summary.sageTransaction',
|
||||
field: (row) => row.transactionTypeSage?.transaction,
|
||||
format: (value) => value,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'rate',
|
||||
label: 'invoiceIn.summary.rate',
|
||||
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'currency',
|
||||
label: 'invoiceIn.summary.currency',
|
||||
field: (row) => row.foreignValue,
|
||||
format: (value) => value,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const dueDayColumns = ref([
|
||||
{
|
||||
name: 'date',
|
||||
label: 'invoiceIn.summary.dueDay',
|
||||
field: (row) => toDate(row.dueDated),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'bank',
|
||||
label: 'invoiceIn.summary.bank',
|
||||
field: (row) => row.bank.bank,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'amount',
|
||||
label: 'invoiceIn.summary.amount',
|
||||
field: (row) => row.amount,
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'landed',
|
||||
label: 'invoiceIn.summary.foreignValue',
|
||||
field: (row) => row.foreignValue,
|
||||
format: (value) => value,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const intrastatColumns = ref([
|
||||
{
|
||||
name: 'code',
|
||||
label: 'invoiceIn.summary.code',
|
||||
field: (row) => {
|
||||
return `${row.intrastat.id}: ${row.intrastat?.description}`;
|
||||
},
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'amount',
|
||||
label: 'invoiceIn.summary.amount',
|
||||
field: (row) => toCurrency(row.amount),
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'net',
|
||||
label: 'invoiceIn.summary.net',
|
||||
field: (row) => row.net,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'stems',
|
||||
label: 'invoiceIn.summary.stems',
|
||||
field: (row) => row.stems,
|
||||
format: (value) => value,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'landed',
|
||||
label: 'invoiceIn.summary.country',
|
||||
field: (row) => row.country?.code,
|
||||
format: (value) => value,
|
||||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
function getAmountNotMatch(totals) {
|
||||
return (
|
||||
totals.totalDueDay != totals.totalTaxableBase &&
|
||||
totals.totalDueDay != totals.totalVat
|
||||
);
|
||||
}
|
||||
|
||||
function getIntrastatTotals(intrastat) {
|
||||
const totals = {
|
||||
amount: intrastat.reduce((acc, cur) => acc + cur.amount, 0),
|
||||
net: intrastat.reduce((acc, cur) => acc + cur.net, 0),
|
||||
stems: intrastat.reduce((acc, cur) => acc + cur.stems, 0),
|
||||
};
|
||||
|
||||
return totals;
|
||||
}
|
||||
|
||||
function getTaxTotal(tax) {
|
||||
return tax.reduce(
|
||||
(acc, cur) => acc + taxRate(cur.taxableBase, cur.taxTypeSage?.rate),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
function setData(entity) {
|
||||
if (!entity) return false;
|
||||
|
||||
amountsNotMatch.value = getAmountNotMatch(entity.totals);
|
||||
|
||||
if (entity.invoiceInIntrastat.length)
|
||||
intrastatTotals.value = { ...getIntrastatTotals(entity.invoiceInIntrastat) };
|
||||
}
|
||||
|
||||
function taxRate(taxableBase = 0, rate = 0) {
|
||||
return (rate / 100) * taxableBase;
|
||||
}
|
||||
|
||||
function getLink(param) {
|
||||
return `#/invoice-in/${entityId.value}/${param}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summary"
|
||||
:url="`InvoiceIns/${entityId}/summary`"
|
||||
@on-fetch="(data) => setData(data)"
|
||||
>
|
||||
<template #header="{ entity: invoiceIn }">
|
||||
<div>{{ invoiceIn.id }} - {{ invoiceIn.supplier.name }}</div>
|
||||
</template>
|
||||
<template #body="{ entity: invoiceIn }">
|
||||
<!--Basic Data-->
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<a class="header" :href="getLink('basic-data')">
|
||||
{{ t('invoiceIn.pageTitles.basicData') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
</QCardSection>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.supplier')"
|
||||
:value="invoiceIn.supplier.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.supplierRef')"
|
||||
:value="invoiceIn.supplierRef"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.currency')"
|
||||
:value="invoiceIn.currency.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.docNumber')"
|
||||
:value="`${invoiceIn.serial}/${invoiceIn.serialNumber}`"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<a class="header" :href="getLink('basic-data')">
|
||||
{{ t('invoiceIn.pageTitles.basicData') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
</QCardSection>
|
||||
<VnLv
|
||||
:ellipsis-value="false"
|
||||
:label="t('invoiceIn.summary.issued')"
|
||||
:value="toDate(invoiceIn.issued)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.operated')"
|
||||
:value="toDate(invoiceIn.operated)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.bookEntried')"
|
||||
:value="toDate(invoiceIn.bookEntried)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.bookedDate')"
|
||||
:value="toDate(invoiceIn.booked)"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<a class="header" :href="getLink('basic-data')">
|
||||
{{ t('invoiceIn.pageTitles.basicData') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
</QCardSection>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.sage')"
|
||||
:value="invoiceIn.sageWithholding.withholding"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.vat')"
|
||||
:value="invoiceIn.expenseDeductible?.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.company')"
|
||||
:value="invoiceIn.company.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.booked')"
|
||||
:value="invoiceIn.isBooked"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<a class="header" :href="getLink('basic-data')">
|
||||
{{ t('invoiceIn.pageTitles.basicData') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pa-none">
|
||||
<div class="bordered q-px-sm q-mx-auto">
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.taxableBase')"
|
||||
:value="toCurrency(invoiceIn.totals.totalTaxableBase)"
|
||||
/>
|
||||
<VnLv
|
||||
label="Total"
|
||||
:value="toCurrency(invoiceIn.totals.totalVat)"
|
||||
/>
|
||||
<VnLv :label="t('invoiceIn.summary.dueTotal')">
|
||||
<template #value>
|
||||
<QChip
|
||||
dense
|
||||
class="q-pa-xs"
|
||||
:color="amountsNotMatch ? 'negative' : 'transparent'"
|
||||
:title="
|
||||
amountsNotMatch
|
||||
? t('invoiceIn.summary.noMatch')
|
||||
: t('invoiceIn.summary.dueTotal')
|
||||
"
|
||||
>
|
||||
{{ toCurrency(invoiceIn.totals.totalDueDay) }}
|
||||
</QChip>
|
||||
</template>
|
||||
</VnLv>
|
||||
</div>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<!--Vat-->
|
||||
<QCard v-if="invoiceIn.invoiceInTax.length">
|
||||
<a class="header" :href="getLink('vat')">
|
||||
{{ t('invoiceIn.card.vat') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<QTable
|
||||
:columns="vatColumns"
|
||||
:rows="invoiceIn.invoiceInTax"
|
||||
flat
|
||||
hide-pagination
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr :props="props" class="bg">
|
||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #bottom-row>
|
||||
<QTr class="bg">
|
||||
<QTd></QTd>
|
||||
<QTd>{{ toCurrency(invoiceIn.totals.totalTaxableBase) }}</QTd>
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd>{{
|
||||
toCurrency(getTaxTotal(invoiceIn.invoiceInTax))
|
||||
}}</QTd>
|
||||
<QTd></QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
<!--Due Day-->
|
||||
<QCard v-if="invoiceIn.invoiceInDueDay.length">
|
||||
<a class="header" :href="getLink('due-day')">
|
||||
{{ t('invoiceIn.card.dueDay') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<QTable
|
||||
class="full-width"
|
||||
:columns="dueDayColumns"
|
||||
:rows="invoiceIn.invoiceInDueDay"
|
||||
flat
|
||||
hide-pagination
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr :props="props" class="bg">
|
||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #bottom-row>
|
||||
<QTr class="bg">
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd>{{ toCurrency(invoiceIn.totals.totalDueDay) }}</QTd>
|
||||
<QTd></QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
<!--Intrastat-->
|
||||
<QCard v-if="invoiceIn.invoiceInIntrastat.length">
|
||||
<a class="header" :href="getUrl('intrastat')">
|
||||
{{ t('invoiceIn.card.intrastat') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<QTable
|
||||
:columns="intrastatColumns"
|
||||
:rows="invoiceIn.invoiceInIntrastat"
|
||||
flat
|
||||
hide-pagination
|
||||
>
|
||||
<template #header="props">
|
||||
<QTr :props="props" class="bg">
|
||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||
{{ t(col.label) }}
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #bottom-row>
|
||||
<QTr class="bg">
|
||||
<QTd></QTd>
|
||||
<QTd>{{ toCurrency(intrastatTotals.amount) }}</QTd>
|
||||
<QTd>{{ intrastatTotals.net }}</QTd>
|
||||
<QTd>{{ intrastatTotals.stems }}</QTd>
|
||||
<QTd></QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.bg {
|
||||
background-color: var(--vn-light-gray);
|
||||
}
|
||||
.bordered {
|
||||
border: 1px solid var(--vn-text);
|
||||
max-width: 18em;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Search invoice: Buscar factura emitida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||
</i18n>
|
|
@ -0,0 +1,29 @@
|
|||
<script setup>
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import InvoiceInSummary from './InvoiceInSummary.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
defineEmits([...useDialogPluginComponent.emits]);
|
||||
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide">
|
||||
<InvoiceInSummary v-if="$props.id" :id="$props.id" />
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-dialog .summary .header {
|
||||
position: sticky;
|
||||
z-index: $z-max;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,500 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import axios from 'axios';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
|
||||
const arrayData = useArrayData('InvoiceIn');
|
||||
const invoiceIn = computed(() => arrayData.store.data);
|
||||
|
||||
const expenses = ref([]);
|
||||
const sageTaxTypes = ref([]);
|
||||
const sageTransactionTypes = ref([]);
|
||||
const rowsSelected = ref([]);
|
||||
const newExpense = ref({
|
||||
code: undefined,
|
||||
isWithheld: false,
|
||||
description: undefined,
|
||||
});
|
||||
|
||||
const invoiceInFormRef = ref();
|
||||
const expensesRef = ref();
|
||||
const newExpenseRef = ref();
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'expense',
|
||||
label: t('Expense'),
|
||||
field: (row) => row.expenseFk,
|
||||
options: expenses.value,
|
||||
model: 'expenseFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'id',
|
||||
sortable: true,
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'taxablebase',
|
||||
label: t('Taxable base'),
|
||||
field: (row) => toCurrency(row.taxableBase),
|
||||
model: 'taxableBase',
|
||||
sortable: true,
|
||||
tabIndex: 2,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'sageiva',
|
||||
label: t('Sage iva'),
|
||||
field: (row) => row.taxTypeSageFk,
|
||||
options: sageTaxTypes.value,
|
||||
model: 'taxTypeSageFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'vat',
|
||||
sortable: true,
|
||||
tabindex: 3,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'sagetransaction',
|
||||
label: t('Sage transaction'),
|
||||
field: (row) => row.transactionTypeSageFk,
|
||||
options: sageTransactionTypes.value,
|
||||
model: 'transactionTypeSageFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'transaction',
|
||||
sortable: true,
|
||||
tabIndex: 4,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'rate',
|
||||
label: t('Rate'),
|
||||
sortable: true,
|
||||
tabIndex: 5,
|
||||
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk)),
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'foreignvalue',
|
||||
label: t('Foreign value'),
|
||||
sortable: true,
|
||||
tabIndex: 6,
|
||||
field: (row) => row.foreignValue,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const filter = {
|
||||
fields: [
|
||||
'id',
|
||||
'invoiceInFk',
|
||||
'taxableBase',
|
||||
'expenseFk',
|
||||
'foreignValue',
|
||||
'taxTypeSageFk',
|
||||
'transactionTypeSageFk',
|
||||
],
|
||||
where: {
|
||||
invoiceInFk: route.params.id,
|
||||
},
|
||||
};
|
||||
|
||||
const isNotEuro = (code) => code != 'EUR';
|
||||
|
||||
function taxRate(invoiceInTax) {
|
||||
const sageTaxTypeId = invoiceInTax.taxTypeSageFk;
|
||||
const taxRateSelection = sageTaxTypes.value.find(
|
||||
(transaction) => transaction.id == sageTaxTypeId
|
||||
);
|
||||
const taxTypeSage = taxRateSelection?.rate ?? 0;
|
||||
const taxableBase = invoiceInTax?.taxableBase ?? 0;
|
||||
|
||||
return (taxTypeSage / 100) * taxableBase;
|
||||
}
|
||||
|
||||
async function addExpense() {
|
||||
try {
|
||||
if (!newExpense.value.code) throw new Error(t(`The code can't be empty`));
|
||||
if (isNaN(newExpense.value.code))
|
||||
throw new Error(t(`The code have to be a number`));
|
||||
if (!newExpense.value.description)
|
||||
throw new Error(t(`The description can't be empty`));
|
||||
|
||||
const data = [
|
||||
{
|
||||
id: newExpense.value.code,
|
||||
isWithheld: newExpense.value.isWithheld,
|
||||
name: newExpense.value.description,
|
||||
},
|
||||
];
|
||||
|
||||
await axios.post(`Expenses`, data);
|
||||
await expensesRef.value.fetch();
|
||||
quasar.notify({
|
||||
type: 'positive',
|
||||
message: t('globals.dataSaved'),
|
||||
});
|
||||
newExpenseRef.value.hide();
|
||||
} catch (error) {
|
||||
quasar.notify({
|
||||
type: 'negative',
|
||||
message: t(`${error.message}`),
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
ref="expensesRef"
|
||||
url="Expenses"
|
||||
auto-load
|
||||
@on-fetch="(data) => (expenses = data)"
|
||||
/>
|
||||
<FetchData url="SageTaxTypes" auto-load @on-fetch="(data) => (sageTaxTypes = data)" />
|
||||
<FetchData
|
||||
url="sageTransactionTypes"
|
||||
auto-load
|
||||
@on-fetch="(data) => (sageTransactionTypes = data)"
|
||||
/>
|
||||
<CrudModel
|
||||
ref="invoiceInFormRef"
|
||||
v-if="invoiceIn"
|
||||
data-key="InvoiceInTaxes"
|
||||
url="InvoiceInTaxes"
|
||||
:filter="filter"
|
||||
:data-required="{ invoiceInFk: route.params.id }"
|
||||
auto-load
|
||||
v-model:selected="rowsSelected"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
v-model:selected="rowsSelected"
|
||||
selection="multiple"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="$index"
|
||||
hide-pagination
|
||||
:grid="$q.screen.lt.sm"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
>
|
||||
<template #body-cell-expense="{ row, col }">
|
||||
<QTd auto-width>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'name']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
||||
</QItem>
|
||||
</template>
|
||||
<template #append>
|
||||
<QIcon
|
||||
name="close"
|
||||
@click.stop="value = null"
|
||||
class="cursor-pointer"
|
||||
/>
|
||||
<QBtn
|
||||
padding="xs"
|
||||
round
|
||||
flat
|
||||
icon="add_circle"
|
||||
@click.stop="newExpenseRef.show()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Create expense') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-taxablebase="{ row }">
|
||||
<QTd>
|
||||
<QInput
|
||||
:class="{
|
||||
'no-pointer-events': isNotEuro(invoiceIn.currency.code),
|
||||
}"
|
||||
:disable="isNotEuro(invoiceIn.currency.code)"
|
||||
label=""
|
||||
clear-icon="close"
|
||||
v-model="row.taxableBase"
|
||||
clearable
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="euro" size="xs" flat />
|
||||
</template>
|
||||
</QInput>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-sageiva="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'vat']"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
input-debounce="0"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt.vat }}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ `#${scope.opt.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-sagetransaction="{ row, col }">
|
||||
<QTd>
|
||||
<VnSelectFilter
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:filter-options="['id', 'transaction']"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
input-debounce="0"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
scope.opt.transaction
|
||||
}}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ `#${scope.opt.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-foreignvalue="{ row }">
|
||||
<QTd>
|
||||
<QInput
|
||||
:class="{
|
||||
'no-pointer-events': !isNotEuro(invoiceIn.currency.code),
|
||||
}"
|
||||
:disable="!isNotEuro(invoiceIn.currency.code)"
|
||||
v-model="row.foreignValue"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
|
||||
<QCard bordered flat class="q-my-xs">
|
||||
<QCardSection>
|
||||
<QCheckbox v-model="props.selected" dense />
|
||||
</QCardSection>
|
||||
<QSeparator />
|
||||
<QList>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
:label="t('Expense')"
|
||||
class="full-width"
|
||||
v-model="props.row['expenseFk']"
|
||||
:options="expenses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:filter-options="['id', 'name']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
{{ `${scope.opt.id}: ${scope.opt.name}` }}
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QInput
|
||||
:label="t('Taxable base')"
|
||||
:class="{
|
||||
'no-pointer-events': isNotEuro(
|
||||
invoiceIn.currency.code
|
||||
),
|
||||
}"
|
||||
class="full-width"
|
||||
:disable="isNotEuro(invoiceIn.currency.code)"
|
||||
clear-icon="close"
|
||||
v-model="props.row.taxableBase"
|
||||
clearable
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="euro" size="xs" flat />
|
||||
</template>
|
||||
</QInput>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
:label="t('Sage iva')"
|
||||
class="full-width"
|
||||
v-model="props.row['taxTypeSageFk']"
|
||||
:options="sageTaxTypes"
|
||||
option-value="id"
|
||||
option-label="vat"
|
||||
:filter-options="['id', 'vat']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
scope.opt.vat
|
||||
}}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ `#${scope.opt.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<VnSelectFilter
|
||||
class="full-width"
|
||||
v-model="props.row['transactionTypeSageFk']"
|
||||
:options="sageTransactionTypes"
|
||||
option-value="id"
|
||||
option-label="transaction"
|
||||
:filter-options="['id', 'transaction']"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
scope.opt.transaction
|
||||
}}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ `#${scope.opt.id}` }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelectFilter>
|
||||
</QItem>
|
||||
<QItem>
|
||||
{{ toCurrency(taxRate(props.row)) }}
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QInput
|
||||
:label="t('Foreign value')"
|
||||
class="full-width"
|
||||
:class="{
|
||||
'no-pointer-events': !isNotEuro(
|
||||
invoiceIn.currency.code
|
||||
),
|
||||
}"
|
||||
:disable="!isNotEuro(invoiceIn.currency.code)"
|
||||
v-model="props.row.foreignValue"
|
||||
/>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QDialog ref="newExpenseRef">
|
||||
<QCard>
|
||||
<QCardSection class="q-pb-none">
|
||||
<QItem class="q-pa-none">
|
||||
<span class="text-primary text-h6 full-width">
|
||||
<QIcon name="edit" class="q-mr-xs" />
|
||||
{{ t('New expense') }}
|
||||
</span>
|
||||
<QBtn icon="close" flat round dense v-close-popup />
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pt-none">
|
||||
<QItem>
|
||||
<QInput :label="`${t('Code')}*`" v-model="newExpense.code" />
|
||||
<QCheckbox
|
||||
dense
|
||||
size="sm"
|
||||
:label="`${t('It\'s a withholding')}`"
|
||||
v-model="newExpense.isWithheld"
|
||||
/>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QInput
|
||||
:label="`${t('Descripction')}*`"
|
||||
v-model="newExpense.description"
|
||||
/>
|
||||
</QItem>
|
||||
</QCardSection>
|
||||
<QCardActions class="justify-end">
|
||||
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
|
||||
<QBtn :label="t('globals.save')" color="primary" @click="addExpense" />
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon="add"
|
||||
size="lg"
|
||||
round
|
||||
@click="invoiceInFormRef.insert()"
|
||||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
.q-dialog {
|
||||
.q-card {
|
||||
&__section:not(:first-child) {
|
||||
.q-item {
|
||||
flex-direction: column;
|
||||
|
||||
.q-checkbox {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.q-item {
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Expense: Gasto
|
||||
Create expense: Crear gasto
|
||||
Add tax: Crear gasto
|
||||
Taxable base: Base imp.
|
||||
Sage tax: Sage iva
|
||||
Sage transaction: Sage transacción
|
||||
Rate: Tasa
|
||||
Foreign value: Divisa
|
||||
New expense: Nuevo gasto
|
||||
Code: Código
|
||||
It's a withholding: Es una retención
|
||||
Descripction: Descripción
|
||||
The code can't be empty: El código no puede estar vacío
|
||||
The description can't be empty: La descripción no puede estar vacía
|
||||
The code have to be a number: El código debe ser un número.
|
||||
</i18n>
|
|
@ -0,0 +1,307 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const suppliers = ref([]);
|
||||
const suppliersRef = ref();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="suppliersRef"
|
||||
url="Suppliers"
|
||||
:filter="{ fields: ['id', 'nickname'] }"
|
||||
order="nickname"
|
||||
limit="30"
|
||||
@on-fetch="(data) => (suppliers = data)"
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<QList dense>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('Id or Supplier')" v-model="params.search">
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('params.supplierRef')"
|
||||
v-model="params.supplierRef"
|
||||
@input.
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="vn:client" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.supplierFk')"
|
||||
v-model="params.supplierFk"
|
||||
:options="suppliers"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
@input-value="suppliersRef.fetch()"
|
||||
>
|
||||
</VnSelectFilter>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('params.fi')" v-model="params.fi" lazy-rules>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('params.serialNumber')"
|
||||
v-model="params.serialNumber"
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('params.serial')"
|
||||
v-model="params.serial"
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('Amount')" v-model="params.amount" lazy-rules>
|
||||
<template #prepend>
|
||||
<QIcon name="euro" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-md">
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.isBooked')"
|
||||
v-model="params.isBooked"
|
||||
@update:model-value="searchFn()"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QExpansionItem :label="t('More options')" expand-separator>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('params.awb')"
|
||||
v-model="params.awbCode"
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('params.account')"
|
||||
v-model="params.account"
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="person" size="sm" />
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('From')" v-model="params.from" mask="date">
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.from" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('To')" v-model="params.to" mask="date">
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.to" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Issued')"
|
||||
v-model="params.issued"
|
||||
mask="date"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.issued" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
search: ID
|
||||
supplierRef: Supplier ref.
|
||||
supplierFk: Supplier
|
||||
fi: Supplier fiscal id
|
||||
clientFk: Customer
|
||||
amount: Amount
|
||||
created: Created
|
||||
awb: AWB
|
||||
dued: Dued
|
||||
serialNumber: Serial Number
|
||||
serial: Serial
|
||||
account: Account
|
||||
isBooked: is booked
|
||||
es:
|
||||
params:
|
||||
search: Contiene
|
||||
supplierRef: Ref. proveedor
|
||||
supplierFk: Proveedor
|
||||
clientFk: Cliente
|
||||
fi: CIF proveedor
|
||||
serialNumber: Num. serie
|
||||
serial: Serie
|
||||
awb: AWB
|
||||
amount: Importe
|
||||
issued: Emitida
|
||||
isBooked: Conciliada
|
||||
account: Cuenta
|
||||
created: Creada
|
||||
dued: Vencida
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Amount: Importe
|
||||
Issued: Fecha factura
|
||||
Id or supplier: Id o proveedor
|
||||
More options: Más opciones
|
||||
</i18n>
|
|
@ -0,0 +1,179 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { downloadFile } from 'src/composables/downloadFile';
|
||||
import { toDate, toCurrency } from 'src/filters/index';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import InvoiceInFilter from './InvoiceInFilter.vue';
|
||||
import InvoiceInSummaryDialog from './Card/InvoiceInSummaryDialog.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const quasar = useQuasar();
|
||||
let url = ref();
|
||||
const { t } = useI18n();
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
url.value = await getUrl('');
|
||||
});
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/invoice-in/${id}` });
|
||||
}
|
||||
|
||||
function viewSummary(id) {
|
||||
quasar.dialog({
|
||||
component: InvoiceInSummaryDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="InvoiceInList"
|
||||
:label="t('Search invoice')"
|
||||
:info="t('You can search by invoice reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
<Teleport to="#actions-append">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<QBtn
|
||||
flat
|
||||
@click="stateStore.toggleRightDrawer()"
|
||||
round
|
||||
dense
|
||||
icon="menu"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.collapseMenu') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<InvoiceInFilter data-key="InvoiceInList" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<VnPaginate
|
||||
data-key="InvoiceInList"
|
||||
url="InvoiceIns/filter"
|
||||
order="issued DESC, id DESC"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:title="row.supplierRef"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv label="ID" :value="row.id" />
|
||||
<VnLv
|
||||
:label="t('invoiceIn.list.supplierRef')"
|
||||
:value="row.supplierRef"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.list.supplier')"
|
||||
:value="row.supplierName"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.list.serialNumber')"
|
||||
:value="row.serialNumber"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.list.serial')"
|
||||
:value="row.serial"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.list.issued')"
|
||||
:value="toDate(row.issued)"
|
||||
/>
|
||||
<VnLv :label="t('invoiceIn.list.awb')" :value="row.awbCode" />
|
||||
<VnLv
|
||||
:label="t('invoiceIn.list.amount')"
|
||||
:value="toCurrency(row.amount)"
|
||||
/>
|
||||
<VnLv :label="t('invoiceIn.list.isBooked')">
|
||||
<template #value>
|
||||
<QCheckbox
|
||||
class="no-pointer-events"
|
||||
v-model="row.isBooked"
|
||||
size="xs"
|
||||
:true-value="1"
|
||||
:false-value="0"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
flat
|
||||
icon="arrow_circle_right"
|
||||
@click.stop="navigate(row.id)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openCard') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openSummary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
flat
|
||||
icon="cloud_download"
|
||||
@click.stop="downloadFile(row.dmsFk)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.downloadFile') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
</QPage>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon="add"
|
||||
size="lg"
|
||||
round
|
||||
:href="`${url}invoice-in/create`"
|
||||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Search invoice: Buscar factura emitida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||
</i18n>
|
|
@ -0,0 +1,17 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import LeftMenu from 'src/components/LeftMenu.vue';
|
||||
|
||||
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>
|
|
@ -7,6 +7,7 @@ import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
|||
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import InvoiceOutDescriptorMenu from './InvoiceOutDescriptorMenu.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -59,12 +60,12 @@ const setData = (entity) => (data.value = useCardDescription(entity.ref, entity.
|
|||
@on-fetch="setData"
|
||||
data-key="invoiceOutData"
|
||||
>
|
||||
<template #menu="{ entity }">
|
||||
<InvoiceOutDescriptorMenu :invoice-out="entity" />
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('invoiceOut.card.issued')" :value="toDate(entity.issued)" />
|
||||
<VnLv
|
||||
:label="t('invoiceOut.card.amount')"
|
||||
:value="toCurrency(entity.amount)"
|
||||
/>
|
||||
<VnLv :label="t('globals.amount')" :value="toCurrency(entity.amount)" />
|
||||
<VnLv v-if="entity.client" :label="t('invoiceOut.card.client')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('Transfer invoice to') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('See invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('Send invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('Delete invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('Post invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('Regenerate invoice PDF') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection>{{ t('Pass') }}</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Transfer invoice to: Transferir factura a
|
||||
See invoice: Ver factura
|
||||
Send invoice: Enviar factura
|
||||
Delete invoice: Eliminar factura
|
||||
Post invoice: Asentar factura
|
||||
Regenerate invoice PDF: Regenerar PDF factura
|
||||
Pass: Abono
|
||||
</i18n>
|
|
@ -3,6 +3,7 @@ import { ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -43,66 +44,72 @@ function setWorkers(data) {
|
|||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Customer ID')"
|
||||
v-model="params.clientFk"
|
||||
class="q-mt-sm"
|
||||
dense
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="vn:client" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('FI')" v-model="params.fi" lazy-rules>
|
||||
<template #prepend>
|
||||
<QIcon name="badge" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('Amount')" v-model="params.amount" lazy-rules>
|
||||
<template #prepend>
|
||||
<QIcon name="euro" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
outlined
|
||||
rounded
|
||||
v-model="params.clientFk"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('FI')"
|
||||
class="q-mt-sm"
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
rounded
|
||||
v-model="params.fi"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Amount')"
|
||||
class="q-mt-sm"
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
rounded
|
||||
v-model="params.amount"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mt-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Min')"
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
rounded
|
||||
type="number"
|
||||
v-model.number="params.min"
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="euro" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Max')"
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
rounded
|
||||
type="number"
|
||||
v-model.number="params.max"
|
||||
lazy-rules
|
||||
>
|
||||
<template #prepend>
|
||||
<QIcon name="euro" size="sm"></QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-md">
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
v-model="params.hasPdf"
|
||||
@update:model-value="searchFn()"
|
||||
:label="t('Has PDF')"
|
||||
@update:model-value="searchFn()"
|
||||
toggle-indeterminate
|
||||
v-model="params.hasPdf"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
@ -110,115 +117,35 @@ function setWorkers(data) {
|
|||
<QExpansionItem :label="t('More options')" expand-separator>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Issued')"
|
||||
<VnInputDate
|
||||
v-model="params.issued"
|
||||
mask="date"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.issued" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
:label="t('Issued')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('Created')"
|
||||
<VnInputDate
|
||||
v-model="params.created"
|
||||
mask="date"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.created" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
:label="t('Created')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput :label="t('Dued')" v-model="params.dued" mask="date">
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.dued" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
<VnInputDate
|
||||
v-model="params.dued"
|
||||
:label="t('Dued')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QExpansionItem>
|
||||
|
|
|
@ -0,0 +1,198 @@
|
|||
<script setup>
|
||||
import { onMounted, onUnmounted, computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import InvoiceOutGlobalForm from './InvoiceOutGlobalForm.vue';
|
||||
import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { QBadge, QBtn } from 'quasar';
|
||||
import CustomerDescriptor from 'src/pages/Customer/Card/CustomerDescriptor.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const invoiceOutGlobalStore = useInvoiceOutGlobalStore();
|
||||
|
||||
// invoiceOutGlobalStore state and getters
|
||||
const {
|
||||
status,
|
||||
getPercentage,
|
||||
getAddressNumber,
|
||||
getNAddresses,
|
||||
nPdfs,
|
||||
totalPdfs,
|
||||
errors,
|
||||
} = storeToRefs(invoiceOutGlobalStore);
|
||||
|
||||
const selectedCustomerId = ref(null);
|
||||
|
||||
const tableColumnComponents = {
|
||||
clientId: {
|
||||
component: QBtn,
|
||||
props: { flat: true, color: 'blue' },
|
||||
event: (prop) => selectCustomerId(prop.value),
|
||||
},
|
||||
clientName: {
|
||||
component: 'span',
|
||||
props: {},
|
||||
},
|
||||
id: {
|
||||
component: 'span',
|
||||
props: {},
|
||||
},
|
||||
nickname: {
|
||||
component: 'span',
|
||||
props: {},
|
||||
},
|
||||
message: {
|
||||
component: QBadge,
|
||||
props: { color: 'red' },
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => {
|
||||
return [
|
||||
{ label: 'Id', field: 'clientId', name: 'clientId', align: 'left' },
|
||||
{
|
||||
label: t('invoiceOut.globalInvoices.table.client'),
|
||||
field: 'clientName',
|
||||
name: 'clientName',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('invoiceOut.globalInvoices.table.addressId'),
|
||||
field: 'id',
|
||||
name: 'id',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('invoiceOut.globalInvoices.table.streetAddress'),
|
||||
field: 'nickname',
|
||||
name: 'nickname',
|
||||
align: 'left',
|
||||
},
|
||||
{ label: 'Error', field: 'message', name: 'message', align: 'left' },
|
||||
];
|
||||
});
|
||||
|
||||
const rows = computed(() => {
|
||||
if (!errors && !errors.length > 0) return [];
|
||||
return errors.value.map((row) => {
|
||||
return {
|
||||
...row.client,
|
||||
message: row.message,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
const selectCustomerId = (id) => {
|
||||
selectedCustomerId.value = id;
|
||||
};
|
||||
|
||||
onMounted(() => (stateStore.rightDrawer = true));
|
||||
onUnmounted(() => {
|
||||
stateStore.rightDrawer = false;
|
||||
invoiceOutGlobalStore.$reset();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" :width="256" side="right" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<InvoiceOutGlobalForm />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QCard v-if="status" class="card">
|
||||
<QCardSection class="card-section">
|
||||
<span class="text">{{ t(`status.${status}`) }}</span>
|
||||
<span class="text">{{
|
||||
t('invoiceOut.globalInvoices.statusCard.percentageText', {
|
||||
getPercentage: getPercentage,
|
||||
getAddressNumber: getAddressNumber,
|
||||
getNAddresses: getNAddresses,
|
||||
})
|
||||
}}</span>
|
||||
<span class="text">{{
|
||||
t('invoiceOut.globalInvoices.statusCard.pdfsNumberText', {
|
||||
nPdfs: nPdfs,
|
||||
totalPdfs: totalPdfs,
|
||||
})
|
||||
}}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
|
||||
<QTable
|
||||
v-if="rows.length > 0"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
hide-bottom
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
>
|
||||
<template #body-cell="props">
|
||||
<QTd :props="props">
|
||||
<component
|
||||
:is="tableColumnComponents[props.col.name].component"
|
||||
v-bind="tableColumnComponents[props.col.name].props"
|
||||
@click="tableColumnComponents[props.col.name].event(props)"
|
||||
class="col-content"
|
||||
>
|
||||
{{ props.value }}
|
||||
<QPopupProxy>
|
||||
<CustomerDescriptor
|
||||
v-if="selectedCustomerId === props.value"
|
||||
:id="selectedCustomerId"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</component>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
background-color: var(--vn-dark);
|
||||
padding: 16px;
|
||||
|
||||
.card-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 14px;
|
||||
color: var(--vn-text);
|
||||
}
|
||||
}
|
||||
|
||||
.col-content {
|
||||
border-radius: 4px;
|
||||
padding: 6px 6px 6px 6px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
status:
|
||||
packageInvoicing: Build packaging tickets
|
||||
invoicing: Invoicing client
|
||||
stopping: Stopping process
|
||||
done: Ended process
|
||||
of: of
|
||||
|
||||
es:
|
||||
status:
|
||||
packageInvoicing: Generación de tickets de empaque
|
||||
invoicing: Facturando a cliente
|
||||
stopping: Deteniendo proceso
|
||||
done: Proceso detenido
|
||||
of: de
|
||||
</i18n>
|
|
@ -0,0 +1,201 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from "components/common/VnInputDate.vue";
|
||||
|
||||
const { t } = useI18n();
|
||||
const invoiceOutGlobalStore = useInvoiceOutGlobalStore();
|
||||
|
||||
// invoiceOutGlobalStore state and getters
|
||||
const {
|
||||
initialDataLoading,
|
||||
formInitialData,
|
||||
|
||||
invoicing,
|
||||
status,
|
||||
} = storeToRefs(invoiceOutGlobalStore);
|
||||
|
||||
// invoiceOutGlobalStore actions
|
||||
const { makeInvoice, setStatusValue } = invoiceOutGlobalStore;
|
||||
|
||||
const clientsToInvoice = ref('all');
|
||||
|
||||
const companiesOptions = ref([]);
|
||||
|
||||
const printersOptions = ref([]);
|
||||
|
||||
const clientsOptions = ref([]);
|
||||
|
||||
const formData = ref({
|
||||
companyFk: null,
|
||||
invoiceDate: null,
|
||||
maxShipped: null,
|
||||
clientId: null,
|
||||
printer: null,
|
||||
});
|
||||
|
||||
const optionsInitialData = computed(() => {
|
||||
return (
|
||||
companiesOptions.value.length > 0 &&
|
||||
printersOptions.value.length > 0 &&
|
||||
clientsOptions.value.length > 0
|
||||
);
|
||||
});
|
||||
|
||||
const getStatus = computed({
|
||||
get() {
|
||||
return status.value;
|
||||
},
|
||||
set(value) {
|
||||
setStatusValue(value.value);
|
||||
},
|
||||
});
|
||||
|
||||
const onFetchCompanies = (companies) => {
|
||||
companiesOptions.value = [...companies];
|
||||
};
|
||||
|
||||
const onFetchPrinters = (printers) => {
|
||||
printersOptions.value = [...printers];
|
||||
};
|
||||
|
||||
const onFetchClients = (clients) => {
|
||||
clientsOptions.value = [...clients];
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await invoiceOutGlobalStore.init();
|
||||
formData.value = { ...formInitialData.value };
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="Companies" @on-fetch="(data) => onFetchCompanies(data)" auto-load />
|
||||
<FetchData url="Printers" @on-fetch="(data) => onFetchPrinters(data)" auto-load />
|
||||
<FetchData url="Clients" @on-fetch="(data) => onFetchClients(data)" auto-load />
|
||||
|
||||
<QForm
|
||||
v-if="!initialDataLoading && optionsInitialData"
|
||||
@submit="makeInvoice(formData, clientsToInvoice)"
|
||||
class="form-container q-pa-md"
|
||||
style="max-width: 256px"
|
||||
>
|
||||
<div class="column q-gutter-y-md">
|
||||
<QRadio
|
||||
v-model="clientsToInvoice"
|
||||
dense
|
||||
val="all"
|
||||
:label="t('allClients')"
|
||||
:dark="true"
|
||||
/>
|
||||
<QRadio
|
||||
v-model="clientsToInvoice"
|
||||
dense
|
||||
val="one"
|
||||
:label="t('oneClient')"
|
||||
:dark="true"
|
||||
/>
|
||||
<VnSelectFilter
|
||||
v-if="clientsToInvoice === 'one'"
|
||||
:label="t('client')"
|
||||
v-model="formData.clientId"
|
||||
:options="clientsOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInputDate
|
||||
v-model="formData.invoiceDate"
|
||||
:label="t('invoiceDate')"
|
||||
dense
|
||||
outlined
|
||||
rounded />
|
||||
<VnInputDate
|
||||
v-model="formData.maxShipped"
|
||||
:label="t('maxShipped')"
|
||||
dense
|
||||
outlined
|
||||
rounded />
|
||||
<VnSelectFilter
|
||||
:label="t('company')"
|
||||
v-model="formData.companyFk"
|
||||
:options="companiesOptions"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnSelectFilter
|
||||
:label="t('printer')"
|
||||
v-model="formData.printer"
|
||||
:options="printersOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</div>
|
||||
|
||||
<QBtn
|
||||
v-if="!invoicing"
|
||||
:label="t('invoiceOut')"
|
||||
type="submit"
|
||||
color="primary"
|
||||
class="q-mt-md full-width"
|
||||
unelevated
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
<QBtn
|
||||
v-if="invoicing"
|
||||
:label="t('stop')"
|
||||
color="primary"
|
||||
class="q-mt-md full-width"
|
||||
unelevated
|
||||
rounded
|
||||
dense
|
||||
@click="getStatus = 'stopping'"
|
||||
/>
|
||||
</QForm>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.form-container * {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
invoiceDate: Invoice date
|
||||
maxShipped: Max date
|
||||
allClients: All clients
|
||||
oneClient: One client
|
||||
company: Company
|
||||
printer: Printer
|
||||
invoiceOut: Invoice out
|
||||
client: Client
|
||||
stop: Stop
|
||||
|
||||
es:
|
||||
invoiceDate: Fecha de factura
|
||||
maxShipped: Fecha límite
|
||||
allClients: Todos los clientes
|
||||
oneClient: Un solo cliente
|
||||
company: Empresa
|
||||
printer: Impresora
|
||||
invoiceOut: Facturar
|
||||
client: Cliente
|
||||
stop: Parar
|
||||
</i18n>
|
|
@ -1,8 +1,8 @@
|
|||
<script setup>
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { exportFile, useQuasar } from 'quasar';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import InvoiceOutSummaryDialog from './Card/InvoiceOutSummaryDialog.vue';
|
||||
|
@ -12,10 +12,11 @@ import InvoiceOutFilter from './InvoiceOutFilter.vue';
|
|||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const selectedCards = ref(new Map());
|
||||
const quasar = useQuasar();
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
onMounted(() => (stateStore.rightDrawer = true));
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
@ -32,25 +33,81 @@ function viewSummary(id) {
|
|||
},
|
||||
});
|
||||
}
|
||||
|
||||
const toggleIndividualCard = (cardData) => {
|
||||
if (selectedCards.value.has(cardData.id)) {
|
||||
selectedCards.value.delete(cardData.id);
|
||||
return;
|
||||
}
|
||||
selectedCards.value.set(cardData.id, cardData);
|
||||
};
|
||||
|
||||
const toggleAllCards = (cardsData) => {
|
||||
const allSelected = selectedCards.value.size === cardsData.length;
|
||||
|
||||
if (!allSelected) {
|
||||
// Si no todas las tarjetas están seleccionadas, selecciónalas todas
|
||||
cardsData.forEach((data) => {
|
||||
if (!selectedCards.value.has(data.id)) {
|
||||
selectedCards.value.set(data.id, data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Si todas las tarjetas están seleccionadas, deselecciónalas todas
|
||||
selectedCards.value.clear();
|
||||
}
|
||||
};
|
||||
|
||||
const downloadCsv = () => {
|
||||
if (selectedCards.value.size === 0) return;
|
||||
const selectedCardsArray = Array.from(selectedCards.value.values());
|
||||
let file;
|
||||
for (var i = 0; i < selectedCardsArray.length; i++) {
|
||||
if (i == 0) file += Object.keys(selectedCardsArray[i]).join(';') + '\n';
|
||||
file +=
|
||||
Object.keys(selectedCardsArray[i])
|
||||
.map(function (key) {
|
||||
return selectedCardsArray[i][key];
|
||||
})
|
||||
.join(';') + '\n';
|
||||
}
|
||||
const status = exportFile('file.csv', file, {
|
||||
encoding: 'windows-1252',
|
||||
mimeType: 'text/csv;charset=windows-1252;',
|
||||
});
|
||||
if (status === true) {
|
||||
quasar.notify({
|
||||
message: t('fileAllowed'),
|
||||
color: 'positive',
|
||||
icon: 'check',
|
||||
});
|
||||
} else {
|
||||
quasar.notify({
|
||||
message: t('fileDenied'),
|
||||
color: 'negative',
|
||||
icon: 'warning',
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
:info="t('youCanSearchByInvoiceReference')"
|
||||
:label="t('searchInvoice')"
|
||||
data-key="InvoiceOutList"
|
||||
:label="t('Search invoice')"
|
||||
:info="t('You can search by invoice reference')"
|
||||
/>
|
||||
</Teleport>
|
||||
<Teleport to="#actions-append">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<QBtn
|
||||
flat
|
||||
@click="stateStore.toggleRightDrawer()"
|
||||
round
|
||||
dense
|
||||
flat
|
||||
icon="menu"
|
||||
round
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.collapseMenu') }}
|
||||
|
@ -64,71 +121,128 @@ function viewSummary(id) {
|
|||
<InvoiceOutFilter data-key="InvoiceOutList" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<VnPaginate
|
||||
data-key="InvoiceOutList"
|
||||
url="InvoiceOuts/filter"
|
||||
order="issued DESC, id DESC"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:title="row.ref"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv label="ID" :value="row.id" />
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.shortIssued')"
|
||||
:title-label="t('invoiceOut.list.issued')"
|
||||
:value="toDate(row.issued)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.amount')"
|
||||
:value="toCurrency(row.amount)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.client')"
|
||||
:value="row.clientSocialName"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.shortCreated')"
|
||||
:title-label="t('invoiceOut.list.created')"
|
||||
:value="toDate(row.created)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.company')"
|
||||
:value="row.companyCode"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.shortDued')"
|
||||
:title-label="t('invoiceOut.list.dued')"
|
||||
:value="toDate(row.dued)"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
flat
|
||||
icon="arrow_circle_right"
|
||||
@click.stop="navigate(row.id)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openCard') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openSummary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPage>
|
||||
<VnPaginate
|
||||
auto-load
|
||||
data-key="InvoiceOutList"
|
||||
order="issued DESC, id DESC"
|
||||
url="InvoiceOuts/filter"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-actions">
|
||||
<QBtn
|
||||
@click="downloadCsv()"
|
||||
class="q-mr-xl"
|
||||
color="primary"
|
||||
:disable="selectedCards.size === 0"
|
||||
:label="t('globals.download')"
|
||||
/>
|
||||
<!-- <QBtnDropdown
|
||||
class="q-mr-xl"
|
||||
color="primary"
|
||||
:disable="!manageCheckboxes && arrayElements.length < 1"
|
||||
:label="t('globals.download')"
|
||||
v-else
|
||||
>
|
||||
<QList>
|
||||
<QItem clickable v-close-popup @click="downloadCsv(rows)">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{
|
||||
t('globals.allRows', {
|
||||
numberRows: rows.length,
|
||||
})
|
||||
}}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QItem clickable v-close-popup @click="downloadCsv(rows)">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{
|
||||
t('globals.selectRows', {
|
||||
numberRows: rows.length,
|
||||
})
|
||||
}}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QBtnDropdown> -->
|
||||
<QCheckbox
|
||||
left-label
|
||||
:label="t('globals.markAll')"
|
||||
@click="toggleAllCards(rows)"
|
||||
:model-value="selectedCards.size === rows.length"
|
||||
class="q-mr-md"
|
||||
/>
|
||||
</div>
|
||||
</QToolbar>
|
||||
<div class="flex flex-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<CardList
|
||||
:element="row"
|
||||
:id="row.id"
|
||||
:show-checkbox="true"
|
||||
:is-selected="selectedCards.has(row.id)"
|
||||
:key="row.id"
|
||||
:title="row.ref"
|
||||
@click="navigate(row.id)"
|
||||
@toggle-card-check="toggleIndividualCard(row)"
|
||||
v-for="row of rows"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.shortIssued')"
|
||||
:title-label="t('invoiceOut.list.issued')"
|
||||
:value="toDate(row.issued)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.amount')"
|
||||
:value="toCurrency(row.amount)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.client')"
|
||||
:value="row.clientSocialName"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.shortCreated')"
|
||||
:title-label="t('invoiceOut.list.created')"
|
||||
:value="toDate(row.created)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.company')"
|
||||
:value="row.companyCode"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceOut.list.shortDued')"
|
||||
:title-label="t('invoiceOut.list.dued')"
|
||||
:value="toDate(row.dued)"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openCard')"
|
||||
@click.stop="navigate(row.id)"
|
||||
class="bg-vn-dark"
|
||||
outline
|
||||
type="reset"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
type="submit"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
|
@ -140,7 +254,14 @@ function viewSummary(id) {
|
|||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
searchInvoice: Search issued invoice
|
||||
fileDenied: Browser denied file download...
|
||||
fileAllowed: Successful download of CSV file
|
||||
youCanSearchByInvoiceReference: You can search by invoice reference
|
||||
es:
|
||||
Search invoice: Buscar factura emitida
|
||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||
searchInvoice: Buscar factura emitida
|
||||
fileDenied: El navegador denegó la descarga de archivos...
|
||||
fileAllowed: Descarga exitosa de archivo CSV
|
||||
youCanSearchByInvoiceReference: Puedes buscar por referencia de la factura
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,356 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import invoiceOutService from 'src/services/invoiceOut.service';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import { QCheckbox, QBtn } from 'quasar';
|
||||
import { useInvoiceOutGlobalStore } from 'src/stores/invoiceOutGlobal.js';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const invoiceOutGlobalStore = useInvoiceOutGlobalStore();
|
||||
|
||||
const rows = ref([]);
|
||||
const { t } = useI18n();
|
||||
|
||||
const dateRange = reactive({
|
||||
from: Date.vnFirstDayOfMonth().toISOString(),
|
||||
to: Date.vnLastDayOfMonth().toISOString(),
|
||||
});
|
||||
|
||||
const selectedCustomerId = ref(0);
|
||||
const selectedWorkerId = ref(0);
|
||||
|
||||
const filter = ref({
|
||||
company: null,
|
||||
country: null,
|
||||
clientId: null,
|
||||
client: null,
|
||||
amount: null,
|
||||
base: null,
|
||||
ticketId: null,
|
||||
active: null,
|
||||
hasToInvoice: null,
|
||||
verifiedData: null,
|
||||
comercial: null,
|
||||
});
|
||||
|
||||
const tableColumnComponents = {
|
||||
company: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
country: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
clientId: {
|
||||
component: QBtn,
|
||||
props: () => ({ flat: true, color: 'blue' }),
|
||||
event: (prop) => selectCustomerId(prop.value),
|
||||
},
|
||||
client: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
amount: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
base: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
ticketId: {
|
||||
component: 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
active: {
|
||||
component: QCheckbox,
|
||||
props: (prop) => ({
|
||||
disable: true,
|
||||
'model-value': Boolean(prop.value),
|
||||
}),
|
||||
event: () => {},
|
||||
},
|
||||
hasToInvoice: {
|
||||
component: QCheckbox,
|
||||
props: (prop) => ({
|
||||
disable: true,
|
||||
'model-value': Boolean(prop.value),
|
||||
}),
|
||||
event: () => {},
|
||||
},
|
||||
verifiedData: {
|
||||
component: QCheckbox,
|
||||
props: (prop) => ({
|
||||
disable: true,
|
||||
'model-value': Boolean(prop.value),
|
||||
}),
|
||||
event: () => {},
|
||||
},
|
||||
comercial: {
|
||||
component: QBtn,
|
||||
props: () => ({ flat: true, color: 'blue' }),
|
||||
event: (prop) => selectWorkerId(prop.row.comercialId),
|
||||
},
|
||||
};
|
||||
|
||||
const columns = ref([
|
||||
{
|
||||
label: 'company',
|
||||
field: 'company',
|
||||
name: 'company',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'country',
|
||||
field: 'country',
|
||||
name: 'country',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'clientId',
|
||||
field: 'clientId',
|
||||
name: 'clientId',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'client',
|
||||
field: 'clientSocialName',
|
||||
name: 'client',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'amount',
|
||||
field: 'amount',
|
||||
name: 'amount',
|
||||
align: 'left',
|
||||
format: (value) => toCurrency(value),
|
||||
},
|
||||
{
|
||||
label: 'base',
|
||||
field: 'taxableBase',
|
||||
name: 'base',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'ticketId',
|
||||
field: 'ticketFk',
|
||||
name: 'ticketId',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'active',
|
||||
field: 'isActive',
|
||||
name: 'active',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'hasToInvoice',
|
||||
field: 'hasToInvoice',
|
||||
name: 'hasToInvoice',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'verifiedData',
|
||||
field: 'isTaxDataChecked',
|
||||
name: 'verifiedData',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: 'comercial',
|
||||
field: 'comercialName',
|
||||
name: 'comercial',
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
|
||||
const downloadCSV = async () => {
|
||||
await invoiceOutGlobalStore.getNegativeBasesCsv(dateRange.from, dateRange.to);
|
||||
};
|
||||
|
||||
const search = async () => {
|
||||
const and = [];
|
||||
Object.keys(filter.value).forEach((key) => {
|
||||
if (filter.value[key]) {
|
||||
and.push({
|
||||
[key]: filter.value[key],
|
||||
});
|
||||
}
|
||||
});
|
||||
const searchFilter = {
|
||||
limit: 20
|
||||
}
|
||||
|
||||
if (and.length) {
|
||||
searchFilter.where = {
|
||||
and
|
||||
}
|
||||
}
|
||||
|
||||
const params = {
|
||||
...dateRange,
|
||||
filter: JSON.stringify(searchFilter),
|
||||
};
|
||||
rows.value = await invoiceOutService.getNegativeBases(params);
|
||||
};
|
||||
|
||||
const refresh = () => {
|
||||
dateRange.from = Date.vnFirstDayOfMonth().toISOString();
|
||||
dateRange.to = Date.vnLastDayOfMonth().toISOString();
|
||||
filter.value = {
|
||||
company: null,
|
||||
country: null,
|
||||
clientId: null,
|
||||
client: null,
|
||||
amount: null,
|
||||
base: null,
|
||||
ticketId: null,
|
||||
active: null,
|
||||
hasToInvoice: null,
|
||||
verifiedData: null,
|
||||
comercial: null,
|
||||
};
|
||||
search();
|
||||
};
|
||||
|
||||
const selectCustomerId = (id) => {
|
||||
selectedCustomerId.value = id;
|
||||
};
|
||||
|
||||
const selectWorkerId = (id) => {
|
||||
selectedWorkerId.value = id;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
refresh();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
hide-bottom
|
||||
row-key="clientId"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
>
|
||||
<template #top-left>
|
||||
<div class="row justify-start items-end">
|
||||
<VnInputDate
|
||||
v-model="dateRange.from"
|
||||
:label="t('invoiceOut.negativeBases.from')"
|
||||
class="q-mr-md"
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInputDate
|
||||
v-model="dateRange.to"
|
||||
:label="t('invoiceOut.negativeBases.to')"
|
||||
class="q-mr-md"
|
||||
dense
|
||||
lazy-rules
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon-right="archive"
|
||||
no-caps
|
||||
@click="downloadCSV()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #top-right>
|
||||
<div class="row justify-start items-center">
|
||||
<span class="q-mr-md text-results">
|
||||
{{ rows.length }} {{ t('results') }}
|
||||
</span>
|
||||
<QBtn
|
||||
color="primary"
|
||||
icon-right="search"
|
||||
no-caps
|
||||
class="q-mr-sm"
|
||||
@click="search()"
|
||||
/>
|
||||
<QBtn color="primary" icon-right="refresh" no-caps @click="refresh" />
|
||||
</div>
|
||||
</template>
|
||||
<template #header="props">
|
||||
<QTr :props="props" class="full-height">
|
||||
<QTh v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div class="column justify-start items-start full-height">
|
||||
{{ t(`invoiceOut.negativeBases.${col.label}`) }}
|
||||
<QInput
|
||||
:class="{
|
||||
invisible:
|
||||
col.field === 'isActive' ||
|
||||
col.field === 'hasToInvoice' ||
|
||||
col.field === 'isTaxDataChecked',
|
||||
}"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
v-model="filter[col.field]"
|
||||
type="text"
|
||||
@keyup.enter="search()"
|
||||
/>
|
||||
</div>
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body-cell="props">
|
||||
<QTd :props="props">
|
||||
<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)"
|
||||
>
|
||||
<template
|
||||
v-if="
|
||||
props.col.name !== 'active' &&
|
||||
props.col.name !== 'hasToInvoice' &&
|
||||
props.col.name !== 'verifiedData'
|
||||
"
|
||||
>{{ props.value }}
|
||||
</template>
|
||||
<CustomerDescriptorProxy
|
||||
v-if="props.col.name === 'clientId'"
|
||||
:id="selectedCustomerId"
|
||||
/>
|
||||
<WorkerDescriptorProxy
|
||||
v-if="props.col.name === 'comercial'"
|
||||
:id="selectedWorkerId"
|
||||
/>
|
||||
</component>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.col-content {
|
||||
border-radius: 4px;
|
||||
padding: 6px 6px 6px 6px;
|
||||
}
|
||||
|
||||
.text-results {
|
||||
color: var(--vn-label);
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n></i18n>
|
|
@ -3,6 +3,7 @@ import { ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInputDate from "components/common/VnInputDate.vue";
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -111,35 +112,7 @@ const countries = ref();
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('route.cmr.list.shipped')"
|
||||
v-model="params.shipped"
|
||||
mask="date"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="rotate"
|
||||
transition-hide="rotate"
|
||||
>
|
||||
<QDate v-model="params.shipped" minimal>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
<VnInputDate v-model="params.shipped" :label="t('route.cmr.list.shipped')" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import LeftMenu from 'components/LeftMenu.vue';
|
||||
import ShelvingDescriptor from 'pages/Shelving/Card/ShelvingDescriptor.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<ShelvingDescriptor />
|
||||
<QSeparator />
|
||||
<LeftMenu source="card" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<RouterView></RouterView>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
</template>
|
|
@ -0,0 +1,71 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import useCardDescription from 'composables/useCardDescription';
|
||||
import WorkerDescriptorProxy from "pages/Worker/Card/WorkerDescriptorProxy.vue";
|
||||
import ShelvingDescriptorMenu from "pages/Shelving/Card/ShelvingDescriptorMenu.vue";
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: { fields: ['nickname'] },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ relation: 'parking' },
|
||||
],
|
||||
};
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity.code, entity.id));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardDescriptor
|
||||
module="Shelving"
|
||||
:url="`Shelvings/${entityId}`"
|
||||
:filter="filter"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
data-key="Shelvings"
|
||||
@on-fetch="setData"
|
||||
>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('shelving.summary.code')" :value="entity.code" />
|
||||
<VnLv :label="t('shelving.summary.parking')" :value="entity.parking?.code" />
|
||||
<VnLv v-if="entity.worker" :label="t('shelving.summary.worker')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ entity.worker?.user?.nickname }}
|
||||
<WorkerDescriptorProxy :id="entity.worker?.id" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
</template>
|
||||
<template #menu="{entity}">
|
||||
<ShelvingDescriptorMenu :shelving="entity" />
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</template>
|
|
@ -0,0 +1,61 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
shelving: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
|
||||
function confirmRemove() {
|
||||
quasar
|
||||
.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('confirmDeletion'),
|
||||
message: t('confirmDeletionMessage'),
|
||||
promise: remove,
|
||||
},
|
||||
})
|
||||
.onOk(async () => await router.push({ name: 'ShelvingList' }));
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
if (!$props.shelving.value.id) {
|
||||
return;
|
||||
}
|
||||
await axios.delete(`Shelvings/${$props.shelving.value.id}`);
|
||||
quasar.notify({
|
||||
message: t('globals.dataDeleted'),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<QItem @click="confirmRemove()" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="delete" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('deleteShelving') }}</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
{
|
||||
"en": {
|
||||
"deleteShelving": "Delete Shelving"
|
||||
},
|
||||
"es": {
|
||||
"deleteShelving": "Eliminar carro"
|
||||
}
|
||||
}
|
||||
</i18n>
|
|
@ -0,0 +1,15 @@
|
|||
<script setup>
|
||||
import ShelvingDescriptor from "pages/Shelving/Card/ShelvingDescriptor.vue";
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<ShelvingDescriptor v-if="$props.id" :id="$props.id" />
|
||||
</QPopupProxy>
|
||||
</template>
|
|
@ -0,0 +1,120 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['search']);
|
||||
|
||||
const workers = ref();
|
||||
const parkings = ref();
|
||||
|
||||
function setWorkers(data) {
|
||||
workers.value = data;
|
||||
}
|
||||
|
||||
function setParkings(data) {
|
||||
parkings.value = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Parkings"
|
||||
:filter="{ fields: ['id', 'code'] }"
|
||||
sort-by="code ASC"
|
||||
@on-fetch="setParkings"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Workers/activeWithInheritedRole"
|
||||
:filter="{ where: { role: 'salesPerson' } }"
|
||||
sort-by="firstName ASC"
|
||||
@on-fetch="setWorkers"
|
||||
auto-load
|
||||
/>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" @search="emit('search')">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense>
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection v-if="!parkings">
|
||||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="parkings">
|
||||
<QSelect
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:label="t('params.parkingFk')"
|
||||
v-model="params.parkingFk"
|
||||
:options="parkings"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection v-if="!workers">
|
||||
<QSkeleton type="QInput" class="full-width" />
|
||||
</QItemSection>
|
||||
<QItemSection v-if="workers">
|
||||
<QSelect
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
:label="t('params.userFk')"
|
||||
v-model="params.userFk"
|
||||
:options="workers"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
emit-value
|
||||
map-options
|
||||
use-input
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-md">
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
v-model="params.isRecyclable"
|
||||
:label="t('params.isRecyclable')"
|
||||
toggle-indeterminate
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
parkingFk: Parking
|
||||
userFk: Worker
|
||||
isRecyclable: Recyclable
|
||||
es:
|
||||
params:
|
||||
parkingFk: Parking
|
||||
userFk: Trabajador
|
||||
isRecyclable: Reciclable
|
||||
</i18n>
|
|
@ -0,0 +1,126 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const shelvingId = route.params?.id || null;
|
||||
const isNew = Boolean(!shelvingId);
|
||||
const defaultInitialData = {
|
||||
parkingFk: null,
|
||||
priority: 0,
|
||||
code: null,
|
||||
isRecyclable: false,
|
||||
}
|
||||
|
||||
const parkingFilter = { fields: ['id', 'code'] };
|
||||
const parkingList = ref([]);
|
||||
const parkingListCopy = ref([]);
|
||||
|
||||
const setParkingList = (data) => {
|
||||
parkingList.value = data;
|
||||
parkingListCopy.value = data;
|
||||
};
|
||||
|
||||
const parkingSelectFilter = {
|
||||
options: parkingList,
|
||||
filterFn: (options, value) => {
|
||||
const search = value.trim().toLowerCase();
|
||||
|
||||
if (!search || search === '') {
|
||||
return parkingListCopy.value;
|
||||
}
|
||||
|
||||
return options.value.filter((option) =>
|
||||
option.code.toLowerCase().startsWith(search)
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
const shelvingFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: { fields: ['nickname'] },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ relation: 'parking' },
|
||||
],
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
<FetchData
|
||||
url="Parkings"
|
||||
:filter="parkingFilter"
|
||||
@on-fetch="setParkingList"
|
||||
auto-load
|
||||
/>
|
||||
<FormModel
|
||||
:url="isNew ? null : `Shelvings/${shelvingId}`"
|
||||
:url-create="isNew ? 'Shelvings' : null"
|
||||
:observe-form-changes="!isNew"
|
||||
:filter="shelvingFilter"
|
||||
model="shelving"
|
||||
:auto-load="!isNew"
|
||||
:form-initial-data="defaultInitialData"
|
||||
>
|
||||
<template #form="{ data, validate, filter }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
v-model="data.code"
|
||||
:label="t('shelving.basicData.code')"
|
||||
:rules="validate('Shelving.code')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QSelect
|
||||
v-model="data.parkingFk"
|
||||
:options="parkingList"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
emit-value
|
||||
:label="t('shelving.basicData.parking')"
|
||||
map-options
|
||||
use-input
|
||||
@filter="
|
||||
(value, update) => filter(value, update, parkingSelectFilter)
|
||||
"
|
||||
:rules="validate('Shelving.parkingFk')"
|
||||
:input-debounce="0"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
v-model="data.priority"
|
||||
:label="t('shelving.basicData.priority')"
|
||||
:rules="validate('Shelving.priority')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QCheckbox
|
||||
v-model="data.isRecyclable"
|
||||
:label="t('shelving.basicData.recyclable')"
|
||||
:rules="validate('Shelving.isRecyclable')"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</template>
|
|
@ -0,0 +1,6 @@
|
|||
<script setup>
|
||||
import VnLog from 'src/components/common/VnLog.vue';
|
||||
</script>
|
||||
<template>
|
||||
<VnLog model="Shelving" url="/ShelvingLogs"></VnLog>
|
||||
</template>
|
|
@ -0,0 +1,20 @@
|
|||
<script setup>
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import {useI18n} from "vue-i18n";
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnSearchbar
|
||||
data-key="ShelvingList"
|
||||
:label="t('Search shelving')"
|
||||
:info="t('You can search by search reference')"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
<i18n>
|
||||
es:
|
||||
Search shelving: Buscar carros
|
||||
You can search by shelving reference: Puedes buscar por referencia del carro
|
||||
</i18n>
|
|
@ -0,0 +1,110 @@
|
|||
<script setup>
|
||||
import { computed, onMounted, onUnmounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const isDialog = Boolean($props.id);
|
||||
const hideRightDrawer = () => {
|
||||
if (!isDialog) {
|
||||
stateStore.rightDrawer = false;
|
||||
}
|
||||
}
|
||||
onMounted(hideRightDrawer);
|
||||
onUnmounted(hideRightDrawer);
|
||||
const filter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'worker',
|
||||
scope: {
|
||||
fields: ['id'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: { fields: ['nickname'] },
|
||||
},
|
||||
},
|
||||
},
|
||||
{ relation: 'parking' },
|
||||
],
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="!isDialog && stateStore.isHeaderMounted()">
|
||||
<Teleport to="#actions-append">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<QBtn
|
||||
flat
|
||||
@click="stateStore.toggleRightDrawer()"
|
||||
round
|
||||
dense
|
||||
icon="menu"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.collapseMenu') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
<div class="q-pa-md">
|
||||
<CardSummary ref="summary" :url="`Shelvings/${entityId}`" :filter="filter">
|
||||
<template #header="{ entity }">
|
||||
<div>{{ entity.code }}</div>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<QCard class="vn-one">
|
||||
<div class="header">
|
||||
{{ t('shelving.pageTitles.basicData') }}
|
||||
</div>
|
||||
<VnLv :label="t('shelving.summary.code')" :value="entity.code" />
|
||||
<VnLv
|
||||
:label="t('shelving.summary.parking')"
|
||||
:value="entity.parking?.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('shelving.summary.priority')"
|
||||
:value="entity.priority"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('shelving.summary.worker')"
|
||||
:value="entity.worker?.user?.nickname"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('shelving.summary.recyclable')"
|
||||
:value="entity.isRecyclable"
|
||||
/>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</div>
|
||||
<QDrawer
|
||||
v-if="!isDialog"
|
||||
v-model="stateStore.rightDrawer"
|
||||
side="right"
|
||||
:width="256"
|
||||
show-if-above
|
||||
>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<ShelvingFilter
|
||||
data-key="ShelvingList"
|
||||
@search="router.push({ name: 'ShelvingList' })"
|
||||
/>
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
</template>
|
|
@ -0,0 +1,29 @@
|
|||
<script setup>
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import ShelvingSummary from "pages/Shelving/Card/ShelvingSummary.vue";
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
defineEmits([...useDialogPluginComponent.emits]);
|
||||
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide">
|
||||
<ShelvingSummary v-if="$props.id" :id="$props.id" />
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-dialog .summary .header {
|
||||
position: sticky;
|
||||
z-index: $z-max;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,138 @@
|
|||
<script setup>
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { onMounted, onUnmounted } from 'vue';
|
||||
import CardList from 'components/ui/CardList.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useRouter } from 'vue-router';
|
||||
import ShelvingFilter from 'pages/Shelving/Card/ShelvingFilter.vue';
|
||||
import ShelvingSummaryDialog from 'pages/Shelving/Card/ShelvingSummaryDialog.vue';
|
||||
import ShelvingSearchbar from 'pages/Shelving/Card/ShelvingSearchbar.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const filter = {
|
||||
include: [{ relation: 'parking' }],
|
||||
};
|
||||
|
||||
onMounted(() => (stateStore.rightDrawer = true));
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/shelving/${id}` });
|
||||
}
|
||||
|
||||
function viewSummary(id) {
|
||||
quasar.dialog({
|
||||
component: ShelvingSummaryDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function exprBuilder(param, value) {
|
||||
switch (param) {
|
||||
case 'search':
|
||||
return { code: { like: `%${value}%` } };
|
||||
case 'parkingFk':
|
||||
case 'userFk':
|
||||
case 'isRecyclable':
|
||||
return { [param]: value };
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<ShelvingSearchbar />
|
||||
</Teleport>
|
||||
<Teleport to="#actions-append">
|
||||
<div class="row q-gutter-x-sm">
|
||||
<QBtn
|
||||
flat
|
||||
@click="stateStore.toggleRightDrawer()"
|
||||
round
|
||||
dense
|
||||
icon="menu"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
{{ t('globals.collapseMenu') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<ShelvingFilter data-key="ShelvingList" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<VnPaginate
|
||||
data-key="ShelvingList"
|
||||
url="Shelvings"
|
||||
:filter="filter"
|
||||
:expr-builder="exprBuilder"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:id="row.id"
|
||||
:title="row.code"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv
|
||||
:label="t('shelving.list.parking')"
|
||||
:title-label="t('shelving.list.parking')"
|
||||
:value="row.parking?.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('shelving.list.priority')"
|
||||
:value="row?.priority"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openCard')"
|
||||
@click.stop="navigate(row.id)"
|
||||
class="bg-vn-dark"
|
||||
outline
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<RouterLink :to="{ name: 'ShelvingCreate' }">
|
||||
<QBtn fab icon="add" color="primary" />
|
||||
<QTooltip>
|
||||
{{ t('shelving.list.newShelving') }}
|
||||
</QTooltip>
|
||||
</RouterLink>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,17 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import LeftMenu from 'src/components/LeftMenu.vue';
|
||||
|
||||
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>
|
|
@ -0,0 +1,63 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="SuppliersList"
|
||||
:limit="20"
|
||||
:label="t('Search suppliers')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<!-- Aca iría left menu y descriptor -->
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
<div class="q-pa-md"><RouterView></RouterView></div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-scrollarea__content {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.descriptor {
|
||||
max-width: 256px;
|
||||
|
||||
h5 {
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.q-card__actions {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#descriptor-skeleton .q-card__actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,94 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const filter = {
|
||||
fields: [
|
||||
'id',
|
||||
'name',
|
||||
'nickname',
|
||||
'nif',
|
||||
'payMethodFk',
|
||||
'payDemFk',
|
||||
'payDay',
|
||||
'isActive',
|
||||
'isSerious',
|
||||
'isTrucker',
|
||||
'account',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
relation: 'payMethod',
|
||||
scope: {
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'payDem',
|
||||
scope: {
|
||||
fields: ['id', 'payDem'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['id', 'fi'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => {
|
||||
data.value = useCardDescription(entity.ref, entity.id);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardDescriptor
|
||||
module="Supplier"
|
||||
:url="`Suppliers/${entityId}`"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
:filter="filter"
|
||||
@on-fetch="setData"
|
||||
data-key="Supplier"
|
||||
>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('supplier.summary.taxNumber')" :value="entity.nif" />
|
||||
<VnLv label="Alias" :value="entity.nickname" />
|
||||
<VnLv
|
||||
:label="t('supplier.summary.payMethod')"
|
||||
:value="entity.payMethod.name"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.payDeadline')"
|
||||
:value="entity.payDem.payDem"
|
||||
/>
|
||||
<VnLv :label="t('supplier.summary.payDay')" :value="entity.payDay" />
|
||||
<VnLv :label="t('supplier.summary.account')" :value="entity.account" />
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</template>
|
||||
<i18n>
|
||||
|
||||
</i18n>
|
|
@ -0,0 +1,16 @@
|
|||
<script setup>
|
||||
import SupplierDescriptor from './SupplierDescriptor.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<SupplierDescriptor v-if="$props.id" :id="$props.id" />
|
||||
</QPopupProxy>
|
||||
</template>
|
|
@ -0,0 +1,188 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, onUpdated } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
onUpdated(() => summaryRef.value.fetch());
|
||||
|
||||
const route = useRoute();
|
||||
const roleState = useRole();
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
|
||||
const summaryRef = ref();
|
||||
const supplier = ref();
|
||||
const supplierUrl = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
await roleState.fetch();
|
||||
supplierUrl.value = (await getUrl('supplier/')) + entityId.value;
|
||||
});
|
||||
|
||||
async function setData(data) {
|
||||
if (data) {
|
||||
supplier.value = data;
|
||||
}
|
||||
}
|
||||
|
||||
const isAdministrative = computed(() => {
|
||||
return roleState.hasAny(['administrative']);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summaryRef"
|
||||
:url="`Suppliers/${entityId}/getSummary`"
|
||||
@on-fetch="(data) => setData(data)"
|
||||
>
|
||||
<template #header-left>
|
||||
<a v-if="isAdministrative" class="header link" :href="supplierUrl">
|
||||
<QIcon name="open_in_new" color="white" size="25px" />
|
||||
</a>
|
||||
</template>
|
||||
<template #header>
|
||||
<span>{{ supplier.name }} - {{ supplier.id }}</span>
|
||||
</template>
|
||||
|
||||
<template #body>
|
||||
<QCard class="vn-one">
|
||||
<a v-if="isAdministrative" class="header link" :href="supplierUrl">
|
||||
{{ t('globals.summary.basicData') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<span v-else> {{ t('globals.summary.basicData') }}</span>
|
||||
<VnLv label="Id" :value="supplier.id" />
|
||||
<VnLv label="Alias" :value="supplier.nickname" />
|
||||
<VnLv :label="t('supplier.summary.responsible')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ dashIfEmpty(supplier.worker?.user?.nickname) }}
|
||||
<WorkerDescriptorProxy
|
||||
v-if="supplier.worker?.user?.id"
|
||||
:id="supplier.worker?.user?.id"
|
||||
/>
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('supplier.summary.notes')" class="q-mb-xs">
|
||||
<template #value>
|
||||
<span> {{ dashIfEmpty(supplier.note) }} </span>
|
||||
</template>
|
||||
</VnLv>
|
||||
|
||||
<VnLv :label="t('supplier.summary.verified')" class="q-mb-xs">
|
||||
<template #value>
|
||||
<QCheckbox
|
||||
v-model="supplier.isSerious"
|
||||
dense
|
||||
disable
|
||||
class="full-width q-mb-xs"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('supplier.summary.isActive')" class="q-mb-xs">
|
||||
<template #value>
|
||||
<QCheckbox
|
||||
v-model="supplier.isActive"
|
||||
dense
|
||||
disable
|
||||
class="full-width q-mb-xs"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<a v-if="isAdministrative" class="header link" :href="supplierUrl">
|
||||
{{ t('supplier.summary.billingData') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<span v-else> {{ t('supplier.summary.billingData') }}</span>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.payMethod')"
|
||||
:value="supplier.payMethod?.name"
|
||||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.payDeadline')"
|
||||
:value="supplier.payDem?.payDem"
|
||||
dash
|
||||
/>
|
||||
<VnLv :label="t('supplier.summary.payDay')" :value="supplier.payDay" />
|
||||
<VnLv :label="t('supplier.summary.account')" :value="supplier.account" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<a v-if="isAdministrative" class="header link" :href="supplierUrl">
|
||||
{{ t('supplier.summary.fiscalData') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<span v-else> {{ t('supplier.summary.fiscalData') }}</span>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.sageTaxType')"
|
||||
:value="supplier.sageTaxType?.vat"
|
||||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.sageTransactionType')"
|
||||
:value="supplier.sageTransactionType?.transaction"
|
||||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.sageWithholding')"
|
||||
:value="supplier.sageWithholding?.withholding"
|
||||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.supplierActivity')"
|
||||
:value="supplier.supplierActivity?.name"
|
||||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.healthRegister')"
|
||||
:value="supplier.healthRegister"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<a v-if="isAdministrative" class="header link" :href="supplierUrl">
|
||||
{{ t('supplier.summary.fiscalAddress') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<span v-else> {{ t('supplier.summary.fiscalAddress') }}</span>
|
||||
<VnLv :label="t('supplier.summary.socialName')" :value="supplier.name" />
|
||||
<VnLv :label="t('supplier.summary.taxNumber')" :value="supplier.nif" />
|
||||
<VnLv :label="t('supplier.summary.street')" :value="supplier.street" />
|
||||
<VnLv :label="t('supplier.summary.city')" :value="supplier.city" />
|
||||
<VnLv
|
||||
:label="t('supplier.summary.postCode')"
|
||||
:value="supplier.postCode"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.province')"
|
||||
:value="supplier.province?.name"
|
||||
dash
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.summary.country')"
|
||||
:value="supplier.country?.country"
|
||||
dash
|
||||
/>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
<style lang="scss" scoped></style>
|
|
@ -0,0 +1,29 @@
|
|||
<script setup>
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import SupplierSummary from './SupplierSummary.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
defineEmits([...useDialogPluginComponent.emits]);
|
||||
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide">
|
||||
<SupplierSummary v-if="$props.id" :id="$props.id" />
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-dialog .summary .header {
|
||||
position: sticky;
|
||||
z-index: $z-max;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,61 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { reactive } from 'vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const newSupplierForm = reactive({
|
||||
name: null,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="SuppliersList"
|
||||
:limit="20"
|
||||
:label="t('Search suppliers')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<QPage>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
<FormModel
|
||||
url-create="Suppliers/newSupplier"
|
||||
model="supplier"
|
||||
:form-initial-data="newSupplierForm"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
v-model="data.name"
|
||||
:label="t('supplier.create.supplierName')"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
background-color: var(--vn-dark);
|
||||
padding: 40px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,111 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useRouter } from 'vue-router';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import SupplierSummaryDialog from './Card/SupplierSummaryDialog.vue';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const router = useRouter();
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/supplier/${id}` });
|
||||
}
|
||||
|
||||
const redirectToCreateView = () => {
|
||||
router.push({ name: 'SupplierCreate' });
|
||||
};
|
||||
|
||||
const viewSummary = (id) => {
|
||||
quasar.dialog({
|
||||
component: SupplierSummaryDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="SuppliersList"
|
||||
:limit="20"
|
||||
:label="t('Search suppliers')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<VnPaginate data-key="SuppliersList" url="Suppliers/filter" auto-load>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:title="row.socialName"
|
||||
:id="row.id"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv label="NIF/CIF" :value="row.nif" />
|
||||
<VnLv label="Alias" :value="row.nickname" />
|
||||
<VnLv
|
||||
:label="t('supplier.list.payMethod')"
|
||||
:value="row.payMethod"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.list.payDeadline')"
|
||||
:title-label="t('invoiceOut.list.created')"
|
||||
:value="row.payDem"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.list.payDay')"
|
||||
:value="row.payDay"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('supplier.list.account')"
|
||||
:value="row.account"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
||||
<QTooltip>
|
||||
{{ t('supplier.list.newSupplier') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
Search suppliers: Search suppliers
|
||||
|
||||
es:
|
||||
Search suppliers: Buscar proveedores
|
||||
</i18n>
|
|
@ -0,0 +1,17 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import LeftMenu from 'src/components/LeftMenu.vue';
|
||||
|
||||
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>
|
|
@ -10,6 +10,7 @@ import FetchedTags from 'components/ui/FetchedTags.vue';
|
|||
import InvoiceOutDescriptorProxy from 'pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from 'pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
|
||||
onUpdated(() => summaryRef.value.fetch());
|
||||
|
@ -180,7 +181,7 @@ async function changeState(value) {
|
|||
<VnLv :label="t('ticket.summary.route')" :value="ticket.routeFk" />
|
||||
<VnLv :label="t('ticket.summary.invoice')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
<span :class="{ link: ticket.refFk }">
|
||||
{{ dashIfEmpty(ticket.refFk) }}
|
||||
<InvoiceOutDescriptorProxy
|
||||
:id="ticket.id"
|
||||
|
@ -207,23 +208,31 @@ async function changeState(value) {
|
|||
:label="t('ticket.summary.landed')"
|
||||
:value="toDate(ticket.landed)"
|
||||
/>
|
||||
<VnLv :label="t('ticket.summary.packages')" :value="ticket.packages" />
|
||||
<VnLv
|
||||
:label="t('ticket.summary.consigneePhone')"
|
||||
:value="ticket.address.phone"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('ticket.summary.consigneeMobile')"
|
||||
:value="ticket.address.mobile"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('ticket.summary.clientPhone')"
|
||||
:value="ticket.client.phone"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('ticket.summary.clientMobile')"
|
||||
:value="ticket.client.mobile"
|
||||
/>
|
||||
<VnLv :label="t('global.packages')" :value="ticket.packages" />
|
||||
<VnLv :value="ticket.address.phone">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.consigneePhone') }}
|
||||
<VnLinkPhone :phone-number="ticket.address.phone" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="ticket.address.mobile">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.consigneeMobile') }}
|
||||
<VnLinkPhone :phone-number="ticket.address.mobile" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="ticket.client.phone">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.clientPhone') }}
|
||||
<VnLinkPhone :phone-number="ticket.client.phone" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :value="ticket.client.mobile">
|
||||
<template #label>
|
||||
{{ t('ticket.summary.clientMobile') }}
|
||||
<VnLinkPhone :phone-number="ticket.client.mobile" />
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('ticket.summary.consignee')"
|
||||
:value="formattedAddress()"
|
||||
|
@ -267,7 +276,7 @@ async function changeState(value) {
|
|||
<QTh auto-width>{{ t('ticket.summary.description') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.price') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.discount') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.amount') }}</QTh>
|
||||
<QTh auto-width>{{ t('globals.amount') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.packing') }}</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
|
@ -391,7 +400,7 @@ async function changeState(value) {
|
|||
v-if="ticket.packagings.length > 0 || ticket.services.length > 0"
|
||||
>
|
||||
<a class="header link" :href="ticketUrl + 'package'">
|
||||
{{ t('ticket.summary.packages') }}
|
||||
{{ t('globals.packages') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<QTable :rows="ticket.packagings" flat>
|
||||
|
@ -422,7 +431,7 @@ async function changeState(value) {
|
|||
<QTh auto-width>{{ t('ticket.summary.description') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.price') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.taxClass') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.amount') }}</QTh>
|
||||
<QTh auto-width>{{ t('globals.amount') }}</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body="props">
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import toDateString from 'filters/toDateString';
|
||||
import VnInputDate from "components/common/VnInputDate.vue";
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -71,69 +72,10 @@ const warehouses = ref();
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QInput v-model="params.from" :label="t('From')" mask="date">
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.from" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
<VnInputDate v-model="params.from" :label="t('From')" />
|
||||
</QItemSection>
|
||||
<QItemSection>
|
||||
<QInput v-model="params.to" :label="t('To')" mask="date">
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.to" landscape>
|
||||
<div
|
||||
class="row items-center justify-end q-gutter-sm"
|
||||
>
|
||||
<QBtn
|
||||
:label="t('globals.cancel')"
|
||||
color="primary"
|
||||
flat
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
flat
|
||||
@click="save"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
<VnInputDate v-model="params.to" :label="t('To')" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
|
|
|
@ -87,6 +87,7 @@ function viewSummary(id) {
|
|||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:id="row.id"
|
||||
:title="`${row.nickname} (${row.id})`"
|
||||
@click="navigate(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
|
@ -120,11 +121,11 @@ function viewSummary(id) {
|
|||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn flat icon="preview" @click.stop="viewSummary(row.id)">
|
||||
<QTooltip>
|
||||
{{ t('components.smartCard.openSummary') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
color="primary"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
const stateStore = useStateStore();
|
||||
</script>
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
|
||||
<QScrollArea class="fit">
|
||||
<!-- Aca iría left menu y descriptor -->
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPageContainer>
|
||||
<QPage>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
<div class="q-pa-md"><RouterView></RouterView></div>
|
||||
</QPage>
|
||||
</QPageContainer>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-scrollarea__content {
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.descriptor {
|
||||
max-width: 256px;
|
||||
|
||||
h5 {
|
||||
margin: 0 15px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.q-card__actions {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
#descriptor-skeleton .q-card__actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,80 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'src/filters';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const filter = {
|
||||
fields: [
|
||||
'id',
|
||||
'ref',
|
||||
'shipped',
|
||||
'landed',
|
||||
'totalEntries',
|
||||
'warehouseInFk',
|
||||
'warehouseOutFk',
|
||||
'cargoSupplierFk',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'warehouseOut',
|
||||
scope: {
|
||||
fields: ['name'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
|
||||
const setData = (entity) => {
|
||||
data.value = useCardDescription(entity.ref, entity.id);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardDescriptor
|
||||
module="Travel"
|
||||
:url="`Travels/${entityId}`"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
:filter="filter"
|
||||
@on-fetch="setData"
|
||||
data-key="travelData"
|
||||
>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('globals.wareHouseIn')" :value="entity.warehouseIn.name" />
|
||||
<VnLv :label="t('globals.wareHouseOut')" :value="entity.warehouseOut.name" />
|
||||
<VnLv :label="t('globals.shipped')" :value="toDate(entity.shipped)" />
|
||||
<VnLv :label="t('globals.landed')" :value="toDate(entity.landed)" />
|
||||
<VnLv :label="t('globals.totalEntries')" :value="entity.totalEntries" />
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</template>
|
||||
<i18n>
|
||||
|
||||
</i18n>
|
|
@ -0,0 +1,16 @@
|
|||
<script setup>
|
||||
import TravelDescriptor from './TravelDescriptor.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<TravelDescriptor v-if="$props.id" :id="$props.id" />
|
||||
</QPopupProxy>
|
||||
</template>
|
|
@ -0,0 +1,323 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, onUpdated } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import { toDate } from 'src/filters';
|
||||
import travelService from 'src/services/travel.service';
|
||||
import { QCheckbox, QIcon } from 'quasar';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
|
||||
onUpdated(() => summaryRef.value.fetch());
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const entries = ref([]);
|
||||
const summaryRef = ref();
|
||||
const travel = ref();
|
||||
const travelUrl = ref();
|
||||
|
||||
onMounted(async () => {
|
||||
travelUrl.value = (await getUrl('travel/')) + entityId.value;
|
||||
});
|
||||
|
||||
const cloneTravel = () => {
|
||||
const stringifiedTravelData = JSON.stringify(travel.value);
|
||||
redirectToCreateView(stringifiedTravelData);
|
||||
};
|
||||
|
||||
const headerMenuOptions = [
|
||||
{ name: t('travel.summary.cloneShipping'), action: cloneTravel },
|
||||
{ name: t('travel.summary.CloneTravelAndEntries'), action: null },
|
||||
{ name: t('travel.summary.AddEntry'), action: null },
|
||||
];
|
||||
|
||||
const tableColumnComponents = {
|
||||
isConfirmed: {
|
||||
component: () => QCheckbox,
|
||||
props: (prop) => ({
|
||||
disable: true,
|
||||
'model-value': Boolean(prop.value),
|
||||
}),
|
||||
},
|
||||
id: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => openEntryDescriptor(),
|
||||
},
|
||||
supplierName: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
reference: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
freightValue: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
packageValue: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
cc: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
pallet: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
m3: {
|
||||
component: () => 'span',
|
||||
props: () => {},
|
||||
event: () => {},
|
||||
},
|
||||
observation: {
|
||||
component: (props) => (props.value ? QIcon : null),
|
||||
props: () => ({ name: 'insert_drive_file', color: 'primary', size: '25px' }),
|
||||
},
|
||||
};
|
||||
|
||||
const entriesTableColumns = computed(() => {
|
||||
return [
|
||||
{
|
||||
label: t('travel.summary.confirmed'),
|
||||
field: 'isConfirmed',
|
||||
name: 'isConfirmed',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('travel.summary.entryId'),
|
||||
field: 'id',
|
||||
name: 'id',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('supplier.pageTitles.supplier'),
|
||||
field: 'supplierName',
|
||||
name: 'supplierName',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('globals.reference'),
|
||||
field: 'reference',
|
||||
name: 'reference',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('travel.summary.freight'),
|
||||
field: 'freightValue',
|
||||
name: 'freightValue',
|
||||
align: 'left',
|
||||
format: (val) => {
|
||||
return toCurrency(val);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('travel.summary.package'),
|
||||
field: 'packageValue',
|
||||
name: 'packageValue',
|
||||
align: 'left',
|
||||
format: (val) => {
|
||||
return toCurrency(val);
|
||||
},
|
||||
},
|
||||
{ label: 'CC', field: 'cc', name: 'cc', align: 'left' },
|
||||
{ label: 'Pallet', field: 'pallet', name: 'pallet', align: 'left' },
|
||||
{ label: 'm³', field: 'm3', name: 'm3', align: 'left' },
|
||||
{
|
||||
label: '',
|
||||
field: 'observation',
|
||||
name: 'observation',
|
||||
align: 'left',
|
||||
toolTip: 'Observation three',
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
const entriesTableRows = computed(() => {
|
||||
if (!entries.value && !entries.value.length > 0) return [];
|
||||
return entries.value;
|
||||
});
|
||||
|
||||
async function setTravelData(data) {
|
||||
if (data) {
|
||||
travel.value = data;
|
||||
const entriesResponse = await travelService.getTravelEntries(travel.value.id);
|
||||
if (entriesResponse.data) entries.value = entriesResponse.data;
|
||||
}
|
||||
}
|
||||
|
||||
const redirectToCreateView = (queryParams) => {
|
||||
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
|
||||
};
|
||||
|
||||
const openEntryDescriptor = () => {};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="summaryRef"
|
||||
:url="`Travels/${entityId}/getTravel`"
|
||||
@on-fetch="(data) => setTravelData(data)"
|
||||
>
|
||||
<template #header-left>
|
||||
<a class="header link" :href="travelUrl">
|
||||
<QIcon name="open_in_new" color="white" size="25px" />
|
||||
</a>
|
||||
</template>
|
||||
<template #header>
|
||||
<span>{{ travel.ref }} - {{ travel.id }}</span>
|
||||
</template>
|
||||
|
||||
<template #header-right>
|
||||
<QBtn color="white" dense flat icon="more_vert" round size="md">
|
||||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
</QTooltip>
|
||||
<QMenu>
|
||||
<QList dense v-for="option in headerMenuOptions" :key="option">
|
||||
<QItem v-ripple clickable @click="option.action">
|
||||
{{ option.name }}
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QBtn>
|
||||
</template>
|
||||
|
||||
<template #body>
|
||||
<QCard class="vn-one row justify-around" style="min-width: 100%">
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnLv
|
||||
:label="t('globals.shipped')"
|
||||
:value="toDate(travel.shipped)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnLv
|
||||
:label="t('globals.wareHouseOut')"
|
||||
:value="travel.warehouseOut?.name"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnLv :label="t('travel.summary.delivered')" class="q-mb-xs">
|
||||
<template #value>
|
||||
<QCheckbox
|
||||
v-model="travel.isDelivered"
|
||||
disable
|
||||
dense
|
||||
class="full-width q-my-xs"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnLv
|
||||
:label="t('globals.landed')"
|
||||
:value="toDate(travel.landed)"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnLv
|
||||
:label="t('globals.wareHouseIn')"
|
||||
:value="travel.warehouseIn?.name"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnLv :label="t('travel.summary.received')" class="q-mb-xs">
|
||||
<template #value>
|
||||
<QCheckbox
|
||||
v-model="travel.isReceived"
|
||||
disable
|
||||
dense
|
||||
class="full-width q-mb-xs"
|
||||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<div class="col">
|
||||
<VnLv :label="t('globals.agency')" :value="travel.agency?.name" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnLv :label="t('globals.reference')" :value="travel.ref" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnLv label="m³" :value="travel.m3" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnLv :label="t('globals.totalEntries')" :value="travel.m3" />
|
||||
</div>
|
||||
</VnRow>
|
||||
</QCard>
|
||||
<QCard class="vn-two" v-if="entriesTableRows.length > 0">
|
||||
<a class="header" :href="travelUrl + 'entry'">
|
||||
{{ t('travel.summary.entries') }}
|
||||
<QIcon name="open_in_new" color="primary" />
|
||||
</a>
|
||||
<QTable
|
||||
:rows="entriesTableRows"
|
||||
:columns="entriesTableColumns"
|
||||
hide-bottom
|
||||
row-key="id"
|
||||
class="full-width q-mt-md"
|
||||
>
|
||||
<template #body-cell="props">
|
||||
<QTd :props="props">
|
||||
<component
|
||||
:is="
|
||||
tableColumnComponents[props.col.name].component(props)
|
||||
"
|
||||
v-bind="
|
||||
tableColumnComponents[props.col.name].props(props)
|
||||
"
|
||||
@click="
|
||||
tableColumnComponents[props.col.name].event(props)
|
||||
"
|
||||
class="col-content"
|
||||
>
|
||||
<template
|
||||
v-if="
|
||||
props.col.name !== 'observation' &&
|
||||
props.col.name !== 'isConfirmed'
|
||||
"
|
||||
>{{ props.value }}</template
|
||||
>
|
||||
<QTooltip v-if="props.col.toolTip">{{
|
||||
props.col.toolTip
|
||||
}}</QTooltip>
|
||||
</component>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
<style lang="scss" scoped></style>
|
|
@ -0,0 +1,29 @@
|
|||
<script setup>
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
import TravelSummary from './TravelSummary.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
defineEmits([...useDialogPluginComponent.emits]);
|
||||
|
||||
const { dialogRef, onDialogHide } = useDialogPluginComponent();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef" @hide="onDialogHide">
|
||||
<TravelSummary v-if="$props.id" :id="$props.id" />
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.q-dialog .summary .header {
|
||||
position: sticky;
|
||||
z-index: $z-max;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,419 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { QBtn, QField, QPopupEdit } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import TravelDescriptorProxy from 'src/pages/Travel/Card/TravelDescriptorProxy.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import ExtraCommunityFilter from './ExtraCommunityFilter.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toDate } from 'src/filters';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
import travelService from 'src/services/travel.service';
|
||||
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { openReport } = usePrintService();
|
||||
|
||||
const shippedFrom = ref(Date.vnNew());
|
||||
const landedTo = ref(Date.vnNew());
|
||||
|
||||
const arrayData = useArrayData('ExtraCommunity', {
|
||||
url: 'Travels/extraCommunityFilter',
|
||||
limit: 0,
|
||||
order: [
|
||||
'landed ASC',
|
||||
'shipped ASC',
|
||||
'travelFk',
|
||||
'loadPriority',
|
||||
'agencyModeFk',
|
||||
'supplierName',
|
||||
'evaNotes',
|
||||
],
|
||||
userParams: {
|
||||
continent: 'AM',
|
||||
shippedFrom: shippedFrom.value,
|
||||
landedTo: landedTo.value,
|
||||
},
|
||||
});
|
||||
|
||||
const rows = computed(() => arrayData.store.data || []);
|
||||
|
||||
const tableColumnComponents = {
|
||||
id: {
|
||||
component: QBtn,
|
||||
attrs: () => ({ flat: true, color: 'blue', class: 'col-content' }),
|
||||
},
|
||||
cargoSupplierNickname: {
|
||||
component: QBtn,
|
||||
attrs: () => ({ flat: true, color: 'blue', class: 'col-content' }),
|
||||
},
|
||||
agencyModeName: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
invoiceAmount: {
|
||||
component: 'span',
|
||||
attrs: () => ({
|
||||
class: 'col-content',
|
||||
}),
|
||||
},
|
||||
ref: {
|
||||
component: QField,
|
||||
attrs: () => ({ readonly: true, dense: true }),
|
||||
},
|
||||
stickers: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
kg: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
loadedKg: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
volumeKg: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
warehouseOutName: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
shipped: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
warehouseInName: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
landed: {
|
||||
component: 'span',
|
||||
attrs: () => ({ class: 'col-content' }),
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => {
|
||||
return [
|
||||
{
|
||||
label: 'id',
|
||||
field: 'id',
|
||||
name: 'id',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('supplier.pageTitles.supplier'),
|
||||
field: 'cargoSupplierNickname',
|
||||
name: 'cargoSupplierNickname',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('globals.agency'),
|
||||
field: 'agencyModeName',
|
||||
name: 'agencyModeName',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('globals.amount'),
|
||||
name: 'invoiceAmount',
|
||||
field: 'entries',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
format: (value) =>
|
||||
toCurrency(
|
||||
value
|
||||
? value.reduce((sum, entry) => {
|
||||
return sum + (entry.invoiceAmount || 0);
|
||||
}, 0)
|
||||
: 0
|
||||
),
|
||||
},
|
||||
{
|
||||
label: t('globals.reference'),
|
||||
field: 'ref',
|
||||
name: 'ref',
|
||||
align: 'left',
|
||||
showValue: false,
|
||||
},
|
||||
{
|
||||
label: t('globals.packages'),
|
||||
field: 'stickers',
|
||||
name: 'stickers',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('kg'),
|
||||
field: 'kg',
|
||||
name: 'kg',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('physicKg'),
|
||||
field: 'loadedKg',
|
||||
name: 'loadedKg',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: 'KG Vol.',
|
||||
field: 'volumeKg',
|
||||
name: 'volumeKg',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('globals.wareHouseOut'),
|
||||
field: 'warehouseOutName',
|
||||
name: 'warehouseOutName',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('shipped'),
|
||||
field: 'shipped',
|
||||
name: 'shipped',
|
||||
align: 'left',
|
||||
format: (value) => toDate(value.substring(0, 10)),
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('globals.wareHouseIn'),
|
||||
field: 'warehouseInName',
|
||||
name: 'warehouseInName',
|
||||
align: 'left',
|
||||
showValue: true,
|
||||
},
|
||||
{
|
||||
label: t('landed'),
|
||||
field: 'landed',
|
||||
name: 'landed',
|
||||
align: 'left',
|
||||
format: (value) => toDate(value.substring(0, 10)),
|
||||
showValue: true,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
async function getData() {
|
||||
await arrayData.fetch({ append: false });
|
||||
}
|
||||
|
||||
const openReportPdf = () => {
|
||||
const params = {
|
||||
...arrayData.store.userParams,
|
||||
limit: arrayData.store.limit,
|
||||
};
|
||||
|
||||
openReport('Travels/extra-community-pdf', params);
|
||||
};
|
||||
|
||||
const saveFieldValue = async (val, field, index) => {
|
||||
const id = rows.value[index].id;
|
||||
const params = { [field]: val };
|
||||
await travelService.updateTravel(id, params);
|
||||
};
|
||||
|
||||
const navigateToTravelId = (id) => {
|
||||
router.push({ path: `/travel/${id}` });
|
||||
};
|
||||
|
||||
const stopEventPropagation = (event, col) => {
|
||||
if (!['ref', 'id', 'supplier'].includes(col.name)) return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
|
||||
shippedFrom.value.setDate(shippedFrom.value.getDate() - 2);
|
||||
shippedFrom.value.setHours(0, 0, 0, 0);
|
||||
|
||||
landedTo.value.setDate(landedTo.value.getDate() + 7);
|
||||
landedTo.value.setHours(23, 59, 59, 59);
|
||||
await getData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="stateStore.isHeaderMounted()">
|
||||
<Teleport to="#searchbar">
|
||||
<VnSearchbar
|
||||
data-key="ExtraCommunity"
|
||||
:limit="20"
|
||||
:label="t('searchExtraCommunity')"
|
||||
/>
|
||||
</Teleport>
|
||||
</template>
|
||||
<QToolbar class="bg-vn-dark justify-end">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions">
|
||||
<QBtn color="primary" icon-right="archive" no-caps @click="openReportPdf()" />
|
||||
</div>
|
||||
</QToolbar>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<ExtraCommunityFilter data-key="ExtraCommunity" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
hide-bottom
|
||||
row-key="clientId"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
>
|
||||
<template #body="props">
|
||||
<QTr
|
||||
:props="props"
|
||||
@click="navigateToTravelId(props.row.id)"
|
||||
class="cursor-pointer"
|
||||
>
|
||||
<QTd
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
@click="stopEventPropagation($event, col)"
|
||||
>
|
||||
<component
|
||||
:is="tableColumnComponents[col.name].component"
|
||||
class="col-content"
|
||||
v-bind="tableColumnComponents[col.name].attrs(props)"
|
||||
>
|
||||
<!-- Editable 'ref' and 'kg' QField slot -->
|
||||
<template
|
||||
v-if="col.name === 'ref' || col.name === 'kg'"
|
||||
#control
|
||||
>
|
||||
<div
|
||||
class="self-center full-width no-outline"
|
||||
tabindex="0"
|
||||
>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
<QPopupEdit
|
||||
:key="col.name"
|
||||
v-model="col.value"
|
||||
label-set="Save"
|
||||
label-cancel="Close"
|
||||
>
|
||||
<QInput
|
||||
v-model="rows[props.pageIndex][col.field]"
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="
|
||||
saveFieldValue(
|
||||
rows[props.pageIndex][col.field],
|
||||
col.field,
|
||||
props.rowIndex
|
||||
)
|
||||
"
|
||||
/>
|
||||
</QPopupEdit>
|
||||
</template>
|
||||
|
||||
<template v-if="col.showValue">
|
||||
{{ col.value }}
|
||||
</template>
|
||||
|
||||
<!-- Main Row Descriptors -->
|
||||
<TravelDescriptorProxy
|
||||
v-if="col.name === 'id'"
|
||||
:id="props.row.id"
|
||||
/>
|
||||
<SupplierDescriptorProxy
|
||||
v-if="col.name === 'cargoSupplierNickname'"
|
||||
:id="props.row.cargoSupplierFk"
|
||||
/>
|
||||
</component>
|
||||
</QTd>
|
||||
</QTr>
|
||||
<QTr
|
||||
v-for="entry in props.row.entries"
|
||||
:key="entry.id"
|
||||
:props="props"
|
||||
class="secondary-row"
|
||||
>
|
||||
<QTd
|
||||
><QBtn flat color="blue" class="col-content">{{ entry.id }}</QBtn>
|
||||
<!-- Cuando se cree el modulo relacionado a entries, crear su descriptor y colocarlo acá -->
|
||||
<!-- <EntryDescriptorProxy :id="entry.id"/> -->
|
||||
</QTd>
|
||||
<QTd
|
||||
><QBtn flat color="blue" class="col-content">{{
|
||||
entry.supplierName
|
||||
}}</QBtn>
|
||||
<SupplierDescriptorProxy :id="entry.supplierFk" />
|
||||
</QTd>
|
||||
<QTd></QTd>
|
||||
<QTd
|
||||
><span class="col-content">{{
|
||||
toCurrency(entry.invoiceAmount)
|
||||
}}</span></QTd
|
||||
>
|
||||
<QTd
|
||||
><span class="col-content">{{ entry.reference }}</span></QTd
|
||||
>
|
||||
<QTd
|
||||
><span class="col-content">{{ entry.stickers }}</span></QTd
|
||||
>
|
||||
<QTd></QTd>
|
||||
<QTd
|
||||
><span class="col-content">{{ entry.loadedkg }}</span></QTd
|
||||
>
|
||||
<QTd
|
||||
><span class="col-content">{{ entry.volumeKg }}</span></QTd
|
||||
>
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
<QTd></QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.col-content {
|
||||
border-radius: 4px;
|
||||
padding: 6px 6px 6px 6px;
|
||||
}
|
||||
|
||||
.secondary-row {
|
||||
background-color: var(--vn-gray);
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
searchExtraCommunity: Search for extra community shipping
|
||||
kg: BI. KG
|
||||
physicKg: Phy. KG
|
||||
shipped: W. shipped
|
||||
landed: W. landed
|
||||
|
||||
es:
|
||||
searchExtraCommunity: Buscar por envío extra comunitario
|
||||
kg: KG Bloq.
|
||||
physicKg: KG físico
|
||||
shipped: F. envío
|
||||
landed: F. llegada
|
||||
</i18n>
|
|
@ -0,0 +1,263 @@
|
|||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const filtersOptions = reactive({
|
||||
warehouses: [],
|
||||
continents: [],
|
||||
agencies: [],
|
||||
suppliers: [],
|
||||
});
|
||||
|
||||
const updateFilterOptions = (data, optionKey) => {
|
||||
filtersOptions[optionKey] = [...data];
|
||||
};
|
||||
|
||||
const add = (paramsObj, key) => {
|
||||
if (paramsObj[key] === undefined) {
|
||||
paramsObj[key] = 1;
|
||||
} else {
|
||||
paramsObj[key]++;
|
||||
}
|
||||
};
|
||||
|
||||
const decrement = (paramsObj, key) => {
|
||||
if (paramsObj[key] === 0) return;
|
||||
|
||||
paramsObj[key]--;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'warehouses')"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Continents"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'continents')"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'agencies')"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Suppliers"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'suppliers')"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense style="max-width: 256px" class="list">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<QInput label="id" dense outlined rounded v-model="params.id" />
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('params.ref')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
v-model="params.reference"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
v-model="params.totalEntries"
|
||||
type="number"
|
||||
:label="t('params.totalEntries')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
min="0"
|
||||
class="input-number"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="add"
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
@click="add(params, 'totalEntries')"
|
||||
/>
|
||||
<QBtn
|
||||
icon="remove"
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
@click="decrement(params, 'totalEntries')"
|
||||
/>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.agencyModeFk')"
|
||||
v-model="params.agencyModeFk"
|
||||
:options="filtersOptions.agencies"
|
||||
option-value="agencyFk"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.shippedFrom"
|
||||
:label="t('params.shippedFrom')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
v-model="params.landedTo"
|
||||
:label="t('params.landedTo')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
:options="filtersOptions.warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
:options="filtersOptions.warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('supplier.pageTitles.supplier')"
|
||||
v-model="params.cargoSupplierFk"
|
||||
:options="filtersOptions.suppliers"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.continent')"
|
||||
v-model="params.continent"
|
||||
:options="filtersOptions.continents"
|
||||
option-value="code"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.input-number >>> input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.input-number >>> input::-webkit-outer-spin-button,
|
||||
.input-number >>> input::-webkit-inner-spin-button {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
ref: Reference
|
||||
totalEntries: Total entries
|
||||
agencyModeFk: Agency
|
||||
warehouseInFk: Warehouse In
|
||||
warehouseOutFk: Warehouse Out
|
||||
shippedFrom: Shipped from
|
||||
landedTo: Landed to
|
||||
cargoSupplierFk: Supplier
|
||||
continent: Continent out
|
||||
es:
|
||||
params:
|
||||
ref: Referencia
|
||||
totalEntries: Ent. totales
|
||||
agencyModeFk: Agencia
|
||||
warehouseInFk: Alm. entrada
|
||||
warehouseOutFk: Alm. salida
|
||||
shippedFrom: Llegada desde
|
||||
landedTo: Llegada hasta
|
||||
cargoSupplierFk: Proveedor
|
||||
continent: Cont. Salida
|
||||
</i18n>
|
|
@ -0,0 +1,179 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { reactive, ref } from 'vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
import { onBeforeMount } from 'vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
|
||||
const newTravelForm = reactive({
|
||||
ref: null,
|
||||
agencyModeFk: null,
|
||||
shipped: null,
|
||||
landed: null,
|
||||
warehouseOutFk: null,
|
||||
warehouseInFk: null,
|
||||
});
|
||||
|
||||
const agenciesOptions = ref([]);
|
||||
const viewAction = ref();
|
||||
const warehousesOptions = ref([]);
|
||||
|
||||
onBeforeMount(() => {
|
||||
// Esto nos permite decirle a FormModel si queremos observar los cambios o no
|
||||
// Ya que si queremos clonar queremos que nos permita guardar inmediatamente sin realizar cambios en el form
|
||||
viewAction.value = route.query.travelData ? 'clone' : 'create';
|
||||
|
||||
if (route.query.travelData) {
|
||||
const travelData = JSON.parse(route.query.travelData);
|
||||
for (let key in newTravelForm) {
|
||||
if (key === 'landed' || key === 'shipped') {
|
||||
newTravelForm[key] = travelData[key].substring(0, 10);
|
||||
} else {
|
||||
newTravelForm[key] = travelData[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const onFetchAgencies = (agencies) => {
|
||||
agenciesOptions.value = [...agencies];
|
||||
};
|
||||
|
||||
const onFetchWarehouses = (warehouses) => {
|
||||
warehousesOptions.value = [...warehouses];
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="AgencyModes" @on-fetch="(data) => onFetchAgencies(data)" auto-load />
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => onFetchWarehouses(data)" auto-load />
|
||||
<QPage>
|
||||
<QToolbar class="bg-vn-dark">
|
||||
<div id="st-data"></div>
|
||||
<QSpace />
|
||||
<div id="st-actions"></div>
|
||||
</QToolbar>
|
||||
<FormModel
|
||||
url-update="Travels"
|
||||
model="travel"
|
||||
:form-initial-data="newTravelForm"
|
||||
:observe-form-changes="viewAction === 'create'"
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput v-model="data.ref" :label="t('globals.reference')" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('globals.agency')"
|
||||
v-model="data.agencyModeFk"
|
||||
:options="agenciesOptions"
|
||||
option-value="agencyFk"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<QInput
|
||||
rounded
|
||||
placeholder="dd-mm-aaa"
|
||||
:label="t('globals.shipped')"
|
||||
:model-value="toDate(data.shipped)"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="data.shipped">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
<div class="col">
|
||||
<QInput
|
||||
rounded
|
||||
placeholder="dd-mm-aaa"
|
||||
:label="t('globals.landed')"
|
||||
:model-value="toDate(data.landed)"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="data.landed">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('globals.wareHouseOut')"
|
||||
v-model="data.warehouseOutFk"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('globals.wareHouseIn')"
|
||||
v-model="data.warehouseInFk"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
grid-gap: 20px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,311 @@
|
|||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const filtersOptions = reactive({
|
||||
warehouses: [],
|
||||
continents: [],
|
||||
agencies: [],
|
||||
});
|
||||
|
||||
const updateFilterOptions = (data, optionKey) => {
|
||||
filtersOptions[optionKey] = [...data];
|
||||
};
|
||||
|
||||
const add = (paramsObj, key) => {
|
||||
if (paramsObj[key] === undefined) {
|
||||
paramsObj[key] = 1;
|
||||
} else {
|
||||
paramsObj[key]++;
|
||||
}
|
||||
};
|
||||
|
||||
const decrement = (paramsObj, key) => {
|
||||
if (paramsObj[key] === 0) return;
|
||||
|
||||
paramsObj[key]--;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'warehouses')"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Continents"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'continents')"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'agencies')"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QList dense style="max-width: 256px" class="list">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
:label="t('params.search')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
v-model="params.search"
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.agencyModeFk')"
|
||||
v-model="params.agencyModeFk"
|
||||
:options="filtersOptions.agencies"
|
||||
option-value="agencyFk"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
:options="filtersOptions.warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
:options="filtersOptions.warehouses"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
v-model="params.scopeDays"
|
||||
type="number"
|
||||
:label="t('params.scopeDays')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
class="input-number"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="add"
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
@click="add(params, 'scopeDays')"
|
||||
/>
|
||||
<QBtn
|
||||
icon="remove"
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
@click="decrement(params, 'scopeDays')"
|
||||
/>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
placeholder="dd-mm-aaa"
|
||||
:label="t('params.landedFrom')"
|
||||
:model-value="toDate(params.landedFrom)"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.landedFrom">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
placeholder="dd-mm-aaa"
|
||||
:model-value="toDate(params.landedTo)"
|
||||
:label="t('params.landedTo')"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="event" class="cursor-pointer">
|
||||
<QPopupProxy
|
||||
cover
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<QDate v-model="params.landedTo">
|
||||
<div class="row items-center justify-end">
|
||||
<QBtn
|
||||
v-close-popup
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
flat
|
||||
/>
|
||||
</div>
|
||||
</QDate>
|
||||
</QPopupProxy>
|
||||
</QIcon>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<VnSelectFilter
|
||||
:label="t('params.continent')"
|
||||
v-model="params.continent"
|
||||
:options="filtersOptions.continents"
|
||||
option-value="code"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem class="q-mb-sm">
|
||||
<QItemSection>
|
||||
<QInput
|
||||
v-model="params.totalEntries"
|
||||
type="number"
|
||||
:label="t('params.totalEntries')"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
min="0"
|
||||
class="input-number"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
icon="add"
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
@click="add(params, 'totalEntries')"
|
||||
/>
|
||||
<QBtn
|
||||
icon="remove"
|
||||
flat
|
||||
dense
|
||||
size="12px"
|
||||
@click="decrement(params, 'totalEntries')"
|
||||
/>
|
||||
</template>
|
||||
</QInput>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.list * {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.input-number >>> input[type='number'] {
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
.input-number >>> input::-webkit-outer-spin-button,
|
||||
.input-number >>> input::-webkit-inner-spin-button {
|
||||
appearance: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
search: Id/Reference
|
||||
agencyModeFk: Agency
|
||||
warehouseInFk: Warehouse In
|
||||
warehouseOutFk: Warehouse Out
|
||||
scopeDays: Days onward
|
||||
landedFrom: Landed from
|
||||
landedTo: Landed to
|
||||
continent: Continent out
|
||||
totalEntries: Total entries
|
||||
es:
|
||||
params:
|
||||
search: Id/Referencia
|
||||
agencyModeFk: Agencia
|
||||
warehouseInFk: Alm. entrada
|
||||
warehouseOutFk: Alm. salida
|
||||
scopeDays: Días adelante
|
||||
landedFrom: Llegada desde
|
||||
landedTo: Llegada hasta
|
||||
continent: Cont. Salida
|
||||
totalEntries: Ent. totales
|
||||
|
||||
</i18n>
|
|
@ -0,0 +1,147 @@
|
|||
<script setup>
|
||||
import { onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import TravelSummaryDialog from './Card/TravelSummaryDialog.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import TravelFilter from './TravelFilter.vue';
|
||||
import { toDate } from 'src/filters/index';
|
||||
|
||||
const router = useRouter();
|
||||
const quasar = useQuasar();
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
||||
const navigateToTravelId = (id) => {
|
||||
router.push({ path: `/travel/${id}` });
|
||||
};
|
||||
|
||||
const cloneTravel = (travelData) => {
|
||||
const stringifiedTravelData = JSON.stringify(travelData);
|
||||
redirectToCreateView(stringifiedTravelData);
|
||||
};
|
||||
|
||||
const redirectToCreateView = (queryParams) => {
|
||||
router.push({ name: 'TravelCreate', query: { travelData: queryParams } });
|
||||
};
|
||||
|
||||
const viewSummary = (id) => {
|
||||
quasar.dialog({
|
||||
component: TravelSummaryDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<TravelFilter data-key="TravelList" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="card-list">
|
||||
<VnPaginate
|
||||
data-key="TravelList"
|
||||
url="Travels/filter"
|
||||
auto-load
|
||||
order="shipped DESC, landed DESC"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
v-for="row of rows"
|
||||
:key="row.id"
|
||||
:title="row.ref"
|
||||
:id="row.id"
|
||||
@click="navigateToTravelId(row.id)"
|
||||
>
|
||||
<template #list-items>
|
||||
<VnLv
|
||||
:label="t('globals.agency')"
|
||||
:value="row.agencyModeName"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.wareHouseOut')"
|
||||
:value="row.warehouseOutFk"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.shipped')"
|
||||
:value="toDate(row.shipped)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.landed')"
|
||||
:value="toDate(row.landed)"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('globals.wareHouseIn')"
|
||||
:value="row.warehouseInFk"
|
||||
/>
|
||||
|
||||
<VnLv
|
||||
:label="t('globals.totalEntries')"
|
||||
:value="row.totalEntries"
|
||||
/>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.clone')"
|
||||
@click.stop="cloneTravel(row)"
|
||||
class="bg-vn-dark"
|
||||
outline
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('addEntry')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
class="bg-vn-dark"
|
||||
outline
|
||||
style="margin-top: 15px"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('components.smartCard.openSummary')"
|
||||
@click.stop="viewSummary(row.id)"
|
||||
color="primary"
|
||||
style="margin-top: 15px"
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn fab icon="add" color="primary" @click="redirectToCreateView()" />
|
||||
<QTooltip>
|
||||
{{ t('supplier.list.newSupplier') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-list {
|
||||
width: 100%;
|
||||
max-width: 60em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
addEntry: Add entry
|
||||
|
||||
|
||||
es:
|
||||
addEntry: Añadir entrada
|
||||
|
||||
|
||||
</i18n>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue