0
0
Fork 0

Resolve conflicts

This commit is contained in:
William Buezas 2024-04-19 10:40:04 -03:00
commit 3a03e42cf9
221 changed files with 8122 additions and 4286 deletions

View File

@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2418.01]
## [2416.01] - 2024-04-18
### Added
### Fixed
- (General) => Se vuelven a mostrar los parámetros en la url al aplicar un filtro
## [2414.01] - 2024-04-04
### Added
- (Tickets) => Se añade la opción de clonar ticket. #6951
- (Parking) => Se añade la sección Parking. #5186
- (Rutas) => Se añade el campo "servida" a la tabla y se añade también a los filtros. #7130
### Changed
### Fixed
- (General) => Se corrige la redirección cuando hay 1 solo registro y cuando se aplica un filtro diferente al id al hacer una búsqueda general. #6893
## [2400.01] - 2024-01-04
### Added

View File

@ -5,13 +5,13 @@ Lilium frontend
## Install the dependencies
```bash
bun install
pnpm install
```
### Install quasar cli
```bash
sudo bun install -g @quasar/cli
sudo npm install -g @quasar/cli
```
### Start the app in development mode (hot-code reloading, error reporting, etc.)
@ -23,13 +23,13 @@ quasar dev
### Run unit tests
```bash
bun run test:unit
pnpm run test:unit
```
### Run e2e tests
```bash
npm run test:e2e
pnpm run test:e2e
```
### Build the app for production

View File

@ -3,6 +3,7 @@ const { defineConfig } = require('cypress');
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:9000/',
experimentalStudio: true,
fixturesFolder: 'test/cypress/fixtures',
screenshotsFolder: 'test/cypress/screenshots',
supportFile: 'test/cypress/support/index.js',

View File

@ -1,6 +1,6 @@
{
"name": "salix-front",
"version": "24.12.0",
"version": "24.18.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",
@ -32,6 +32,7 @@
"@intlify/unplugin-vue-i18n": "^0.8.1",
"@pinia/testing": "^0.1.2",
"@quasar/app-vite": "^1.7.3",
"@quasar/quasar-app-extension-qcalendar": "4.0.0-beta.15",
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
"@vue/test-utils": "^2.4.4",
"autoprefixer": "^10.4.14",

View File

@ -49,6 +49,9 @@ devDependencies:
'@quasar/app-vite':
specifier: ^1.7.3
version: 1.7.3(eslint@8.56.0)(pinia@2.1.7)(quasar@2.14.5)(vue-router@4.2.5)(vue@3.4.19)
'@quasar/quasar-app-extension-qcalendar':
specifier: 4.0.0-beta.15
version: 4.0.0-beta.15
'@quasar/quasar-app-extension-testing-unit-vitest':
specifier: ^0.4.0
version: 0.4.0(@vue/test-utils@2.4.4)(quasar@2.14.5)(vite@5.1.4)(vitest@0.31.4)(vue@3.4.19)
@ -912,6 +915,13 @@ packages:
resolution: {integrity: sha512-SlOhwzXyPQHWgQIS2ncyDdYdksCJvUYNtgsDQqzAKEG3r3d/ejOxvThle79HTK3Q6HB+gQWFG21Ux00Osr5XSw==}
dev: false
/@quasar/quasar-app-extension-qcalendar@4.0.0-beta.15:
resolution: {integrity: sha512-i6hQkcP70LXLfVMPZMKQjSg3681gjZmASV3vq6ULzc0LhtBiPneLdVNNtH2itkWxAmaUj+1heQDI5Pa0F7VKLQ==}
engines: {node: '>= 10.0.0', npm: '>= 5.6.0', yarn: '>= 1.6.0'}
dependencies:
'@quasar/quasar-ui-qcalendar': 4.0.0-beta.19
dev: true
/@quasar/quasar-app-extension-testing-unit-vitest@0.4.0(@vue/test-utils@2.4.4)(quasar@2.14.5)(vite@5.1.4)(vitest@0.31.4)(vue@3.4.19):
resolution: {integrity: sha512-eyzdUdmZiCueNS+5nedjMmzdbpCetSrtdGIwW6KplW1dTzRbLiNvYUjpBOxQGmJCgEhWy9zuswJ7MZ/bTql24Q==}
engines: {node: '>= 12.22.1', npm: '>= 6.14.12', yarn: '>= 1.17.3'}
@ -939,6 +949,10 @@ packages:
- vite
dev: true
/@quasar/quasar-ui-qcalendar@4.0.0-beta.19:
resolution: {integrity: sha512-BT0G2JjgKl1bqNrY5utcYeoy8gK+U9k3Pz1YDi1OB265W/jHU6nFoWMEUdY3JdvMccwkXTL2DLVyl3eqAUyLyg==}
dev: true
/@quasar/render-ssr-error@1.0.3:
resolution: {integrity: sha512-A8RF99q6/sOSe1Ighnh5syEIbliD3qUYEJd2HyfFyBPSMF+WYGXon5dmzg4nUoK662NgOggInevkDyBDJcZugg==}
engines: {node: '>= 16'}

View File

@ -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', 'validations'],
boot: ['i18n', 'axios', 'vnDate', 'validations', 'quasar.defaults'],
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#css
css: ['app.scss'],
@ -93,13 +93,11 @@ module.exports = configure(function (/* ctx */) {
[
VueI18nPlugin({
runtimeOnly: false,
include: [
path.resolve(__dirname, './src/i18n/locale/**'),
path.resolve(__dirname, './src/pages/**/locale/**'),
],
}),
{
// if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
// compositionOnly: false,
// you need to set i18n resource including paths !
include: path.resolve(__dirname, './src/i18n/**'),
},
],
],
},
@ -117,6 +115,7 @@ module.exports = configure(function (/* ctx */) {
secure: false,
},
},
open: false,
},
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework

View File

@ -1,7 +1,6 @@
{
"@quasar/testing-unit-vitest": {
"options": [
"scripts"
]
}
"@quasar/testing-unit-vitest": {
"options": ["scripts"]
},
"@quasar/qcalendar": {}
}

View File

@ -16,7 +16,7 @@ onMounted(() => {
if (availableLocales.includes(userLang)) {
locale.value = userLang;
} else {
locale.value = fallbackLocale;
locale.value = fallbackLocale.value;
}
});

View File

@ -11,7 +11,7 @@ axios.defaults.baseURL = '/api/';
const onRequest = (config) => {
const token = session.getToken();
if (token.length && config.headers) {
if (token.length && !config.headers.Authorization) {
config.headers.Authorization = token;
}

View File

@ -0,0 +1,5 @@
import { QTable } from 'quasar';
import setDefault from './setDefault';
setDefault(QTable, 'pagination', { rowsPerPage: 0 });
setDefault(QTable, 'hidePagination', true);

View File

@ -0,0 +1,18 @@
export default function (component, key, value) {
const prop = component.props[key];
switch (typeof prop) {
case 'object':
prop.default = value;
break;
case 'function':
component.props[key] = {
type: prop,
default: value,
};
break;
case 'undefined':
throw new Error('unknown prop: ' + key);
default:
throw new Error('unhandled type: ' + typeof prop);
}
}

21
src/boot/qformMixin.js Normal file
View File

@ -0,0 +1,21 @@
import { getCurrentInstance } from 'vue';
const filterAvailableInput = element => element.classList.contains('q-field__native') && !element.disabled
const filterAvailableText = element => element.__vueParentComponent.type.name === 'QInput' && element.__vueParentComponent?.attrs?.class !== 'vn-input-date';
export default {
mounted: function () {
const vm = getCurrentInstance();
if (vm.type.name === 'QForm')
if (!['searchbarForm','filterPanelForm'].includes(this.$el?.id)) {
// AUTOFOCUS
const elementsArray = Array.from(this.$el.elements);
const firstInputElement = elementsArray.filter(filterAvailableInput).find(filterAvailableText);
if (firstInputElement) {
firstInputElement.focus();
}
}
},
};

View File

@ -0,0 +1 @@
export * from './defaults/qTable';

6
src/boot/quasar.js Normal file
View File

@ -0,0 +1,6 @@
import { boot } from 'quasar/wrappers';
import qFormMixin from './qformMixin';
export default boot(({ app }) => {
app.mixin(qFormMixin);
});

View File

@ -0,0 +1,174 @@
<script setup>
import { reactive, ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModelPopup from './FormModelPopup.vue';
import VnInputDate from './common/VnInputDate.vue';
const emit = defineEmits(['onDataSaved']);
const { t } = useI18n();
const router = useRouter();
const manualInvoiceFormData = reactive({
maxShipped: Date.vnNew(),
});
const formModelPopupRef = ref();
const invoiceOutSerialsOptions = ref([]);
const taxAreasOptions = ref([]);
const ticketsOptions = ref([]);
const clientsOptions = ref([]);
const isLoading = computed(() => formModelPopupRef.value?.isLoading);
const onDataSaved = async (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
if (requestResponse && requestResponse.id)
router.push({ name: 'InvoiceOutSummary', params: { id: requestResponse.id } });
};
</script>
<template>
<FetchData
url="InvoiceOutSerials"
:filter="{ where: { code: { neq: 'R' } }, order: ['code'] }"
@on-fetch="(data) => (invoiceOutSerialsOptions = data)"
auto-load
/>
<FetchData
url="TaxAreas"
:filter="{ order: ['code'] }"
@on-fetch="(data) => (taxAreasOptions = data)"
auto-load
/>
<FetchData
url="Tickets"
:filter="{ fields: ['id', 'nickname'], order: 'shipped DESC', limit: 30 }"
@on-fetch="(data) => (ticketsOptions = data)"
auto-load
/>
<FetchData
url="Clients"
:filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }"
@on-fetch="(data) => (clientsOptions = data)"
auto-load
/>
<FormModelPopup
ref="formModelPopupRef"
:title="t('Create manual invoice')"
url-create="InvoiceOuts/createManualInvoice"
model="invoiceOut"
:form-initial-data="manualInvoiceFormData"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data }">
<span v-if="isLoading" class="text-primary invoicing-text">
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
{{ t('Invoicing in progress...') }}
</span>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Ticket')"
:options="ticketsOptions"
hide-selected
option-label="id"
option-value="id"
v-model="data.ticketFk"
@update:model-value="data.clientFk = null"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
<QItemLabel caption>{{
scope.opt?.nickname
}}</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
<span class="row items-center" style="max-width: max-content">{{
t('Or')
}}</span>
<div class="col">
<VnSelectFilter
:label="t('Client')"
:options="clientsOptions"
hide-selected
option-label="name"
option-value="id"
v-model="data.clientFk"
@update:model-value="data.ticketFk = null"
/>
</div>
<div class="col">
<VnInputDate :label="t('Max date')" v-model="data.maxShipped" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Serial')"
:options="invoiceOutSerialsOptions"
hide-selected
option-label="description"
option-value="code"
v-model="data.serial"
:required="true"
/>
</div>
<div class="col">
<VnSelectFilter
:label="t('Area')"
:options="taxAreasOptions"
hide-selected
option-label="code"
option-value="code"
v-model="data.taxArea"
:required="true"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput
:label="t('Reference')"
type="textarea"
v-model="data.reference"
fill-input
autogrow
/>
</VnRow>
</template>
</FormModelPopup>
</template>
<style lang="scss" scoped>
.invoicing-text {
display: flex;
justify-content: center;
align-items: center;
color: $primary;
font-size: 24px;
margin-bottom: 8px;
}
</style>
<i18n>
es:
Create manual invoice: Crear factura manual
Ticket: Ticket
Client: Cliente
Max date: Fecha límite
Serial: Serie
Area: Area
Reference: Referencia
Or: O
Invoicing in progress...: Facturación en progreso...
</i18n>

View File

@ -28,8 +28,23 @@ const countriesOptions = ref([]);
const provincesOptions = ref([]);
const townsLocationOptions = ref([]);
const onDataSaved = (dataSaved) => {
emit('onDataSaved', dataSaved);
const onDataSaved = (formData) => {
const newPostcode = {
...formData
};
const townObject = townsLocationOptions.value.find(
({id}) => id === formData.townFk
);
newPostcode.town = townObject?.name;
const provinceObject = provincesOptions.value.find(
({id}) => id === formData.provinceFk
);
newPostcode.province = provinceObject?.name;
const countryObject = countriesOptions.value.find(
({id}) => id === formData.countryFk
);
newPostcode.country = countryObject?.country;
emit('onDataSaved', newPostcode);
};
const onCityCreated = async ({ name, provinceFk }, formData) => {
@ -73,7 +88,7 @@ const onProvinceCreated = async ({ name }, formData) => {
:title="t('New postcode')"
:subtitle="t('Please, ensure you put the correct data!')"
:form-initial-data="postcodeFormData"
@on-data-saved="onDataSaved($event)"
@on-data-saved="onDataSaved"
>
<template #form-inputs="{ data, validate }">
<VnRow class="row q-gutter-md q-mb-md">

View File

@ -24,6 +24,10 @@ const $props = defineProps({
type: String,
default: '',
},
limit: {
type: Number,
default: 20,
},
saveUrl: {
type: String,
default: null,
@ -76,6 +80,7 @@ defineExpose({
reset,
hasChanges,
saveChanges,
getChanges,
});
async function fetch(data) {
@ -260,6 +265,7 @@ watch(formUrl, async () => {
<template>
<VnPaginate
:url="url"
:limit="limit"
v-bind="$attrs"
@on-fetch="fetch"
:skeleton="false"

View File

@ -1,5 +1,5 @@
<script setup>
import { h, onMounted } from 'vue';
import { onMounted } from 'vue';
import axios from 'axios';
const $props = defineProps({
@ -60,3 +60,6 @@ async function fetch(fetchFilter = {}) {
}
}
</script>
<template>
<template></template>
</template>

View File

@ -202,7 +202,6 @@ const selectItem = ({ id }) => {
<QTable
:columns="tableColumns"
:rows="tableRows"
:pagination="{ rowsPerPage: 0 }"
:loading="loading"
:hide-header="!tableRows || !tableRows.length > 0"
:no-data-label="t('Enter a new search')"

View File

@ -200,7 +200,6 @@ const selectTravel = ({ id }) => {
<QTable
:columns="tableColumns"
:rows="tableRows"
:pagination="{ rowsPerPage: 0 }"
:loading="loading"
:hide-header="!tableRows || !tableRows.length > 0"
:no-data-label="t('Enter a new search')"

View File

@ -78,10 +78,6 @@ const $props = defineProps({
const emit = defineEmits(['onFetch', 'onDataSaved']);
defineExpose({
save,
});
const componentIsRendered = ref(false);
onMounted(async () => {
@ -106,19 +102,16 @@ onMounted(async () => {
});
onBeforeRouteLeave((to, from, next) => {
if (!hasChanges.value) {
next();
return;
}
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('Unsaved changes will be lost'),
message: t('Are you sure exit without saving?'),
promise: () => next(),
},
});
if (hasChanges.value)
quasar.dialog({
component: VnConfirm,
componentProps: {
title: t('Unsaved changes will be lost'),
message: t('Are you sure exit without saving?'),
promise: () => next(),
},
});
else next();
});
onUnmounted(() => {
@ -140,12 +133,12 @@ const formUrl = computed(() => $props.url);
const defaultButtons = computed(() => ({
save: {
color: 'primary',
icon: 'restart_alt',
icon: 'save',
label: 'globals.save',
},
reset: {
color: 'primary',
icon: 'save',
icon: 'restart_alt',
label: 'globals.reset',
},
...$props.defaultButtons,
@ -235,6 +228,12 @@ watch(formUrl, async () => {
reset();
fetch();
});
defineExpose({
save,
isLoading,
hasChanges,
});
</script>
<template>
<div class="column items-center full-width">
@ -291,6 +290,9 @@ watch(formUrl, async () => {
/>
</template>
<style lang="scss" scoped>
.q-notifications {
color: black;
}
#formModel {
max-width: 800px;
width: 100%;

View File

@ -1,5 +1,5 @@
<script setup>
import { ref } from 'vue';
import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue';
@ -39,21 +39,28 @@ const $props = defineProps({
const { t } = useI18n();
const formModelRef = ref(null);
const closeButton = ref(null);
const isLoading = ref(false);
const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse);
closeForm();
};
const closeForm = () => {
const isLoading = computed(() => formModelRef.value?.isLoading);
const closeForm = async () => {
if (closeButton.value) closeButton.value.click();
};
defineExpose({
isLoading,
});
</script>
<template>
<FormModel
ref="formModelRef"
:form-initial-data="formInitialData"
:observe-form-changes="false"
:default-actions="false"
@ -71,6 +78,7 @@ const closeForm = () => {
<div class="q-mt-lg row justify-end">
<QBtn
:label="t('globals.save')"
:title="t('globals.save')"
type="submit"
color="primary"
:disabled="isLoading"
@ -78,6 +86,7 @@ const closeForm = () => {
/>
<QBtn
:label="t('globals.cancel')"
:title="t('globals.cancel')"
type="reset"
color="primary"
flat

View File

@ -0,0 +1,96 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
const emit = defineEmits(['onSubmit']);
const $props = defineProps({
title: {
type: String,
default: '',
},
subtitle: {
type: String,
default: '',
},
defaultSubmitButton: {
type: Boolean,
default: true,
},
defaultCancelButton: {
type: Boolean,
default: true,
},
customSubmitButtonLabel: {
type: String,
default: '',
},
});
const { t } = useI18n();
const closeButton = ref(null);
const isLoading = ref(false);
const onSubmit = () => {
emit('onSubmit');
closeForm();
};
const closeForm = () => {
if (closeButton.value) closeButton.value.click();
};
</script>
<template>
<QForm
@submit="onSubmit($event)"
class="all-pointer-events full-width"
style="max-width: 800px"
>
<QCard class="q-pa-lg">
<span ref="closeButton" class="close-icon" v-close-popup>
<QIcon name="close" size="sm" />
</span>
<h1 class="title">{{ title }}</h1>
<p>{{ subtitle }}</p>
<slot name="form-inputs" />
<div class="q-mt-lg row justify-end">
<QBtn
v-if="defaultSubmitButton"
:label="customSubmitButtonLabel || t('globals.save')"
type="submit"
color="primary"
:disabled="isLoading"
:loading="isLoading"
/>
<QBtn
v-if="defaultCancelButton"
:label="t('globals.cancel')"
color="primary"
flat
class="q-ml-sm"
:disabled="isLoading"
:loading="isLoading"
v-close-popup
/>
<slot name="customButtons" />
</div>
</QCard>
</QForm>
</template>
<style lang="scss" scoped>
.title {
font-size: 17px;
font-weight: bold;
line-height: 20px;
}
.close-icon {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}
</style>

View File

@ -244,6 +244,6 @@ const handleItemExpansion = (itemName) => {
max-width: 256px;
}
.header {
color: #999999;
color: var(--vn-label-color);
}
</style>

View File

@ -2,7 +2,7 @@
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const { t, te } = useI18n();
const props = defineProps({
item: {
@ -11,19 +11,25 @@ const props = defineProps({
},
});
const item = computed(() => props.item); // eslint-disable-line vue/no-dupe-keys
const itemComputed = computed(() => {
const item = JSON.parse(JSON.stringify(props.item));
const [, , section] = item.title.split('.');
if (!te(item.title)) item.title = t(`globals.pageTitles.${section}`);
return item;
});
</script>
<template>
<QItem active-class="text-primary" :to="{ name: item.name }" clickable v-ripple>
<QItemSection avatar v-if="item.icon">
<QIcon :name="item.icon" />
<QItem active-class="bg-hover" :to="{ name: itemComputed.name }" clickable v-ripple>
<QItemSection avatar v-if="itemComputed.icon">
<QIcon :name="itemComputed.icon" />
</QItemSection>
<QItemSection avatar v-if="!item.icon">
<QItemSection avatar v-if="!itemComputed.icon">
<QIcon name="disabled_by_default" />
</QItemSection>
<QItemSection>{{ t(item.title) }}</QItemSection>
<QItemSection>{{ t(itemComputed.title) }}</QItemSection>
<QItemSection side>
<slot name="side" :item="item" />
<slot name="side" :item="itemComputed" />
</QItemSection>
</QItem>
</template>

View File

@ -10,12 +10,12 @@ import UserPanel from 'components/UserPanel.vue';
import VnBreadcrumbs from './common/VnBreadcrumbs.vue';
const { t } = useI18n();
const session = useSession();
const stateStore = useStateStore();
const quasar = useQuasar();
const state = useState();
const user = state.getUser();
const token = session.getToken();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const appName = 'Lilium';
onMounted(() => stateStore.setMounted());
@ -106,7 +106,7 @@ const pinnedModulesRef = ref();
width: max-content;
}
.q-header {
background-color: var(--vn-dark);
background-color: var(--vn-section-color);
}
</style>
<i18n>

View File

@ -0,0 +1,168 @@
<script setup>
import { ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
import VnSelectFilter from 'components/common/VnSelectFilter.vue';
import FormPopup from './FormPopup.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
const $props = defineProps({
invoiceOutData: {
type: Object,
default: () => {},
},
});
const { t } = useI18n();
const router = useRouter();
const { notify } = useNotify();
const transferInvoiceParams = reactive({
id: $props.invoiceOutData?.id,
refFk: $props.invoiceOutData?.ref,
});
const closeButton = ref(null);
const clientsOptions = ref([]);
const rectificativeTypeOptions = ref([]);
const siiTypeInvoiceOutsOptions = ref([]);
const invoiceCorrectionTypesOptions = ref([]);
const closeForm = () => {
if (closeButton.value) closeButton.value.click();
};
const transferInvoice = async () => {
try {
const { data } = await axios.post(
'InvoiceOuts/transferInvoice',
transferInvoiceParams
);
notify(t('Transferred invoice'), 'positive');
closeForm();
router.push('InvoiceOutSummary', { id: data.id });
} catch (err) {
console.error('Error transfering invoice', err);
}
};
</script>
<template>
<FetchData
url="Clients"
@on-fetch="(data) => (clientsOptions = data)"
:filter="{ fields: ['id', 'name'], order: 'id', limit: 30 }"
auto-load
/>
<FetchData
url="CplusRectificationTypes"
:filter="{ order: 'description' }"
@on-fetch="(data) => (rectificativeTypeOptions = data)"
auto-load
/>
<FetchData
url="SiiTypeInvoiceOuts"
:filter="{ where: { code: { like: 'R%' } } }"
@on-fetch="(data) => (siiTypeInvoiceOutsOptions = data)"
auto-load
/>
<FetchData
url="InvoiceCorrectionTypes"
@on-fetch="(data) => (invoiceCorrectionTypesOptions = data)"
auto-load
/>
<FormPopup
@on-submit="transferInvoice()"
:title="t('Transfer invoice')"
:custom-submit-button-label="t('Transfer client')"
:default-cancel-button="false"
>
<template #form-inputs>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Client')"
:options="clientsOptions"
hide-selected
option-label="name"
option-value="id"
v-model="transferInvoiceParams.newClientFk"
:required="true"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
#{{ scope.opt?.id }} -
{{ scope.opt?.name }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
<div class="col">
<VnSelectFilter
:label="t('Rectificative type')"
:options="rectificativeTypeOptions"
hide-selected
option-label="description"
option-value="id"
v-model="transferInvoiceParams.cplusRectificationTypeFk"
:required="true"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnSelectFilter
:label="t('Class')"
:options="siiTypeInvoiceOutsOptions"
hide-selected
option-label="description"
option-value="id"
v-model="transferInvoiceParams.siiTypeInvoiceOutFk"
:required="true"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>
{{ scope.opt?.code }} -
{{ scope.opt?.description }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
</div>
<div class="col">
<VnSelectFilter
:label="t('Type')"
:options="invoiceCorrectionTypesOptions"
hide-selected
option-label="description"
option-value="id"
v-model="transferInvoiceParams.invoiceCorrectionTypeFk"
:required="true"
/>
</div>
</VnRow>
</template>
</FormPopup>
</template>
<i18n>
es:
Transfer invoice: Transferir factura
Transfer client: Transferir cliente
Client: Cliente
Rectificative type: Tipo rectificativa
Class: Clase
Type: Tipo
Transferred invoice: Factura transferida
</i18n>

View File

@ -7,12 +7,16 @@ import axios from 'axios';
import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession';
import { localeEquivalence } from 'src/i18n/index';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'components/FetchData.vue';
const state = useState();
const session = useSession();
const router = useRouter();
const { t, locale } = useI18n();
import { useClipboard } from 'src/composables/useClipboard';
import { ref } from 'vue';
const { copyText } = useClipboard();
const userLocale = computed({
get() {
@ -44,7 +48,10 @@ const darkMode = computed({
});
const user = state.getUser();
const token = session.getToken();
const token = session.getTokenMultimedia();
const warehousesData = ref();
const companiesData = ref();
const accountBankData = ref();
onMounted(async () => {
updatePreferences();
@ -87,10 +94,28 @@ function copyUserToken() {
</script>
<template>
<QMenu anchor="bottom left">
<FetchData
url="Warehouses"
order="name"
@on-fetch="(data) => (warehousesData = data)"
auto-load
/>
<FetchData
url="Companies"
order="name"
@on-fetch="(data) => (companiesData = data)"
auto-load
/>
<FetchData
url="Accountings"
order="name"
@on-fetch="(data) => (accountBankData = data)"
auto-load
/>
<QMenu anchor="bottom left" class="bg-vn-section-color">
<div class="row no-wrap q-pa-md">
<div class="column panel">
<div class="text-h6 q-mb-md">
<div class="col column">
<div class="text-h6 q-ma-sm q-mb-none">
{{ t('components.userPanel.settings') }}
</div>
<QToggle
@ -114,7 +139,7 @@ function copyUserToken() {
<QSeparator vertical inset class="q-mx-lg" />
<div class="column items-center panel">
<div class="col column items-center q-mb-sm">
<QAvatar size="80px">
<QImg
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
@ -131,7 +156,6 @@ function copyUserToken() {
>
@{{ user.name }}
</div>
<QBtn
id="logout"
color="orange"
@ -141,17 +165,63 @@ function copyUserToken() {
icon="logout"
@click="logout()"
v-close-popup
dense
/>
</div>
</div>
<QSeparator inset class="q-mx-lg" />
<div class="col q-gutter-xs q-pa-md">
<VnRow>
<VnSelectFilter
:label="t('components.userPanel.localWarehouse')"
v-model="user.localWarehouseFk"
:options="warehousesData"
option-label="name"
option-value="id"
/>
<VnSelectFilter
:label="t('components.userPanel.localBank')"
hide-selected
v-model="user.localBankFk"
:options="accountBankData"
option-label="bank"
option-value="id"
></VnSelectFilter>
</VnRow>
<VnRow>
<VnSelectFilter
:label="t('components.userPanel.localCompany')"
hide-selected
v-model="user.companyFk"
:options="companiesData"
option-label="code"
option-value="id"
/>
<VnSelectFilter
:label="t('components.userPanel.userWarehouse')"
hide-selected
v-model="user.warehouseFk"
:options="warehousesData"
option-label="name"
option-value="id"
/>
</VnRow>
<VnRow>
<VnSelectFilter
:label="t('components.userPanel.userCompany')"
hide-selected
v-model="user.companyFk"
:options="companiesData"
option-label="code"
option-value="id"
style="flex: 0"
/>
</VnRow>
</div>
</QMenu>
</template>
<style lang="scss" scoped>
.panel {
width: 150px;
}
.copyText {
&:hover {
cursor: alias;

View File

@ -5,16 +5,16 @@ import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
import { useCamelCase } from 'src/composables/useCamelCase';
const router = useRouter();
const quasar = useQuasar();
const { t } = useI18n();
const { currentRoute } = useRouter();
const { screen } = useQuasar();
const { t, te } = useI18n();
let matched = ref([]);
let breadcrumbs = ref([]);
let root = ref(null);
watchEffect(() => {
matched.value = router.currentRoute.value.matched.filter(
matched.value = currentRoute.value.matched.filter(
(matched) => Object.keys(matched.meta).length
);
breadcrumbs.value.length = 0;
@ -34,13 +34,17 @@ function getBreadcrumb(param) {
icon: param.meta.icon,
path: param.path,
root: root.value,
locale: t(`globals.pageTitles.${param.meta.title}`),
};
if (quasar.screen.gt.sm) {
if (screen.gt.sm) {
breadcrumb.name = param.name;
breadcrumb.title = useCamelCase(param.meta.title);
}
const moduleLocale = `${breadcrumb.root}.pageTitles.${breadcrumb.title}`;
if (te(moduleLocale)) breadcrumb.locale = t(moduleLocale);
return breadcrumb;
}
</script>
@ -50,7 +54,7 @@ function getBreadcrumb(param) {
v-for="(breadcrumb, index) of breadcrumbs"
:key="index"
:icon="breadcrumb.icon"
:label="t(`${breadcrumb.root}.pageTitles.${breadcrumb.title}`)"
:label="breadcrumb.locale"
:to="breadcrumb.path"
/>
</QBreadcrumbs>
@ -71,7 +75,7 @@ function getBreadcrumb(param) {
}
&--last,
&__separator {
color: var(--vn-label);
color: var(--vn-label-color);
}
}
@media (max-width: $breakpoint-md) {

View File

@ -5,7 +5,7 @@ import { useCapitalize } from 'src/composables/useCapitalize';
import VnInput from 'src/components/common/VnInput.vue';
const props = defineProps({
modelValue: { type: String, default: '' },
modelValue: { type: [String, Number], default: '' },
});
const { t } = useI18n();

View File

@ -198,9 +198,13 @@ function addDefaultData(data) {
en:
contentTypesInfo: Allowed file types {allowedContentTypes}
EntryDmsDescription: Reference {reference}
WorkersDescription: Working of employee id {reference}
SupplierDmsDescription: Reference {reference}
es:
Generate identifier for original file: Generar identificador para archivo original
contentTypesInfo: Tipos de archivo permitidos {allowedContentTypes}
EntryDmsDescription: Referencia {reference}
WorkersDescription: Laboral del empleado {reference}
SupplierDmsDescription: Referencia {reference}
</i18n>

View File

@ -5,9 +5,11 @@ import { useRoute } from 'vue-router';
import { useQuasar, QCheckbox, QBtn, QInput } from 'quasar';
import axios from 'axios';
import FetchData from 'components/FetchData.vue';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnDms from 'src/components/common/VnDms.vue';
import VnConfirm from 'components/ui/VnConfirm.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnUserLink from '../ui/VnUserLink.vue';
import { downloadFile } from 'src/composables/downloadFile';
const route = useRoute();
@ -26,6 +28,15 @@ const $props = defineProps({
type: String,
default: null,
},
deleteModel: {
type: String,
default: null,
},
downloadModel: {
type: String,
required: false,
default: null,
},
defaultDmsCode: {
type: String,
required: true,
@ -74,7 +85,7 @@ const dmsFilter = {
],
},
},
order: ['dmsFk DESC'],
where: { [$props.filter]: route.params.id },
};
const columns = computed(() => [
@ -94,12 +105,12 @@ const columns = computed(() => [
props: (prop) => ({
readonly: true,
borderless: true,
'model-value': prop.row.dmsType.name,
'model-value': prop.row.dmsType?.name,
}),
},
{
align: 'left',
field: 'order',
field: 'hardCopyNumber',
label: t('globals.order'),
name: 'order',
component: 'span',
@ -117,6 +128,7 @@ const columns = computed(() => [
label: t('globals.description'),
name: 'description',
component: 'span',
props: (prop) => ({ value: prop.value?.toUpperCase() }),
},
{
align: 'left',
@ -136,21 +148,53 @@ const columns = computed(() => [
name: 'file',
component: 'span',
},
{
align: 'left',
field: 'worker',
label: t('globals.worker'),
name: 'worker',
component: VnUserLink,
props: (prop) => ({
name: prop.row.worker?.user?.name.toLowerCase(),
workerId: prop.row.worker?.id,
}),
},
{
align: 'left',
field: 'created',
label: t('globals.created'),
name: 'created',
component: VnInputDate,
props: (prop) => ({
disable: true,
'model-value': prop.row.created,
}),
},
{
field: 'options',
name: 'options',
components: [
{
component: QBtn,
name: 'download',
isDocuware: true,
props: () => ({
icon: 'cloud_download',
flat: true,
color: 'primary',
}),
click: (prop) => downloadFile(prop.row.id),
click: (prop) =>
downloadFile(
prop.row.id,
$props.downloadModel,
null,
prop.row.download
),
},
{
component: QBtn,
name: 'edit',
external: false,
props: () => ({
icon: 'edit',
flat: true,
@ -160,6 +204,8 @@ const columns = computed(() => [
},
{
component: QBtn,
name: 'delete',
external: false,
props: () => ({
icon: 'delete',
flat: true,
@ -167,12 +213,24 @@ const columns = computed(() => [
}),
click: (prop) => deleteDms(prop.row.id),
},
{
component: QBtn,
name: 'open',
external: true,
props: () => ({
icon: 'open_in_new',
flat: true,
color: 'primary',
}),
click: (prop) => open(prop.row.url),
},
],
},
]);
function setData(data) {
const newData = data.map((value) => value.dms);
const newData = data.map((value) => value.dms || value);
newData.sort((a, b) => new Date(b.created) - new Date(a.created));
rows.value = newData;
}
@ -186,7 +244,7 @@ function deleteDms(dmsFk) {
},
})
.onOk(async () => {
await axios.post(`${$props.model}/${dmsFk}/removeFile`);
await axios.post(`${$props.deleteModel ?? $props.model}/${dmsFk}/removeFile`);
const index = rows.value.findIndex((row) => row.id == dmsFk);
rows.value.splice(index, 1);
});
@ -206,85 +264,106 @@ function parseDms(data) {
}
return data;
}
async function open(url) {
window.open(url).focus();
}
function shouldRenderButton(button, isExternal = false) {
if (button.name == 'download') return true;
return button.external === isExternal;
}
</script>
<template>
<FetchData
<VnPaginate
ref="dmsRef"
:data-key="$props.model"
:url="$props.model"
:filter="dmsFilter"
:where="{ [$props.filter]: route.params.id }"
:order="['dmsFk DESC']"
:auto-load="true"
@on-fetch="setData"
auto-load
/>
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 0 }"
:rows="rows"
class="full-width q-mt-md"
hide-bottom
row-key="clientFk"
:grid="$q.screen.lt.sm"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props">
<component
v-if="props.col.component"
:is="props.col.component"
v-bind="props.col.props && props.col.props(props)"
>
<span
v-if="props.col.component == 'span'"
style="white-space: wrap"
>{{ props.value }}</span
>
</component>
</QTr>
<div class="flex justify-center" v-if="props.col.name == 'options'">
<div v-for="button of props.col.components" :key="button.id">
<component
:is="button.component"
v-bind="button.props(props)"
@click="button.click(props)"
/>
</div>
</div>
</QTd>
</template>
<template #item="props">
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
<QCard
bordered
flat
@keyup.ctrl.enter.stop="claimDevelopmentForm?.saveChanges()"
>
<QSeparator />
<QList dense>
<QItem v-for="col in props.cols" :key="col.name">
<div v-if="col.name != 'options'" class="row">
<span class="labelColor">{{ col.label }}:</span>
<span>{{ col.value }}</span>
</div>
<div v-if="col.name == 'options'" class="row">
<div
v-for="button of col.components"
:key="button.id"
class="row"
<template #body>
<QTable
:columns="columns"
:rows="rows"
class="full-width q-mt-md"
hide-bottom
row-key="clientFk"
:grid="$q.screen.lt.sm"
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props">
<component
v-if="props.col.component"
:is="props.col.component"
v-bind="props.col.props && props.col.props(props)"
>
<span
v-if="props.col.component == 'span'"
style="white-space: wrap"
>{{ props.value }}</span
>
<component
:is="button.component"
v-bind="button.props(col)"
@click="button.click(col)"
/>
</div>
</component>
</QTr>
<div class="row no-wrap" v-if="props.col.name == 'options'">
<div v-for="button of props.col.components" :key="button.id">
<component
v-if="
shouldRenderButton(button, props.row.isDocuware)
"
:is="button.component"
v-bind="button.props(props)"
@click="button.click(props)"
/>
</div>
</QItem>
</QList>
</QCard>
</div>
</div>
</QTd>
</template>
<template #item="props">
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
<QCard
bordered
flat
@keyup.ctrl.enter.stop="claimDevelopmentForm?.saveChanges()"
>
<QSeparator />
<QList dense>
<QItem v-for="col in props.cols" :key="col.name">
<div v-if="col.name != 'options'" class="row">
<span class="labelColor">{{ col.label }}:</span>
<span>{{ col.value }}</span>
</div>
<div v-if="col.name == 'options'" class="row">
<div
v-for="button of col.components"
:key="button.id"
class="row"
>
<component
v-if="
shouldRenderButton(
button.name,
props.row.isDocuware
)
"
:is="button.component"
v-bind="button.props(col)"
@click="button.click(col)"
/>
</div>
</div>
</QItem>
</QList>
</QCard>
</div>
</template>
</QTable>
</template>
</QTable>
</VnPaginate>
<QDialog v-model="formDialog.show">
<VnDms
:model="updateModel ?? model"
@ -304,7 +383,7 @@ function parseDms(data) {
row-gap: 20px;
}
.labelColor {
color: var(--vn-label);
color: var(--vn-label-color);
}
</style>
<i18n>

View File

@ -26,7 +26,7 @@ const value = computed({
emit('update:modelValue', value);
},
});
const hover = ref(false);
const styleAttrs = computed(() => {
return $props.isOutlined
? {
@ -41,6 +41,10 @@ const onEnterPress = () => {
emit('keyup.enter');
};
const handleValue = (val = null) => {
value.value = val;
};
const focus = () => {
vnInputRef.value.focus();
};
@ -51,20 +55,33 @@ defineExpose({
</script>
<template>
<QInput
ref="vnInputRef"
v-model="value"
v-bind="{ ...$attrs, ...styleAttrs }"
type="text"
:class="{ required: $attrs.required }"
@keyup.enter="onEnterPress()"
<div
@mouseover="hover = true"
@mouseleave="hover = false"
:rules="$attrs.required ? [requiredFieldRule] : null"
>
<template v-if="$slots.prepend" #prepend>
<slot name="prepend" />
</template>
<template v-if="$slots.append" #append>
<slot name="append" />
</template>
</QInput>
<QInput
ref="vnInputRef"
v-model="value"
v-bind="{ ...$attrs, ...styleAttrs }"
:type="$attrs.type"
:class="{ required: $attrs.required }"
@keyup.enter="onEnterPress()"
:clearable="false"
>
<template v-if="$slots.prepend" #prepend>
<slot name="prepend" />
</template>
<template #append>
<slot name="append" v-if="$slots.append" />
<QIcon
name="close"
size="xs"
v-if="hover && value"
@click="handleValue(null)"
></QIcon>
</template>
</QInput>
</div>
</template>

View File

@ -1,7 +1,6 @@
<script setup>
import { computed, ref } from 'vue';
import VnInput from 'components/common/VnInput.vue';
import isValidDate from "filters/isValidDate";
import isValidDate from 'filters/isValidDate';
const props = defineProps({
modelValue: {
@ -17,6 +16,8 @@ const props = defineProps({
default: false,
},
});
const hover = ref(false);
const emit = defineEmits(['update:modelValue']);
const joinDateAndTime = (date, time) => {
@ -77,30 +78,39 @@ const styleAttrs = computed(() => {
</script>
<template>
<VnInput
class="vn-input-date"
:model-value="displayDate(value)"
v-bind="{ ...$attrs, ...styleAttrs }"
readonly
@click="isPopupOpen = true"
>
<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>
</VnInput>
<div @mouseover="hover = true" @mouseleave="hover = false">
<QInput
class="vn-input-date"
readonly
:model-value="displayDate(value)"
v-bind="{ ...$attrs, ...styleAttrs }"
@click="isPopupOpen = true"
>
<template #append>
<QIcon
name="close"
size="xs"
v-if="hover && value"
@click="onDateUpdate(null)"
></QIcon>
<QIcon name="event" class="cursor-pointer">
<QPopupProxy
v-model="isPopupOpen"
cover
transition-show="scale"
transition-hide="scale"
:no-parent-event="props.readonly"
>
<QDate
:today-btn="true"
:model-value="formatDate(value)"
@update:model-value="onDateUpdate"
/>
</QPopupProxy>
</QIcon>
</template>
</QInput>
</div>
</template>
<style lang="scss">

View File

@ -2,7 +2,6 @@
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import isValidDate from 'filters/isValidDate';
import VnInput from "components/common/VnInput.vue";
const props = defineProps({
modelValue: {
@ -20,6 +19,7 @@ const props = defineProps({
});
const { t } = useI18n();
const emit = defineEmits(['update:modelValue']);
const value = computed({
get() {
return props.modelValue;
@ -27,12 +27,7 @@ const value = computed({
set(value) {
const [hours, minutes] = value.split(':');
const date = new Date(props.modelValue);
date.setHours(
Number.parseInt(hours) || 0,
Number.parseInt(minutes) || 0,
0,
0
);
date.setHours(Number.parseInt(hours) || 0, Number.parseInt(minutes) || 0, 0, 0);
emit('update:modelValue', value ? date.toISOString() : null);
},
});
@ -71,7 +66,7 @@ const styleAttrs = computed(() => {
</script>
<template>
<VnInput
<QInput
class="vn-input-time"
readonly
:model-value="formatTime(value)"
@ -79,7 +74,7 @@ const styleAttrs = computed(() => {
@click="isPopupOpen = true"
>
<template #append>
<QIcon name="event" class="cursor-pointer">
<QIcon name="schedule" class="cursor-pointer">
<QPopupProxy
v-model="isPopupOpen"
cover
@ -111,7 +106,7 @@ const styleAttrs = computed(() => {
</QPopupProxy>
</QIcon>
</template>
</VnInput>
</QInput>
</template>
<style lang="scss">

View File

@ -88,6 +88,10 @@ function locationFilter(search = '') {
function handleFetch(data) {
postcodesOptions.value = data;
}
function onDataSaved(newPostcode) {
postcodesOptions.value.push(newPostcode);
value.value = newPostcode.code;
}
</script>
<template>
<FetchData
@ -111,11 +115,13 @@ function handleFetch(data) {
clearable
>
<template #form>
<CreateNewPostcode @on-data-saved="locationFilter()" />
<CreateNewPostcode
@on-data-saved="onDataSaved"
/>
</template>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
<QItemSection v-if="opt">
<QItemSection v-if="opt.code">
<QItemLabel>{{ opt.code }}</QItemLabel>
<QItemLabel caption>{{ showLabel(opt) }}</QItemLabel>
</QItemSection>

View File

@ -403,7 +403,7 @@ setLogTree();
auto-load
/>
<div
class="column items-center logs origin-log"
class="column items-center logs origin-log q-mt-md"
v-for="(originLog, originLogIndex) in logTree"
:key="originLogIndex"
>
@ -819,7 +819,7 @@ setLogTree();
</template>
<style lang="scss" scoped>
.q-card {
background-color: var(--vn-gray);
background-color: var(--vn-section-color);
}
.q-item {
min-height: 0px;
@ -836,7 +836,7 @@ setLogTree();
max-width: 400px;
& > .header {
color: $dark;
color: var(--vn-section-color);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
@ -916,7 +916,7 @@ setLogTree();
font-style: italic;
}
.model-id {
color: var(--vn-label);
color: var(--vn-label-color);
font-size: 0.9rem;
}
.q-btn {
@ -942,7 +942,7 @@ setLogTree();
}
.change-info {
overflow: hidden;
background-color: var(--vn-dark);
background-color: var(--vn-section-color);
& > .date {
overflow: hidden;
white-space: nowrap;
@ -981,7 +981,7 @@ setLogTree();
position: relative;
overflow: hidden;
text-overflow: ellipsis;
background-color: var(--vn-gray);
background-color: var(--vn-section-color);
white-space: nowrap;
box-sizing: border-box;
& > .q-icon {
@ -1030,7 +1030,7 @@ en:
ticketCreated: Created
created: Created
isChargedToMana: Charged to mana
hasToPickUp: Has to pick Up
pickup: Type of pickup
dmsFk: Document ID
text: Description
claimStateFk: Claim State
@ -1069,7 +1069,7 @@ es:
ticketCreated: Creado
created: Creado
isChargedToMana: Cargado a maná
hasToPickUp: Se debe recoger
pickup: Se debe recoger
dmsFk: ID documento
text: Descripción
claimStateFk: Estado de la reclamación

View File

@ -82,7 +82,7 @@ const toggleForm = () => {
border-radius: 50px;
&.--add-icon {
color: var(--vn-text);
color: var(--vn-text-color);
background-color: $primary;
}
}

View File

@ -51,8 +51,8 @@ const $props = defineProps({
default: null,
},
limit: {
type: Number,
default: 30,
type: [Number, String],
default: '30',
},
});
@ -151,7 +151,7 @@ watch(modelValue, (newValue) => {
@on-fetch="(data) => setOptions(data)"
:where="where || { [optionValue]: value }"
:limit="limit"
:order-by="orderBy"
:sort-by="sortBy"
:fields="fields"
/>
<QSelect

View File

@ -0,0 +1,25 @@
<script setup>
const $props = defineProps({
url: { type: String, default: null },
text: { type: String, default: null },
icon: { type: String, default: 'open_in_new' },
});
</script>
<template>
<div class="titleBox">
<div class="header-link">
<a :href="$props.url" :class="$props.url ? 'link' : 'color-vn-text'">
{{ $props.text }}
<QIcon v-if="url" :name="$props.icon" />
</a>
</div>
</div>
</template>
<style scoped lang="scss">
a {
font-size: large;
}
.titleBox {
padding-bottom: 2%;
}
</style>

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, useSlots, watch, computed, ref } from 'vue';
import { onBeforeMount, useSlots, watch, computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
import { useArrayData } from 'composables/useArrayData';
@ -41,34 +41,33 @@ const state = useState();
const slots = useSlots();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const entity = computed(() => useArrayData($props.dataKey).store.data);
const arrayData = useArrayData($props.dataKey || $props.module, {
url: $props.url,
filter: $props.filter,
skip: 0,
});
const { store } = arrayData;
const entity = computed(() =>Array.isArray( store.data) ? store.data[0] : store.data);
const isLoading = ref(false);
defineExpose({
getData,
});
onMounted(async () => {
onBeforeMount(async () => {
await getData();
watch(
() => $props.url,
async (newUrl, lastUrl) => {
if (newUrl == lastUrl) return;
await getData();
}
async () => await getData()
);
});
async function getData() {
const arrayData = useArrayData($props.dataKey, {
url: $props.url,
filter: $props.filter,
skip: 0,
});
store.url = $props.url;
isLoading.value = true;
try {
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
state.set($props.dataKey, data);
emit('onFetch', data);
emit('onFetch', Array.isArray(data) ? data[0] : data);
} finally {
isLoading.value = false;
}
@ -158,7 +157,7 @@ const emit = defineEmits(['onFetch']);
<div class="icons">
<slot name="icons" :entity="entity" />
</div>
<div class="actions">
<div class="actions justify-center">
<slot name="actions" :entity="entity" />
</div>
<slot name="after" />
@ -175,33 +174,34 @@ const emit = defineEmits(['onFetch']);
<style lang="scss">
.body {
background-color: var(--vn-gray);
background-color: var(--vn-section-color);
.text-h5 {
font-size: 20px;
padding-top: 5px;
padding-bottom: 5px;
padding-bottom: 0px;
}
.q-item {
min-height: 20px;
.link {
margin-left: 5px;
margin-left: 10px;
}
}
.vn-label-value {
display: flex;
padding: 2px 16px;
padding: 0px 16px;
.label {
color: var(--vn-label);
font-size: 12px;
color: var(--vn-label-color);
font-size: 14px;
&:not(:has(a))::after {
content: ':';
}
}
.value {
color: var(--vn-text);
color: var(--vn-text-color);
font-size: 14px;
margin-left: 12px;
margin-left: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@ -219,18 +219,19 @@ const emit = defineEmits(['onFetch']);
overflow: hidden;
text-overflow: ellipsis;
span {
color: $primary;
color: var(--vn-text-color);
font-weight: bold;
}
}
.subtitle {
color: var(--vn-text);
color: var(--vn-text-color);
font-size: 16px;
margin-bottom: 15px;
margin-bottom: 2px;
}
.list-box {
.q-item__label {
color: var(--vn-label);
color: var(--vn-label-color);
padding-bottom: 0%;
}
}
.descriptor {
@ -248,6 +249,7 @@ const emit = defineEmits(['onFetch']);
}
.actions {
margin: 0 5px;
justify-content: center !important;
}
}
</style>

View File

@ -61,7 +61,7 @@ const toggleCardCheck = (item) => {
}
.q-chip-color {
color: var(--vn-label);
color: var(--vn-label-color) !important;
}
.card-list-body {
@ -75,7 +75,7 @@ const toggleCardCheck = (item) => {
width: 50%;
.label {
width: 35%;
color: var(--vn-label);
color: var(--vn-label-color);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@ -117,7 +117,7 @@ const toggleCardCheck = (item) => {
transition: background-color 0.2s;
}
.card:hover {
background-color: var(--vn-gray);
background-color: var(--vn-section-color);
}
.list-items {
width: 75%;

View File

@ -1,11 +1,10 @@
<script setup>
import { onMounted, ref, watch } from 'vue';
import { ref, computed, watch, onBeforeMount } from 'vue';
import { useRoute } from 'vue-router';
import axios from 'axios';
import SkeletonSummary from 'components/ui/SkeletonSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { useArrayData } from 'src/composables/useArrayData';
const entity = ref();
const props = defineProps({
url: {
type: String,
@ -19,43 +18,48 @@ const props = defineProps({
type: Number,
default: null,
},
dataKey: {
type: String,
default: '',
},
});
const emit = defineEmits(['onFetch']);
const route = useRoute();
const isSummary = ref();
const arrayData = useArrayData(props.dataKey || route.meta.moduleName, {
url: props.url,
filter: props.filter,
skip: 0,
});
const { store } = arrayData;
const entity = computed(() => Array.isArray(store.data) ? store.data[0] : store.data);
const isLoading = ref(false);
defineExpose({
entity,
fetch,
});
onMounted(() => {
onBeforeMount(async () => {
isSummary.value = String(route.path).endsWith('/summary');
fetch();
await fetch();
watch(props, async () => await fetch());
});
async function fetch() {
const params = {};
if (props.filter) params.filter = JSON.stringify(props.filter);
const { data } = await axios.get(props.url, { params });
entity.value = data;
store.url = props.url;
isLoading.value = true;
const { data } = await arrayData.fetch({ append: false, updateRouter: false });
emit('onFetch', data);
isLoading.value = false;
}
watch(props, async () => {
entity.value = null;
fetch();
});
</script>
<template>
<div class="summary container">
<QCard class="cardSummary">
<SkeletonSummary v-if="!entity" />
<template v-if="entity">
<SkeletonSummary v-if="!entity || isLoading" />
<template v-if="entity && !isLoading">
<div class="summaryHeader bg-primary q-pa-sm text-weight-bolder">
<slot name="header-left">
<router-link
@ -70,7 +74,7 @@ watch(props, async () => {
</router-link>
<span v-else></span>
</slot>
<slot name="header" :entity="entity">
<slot name="header" :entity="entity" dense>
<VnLv :label="`${entity.id} -`" :value="entity.name" />
</slot>
<slot name="header-right">
@ -93,7 +97,6 @@ watch(props, async () => {
.cardSummary {
width: 100%;
.summaryHeader {
text-align: center;
font-size: 20px;
@ -107,7 +110,7 @@ watch(props, async () => {
justify-content: space-evenly;
gap: 10px;
padding: 10px;
background-color: var(--vn-gray);
background-color: var(--vn-section-color);
> .q-card.vn-one {
flex: 1;
@ -124,17 +127,18 @@ watch(props, async () => {
> .q-card {
width: 100%;
background-color: var(--vn-gray);
background-color: var(--vn-section-color);
padding: 7px;
font-size: 16px;
min-width: 275px;
box-shadow: none;
.vn-label-value {
display: flex;
flex-direction: row;
margin-top: 2px;
.label {
color: var(--vn-label);
color: var(--vn-label-color);
width: 8em;
overflow: hidden;
white-space: nowrap;
@ -144,7 +148,7 @@ watch(props, async () => {
flex-shrink: 0;
}
.value {
color: var(--vn-text);
color: var(--vn-text-color);
overflow: hidden;
}
}
@ -163,12 +167,12 @@ watch(props, async () => {
margin-bottom: 9px;
& .q-checkbox__label {
margin-left: 31px;
color: var(--vn-text);
color: var(--vn-text-color);
}
& .q-checkbox__inner {
position: absolute;
left: 0;
color: var(--vn-label);
color: var(--vn-label-color);
}
}
}

View File

@ -0,0 +1,66 @@
<script setup>
import { computed } from 'vue';
import { useQuasar } from 'quasar';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.sass';
const $props = defineProps({
bordered: {
type: Boolean,
default: false,
},
transparentBackground: {
type: Boolean,
default: false,
},
});
const $q = useQuasar();
const containerClasses = computed(() => {
const classes = ['main-container-background'];
if ($props.bordered) classes.push('--bordered');
if ($props.transparentBackground) classes.push('transparent-background');
else classes.push($q.dark.isActive ? '--dark' : '--light');
return classes;
});
</script>
<template>
<div :class="containerClasses">
<div class="nav-container row"><slot name="header" /></div>
<slot name="calendar" />
</div>
</template>
<style lang="scss">
.main-container-background {
--calendar-current-background-dark: transparent;
&.--dark {
background-color: var(--calendar-background-dark);
}
&.--light {
background-color: var(--calendar-background);
}
&.--bordered {
border: 1px solid black;
}
}
.transparent-background {
--calendar-background-dark: transparent;
--calendar-background: transparent;
--calendar-outside-background-dark: transparent;
}
.nav-container {
display: flex;
align-items: center;
&.--bordered {
border: 1px solid black;
}
}
</style>

View File

@ -10,8 +10,8 @@ const $props = defineProps({
size: { type: String, default: null },
title: { type: String, default: null },
});
const session = useSession();
const token = session.getToken();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const { t } = useI18n();
const title = computed(() => $props.title ?? t('globals.system'));

View File

@ -164,7 +164,7 @@ function formatValue(value) {
</script>
<template>
<QForm @submit="search">
<QForm @submit="search" id="filterPanelForm">
<QList dense>
<QItem class="q-mt-xs">
<QItemSection top>

View File

@ -15,7 +15,6 @@ const { t } = useI18n();
color="primary"
padding="none"
:href="`sip:${props.phoneNumber}`"
:title="t('globals.microsip')"
@click.stop
/>
</template>

View File

@ -6,6 +6,7 @@ import axios from 'axios';
import { useI18n } from 'vue-i18n';
import VnPaginate from './VnPaginate.vue';
import VnUserLink from '../ui/VnUserLink.vue';
import { useState } from 'src/composables/useState';
const $props = defineProps({
url: { type: String, default: null },
@ -13,8 +14,10 @@ const $props = defineProps({
body: { type: Object, default: () => {} },
addNote: { type: Boolean, default: false },
});
const { t } = useI18n();
const noteModal = ref(false);
const state = useState();
const currentUser = ref(state.getUser());
const newNote = ref('');
const vnPaginateRef = ref();
@ -22,98 +25,83 @@ async function insert() {
const body = $props.body;
Object.assign(body, { text: newNote.value });
await axios.post($props.url, body);
vnPaginateRef.value.fetch();
await vnPaginateRef.value.fetch();
newNote.value = '';
}
</script>
<template>
<div class="column items-center full-height full-width">
<VnPaginate
:data-key="$props.url"
:url="$props.url"
order="created DESC"
:limit="20"
:filter="$props.filter"
auto-load
ref="vnPaginateRef"
>
<template #body="{ rows }">
<div class="column items-center full-width">
<QCard
class="q-pa-xs q-mb-sm full-width"
v-for="(note, index) in rows"
:key="index"
>
<QCardSection horizontal>
<slot name="picture">
<VnAvatar
:descriptor="false"
:worker-id="note.workerFk"
size="md"
/>
</slot>
<div class="full-width row justify-between q-pa-xs">
<VnUserLink
:name="`${note.worker.user.nickname}`"
:worker-id="note.worker.id"
/>
<slot name="actions">
{{ toDateHour(note.created) }}
</slot>
</div>
</QCardSection>
<QCardSection class="q-pa-xs q-my-none q-py-none">
<slot name="text">
{{ note.text }}
</slot>
</QCardSection>
</QCard>
</div>
</template>
</VnPaginate>
<QPageSticky position="bottom-right" :offset="[25, 25]" v-if="addNote">
<QBtn color="primary" icon="add" size="lg" round @click="noteModal = true" />
</QPageSticky>
<QDialog v-model="noteModal" @hide="newNote = ''">
<QCard>
<QCardSection>
<QItem class="q-px-none">
<span class="text-primary text-h6 full-width">
<QIcon name="draft" class="q-mr-xs" />
{{ t('Add note') }}
</span>
<QBtn icon="close" flat round dense v-close-popup />
</QItem>
</QCardSection>
<QCardSection>
<QInput
autofocus
type="textarea"
:label="t('Add note here...')"
filled
size="lg"
autogrow
v-model="newNote"
></QInput>
</QCardSection>
<QCardActions class="justify-end q-mr-sm">
<QBtn
<QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">
<QCardSection horizontal>
<VnAvatar :descriptor="false" :worker-id="1" size="md" />
<div class="full-width row justify-between q-pa-xs">
<VnUserLink :name="t('New note')" :worker-id="currentUser.id" />
{{ t('globals.now') }}
</div>
</QCardSection>
<QCardSection class="q-pa-xs q-my-none q-py-none" horizontal>
<QInput
v-model="newNote"
class="full-width"
type="textarea"
:label="t('Add note here...')"
filled
size="lg"
autogrow
autofocus
@keyup.ctrl.enter.stop="insert"
clearable
>
<template #append
><QBtn
:title="t('Save (ctrl + Enter)')"
icon="save"
color="primary"
flat
:label="t('globals.close')"
color="primary"
v-close-popup
/>
<QBtn
:label="t('globals.save')"
color="primary"
v-close-popup
@click="insert"
/>
</QCardActions>
</QCard>
</QDialog>
</div>
</template>
</QInput>
</QCardSection>
</QCard>
<VnPaginate
:data-key="$props.url"
:url="$props.url"
order="created DESC"
:limit="0"
:filter="$props.filter"
auto-load
ref="vnPaginateRef"
class="show"
v-bind="$attrs"
>
<template #body="{ rows }">
<TransitionGroup name="list" tag="div" class="column items-center full-width">
<QCard
class="q-pa-xs q-mb-sm full-width"
v-for="note in rows"
:key="note.id"
>
<QCardSection horizontal>
<VnAvatar
:descriptor="false"
:worker-id="note.workerFk"
size="md"
/>
<div class="full-width row justify-between q-pa-xs">
<VnUserLink
:name="`${note.worker.user.nickname}`"
:worker-id="note.worker.id"
/>
{{ toDateHour(note.created) }}
</div>
</QCardSection>
<QCardSection class="q-pa-xs q-my-none q-py-none">
{{ note.text }}
</QCardSection>
</QCard>
</TransitionGroup>
</template>
</VnPaginate>
</template>
<style lang="scss" scoped>
.q-card {
@ -128,9 +116,20 @@ async function insert() {
.q-dialog .q-card {
width: 400px;
}
.list-enter-active,
.list-leave-active {
transition: all 1s ease;
}
.list-enter-from,
.list-leave-to {
opacity: 0;
background-color: $primary;
}
</style>
<i18n>
es:
Add note here...: Añadir nota aquí...
Add note: Añadir nota
New note: Nueva nota
Save (ctrl + Enter): Guardar (Ctrl + Intro)
</i18n>

View File

@ -61,7 +61,6 @@ const props = defineProps({
});
const emit = defineEmits(['onFetch', 'onPaginate']);
defineExpose({ fetch });
const isLoading = ref(false);
const pagination = ref({
sortBy: props.order,
@ -78,6 +77,7 @@ const arrayData = useArrayData(props.dataKey, {
userParams: props.userParams,
exprBuilder: props.exprBuilder,
});
const hasMoreData = ref();
const store = arrayData.store;
onMounted(() => {
@ -91,6 +91,10 @@ watch(
}
);
const addFilter = async (filter, params) => {
await arrayData.addFilter({ filter, params });
};
async function fetch() {
await arrayData.fetch({ append: false });
if (!arrayData.hasMoreData.value) {
@ -106,11 +110,10 @@ async function paginate() {
isLoading.value = true;
await arrayData.loadMore();
if (!arrayData.hasMoreData.value) {
if (store.userParamsChanged) arrayData.hasMoreData.value = true;
store.userParamsChanged = false;
isLoading.value = false;
endPagination();
return;
}
@ -120,12 +123,14 @@ async function paginate() {
pagination.value.sortBy = sortBy;
pagination.value.descending = descending;
isLoading.value = false;
endPagination();
}
function endPagination() {
isLoading.value = false;
emit('onFetch', store.data);
emit('onPaginate');
}
async function onLoad(index, done) {
if (!store.data) {
return done();
@ -140,6 +145,8 @@ async function onLoad(index, done) {
if (store.userParamsChanged) isDone = !arrayData.hasMoreData.value;
done(isDone);
}
defineExpose({ fetch, addFilter });
</script>
<template>
@ -175,11 +182,12 @@ async function onLoad(index, done) {
</QCard>
</div>
</div>
<QInfiniteScroll
v-if="store.data"
@load="onLoad"
:offset="offset"
:disable="disableInfiniteScroll || !arrayData.hasMoreData.value"
:disable="disableInfiniteScroll || !arrayData.hasMoreData"
class="full-width"
v-bind="$attrs"
>
@ -188,6 +196,9 @@ async function onLoad(index, done) {
<QSpinner color="orange" size="md" />
</div>
</QInfiniteScroll>
<div v-if="!isLoading && hasMoreData" class="w-full flex justify-center q-mt-md">
<QBtn color="primary" :label="t('Load more data')" @click="paginate()" />
</div>
</template>
<style lang="scss" scoped>
@ -204,4 +215,5 @@ async function onLoad(index, done) {
es:
No data to display: Sin datos que mostrar
No results found: No se han encontrado resultados
Load more data: Cargar más resultados
</i18n>

View File

@ -1,17 +1,17 @@
<template>
<div id="row" class="q-gutter-md q-mb-md">
<div class="vn-row q-gutter-md q-mb-md">
<slot></slot>
</div>
</template>
<style lang="scss" scopped>
#row {
.vn-row {
display: flex;
> * {
flex: 1;
}
}
@media screen and (max-width: 800px) {
#row {
.vn-row {
flex-direction: column;
}
}

View File

@ -1,11 +1,9 @@
<script setup>
import { onMounted, ref } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import VnInput from 'src/components/common/VnInput.vue';
import { useArrayData } from 'composables/useArrayData';
import VnInput from 'src/components/common/VnInput.vue';
const quasar = useQuasar();
@ -68,9 +66,8 @@ const props = defineProps({
});
const router = useRouter();
const route = useRoute();
const arrayData = useArrayData(props.dataKey, { ...props });
const store = arrayData.store;
const { store } = arrayData;
const searchText = ref('');
onMounted(() => {
@ -92,23 +89,31 @@ async function search() {
});
if (!props.redirect) return;
if (props.customRouteRedirectName) {
router.push({
if (props.customRouteRedirectName)
return router.push({
name: props.customRouteRedirectName,
params: { id: searchText.value },
});
return;
}
const { matched: matches } = route;
const { path } = matches[matches.length - 1];
const newRoute = path.replace(':id', searchText.value);
await router.push(newRoute);
const { matched: matches } = router.currentRoute.value;
const { path } = matches.at(-1);
const [, moduleName] = path.split('/');
if (!store.data.length || store.data.length > 1)
return router.push({ path: `/${moduleName}/list` });
const targetId = store.data[0].id;
let targetUrl;
if (path.endsWith('/list')) targetUrl = path.replace('/list', `/${targetId}/summary`);
else if (path.includes(':id')) targetUrl = path.replace(':id', targetId);
await router.push({ path: targetUrl });
}
</script>
<template>
<QForm @submit="search">
<QForm @submit="search" id="searchbarForm">
<VnInput
id="searchbar"
v-model="searchText"
@ -163,7 +168,12 @@ async function search() {
}
#searchbar {
.q-field--standout.q-field--highlighted .q-field__control {
background-color: var(--vn-text);
background-color: white;
color: black;
.q-field__native,
.q-icon {
color: black !important;
}
}
}
</style>

View File

@ -14,7 +14,7 @@ onUnmounted(() => {
</script>
<template>
<QToolbar class="bg-vn-dark justify-end sticky">
<QToolbar class="bg-vn-section-color justify-end sticky">
<slot name="st-data">
<div id="st-data"></div>
</slot>
@ -24,6 +24,11 @@ onUnmounted(() => {
</slot>
</QToolbar>
</template>
<style lang="scss">
.q-toolbar {
background: var(--vn-section-color);
}
</style>
<style lang="scss" scoped>
.sticky {
position: sticky;

View File

@ -76,7 +76,7 @@ const removeNode = (node) => {
notify(t('department.departmentRemoved'), 'positive');
await fetchNodeLeaves(parentFk);
} catch (err) {
console.log('Error removing department');
console.error('Error removing department');
}
});
};

View File

@ -1,5 +1,6 @@
<script setup>
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
import { useI18n } from 'vue-i18n';
const $props = defineProps({

View File

@ -1,11 +1,11 @@
import { useSession } from 'src/composables/useSession';
import { getUrl } from './getUrl';
const session = useSession();
const token = session.getToken();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
export async function downloadFile(dmsId) {
export async function downloadFile(id, model = 'dms', urlPath = '/downloadFile', url) {
let appUrl = await getUrl('', 'lilium');
appUrl = appUrl.replace('/#/', '');
window.open(`${appUrl}/api/dms/${dmsId}/downloadFile?access_token=${token}`);
window.open(url ?? `${appUrl}/api/${model}/${id}${urlPath}?access_token=${token}`);
}

View File

@ -1,5 +1,5 @@
import { onMounted, ref, computed } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { useRoute } from 'vue-router';
import axios from 'axios';
import { useArrayDataStore } from 'stores/useArrayDataStore';
import { buildFilter } from 'filters/filterPanel';
@ -15,7 +15,6 @@ export function useArrayData(key, userOptions) {
const store = arrayDataStore.get(key);
const hasMoreData = ref(false);
const router = useRouter();
const route = useRoute();
let canceller = null;
@ -97,15 +96,15 @@ export function useArrayData(key, userOptions) {
});
const { limit } = filter;
hasMoreData.value = response.data.length === limit;
hasMoreData.value = limit && response.data.length >= limit;
store.hasMoreData = hasMoreData.value;
if (append) {
if (!store.data) store.data = [];
for (const row of response.data) store.data.push(row);
} else {
store.data = response.data;
if (!document.querySelectorAll('[role="dialog"]'))
if (!document.querySelectorAll('[role="dialog"]').length)
updateRouter && updateStateParams();
}
@ -145,6 +144,8 @@ export function useArrayData(key, userOptions) {
store.userParams = userParams;
store.skip = 0;
store.filter.skip = 0;
page.value = 1;
await fetch({ append: false });
return { filter, params };
}
@ -168,7 +169,7 @@ export function useArrayData(key, userOptions) {
}
async function loadMore() {
if (!hasMoreData.value) return;
if (!hasMoreData.value && !store.hasMoreData) return;
store.skip = store.limit * page.value;
page.value += 1;
@ -188,11 +189,15 @@ export function useArrayData(key, userOptions) {
if (store.userParams && Object.keys(store.userParams).length !== 0)
query.params = JSON.stringify(store.userParams);
if (router)
router.replace({
path: route.path,
query: query,
});
const url = new URL(window.location.href);
const { hash: currentHash } = url;
const [currentRoute] = currentHash.split('?');
const params = new URLSearchParams();
for (const param in query) params.append(param, query[param]);
url.hash = currentRoute + '?' + params.toString();
window.history.pushState({}, '', url.hash);
}
const totalRows = computed(() => (store.data && store.data.length) || 0);

View File

@ -4,7 +4,7 @@ import { useQuasar } from 'quasar';
export function usePrintService() {
const quasar = useQuasar();
const { getToken } = useSession();
const { getTokenMultimedia } = useSession();
function sendEmail(path, params) {
return axios.post(path, params).then(() =>
@ -19,7 +19,7 @@ export function usePrintService() {
function openReport(path, params) {
params = Object.assign(
{
access_token: getToken(),
access_token: getTokenMultimedia(),
},
params
);

View File

@ -1,30 +1,54 @@
import { useState } from './useState';
import { useRole } from './useRole';
import { useUserConfig } from './useUserConfig';
import axios from 'axios';
import useNotify from './useNotify';
const TOKEN_MULTIMEDIA = 'tokenMultimedia';
const TOKEN = 'token';
export function useSession() {
const { notify } = useNotify();
function getToken() {
const localToken = localStorage.getItem('token');
const sessionToken = sessionStorage.getItem('token');
const localToken = localStorage.getItem(TOKEN);
const sessionToken = sessionStorage.getItem(TOKEN);
return localToken || sessionToken || '';
}
function getTokenMultimedia() {
const localTokenMultimedia = localStorage.getItem(TOKEN_MULTIMEDIA);
const sessionTokenMultimedia = sessionStorage.getItem(TOKEN_MULTIMEDIA);
function setToken(data) {
if (data.keepLogin) {
localStorage.setItem('token', data.token);
} else {
sessionStorage.setItem('token', data.token);
}
return localTokenMultimedia || sessionTokenMultimedia || '';
}
function destroy() {
if (localStorage.getItem('token'))
localStorage.removeItem('token')
if (sessionStorage.getItem('token'))
sessionStorage.removeItem('token');
function setToken(data) {
const storage = data.keepLogin ? localStorage : sessionStorage;
storage.setItem(TOKEN, data.token);
storage.setItem(TOKEN_MULTIMEDIA, data.tokenMultimedia);
}
async function destroyToken(url, storage, key) {
if (storage.getItem(key)) {
try {
await axios.post(url, null, {
headers: { Authorization: storage.getItem(key) },
});
} catch (error) {
notify('errors.statusUnauthorized', 'negative');
} finally {
storage.removeItem(key);
}
}
}
async function destroy() {
const tokens = {
tokenMultimedia: 'Accounts/logout',
token: 'VnUsers/logout',
};
for (const [key, url] of Object.entries(tokens)) {
await destroyToken(url, localStorage, key);
await destroyToken(url, sessionStorage, key);
}
const { setUser } = useState();
@ -37,22 +61,23 @@ export function useSession() {
});
}
async function login(token, keepLogin) {
setToken({ token, keepLogin });
async function login(token, tokenMultimedia, keepLogin) {
setToken({ token, tokenMultimedia, keepLogin });
await useRole().fetch();
await useUserConfig().fetch();
}
function isLoggedIn() {
const localToken = localStorage.getItem('token');
const sessionToken = sessionStorage.getItem('token');
const localToken = localStorage.getItem(TOKEN);
const sessionToken = sessionStorage.getItem(TOKEN);
return !!(localToken || sessionToken);
}
return {
getToken,
getTokenMultimedia,
setToken,
destroy,
login,

View File

@ -0,0 +1,23 @@
import VnConfirm from 'components/ui/VnConfirm.vue';
import { useQuasar } from 'quasar';
export function useVnConfirm() {
const quasar = useQuasar();
const openConfirmationModal = (title, message, promise, successFn) => {
quasar
.dialog({
component: VnConfirm,
componentProps: {
title: title,
message: message,
promise: promise,
},
})
.onOk(async () => {
if (successFn) successFn();
});
};
return { openConfirmationModal };
}

View File

@ -1,30 +1,29 @@
// app global css in SCSS form
@import './icons.scss';
@import '@quasar/quasar-ui-qcalendar/src/QCalendarMonth.sass';
body.body--light {
--fount-color: black;
--vn-sectionColor: #ffffff;
--vn-pageColor: #e0e0e0;
background-color: var(--vn-pageColor);
.q-header .q-toolbar {
color: var(--fount-color);
}
--vn-text: var(--fount-color);
--vn-gray: var(--vn-sectionColor);
--vn-label: #5f5f5f;
--vn-dark: var(--vn-sectionColor);
--vn-light-gray: #e7e3e3;
}
--font-color: black;
--vn-section-color: #e0e0e0;
--vn-page-color: #ffffff;
--vn-text-color: var(--font-color);
--vn-label-color: #5f5f5f;
--vn-accent-color: #e7e3e3;
background-color: var(--vn-page-color);
.q-header .q-toolbar {
color: var(--font-color);
}
}
body.body--dark {
--vn-pageColor: #222;
--vn-SectionColor: #3c3b3b;
background-color: var(--vn-pageColor);
--vn-text: white;
--vn-gray: var(--vn-SectionColor);
--vn-label: #a8a8a8;
--vn-dark: var(--vn-SectionColor);
--vn-light-gray: #424242;
--vn-page-color: #222;
--vn-section-color: #3d3d3d;
--vn-text-color: white;
--vn-label-color: #a8a8a8;
--vn-accent-color: #424242;
background-color: var(--vn-page-color);
}
a {
@ -39,6 +38,9 @@ a {
.tx-color-link {
color: $color-link !important;
}
.tx-color-font {
color: $color-link !important;
}
.header-link {
color: $color-link !important;
@ -59,15 +61,18 @@ a {
// Removes chrome autofill background
input:-webkit-autofill,
select:-webkit-autofill {
color: var(--vn-text);
color: var(--vn-text-color);
font-family: $typography-font-family;
-webkit-text-fill-color: var(--vn-text);
-webkit-text-fill-color: var(--vn-text-color);
-webkit-background-clip: text !important;
background-clip: text !important;
}
.bg-vn-dark {
background-color: var(--vn-dark);
.bg-vn-section-color {
background-color: var(--vn-section-color);
}
.bg-hover {
background-color: #666666;
}
.color-vn-label {
@ -75,16 +80,21 @@ select:-webkit-autofill {
}
.color-vn-text {
color: var(--vn-text);
color: var(--vn-text-color);
}
.color-vn-white {
color: $white;
}
.card-width {
max-width: 800px;
width: 100%;
}
.vn-card {
background-color: var(--vn-gray);
color: var(--vn-text);
background-color: var(--vn-section-color);
color: var(--vn-text-color);
border-radius: 8px;
}
@ -98,16 +108,20 @@ select:-webkit-autofill {
}
.bg-vn-primary-row {
background-color: var(--vn-dark);
background-color: var(--vn-section-color);
}
.bg-vn-secondary-row {
background-color: var(--vn-light-gray);
background-color: var(--vn-accent-color);
}
.fill-icon {
font-variation-settings: 'FILL' 1;
}
.vn-table-separation-row {
height: 16px !important;
background-color: var(--vn-gray) !important;
background-color: var(--vn-section-color) !important;
}
/* Estilo para el asterisco en campos requeridos */
@ -115,6 +129,37 @@ select:-webkit-autofill {
content: ' *';
}
.q-card,
.q-table,
.q-table__bottom,
.q-drawer {
background-color: var(--vn-section-color);
}
.q-chip,
.q-notification__message,
.q-notification__icon {
color: black;
}
.q-notification--standard.bg-negative {
background-color: #fa3939 !important;
}
.q-notification--standard.bg-positive {
background-color: #a3d131 !important;
}
.q-tooltip {
background-color: var(--vn-page-color);
color: var(--font-color);
font-size: medium;
}
.q-card__actions {
justify-content: center;
}
/* q-notification row items-stretch q-notification--standard bg-negative text-white */
input[type='number'] {
-moz-appearance: textfield;
}
@ -124,3 +169,14 @@ input::-webkit-inner-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
}
// Clases para modificar el color de fecha seleccionada en componente QCalendarMonth
.q-dark div .q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}
.q-calendar-mini .q-calendar-month__day.q-selected .q-calendar__button {
background-color: $primary !important;
color: white !important;
}

View File

@ -14,15 +14,15 @@
// Tip: to add new colors https://quasar.dev/style/color-palette/#adding-your-own-colors
$primary: #ec8916;
$secondary: $primary;
$positive: #21ba45;
$negative: #c10015;
$info: #31ccec;
$warning: #f2c037;
$positive: #c8e484;
$negative: #fb5252;
$info: #84d0e2;
$warning: #f4b974;
// Pendiente de cuadrar con la base de datos
$success: $positive;
$alert: $negative;
$white: #fff;
$dark: #3c3b3b;
$dark: #3d3d3d;
// custom
$color-link: #66bfff;
$color-spacer-light: #a3a3a31f;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,28 @@
import en from './en';
import es from './es';
export const localeEquivalence = {
'en':'en-GB'
const files = import.meta.glob(`./locale/*.yml`);
const modules = import.meta.glob(`../pages/**/locale/*.yml`);
const translations = {};
for (const file in files) {
const lang = file.split('/').at(2).split('.')[0];
files[file]()
.then((g) => {
translations[lang] = g.default;
})
.finally(() => {
const actualLang = lang + '.yml';
for (const module in modules) {
if (!module.endsWith(actualLang)) continue;
modules[module]().then((t) => {
Object.assign(translations[lang], t.default);
})
}
});
}
export default {
en: en,
es: es,
export const localeEquivalence = {
en: 'en-GB',
};
export default translations;

1202
src/i18n/locale/en.yml Normal file

File diff suppressed because it is too large Load Diff

1201
src/i18n/locale/es.yml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,5 +11,3 @@ const quasar = useQuasar();
<QFooter v-if="quasar.platform.is.mobile"></QFooter>
</QLayout>
</template>
<style lang="scss" scoped></style>

View File

@ -40,7 +40,7 @@ const langs = ['en', 'es'];
<template>
<QLayout view="hHh LpR fFf">
<QHeader reveal class="bg-vn-dark">
<QHeader reveal class="bg-vn-section-color">
<QToolbar class="justify-end">
<QBtn
id="switchLanguage"

View File

@ -291,8 +291,6 @@ async function importToNewRefundTicket() {
selection="multiple"
v-model:selected="selectedRows"
:grid="$q.screen.lt.md"
:pagination="{ rowsPerPage: 0 }"
:hide-bottom="true"
>
<template #body-cell-ticket="{ value }">
<QTd align="center">

View File

@ -9,12 +9,13 @@ import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import axios from 'axios';
import { useSession } from 'src/composables/useSession';
const route = useRoute();
const { t } = useI18n();
const session = useSession();
const token = session.getToken();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const claimFilter = {
fields: [
@ -24,7 +25,7 @@ const claimFilter = {
'workerFk',
'claimStateFk',
'packages',
'hasToPickUp',
'pickup',
],
include: [
{
@ -50,6 +51,20 @@ function setClaimStates(data) {
claimStates.value = data;
claimStatesCopy.value = data;
}
let optionsList;
async function getEnumValues() {
optionsList = [{ id: null, description: t('claim.basicData.null') }];
const { data } = await axios.get(`Applications/get-enum-values`, {
params: {
schema: 'vn',
table: 'claim',
column: 'pickup',
},
});
for (let value of data)
optionsList.push({ id: value, description: t(`claim.basicData.${value}`) });
}
getEnumValues();
const workerFilter = {
options: workers,
@ -168,13 +183,19 @@ const statesFilter = {
type="number"
/>
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox
v-model="data.hasToPickUp"
:label="t('claim.basicData.picked')"
/>
<QSelect
v-model="data.pickup"
:options="optionsList"
option-value="id"
option-label="description"
emit-value
:label="t('claim.basicData.pickup')"
map-options
use-input
:input-debounce="0"
>
</QSelect>
</div>
</VnRow>
</template>

View File

@ -107,7 +107,11 @@ onMounted(async () => {
<template #body="{ entity }">
<VnLv v-if="entity.claimState" :label="t('claim.card.state')">
<template #value>
<QBadge :color="stateColor(entity.claimState.code)" dense>
<QBadge
:color="stateColor(entity.claimState.code)"
text-color="black"
dense
>
{{ entity.claimState.description }}
</QBadge>
</template>

View File

@ -150,10 +150,8 @@ const columns = computed(() => [
<QTable
:columns="columns"
:rows="rows"
:pagination="{ rowsPerPage: 0 }"
row-key="$index"
selection="multiple"
hide-pagination
v-model:selected="selected"
:grid="$q.screen.lt.md"
table-header-class="text-left"

View File

@ -121,11 +121,6 @@ async function fetchMana() {
mana.value = response.data;
}
async function updateQuantity({ id, quantity }) {
if (!id) return;
await axios.patch(`ClaimBeginnings/${id}`, { quantity });
}
async function updateDiscount({ saleFk, discount, canceller }) {
const body = { salesIds: [saleFk], newDiscount: discount };
const claimId = claim.value.ticketFk;
@ -155,13 +150,17 @@ function showImportDialog() {
})
.onOk(() => claimLinesForm.value.reload());
}
function saveWhenHasChanges() {
claimLinesForm.value.getChanges().updates && claimLinesForm.value.onSubmit();
}
</script>
<template>
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
<div class="row q-gutter-md">
<div>
{{ t('Amount') }}
<QChip :dense="$q.screen.lt.sm">
<QChip :dense="$q.screen.lt.sm" text-color="white">
{{ toCurrency(amount) }}
</QChip>
</div>
@ -181,163 +180,135 @@ function showImportDialog() {
@on-fetch="onFetchClaim"
auto-load
/>
<div class="column items-center">
<div class="list">
<CrudModel
data-key="ClaimLines"
ref="claimLinesForm"
:url="`Claims/${route.params.id}/lines`"
save-url="ClaimBeginnings/crud"
:filter="linesFilter"
@on-fetch="onFetch"
@save-changes="onFetch"
v-model:selected="selected"
:default-save="false"
:default-reset="false"
auto-load
>
<template #body="{ rows }">
<QTable
:columns="columns"
:rows="rows"
:dense="$q.screen.lt.md"
:pagination="{ rowsPerPage: 0 }"
row-key="id"
selection="multiple"
v-model:selected="selected"
hide-pagination
:grid="$q.screen.lt.md"
>
<template #body-cell-claimed="{ row, value }">
<QTd auto-width align="right" class="text-primary">
<span>{{ value }}</span>
<QPopupEdit
v-model="row.quantity"
v-slot="scope"
:title="t('Claimed quantity')"
@update:model-value="updateQuantity(row)"
buttons
>
<QInput
v-model="scope.value"
type="number"
dense
autofocus
@keyup.enter="scope.set"
@focus="($event) => $event.target.select()"
/>
</QPopupEdit>
</QTd>
</template>
<template #body-cell-description="{ row, value }">
<QTd auto-width align="right" class="text-primary">
{{ value }}
<ItemDescriptorProxy
:id="row.sale.itemFk"
></ItemDescriptorProxy>
</QTd>
</template>
<template #body-cell-discount="{ row, value, rowIndex }">
<QTd auto-width align="right" class="text-primary">
{{ value }}
<VnDiscount
:quantity="row.quantity"
:price="row.sale.price"
:discount="row.sale.discount"
:mana="mana"
:promise="updateDiscount"
:data="{ saleFk: row.sale.id, rowIndex: rowIndex }"
@on-update="onUpdateDiscount"
/>
</QTd>
</template>
<!-- View for grid mode -->
<template #item="props">
<div
class="q-mb-md col-12 grid-style-transition"
:style="props.selected ? 'transform: scale(0.95);' : ''"
>
<QCard>
<QCardSection>
<QCheckbox v-model="props.selected" />
</QCardSection>
<QSeparator inset />
<QList dense>
<QItem
v-for="column of props.cols"
:key="column.name"
>
<QItemSection>
<QItemLabel caption>
{{ column.label }}
<div class="q-pa-md">
<CrudModel
data-key="ClaimLines"
ref="claimLinesForm"
:url="`Claims/${route.params.id}/lines`"
save-url="ClaimBeginnings/crud"
:filter="linesFilter"
@on-fetch="onFetch"
@save-changes="onFetch"
v-model:selected="selected"
:default-save="false"
:default-reset="false"
auto-load
:limit="0"
>
<template #body="{ rows }">
<QTable
:columns="columns"
:rows="rows"
:dense="$q.screen.lt.md"
row-key="id"
selection="multiple"
v-model:selected="selected"
:grid="$q.screen.lt.md"
>
<template #body-cell-claimed="{ row }">
<QTd auto-width align="right" class="text-primary">
<QInput
v-model="row.quantity"
type="number"
dense
@keyup.enter="saveWhenHasChanges()"
@blur="saveWhenHasChanges()"
/>
</QTd>
</template>
<template #body-cell-description="{ row, value }">
<QTd auto-width align="right" class="text-primary">
{{ value }}
<ItemDescriptorProxy
:id="row.sale.itemFk"
></ItemDescriptorProxy>
</QTd>
</template>
<template #body-cell-discount="{ row, value, rowIndex }">
<QTd auto-width align="right" class="text-primary">
{{ value }}
<VnDiscount
:quantity="row.quantity"
:price="row.sale.price"
:discount="row.sale.discount"
:mana="mana"
:promise="updateDiscount"
:data="{ saleFk: row.sale.id, rowIndex: rowIndex }"
@on-update="onUpdateDiscount"
/>
</QTd>
</template>
<!-- View for grid mode -->
<template #item="props">
<div
class="q-mb-md col-12 grid-style-transition"
:style="props.selected ? 'transform: scale(0.95);' : ''"
>
<QCard>
<QCardSection>
<QCheckbox v-model="props.selected" />
</QCardSection>
<QSeparator inset />
<QList dense>
<QItem
v-for="column of props.cols"
:key="column.name"
>
<QItemSection>
<QItemLabel caption>
{{ column.label }}
</QItemLabel>
</QItemSection>
<QItemSection side>
<template v-if="column.name === 'claimed'">
<QItemLabel class="text-primary">
<QInput
v-model="props.row.quantity"
type="number"
dense
autofocus
@keyup.enter="
saveWhenHasChanges()
"
@blur="saveWhenHasChanges()"
/>
</QItemLabel>
</QItemSection>
<QItemSection side>
<template
v-if="column.name === 'claimed'"
>
<QItemLabel class="text-primary">
{{ column.value }}
<QPopupEdit
v-model="props.row.quantity"
v-slot="scope"
:title="t('Claimed quantity')"
@update:model-value="
updateQuantity(props.row)
"
buttons
>
<QInput
v-model="scope.value"
type="number"
dense
autofocus
@keyup.enter="scope.set"
@focus="
($event) =>
$event.target.select()
"
/>
</QPopupEdit>
</QItemLabel>
</template>
<template
v-else-if="column.name === 'discount'"
>
<QItemLabel class="text-primary">
{{ column.value }}
<VnDiscount
:quantity="props.row.quantity"
:price="props.row.sale.price"
:discount="
props.row.sale.discount
"
:mana="mana"
:promise="updateDiscount"
:data="{
saleFk: props.row.sale.id,
rowIndex: props.rowIndex,
}"
@on-update="onUpdateDiscount"
/>
</QItemLabel>
</template>
<template v-else>
<QItemLabel>
{{ column.value }}
</QItemLabel>
</template>
</QItemSection>
</QItem>
</QList>
</QCard>
</div>
</template>
</QTable>
</template>
</CrudModel>
</div>
</template>
<template
v-else-if="column.name === 'discount'"
>
<QItemLabel class="text-primary">
{{ column.value }}
<VnDiscount
:quantity="props.row.quantity"
:price="props.row.sale.price"
:discount="
props.row.sale.discount
"
:mana="mana"
:promise="updateDiscount"
:data="{
saleFk: props.row.sale.id,
rowIndex: props.rowIndex,
}"
@on-update="onUpdateDiscount"
/>
</QItemLabel>
</template>
<template v-else>
<QItemLabel>
{{ column.value }}
</QItemLabel>
</template>
</QItemSection>
</QItem>
</QList>
</QCard>
</div>
</template>
</QTable>
</template>
</CrudModel>
</div>
<QPageSticky position="bottom-right" :offset="[25, 25]">

View File

@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FetchData from 'components/FetchData.vue';
import { toDate, toCurrency, toPercentage } from 'filters/index';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import axios from 'axios';
defineEmits([...useDialogPluginComponent.emits]);
@ -118,16 +119,21 @@ function cancel() {
<QBtn icon="close" flat round dense v-close-popup />
</QCardSection>
<QTable
class="my-sticky-header-table"
:columns="columns"
:rows="claimableSales"
:pagination="{ rowsPerPage: 10 }"
row-key="saleFk"
selection="multiple"
v-model:selected="selected"
square
flat
/>
>
<template #body-cell-description="{ row, value }">
<QTd auto-width align="right" class="link">
{{ value }}
<ItemDescriptorProxy :id="row.itemFk"></ItemDescriptorProxy>
</QTd>
</template>
</QTable>
<QSeparator />
<QCardActions align="right">
<QBtn :label="t('globals.cancel')" color="primary" flat @click="cancel" />
@ -149,33 +155,6 @@ function cancel() {
}
</style>
<style lang="scss">
.my-sticky-header-table {
height: 400px;
thead tr th {
position: sticky;
z-index: 1;
}
thead tr:first-child th {
/* this is when the loading indicator appears */
top: 0;
}
&.q-table--loading thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
// /* prevent scrolling behind sticky top row on focus */
tbody {
/* height of all previous header rows */
scroll-margin-top: 48px;
}
}
</style>
<i18n>
es:
Available sales lines: Líneas de venta disponibles

View File

@ -38,10 +38,11 @@ const body = {
</script>
<template>
<VnNotes
style="overflow-y: auto"
:add-note="$props.addNote"
url="claimObservations"
:add-note="$props.addNote"
:filter="claimFilter"
:body="body"
v-bind="$attrs"
style="overflow-y: auto"
/>
</template>

View File

@ -11,8 +11,8 @@ import FetchData from 'components/FetchData.vue';
const router = useRouter();
const quasar = useQuasar();
const { t } = useI18n();
const session = useSession();
const token = session.getToken();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const claimId = computed(() => router.currentRoute.value.params.id);

View File

@ -11,11 +11,13 @@ import VnLv from 'src/components/ui/VnLv.vue';
import ClaimNotes from 'src/pages/Claim/Card/ClaimNotes.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
const route = useRoute();
const { t } = useI18n();
const session = useSession();
const token = session.getToken();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const $props = defineProps({
id: {
@ -176,14 +178,14 @@ function openDialog(dmsId) {
@on-fetch="getClaimDms"
>
<template #header="{ entity: { claim } }">
{{ claim.id }} - {{ claim.client.name }}
{{ claim.id }} - {{ claim.client.name }} ({{ claim.client.id }})
</template>
<template #body="{ entity: { claim, salesClaimed, developments } }">
<QCard class="vn-one">
<a class="header header-link" :href="`#/claim/${entityId}/basic-data`">
{{ t('claim.pageTitles.basicData') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/claim/${entityId}/basic-data`"
:text="t('claim.pageTitles.basicData')"
/>
<VnLv
:label="t('claim.summary.created')"
:value="toDate(claim.created)"
@ -213,23 +215,22 @@ function openDialog(dmsId) {
</VnLv>
<VnLv :label="t('claim.summary.customer')">
<template #value>
<VnUserLink
:name="claim.client?.name"
:worker-id="claim.client?.id"
/>
<span class="link cursor-pointer">
{{ claim.client?.name }}
<CustomerDescriptorProxy :id="claim.clientFk" />
</span>
</template>
</VnLv>
<QCheckbox
:label="t('claim.basicData.picked')"
v-model="claim.hasToPickUp"
:disable="true"
<VnLv
:label="t('claim.basicData.pickup')"
:value="t(`claim.basicData.${claim.pickup}`)"
/>
</QCard>
<QCard class="vn-three">
<a class="header header-link" :href="`#/claim/${entityId}/notes`">
{{ t('claim.summary.notes') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/claim/${entityId}/notes`"
:text="t('claim.summary.notes')"
/>
<ClaimNotes
:id="entityId"
:add-note="false"
@ -238,10 +239,10 @@ function openDialog(dmsId) {
/>
</QCard>
<QCard class="vn-two" v-if="salesClaimed.length > 0">
<a class="header header-link" :href="`#/claim/${entityId}/lines`">
{{ t('claim.summary.details') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/claim/${entityId}/lines`"
:text="t('claim.summary.details')"
/>
<QTable
:columns="detailsColumns"
:rows="salesClaimed"
@ -271,7 +272,7 @@ function openDialog(dmsId) {
>
<ItemDescriptorProxy
v-if="col.name == 'description'"
:id="props.row.id"
:id="props.row.sale.itemFk"
:sale-fk="props.row.saleFk"
></ItemDescriptorProxy>
</QTh>
@ -279,34 +280,11 @@ function openDialog(dmsId) {
</template>
</QTable>
</QCard>
<QCard class="vn-two" v-if="developments.length > 0">
<a class="header header-link" :href="claimUrl + 'development'">
{{ t('claim.summary.development') }}
<QIcon name="open_in_new" />
</a>
<QTable
:columns="developmentColumns"
:rows="developments"
flat
dense
:rows-per-page-options="[0]"
hide-bottom
>
<template #header="props">
<QTr :props="props">
<QTh v-for="col in props.cols" :key="col.name" :props="props">
{{ t(col.label) }}
</QTh>
</QTr>
</template>
</QTable>
</QCard>
<QCard class="vn-max" v-if="claimDms.length > 0">
<a class="header header-link" :href="`#/claim/${entityId}/photos`">
{{ t('claim.summary.photos') }}
<QIcon name="open_in_new" />
</a>
<QCard class="vn-two" v-if="claimDms.length > 0">
<VnTitle
:url="`#/claim/${entityId}/photos`"
:text="t('claim.summary.photos')"
/>
<div class="container">
<div
class="multimedia-container"
@ -322,7 +300,7 @@ function openDialog(dmsId) {
v-if="media.isVideo"
@click.stop="openDialog(media.dmsFk)"
>
<QTooltip>Video</QTooltip>header
<QTooltip>Video</QTooltip>
</QIcon>
<QCard class="multimedia relative-position">
<QImg
@ -344,12 +322,30 @@ function openDialog(dmsId) {
</div>
</div>
</QCard>
<QCard class="vn-two" v-if="developments.length > 0">
<VnTitle
:url="claimUrl + 'development'"
:text="t('claim.summary.development')"
/>
<QTable
:columns="developmentColumns"
:rows="developments"
flat
dense
:rows-per-page-options="[0]"
hide-bottom
>
<template #header="props">
<QTr :props="props">
<QTh v-for="col in props.cols" :key="col.name" :props="props">
{{ t(col.label) }}
</QTh>
</QTr>
</template>
</QTable>
</QCard>
<QCard class="vn-max">
<a class="header header-link" :href="claimUrl + 'action'">
{{ t('claim.summary.actions') }}
<QIcon name="open_in_new" class="link" />
</a>
<VnTitle :url="claimUrl + 'action'" :text="t('claim.summary.actions')" />
<div id="slider-container" class="q-px-xl q-py-md">
<QSlider
v-model="claim.responsibility"

View File

@ -108,7 +108,11 @@ function navigate(event, id) {
/>
<VnLv :label="t('claim.list.state')">
<template #value>
<QBadge :color="stateColor(row.stateCode)" dense>
<QBadge
text-color="black"
:color="stateColor(row.stateCode)"
dense
>
{{ row.stateDescription }}
</QBadge>
</template>
@ -118,7 +122,6 @@ function navigate(event, id) {
<QBtn
:label="t('globals.description')"
@click.stop
class="bg-vn-dark"
outline
style="margin-top: 15px"
>

View File

@ -140,8 +140,8 @@ const toCustomerAddressEdit = (addressId) => {
<div
v-for="(item, index) in addresses"
:key="index"
class="address-card"
:class="{
'address-card': true,
'q-mb-md': index < addresses.length - 1,
'item-disabled': !item.isActive,
}"
@ -234,7 +234,7 @@ const toCustomerAddressEdit = (addressId) => {
cursor: pointer;
&:hover {
background-color: var(--vn-light-gray);
background-color: var(--vn-accent-color);
}
}

View File

@ -11,8 +11,8 @@ import VnInput from 'src/components/common/VnInput.vue';
const route = useRoute();
const { t } = useI18n();
const session = useSession();
const token = session.getToken();
const { getTokenMultimedia } = useSession();
const token = getTokenMultimedia();
const workers = ref([]);
const workersCopy = ref([]);

View File

@ -171,6 +171,18 @@ const toCustomerGreugeCreate = () => {
</QPageSticky>
</template>
<style lang="scss">
.consignees-card {
border: 2px solid var(--vn-accent-color);
border-radius: 10px;
padding: 10px;
}
.label-color {
color: var(--vn-label-color);
}
</style>
<i18n>
es:
Total: Total

View File

@ -71,7 +71,7 @@ const toCustomerNoteCreate = () => {
<style lang="scss">
.custom-border {
border: 2px solid var(--vn-light-gray);
border: 2px solid var(--vn-accent-color);
border-radius: 10px;
padding: 10px;
}

View File

@ -124,6 +124,18 @@ const toCustomerRecoverieCreate = () => {
</QPageSticky>
</template>
<style lang="scss">
.consignees-card {
border: 2px solid var(--vn-accent-color);
border-radius: 10px;
padding: 10px;
}
.label-color {
color: var(--vn-label-color);
}
</style>
<i18n>
es:
Since: Desde

View File

@ -8,6 +8,7 @@ import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import CustomerSummaryTable from 'src/pages/Customer/components/CustomerSummaryTable.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute();
const { t } = useI18n();
@ -63,10 +64,10 @@ const creditWarning = computed(() => {
<CardSummary ref="summary" :url="`Clients/${entityId}/summary`">
<template #body="{ entity }">
<QCard class="vn-one">
<a class="header header-link" :href="`#/customer/${entityId}/basic-data`">
{{ t('customer.summary.basicData') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/customer/${entityId}/basic-data`"
:text="t('customer.summary.basicData')"
/>
<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" />
@ -97,13 +98,10 @@ const creditWarning = computed(() => {
/>
</QCard>
<QCard class="vn-one">
<a
class="header header-link"
:href="`#/customer/${entityId}/fiscal-data`"
>
{{ t('customer.summary.fiscalAddress') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/customer/${entityId}/fiscal-data`"
:text="t('customer.summary.fiscalAddress')"
/>
<VnLv
:label="t('customer.summary.socialName')"
:value="entity.socialName"
@ -125,14 +123,10 @@ const creditWarning = computed(() => {
<VnLv :label="t('customer.summary.street')" :value="entity.street" />
</QCard>
<QCard class="vn-one">
<a
class="header header-link"
:href="`#/customer/${entityId}/fiscal-data`"
link
>
{{ t('customer.summary.fiscalData') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/customer/${entityId}/fiscal-data`"
:text="t('customer.summary.fiscalData')"
/>
<QCheckbox
:label="t('customer.summary.isEqualizated')"
v-model="entity.isEqualizated"
@ -170,14 +164,10 @@ const creditWarning = computed(() => {
/>
</QCard>
<QCard class="vn-one">
<a
class="header header-link"
:href="`#/customer/${entityId}/billing-data`"
link
>
{{ t('customer.summary.billingData') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/customer/${entityId}/billing-data`"
:text="t('customer.summary.billingData')"
/>
<VnLv
:label="t('customer.summary.payMethod')"
:value="entity.payMethod.name"
@ -203,14 +193,10 @@ const creditWarning = computed(() => {
/>
</QCard>
<QCard class="vn-one" v-if="entity.defaultAddress">
<a
class="header header-link"
:href="`#/customer/${entityId}/consignees`"
link
>
{{ t('customer.summary.consignee') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/customer/${entityId}/consignees`"
:text="t('customer.summary.consignee')"
/>
<VnLv
:label="t('customer.summary.addressName')"
:value="entity.defaultAddress.nickname"
@ -225,10 +211,10 @@ const creditWarning = computed(() => {
/>
</QCard>
<QCard class="vn-one" v-if="entity.account">
<a class="header header-link" :href="`#/customer/${entityId}/web-access`">
{{ t('customer.summary.webAccess') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/customer/${entityId}/web-access`"
:text="t('customer.summary.webAccess')"
/>
<VnLv
:label="t('customer.summary.username')"
:value="entity.account.name"
@ -240,9 +226,7 @@ const creditWarning = computed(() => {
/>
</QCard>
<QCard class="vn-one" v-if="entity.account">
<div class="header header-link">
{{ t('customer.summary.businessData') }}
</div>
<VnTitle :text="t('customer.summary.businessData')" />
<VnLv
:label="t('customer.summary.totalGreuge')"
:value="toCurrency(entity.totalGreuge)"
@ -267,14 +251,11 @@ const creditWarning = computed(() => {
/>
</QCard>
<QCard class="vn-one" v-if="entity.account">
<a
class="header header-link"
:href="`https://grafana.verdnatura.es/d/40buzE4Vk/comportamiento-pagos-clientes?orgId=1&var-clientFk=${entityId}`"
link
>
{{ t('customer.summary.financialData') }}
<QIcon name="vn:grafana" />
</a>
<VnTitle
:url="`https://grafana.verdnatura.es/d/40buzE4Vk/comportamiento-pagos-clientes?orgId=1&var-clientFk=${entityId}`"
:text="t('customer.summary.financialData')"
icon="vn:grafana"
/>
<VnLv
:label="t('customer.summary.risk')"
:value="toCurrency(entity?.debt?.debt)"

View File

@ -125,7 +125,7 @@ function handleLocation(data, location) {
>
<template #append>
<QIcon name="info" class="cursor-info">
<QTooltip>{{
<QTooltip max-width="400px">{{
t('customer.basicData.youCanSaveMultipleEmails')
}}</QTooltip>
</QIcon>

View File

@ -48,13 +48,17 @@ const zones = ref();
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
<VnInput
:label="t('customerFilter.filter.name')"
v-model="params.name"
is-outlined
/>
</QItemSection>
</QItem>
<QItem class="q-mb-sm">
<QItemSection>
<VnInput
:label="t('Social Name')"
:label="t('customerFilter.filter.socialName')"
v-model="params.socialName"
is-outlined
/>
@ -170,8 +174,6 @@ en:
params:
search: Contains
fi: FI
name: Name
socialName: Social Name
salesPersonFk: Salesperson
provinceFk: Province
city: City
@ -183,8 +185,6 @@ es:
params:
search: Contiene
fi: NIF
name: Nombre
socialName: Razón Social
salesPersonFk: Comercial
provinceFk: Provincia
city: Ciudad
@ -193,8 +193,6 @@ es:
zoneFk: Zona
postcode: CP
FI: NIF
Name: Nombre
Social Name: Razón social
Salesperson: Comercial
Province: Provincia
City: Ciudad

View File

@ -84,7 +84,6 @@ const redirectToCreateView = () => {
<QBtn
:label="t('components.smartCard.openCard')"
@click.stop="navigate(row.id)"
class="bg-vn-dark"
outline
/>
<QBtn

View File

@ -30,16 +30,16 @@ const { t } = useI18n();
border: 1px solid black;
}
.title_balance {
color: var(--vn-text);
color: var(--vn-text-color);
margin-top: 0;
margin-bottom: 0;
}
.key_balance {
color: var(--vn-label);
color: var(--vn-label-color);
margin-bottom: 0;
}
.value_balance {
color: var(--vn-text);
color: var(--vn-text-color);
margin-bottom: 0;
}
</style>

View File

@ -205,7 +205,7 @@ const onFetch = (data) => {
</QScrollArea>
</QDrawer>
<VnSubToolbar class="bg-vn-dark">
<VnSubToolbar>
<template #st-data>
<CustomerBalanceDueTotal :amount="balanceDueTotal" />
<div class="flex items-center q-ml-lg">
@ -222,10 +222,8 @@ const onFetch = (data) => {
<QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 0 }"
:rows="rows"
class="full-width q-mt-md"
hide-bottom
row-key="clientFk"
selection="multiple"
v-model:selected="selected"

View File

@ -510,7 +510,6 @@ const selectSalesPersonId = (id) => (selectedSalesPersonId.value = id);
<QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 12 }"
:rows="rows"
class="full-width q-mt-md"
row-key="id"

View File

@ -100,10 +100,8 @@ const selectCustomerId = (id) => {
<QPage class="column items-center q-pa-md">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 0 }"
:rows="rows"
class="full-width q-mt-md"
hide-bottom
row-key="id"
selection="multiple"
v-model:selected="selected"

View File

@ -151,10 +151,8 @@ function stateColor(row) {
:columns="columns"
:rows="rows"
row-key="id"
:pagination="{ rowsPerPage: 0 }"
:grid="grid || $q.screen.lt.sm"
class="q-mt-xs custom-table"
hide-pagination
>
<template #body-cell-actions="{ row }">
<QTd auto-width class="text-center">
@ -196,7 +194,7 @@ function stateColor(row) {
</template>
<template #body-cell-state="{ row }">
<QTd auto-width class="text-center">
<QBadge :color="stateColor(row)">
<QBadge text-color="black" :color="stateColor(row)">
{{
row.isConfirmed
? t('Confirmed')
@ -227,6 +225,7 @@ function stateColor(row) {
v-if="col.name == 'state'"
>
<QBadge
text-color="black"
:color="
stateColor(row)
"

View File

@ -0,0 +1,4 @@
customerFilter:
filter:
name: Name
socialName: Social name

View File

@ -0,0 +1,4 @@
customerFilter:
filter:
name: Nombre
socialName: Razón Social

View File

@ -21,7 +21,7 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
:width="256"
:breakpoint="1000"
>
<QScrollArea class="fit text-grey-8">
<QScrollArea class="fit">
<LeftMenu />
</QScrollArea>
</QDrawer>
@ -67,6 +67,10 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
</template>
<style lang="scss" scoped>
.left-menu {
color: var(--vn-font-color);
}
.flex-container {
display: flex;
flex-wrap: wrap;

View File

@ -63,7 +63,7 @@ const removeDepartment = () => {
router.push({ name: 'WorkerDepartment' });
notify('department.departmentRemoved', 'positive');
} catch (err) {
console.log('Error removing department');
console.error('Error removing department');
}
});
};

View File

@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import { getUrl } from 'src/composables/getUrl';
import VnLv from 'src/components/ui/VnLv.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
const route = useRoute();
const { t } = useI18n();
@ -36,13 +37,10 @@ onMounted(async () => {
</template>
<template #body="{ entity: department }">
<QCard class="column">
<a
class="header header-link"
:href="`#/department/department/${entityId}/basic-data`"
>
{{ t('Basic data') }}
<QIcon name="open_in_new" />
</a>
<VnTitle
:url="`#/department/department/${entityId}/basic-data`"
:text="t('Basic data')"
/>
<div class="full-width row wrap justify-between content-between">
<div class="column" style="min-width: 50%">
<VnLv

View File

@ -2,6 +2,7 @@
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useRole } from 'src/composables/useRole';
import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue';
@ -15,6 +16,8 @@ import { toDate } from 'src/filters';
const route = useRoute();
const { t } = useI18n();
const { hasAny } = useRole();
const isAdministrative = () => hasAny(['administrative']);
const suppliersOptions = ref([]);
const travelsOptions = ref([]);
@ -206,6 +209,7 @@ const onFilterTravelSelected = (formData, id) => {
</div>
<div class="col">
<QCheckbox
v-if="isAdministrative()"
v-model="data.isBooked"
:label="t('entry.basicData.booked')"
/>

View File

@ -268,16 +268,11 @@ const importBuys = () => {
const toggleGroupingMode = async (buy, mode) => {
try {
const grouping = 1;
const packing = 2;
const groupingMode = mode === 'grouping' ? grouping : packing;
const newGroupingMode = buy.groupingMode === groupingMode ? 0 : groupingMode;
const groupingMode = mode === 'grouping' ? mode : 'packing';
const newGroupingMode = buy.groupingMode === groupingMode ? null : groupingMode;
const params = {
groupingMode: newGroupingMode,
};
await axios.patch(`Buys/${buy.id}`, params);
buy.groupingMode = newGroupingMode;
} catch (err) {
@ -287,9 +282,9 @@ const toggleGroupingMode = async (buy, mode) => {
const lockIconType = (groupingMode, mode) => {
if (mode === 'packing') {
return groupingMode === 2 ? 'lock' : 'lock_open';
return groupingMode === 'packing' ? 'lock' : 'lock_open';
} else {
return groupingMode === 1 ? 'lock' : 'lock_open';
return groupingMode === 'grouping' ? 'lock' : 'lock_open';
}
};
</script>
@ -471,6 +466,9 @@ const lockIconType = (groupingMode, mode) => {
</template>
<style lang="scss" scoped>
.separation-row {
background-color: var(--vn-section-color) !important;
}
.grid-style-transition {
transition: transform 0.28s, background-color 0.28s;
}

View File

@ -238,12 +238,7 @@ const redirectToBuysView = () => {
</div>
</VnRow>
<VnRow>
<QTable
:columns="columns"
:rows="importData.buys"
:pagination="{ rowsPerPage: 0 }"
hide-pagination
>
<QTable :columns="columns" :rows="importData.buys">
<template #body-cell-item="{ row, col }">
<QTd auto-width>
<VnSelectDialog

Some files were not shown because too many files have changed in this diff Show More