0
0
Fork 0

Merge branch 'dev' into 6973-UpdateVnLocationLabel

This commit is contained in:
Jon Elias 2024-04-09 06:48:06 +00:00
commit f988923b4b
51 changed files with 1255 additions and 262 deletions

View File

@ -5,16 +5,23 @@ 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).
## [2416.01] - 2024-04-18
### Added
## [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
### 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

@ -1,6 +1,6 @@
{
"name": "salix-front",
"version": "24.14.0",
"version": "24.16.0",
"description": "Salix frontend",
"productName": "Salix",
"author": "Verdnatura",

View File

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

View File

@ -1,5 +1,5 @@
<script setup>
import { h, onMounted } from 'vue';
import { onMounted } from 'vue';
import axios from 'axios';
const $props = defineProps({

View File

@ -227,6 +227,7 @@ watch(formUrl, async () => {
defineExpose({
save,
isLoading,
hasChanges,
});
</script>
<template>
@ -284,6 +285,9 @@ defineExpose({
/>
</template>
<style lang="scss" scoped>
.q-notifications {
color: black;
}
#formModel {
max-width: 800px;
width: 100%;

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

@ -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>

View File

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

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"
>

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,29 +41,28 @@ 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(() => 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 });
@ -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" />
@ -177,22 +176,23 @@ const emit = defineEmits(['onFetch']);
.body {
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-color);
font-size: 12px;
font-size: 14px;
&:not(:has(a))::after {
content: ':';
@ -201,7 +201,7 @@ const emit = defineEmits(['onFetch']);
.value {
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);
font-size: 16px;
margin-bottom: 15px;
margin-bottom: 2px;
}
.list-box {
.q-item__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

@ -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(() => 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;
@ -128,6 +131,7 @@ watch(props, async () => {
padding: 7px;
font-size: 16px;
min-width: 275px;
box-shadow: none;
.vn-label-value {
display: flex;

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

@ -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,18 +89,26 @@ 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>

View File

@ -14,7 +14,7 @@ onUnmounted(() => {
</script>
<template>
<QToolbar class="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

@ -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

@ -14,8 +14,8 @@ export function useSession() {
return localToken || sessionToken || '';
}
function getTokenMultimedia() {
const localTokenMultimedia = localStorage.getItem('tokenMultimedia');
const sessionTokenMultimedia = sessionStorage.getItem('tokenMultimedia');
const localTokenMultimedia = localStorage.getItem('token'); // Temporal
const sessionTokenMultimedia = sessionStorage.getItem('token'); // Temporal
return localTokenMultimedia || sessionTokenMultimedia || '';
}

View File

@ -14,21 +14,15 @@ body.body--light {
.q-header .q-toolbar {
color: var(--font-color);
}
.q-card,
.q-table,
.q-table__bottom,
.q-drawer {
background-color: var(--vn-section-color);
}
}
body.body--dark {
--vn-section-color: #403c3c;
--vn-page-color: #222;
--vn-section-color: #3d3d3d;
--vn-text-color: white;
--vn-label-color: #a8a8a8;
--vn-accent-color: #424242;
background-color: #222;
background-color: var(--vn-page-color);
}
a {
@ -76,6 +70,9 @@ select:-webkit-autofill {
.bg-vn-section-color {
background-color: var(--vn-section-color);
}
.bg-hover {
background-color: #666666;
}
.color-vn-text {
color: var(--vn-text-color);
@ -85,6 +82,11 @@ select:-webkit-autofill {
color: $white;
}
.card-width {
max-width: 800px;
width: 100%;
}
.vn-card {
background-color: var(--vn-section-color);
color: var(--vn-text-color);
@ -118,9 +120,36 @@ select:-webkit-autofill {
content: ' *';
}
.q-chip {
.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;

View File

@ -22,7 +22,7 @@ $warning: #f4b974;
$success: $positive;
$alert: $negative;
$white: #fff;
$dark: #3c3b3b;
$dark: #3d3d3d;
// custom
$color-link: #66bfff;
$color-spacer-light: #a3a3a31f;

View File

@ -48,7 +48,6 @@ export default {
today: 'Today',
yesterday: 'Yesterday',
dateFormat: 'en-GB',
microsip: 'Open in MicroSIP',
noSelectedRows: `You don't have any line selected`,
downloadCSVSuccess: 'CSV downloaded successfully',
reference: 'Reference',
@ -85,6 +84,13 @@ export default {
selectFile: 'Select a file',
copyClipboard: 'Copy on clipboard',
salesPerson: 'SalesPerson',
code: 'Code',
pageTitles: {
summary: 'Summary',
basicData: 'Basic data',
log: 'Logs',
parkingList: 'Parkings list',
},
},
errors: {
statusUnauthorized: 'Access denied',
@ -492,6 +498,7 @@ export default {
request: 'Request',
weight: 'Weight',
goTo: 'Go to',
summaryAmount: 'Summary',
},
},
claim: {
@ -686,6 +693,19 @@ export default {
recyclable: 'Recyclable',
},
},
parking: {
pickingOrder: 'Picking order',
sector: 'Sector',
row: 'Row',
column: 'Column',
pageTitles: {
parking: 'Parking',
},
searchBar: {
info: 'You can search by parking code',
label: 'Search parking...',
},
},
invoiceIn: {
pageTitles: {
invoiceIns: 'Invoices In',
@ -831,12 +851,14 @@ export default {
pageTitles: {
workers: 'Workers',
list: 'List',
basicData: 'Basic data',
summary: 'Summary',
notifications: 'Notifications',
workerCreate: 'New worker',
department: 'Department',
basicData: 'Basic data',
notes: 'Notes',
pda: 'PDA',
notifications: 'Notifications',
pbx: 'Private Branch Exchange',
log: 'Log',
},
list: {
@ -1014,6 +1036,7 @@ export default {
addresses: 'Addresses',
consumption: 'Consumption',
agencyTerm: 'Agency agreement',
dms: 'File management',
},
list: {
payMethod: 'Pay method',

View File

@ -49,7 +49,6 @@ export default {
yesterday: 'Ayer',
dateFormat: 'es-ES',
noSelectedRows: `No tienes ninguna línea seleccionada`,
microsip: 'Abrir en MicroSIP',
downloadCSVSuccess: 'Descarga de CSV exitosa',
reference: 'Referencia',
agency: 'Agencia',
@ -85,6 +84,13 @@ export default {
selectFile: 'Seleccione un fichero',
copyClipboard: 'Copiar en portapapeles',
salesPerson: 'Comercial',
code: 'Código',
pageTitles: {
summary: 'Resumen',
basicData: 'Datos básicos',
log: 'Historial',
parkingList: 'Listado de parkings',
},
},
errors: {
statusUnauthorized: 'Acceso denegado',
@ -491,6 +497,7 @@ export default {
request: 'Petición de compra',
weight: 'Peso',
goTo: 'Ir a',
summaryAmount: 'Resumen',
},
},
claim: {
@ -744,6 +751,18 @@ export default {
recyclable: 'Reciclable',
},
},
parking: {
pickingOrder: 'Orden de recogida',
row: 'Fila',
column: 'Columna',
pageTitles: {
parking: 'Parking',
},
searchBar: {
info: 'Puedes buscar por código de parking',
label: 'Buscar parking...',
},
},
invoiceIn: {
pageTitles: {
invoiceIns: 'Fact. recibidas',
@ -831,12 +850,14 @@ export default {
pageTitles: {
workers: 'Trabajadores',
list: 'Listado',
basicData: 'Datos básicos',
summary: 'Resumen',
notifications: 'Notificaciones',
workerCreate: 'Nuevo trabajador',
department: 'Departamentos',
basicData: 'Datos básicos',
notes: 'Notas',
pda: 'PDA',
notifications: 'Notificaciones',
pbx: 'Centralita',
log: 'Historial',
},
list: {
@ -1014,6 +1035,7 @@ export default {
addresses: 'Direcciones',
consumption: 'Consumo',
agencyTerm: 'Acuerdo agencia',
dms: 'Gestión documental',
},
list: {
payMethod: 'Método de pago',

View File

@ -199,7 +199,7 @@ function getLink(param) {
<template>
<CardSummary
ref="summary"
data-key="InvoiceInSummary"
:url="`InvoiceIns/${entityId}/summary`"
@on-fetch="(data) => setData(data)"
>

View File

@ -29,6 +29,7 @@ const suppliersRef = ref();
order="nickname"
limit="30"
@on-fetch="(data) => (suppliers = data)"
auto-load
/>
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }">
@ -38,46 +39,6 @@ const suppliersRef = ref();
</div>
</template>
<template #body="{ params, searchFn }">
<QItem>
<QItemSection>
<VnInput
:label="t('Id or Supplier')"
v-model="params.search"
is-outlined
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="useCapitalize(t('params.correctedFk'))"
v-model="params.correctedFk"
is-outlined
>
<template #prepend>
<QIcon name="attachment" size="sm" />
</template>
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.supplierRef')"
v-model="params.supplierRef"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="vn:client" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
@ -97,29 +58,29 @@ const suppliersRef = ref();
<QItem>
<QItemSection>
<VnInput
:label="t('params.fi')"
v-model="params.fi"
:label="t('params.supplierRef')"
v-model="params.supplierRef"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
<QIcon name="vn:client" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.serialNumber')"
v-model="params.serialNumber"
<VnInputDate
:label="t('From')"
v-model="params.from"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
<QItem>
@ -152,6 +113,34 @@ const suppliersRef = ref();
</QItemSection>
</QItem>
<QExpansionItem :label="t('More options')" expand-separator>
<QItem>
<QItemSection>
<VnInput
:label="t('params.fi')"
v-model="params.fi"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
:label="t('params.serialNumber')"
v-model="params.serialNumber"
is-outlined
lazy-rules
>
<template #prepend>
<QIcon name="badge" size="sm"></QIcon>
</template>
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput
@ -180,20 +169,6 @@ const suppliersRef = ref();
</VnInput>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate
:label="t('From')"
v-model="params.from"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInputDate

View File

@ -22,7 +22,7 @@ const { t } = useI18n();
const router = useRouter();
const stateStore = useStateStore();
const session = useSession();
const token = session.getToken();
const tokenMultimedia = session.getTokenMultimedia();
const { viewSummary } = useSummaryDialog();
const manualInvoiceDialogRef = ref(null);
@ -66,7 +66,7 @@ const openPdf = () => {
if (selectedCards.value.size === 1) {
const [invoiceOut] = selectedCardsArray;
const url = `api/InvoiceOuts/${invoiceOut.id}/download?access_token=${token}`;
const url = `api/InvoiceOuts/${invoiceOut.id}/download?access_token=${tokenMultimedia}`;
window.open(url, '_blank');
} else {
const invoiceOutIdsArray = selectedCardsArray.map(
@ -75,7 +75,7 @@ const openPdf = () => {
const invoiceOutIds = invoiceOutIdsArray.join(',');
const params = new URLSearchParams({
access_token: token,
access_token: tokenMultimedia,
ids: invoiceOutIds,
});

View File

@ -55,7 +55,7 @@ async function onSubmit() {
if (res.response?.data?.error?.code === 'REQUIRES_2FA') {
Notify.create({
message: t('login.twoFactorRequired'),
icon: 'phonelink_lock',
icon: 'phoneLink_lock',
type: 'warning',
});
params.keepLogin = keepLogin.value;

View File

@ -0,0 +1,56 @@
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import VnRow from 'components/ui/VnRow.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import VnInput from 'src/components/common/VnInput.vue';
import FormModel from 'components/FormModel.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const { t } = useI18n();
const route = useRoute();
const parkingId = route.params?.id || null;
const sectors = ref([]);
const sectorFilter = { fields: ['id', 'description'] };
const filter = {
fields: ['sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: sectorFilter }],
};
</script>
<template>
<FetchData
url="Sectors"
:filter="sectorFilter"
sort-by="description"
@on-fetch="(data) => (sectors = data)"
auto-load
/>
<VnSubToolbar />
<FormModel :url="`Parkings/${parkingId}`" model="parking" :filter="filter" auto-load>
<template #form="{ data }">
<VnRow>
<VnInput v-model="data.code" :label="t('globals.code')" />
<VnInput v-model="data.pickingOrder" :label="t('parking.pickingOrder')" />
</VnRow>
<VnRow>
<VnInput v-model="data.row" :label="t('parking.row')" />
<VnInput v-model="data.column" :label="t('parking.column')" />
</VnRow>
<VnRow>
<VnSelectFilter
v-model="data.sectorFk"
option-value="id"
option-label="description"
:label="t('parking.sector')"
:options="sectors"
use-input
input-debounce="0"
:is-clearable="false"
/>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -0,0 +1,57 @@
<script setup>
import { onMounted, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import { useArrayData } from 'src/composables/useArrayData';
import LeftMenu from 'components/LeftMenu.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import ParkingDescriptor from 'pages/Parking/Card/ParkingDescriptor.vue';
const { t } = useI18n();
const route = useRoute();
const stateStore = useStateStore();
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
const arrayData = useArrayData('Parking', {
url: `Parkings/${route.params.id}`,
filter,
});
const { store } = arrayData;
onMounted(async () => await arrayData.fetch({ append: false }));
watch(
() => route.params.id,
async (newId) => {
if (newId) {
store.url = `Parkings/${newId}`;
store.filter = filter;
await arrayData.fetch({ append: false });
}
}
);
</script>
<template>
<Teleport to="#searchbar" v-if="stateStore.isHeaderMounted()">
<VnSearchbar
:info="t('parking.searchBar.info')"
:label="t('parking.searchBar.label')"
data-key="Parking"
/>
</Teleport>
<QDrawer v-model="stateStore.leftDrawer" show-if-above :width="256">
<QScrollArea class="fit">
<ParkingDescriptor />
<QSeparator />
<LeftMenu source="card" />
</QScrollArea>
</QDrawer>
<QPageContainer>
<QPage>
<RouterView></RouterView>
</QPage>
</QPageContainer>
</template>

View File

@ -0,0 +1,42 @@
<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useArrayData } from 'src/composables/useArrayData';
import CardDescriptor from 'components/ui/CardDescriptor.vue';
import VnLv from 'components/ui/VnLv.vue';
const props = defineProps({
id: {
type: Number,
required: false,
default: null,
},
});
const { t } = useI18n();
const { params } = useRoute();
const entityId = computed(() => props.id || params.id);
const { store } = useArrayData('Parking');
const card = computed(() => store.data);
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
</script>
<template>
<CardDescriptor
module="Parking"
data-key="Parking"
:url="`Parkings/${entityId}`"
:title="card?.code"
:subtitle="card?.id"
:filter="filter"
>
<template #body="{ entity: parking }">
<VnLv :label="t('globals.code')" :value="parking.code" />
<VnLv :label="t('parking.pickingOrder')" :value="parking.pickingOrder" />
<VnLv :label="t('parking.sector')" :value="parking.sector?.description" />
</template>
</CardDescriptor>
</template>

View File

@ -0,0 +1,6 @@
<script setup>
import VnLog from 'src/components/common/VnLog.vue';
</script>
<template>
<VnLog model="Parking" url="/ParkingLogs" />
</template>

View File

@ -0,0 +1,54 @@
<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'components/ui/VnLv.vue';
const $props = defineProps({
id: {
type: Number,
default: 0,
},
});
const { params } = useRoute();
const { t } = useI18n();
const entityId = computed(() => $props.id || params.id);
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder', 'row', 'column'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
</script>
<template>
<div class="q-pa-md">
<CardSummary :url="`Parkings/${entityId}`" :filter="filter">
<template #header="{ entity: parking }">{{ parking.code }}</template>
<template #body="{ entity: parking }">
<QCard class="vn-one">
<QCardSection class="q-pa-none">
<a
class="header header-link"
:href="`#/parking/${entityId}/basic-data`"
>
{{ t('globals.pageTitles.basicData') }}
<QIcon name="open_in_new" />
</a>
</QCardSection>
<VnLv :label="t('globals.code')" :value="parking.code" />
<VnLv
:label="t('parking.pickingOrder')"
:value="parking.pickingOrder"
/>
<VnLv
:label="t('parking.sector')"
:value="parking.sector?.description"
/>
<VnLv :label="t('parking.row')" :value="parking.row" />
<VnLv :label="t('parking.column')" :value="parking.column" />
</QCard>
</template>
</CardSummary>
</div>
</template>

View File

@ -0,0 +1,77 @@
<script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n';
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
import VnInput from 'components/common/VnInput.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const { t } = useI18n();
defineProps({
dataKey: {
type: String,
required: true,
},
});
const sectors = ref([]);
const emit = defineEmits(['search']);
</script>
<template>
<FetchData
url="Sectors"
:filter="{ fields: ['id', 'description'] }"
sort-by="description"
@on-fetch="(data) => (sectors = data)"
auto-load
/>
<VnFilterPanel :data-key="dataKey" :search-button="true" @search="emit('search')">
<template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs">
<strong>{{ t(`params.${tag.label}`) }}: </strong>
<span>{{ formatFn(tag.value) }}</span>
</div>
</template>
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput
:label="t('params.code')"
v-model="params.code"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnSelectFilter
v-model="params.sectorFk"
option-value="id"
option-label="description"
:label="t('params.sectorFk')"
dense
outlined
rounded
:options="sectors"
use-input
input-debounce="0"
/>
</QItemSection>
</QItem>
</template>
</VnFilterPanel>
</template>
<i18n>
en:
params:
code: Code
sectorFk: Sector
search: General Search
es:
params:
code: Código
search: Búsqueda general
</i18n>

View File

@ -0,0 +1,112 @@
<script setup>
import { onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import VnPaginate from 'components/ui/VnPaginate.vue';
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
import CardList from 'components/ui/CardList.vue';
import VnLv from 'components/ui/VnLv.vue';
import ParkingFilter from './ParkingFilter.vue';
import ParkingSummary from './Card/ParkingSummary.vue';
const stateStore = useStateStore();
const { push } = useRouter();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
onMounted(() => (stateStore.rightDrawer = true));
onUnmounted(() => (stateStore.rightDrawer = false));
const filter = {
fields: ['id', 'sectorFk', 'code', 'pickingOrder'],
include: [{ relation: 'sector', scope: { fields: ['id', 'description'] } }],
};
function exprBuilder(param, value) {
switch (param) {
case 'code':
return { [param]: { like: `%${value}%` } };
case 'sectorFk':
return { [param]: value };
case 'search':
return { or: [{ code: { like: `%${value}%` } }, { id: value }] };
}
}
</script>
<template>
<template v-if="stateStore.isHeaderMounted()">
<Teleport to="#searchbar">
<VnSearchbar
data-key="ParkingList"
:label="t('Search parking')"
:info="t('You can search by parking code')"
/>
</Teleport>
<Teleport to="#actions-append">
<div class="row q-gutter-x-sm">
<QBtn
flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</QTooltip>
</QBtn>
</div>
</Teleport>
</template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8">
<ParkingFilter data-key="ParkingList" />
</QScrollArea>
</QDrawer>
<QPage class="column items-center q-pa-md">
<div class="vn-card-list">
<VnPaginate
data-key="ParkingList"
url="Parkings"
:filter="filter"
:expr-builder="exprBuilder"
:limit="20"
auto-load
order="code"
>
<template #body="{ rows }">
<CardList
v-for="row of rows"
:key="row.id"
:id="row.id"
:title="row.code"
@click="push({ path: `/parking/${row.id}` })"
>
<template #list-items>
<VnLv label="Sector" :value="row.sector?.description" />
<VnLv
:label="t('parking.pickingOrder')"
:value="row.pickingOrder"
/>
</template>
<template #actions>
<QBtn
:label="t('components.smartCard.openSummary')"
@click.stop="viewSummary(row.id, ParkingSummary)"
color="primary"
/>
</template>
</CardList>
</template>
</VnPaginate>
</div>
</QPage>
</template>
<i18n>
es:
Search parking: Buscar parking
You can search by parking code: Puede buscar por el código del parking
</i18n>

View File

@ -277,7 +277,6 @@ function navigateToRoadmapSummary(event, row) {
.route-list {
width: 100%;
}
.table-actions {
gap: 12px;
}

View File

@ -0,0 +1,11 @@
<script setup>
import VnDmsList from 'src/components/common/VnDmsList.vue';
</script>
<template>
<VnDmsList
model="SupplierDms"
update-model="SupplierDms"
default-dms-code="supplier"
filter="supplierFk"
/>
</template>

View File

@ -1,5 +1,5 @@
<script setup>
import { onMounted, ref, computed, onUpdated } from 'vue';
import { onMounted, ref, computed } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
@ -14,8 +14,6 @@ import { getUrl } from 'src/composables/getUrl';
import VnUserLink from 'src/components/ui/VnUserLink.vue';
import VnTitle from 'src/components/common/VnTitle.vue';
onUpdated(() => summaryRef.value.fetch());
const route = useRoute();
const router = useRouter();
@ -131,22 +129,6 @@ async function changeState(value) {
</QBtnDropdown>
</template>
<template #body>
<QCard class="vn-max">
<div class="taxes">
<VnLv
:label="t('ticket.summary.subtotal')"
:value="toCurrency(ticket.totalWithoutVat)"
/>
<VnLv
:label="t('ticket.summary.vat')"
:value="toCurrency(ticket.totalWithVat - ticket.totalWithoutVat)"
/>
<VnLv
:label="t('ticket.summary.total')"
:value="toCurrency(ticket.totalWithVat)"
/>
</div>
</QCard>
<QCard class="vn-one">
<VnTitle
:url="ticketUrl + 'basic-data/step-one'"
@ -236,7 +218,7 @@ async function changeState(value) {
:value="formattedAddress()"
/>
</QCard>
<QCard class="vn-one">
<QCard class="vn-one" v-if="ticket.notes.length">
<VnTitle
:url="ticketUrl + 'observation'"
:text="t('ticket.pageTitles.notes')"
@ -258,6 +240,23 @@ async function changeState(value) {
</template>
</VnLv>
</QCard>
<QCard class="vn-one">
<VnTitle :text="t('ticket.summary.summaryAmount')" />
<div class="bodyCard">
<VnLv
:label="t('ticket.summary.subtotal')"
:value="toCurrency(ticket.totalWithoutVat)"
/>
<VnLv
:label="t('ticket.summary.vat')"
:value="toCurrency(ticket.totalWithVat - ticket.totalWithoutVat)"
/>
<VnLv
:label="t('ticket.summary.total')"
:value="toCurrency(ticket.totalWithVat)"
/>
</div>
</QCard>
<QCard class="vn-max">
<VnTitle
:url="ticketUrl + 'sale'"
@ -448,21 +447,10 @@ async function changeState(value) {
.notes {
width: max-content;
}
.cardSummary .summaryBody > .q-card > .taxes {
border: 2px solid gray;
padding: 0;
> .vn-label-value {
text-align: right;
display: flex;
flex-direction: row;
margin-top: 5px;
justify-content: flex-end;
padding-right: 20px;
}
}
.cardSummary .summaryBody > .q-card:has(.taxes) {
margin-top: 2px;
padding: 0;
.q-card.q-card--dark.q-dark.vn-one {
& > .bodyCard {
padding: 1%;
}
}
</style>

View File

@ -0,0 +1,168 @@
<script setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import FetchData from 'components/FetchData.vue';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
import VnSelectFilter from 'src/components/common/VnSelectFilter.vue';
const route = useRoute();
const { t } = useI18n();
const workersOptions = ref([]);
const countriesOptions = ref([]);
const educationLevelsOptions = ref([]);
const workerFilter = {
include: [
{
relation: 'user',
scope: {
fields: ['name', 'emailVerified'],
include: { relation: 'emailUser', scope: { fields: ['email'] } },
},
},
{ relation: 'sip', scope: { fields: ['extension', 'secret'] } },
{ relation: 'department', scope: { include: { relation: 'department' } } },
],
};
const workersFilter = {
fields: ['id', 'nickname'],
order: 'nickname ASC',
limit: 30,
};
const countriesFilter = {
fields: ['id', 'country', 'code'],
order: 'country ASC',
limit: 30,
};
const educationLevelsFilter = { fields: ['id', 'name'], order: 'name ASC', limit: 30 };
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
</script>
<template>
<FetchData
:filter="workersFilter"
@on-fetch="(data) => (workersOptions = data)"
auto-load
url="Workers/search"
/>
<FetchData
:filter="countriesFilter"
@on-fetch="(data) => (countriesOptions = data)"
auto-load
url="Countries"
/>
<FetchData
:filter="educationLevelsFilter"
@on-fetch="(data) => (educationLevelsOptions = data)"
auto-load
url="EducationLevels"
/>
<FormModel
:filter="workerFilter"
:url="`Workers/${route.params.id}`"
auto-load
model="Worker"
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<VnInput :label="t('Name')" clearable v-model="data.firstName" />
<VnInput :label="t('Last name')" clearable v-model="data.lastName" />
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.phone" :label="t('Business phone')" clearable />
<VnInput
v-model="data.mobileExtension"
:label="t('Mobile extension')"
clearable
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter
:label="t('Boss')"
:options="workersOptions"
hide-selected
option-label="nickname"
option-value="id"
v-model="data.bossFk"
>
<template #option="scope">
<QItem v-bind="scope.itemProps">
<QItemSection>
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
<QItemLabel caption>
{{ scope.opt?.nickname }},
{{ scope.opt?.code }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
</VnSelectFilter>
<VnSelectFilter
:label="t('Marital status')"
:options="maritalStatus"
hide-selected
option-label="name"
option-value="code"
v-model="data.maritalStatus"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnSelectFilter
:label="t('Origin country')"
:options="countriesOptions"
hide-selected
option-label="country"
option-value="id"
v-model="data.originCountryFk"
/>
<VnSelectFilter
:label="t('Education level')"
:options="educationLevelsOptions"
hide-selected
option-label="name"
option-value="id"
v-model="data.educationLevelFk"
/>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<VnInput v-model="data.SSN" :label="t('SSN')" clearable />
<VnInput
v-model="data.locker"
type="number"
:label="t('Locker')"
clearable
/>
</VnRow>
</template>
</FormModel>
</template>
<i18n>
es:
Name: Nombre
Last name: Apellidos
Business phone: Teléfono de empresa
Mobile extension: Extensión móvil
Boss: Jefe
Marital status: Estado civil
Married: Casado/a
Single: Soltero/a
Origin country: País origen
Education level: Nivel educación
SSN: NSS
Locker: Taquilla
</i18n>

View File

@ -1,5 +1,5 @@
<script setup>
import { computed, ref } from 'vue';
import { computed, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useSession } from 'src/composables/useSession';
@ -7,6 +7,7 @@ import CardDescriptor from 'src/components/ui/CardDescriptor.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
import useCardDescription from 'src/composables/useCardDescription';
import { useState } from 'src/composables/useState';
const $props = defineProps({
id: {
@ -23,6 +24,7 @@ const $props = defineProps({
const route = useRoute();
const { t } = useI18n();
const { getTokenMultimedia } = useSession();
const state = useState();
const entityId = computed(() => {
return $props.id || route.params.id;
@ -53,7 +55,18 @@ const filter = {
],
};
const sip = computed(() => worker.value?.sip && worker.value.sip.extension);
const sip = ref(null);
watch(
() => [worker.value?.sip?.extension, state.get('extension')],
([newWorkerSip, newStateExtension], [oldWorkerSip, oldStateExtension]) => {
if (newStateExtension !== oldStateExtension || sip.value === oldStateExtension) {
sip.value = newStateExtension;
} else if (newWorkerSip !== oldWorkerSip && sip.value !== newStateExtension) {
sip.value = newWorkerSip;
}
}
);
function getWorkerAvatar() {
const token = getTokenMultimedia();

View File

@ -0,0 +1,38 @@
<script setup>
import { useRoute } from 'vue-router';
import VnNotes from 'src/components/ui/VnNotes.vue';
const route = useRoute();
const filter = {
order: 'created DESC',
where: { workerFk: route.params.id },
include: {
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName'],
include: {
relation: 'user',
scope: {
fields: ['id', 'nickname'],
},
},
},
},
};
const body = {
workerFk: route.params.id,
};
</script>
<template>
<VnNotes
style="overflow-y: auto"
:add-note="{ type: Boolean, default: true }"
url="WorkerObservations"
:filter="filter"
:body="body"
/>
</template>

View File

@ -0,0 +1,70 @@
<script setup>
import { watch, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useState } from 'src/composables/useState';
import FormModel from 'src/components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const state = useState();
const route = useRoute();
const workerPBXForm = ref();
const extension = ref(null);
const filter = {
include: [
{
relation: 'sip',
},
],
};
watch(
() => route.params.id,
() => state.set('extension', null)
);
const onFetch = (data) => {
state.set('extension', data?.sip?.extension);
extension.value = state.get('extension');
};
const updateModelValue = (data) => {
state.set('extension', data);
workerPBXForm.value.hasChanges = true;
};
</script>
<template>
<FormModel
ref="workerPBXForm"
:filter="filter"
:url="`Workers/${route.params.id}`"
url-update="Sips"
auto-load
:mapper="
() => ({
userFk: +route.params.id,
extension,
})
"
model="DeviceProductionUser"
@on-fetch="onFetch"
>
<template #form="{}">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<VnInput
:label="t('worker.summary.sipExtension')"
v-model="extension"
@update:model-value="updateModelValue"
/>
</div>
</VnRow>
</template>
</FormModel>
</template>

View File

@ -15,7 +15,7 @@ import { toLowerCamel } from 'src/filters';
const state = useState();
const session = useSession();
const { t } = i18n.global;
const { t, te } = i18n.global;
const createHistory = process.env.SERVER
? createMemoryHistory
@ -90,7 +90,10 @@ export default route(function (/* { store, ssrContext } */) {
if (childPageTitle && matches.length > 2) {
if (title != '') title += ': ';
const pageTitle = t(`${moduleName}.pageTitles.${childPageTitle}`);
const moduleLocale = `${moduleName}.pageTitles.${childPageTitle}`;
const pageTitle = te(moduleLocale)
? t(moduleLocale)
: t(`globals.pageTitles.${childPageTitle}`);
const idParam = to.params && to.params.id;
const idPageTitle = `${idParam} - ${pageTitle}`;
const builtTitle = idParam ? idPageTitle : pageTitle;

View File

@ -22,6 +22,7 @@ export default {
'SupplierAddresses',
'SupplierConsumption',
'SupplierAgencyTerm',
'SupplierDms',
],
},
children: [
@ -161,6 +162,15 @@ export default {
component: () =>
import('src/pages/Supplier/Card/SupplierAgencyTerm.vue'),
},
{
path: 'dms',
name: 'SupplierDms',
meta: {
title: 'dms',
icon: 'smb_share',
},
component: () => import('src/pages/Supplier/Card/SupplierDms.vue'),
},
{
path: 'agency-term/create',
name: 'SupplierAgencyTermCreate',

View File

@ -13,7 +13,8 @@ import Travel from './travel';
import Order from './order';
import Department from './department';
import Entry from './entry';
import roadmap from "./roadmap";
import roadmap from './roadmap';
import Parking from './parking';
export default [
Item,
@ -31,5 +32,6 @@ export default [
invoiceIn,
Department,
Entry,
roadmap
roadmap,
Parking,
];

View File

@ -0,0 +1,54 @@
import { RouterView } from 'vue-router';
export default {
path: '/parking',
name: 'Parking',
meta: {
title: 'parking',
icon: 'garage_home',
moduleName: 'Parking',
},
component: RouterView,
redirect: { name: 'ParkingCard' },
menus: {
main: [],
card: ['ParkingBasicData', 'ParkingLog'],
},
children: [
{
path: '/parking/:id',
name: 'ParkingCard',
component: () => import('src/pages/Parking/Card/ParkingCard.vue'),
redirect: { name: 'ParkingSummary' },
children: [
{
name: 'ParkingSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'view_list',
},
component: () => import('src/pages/Parking/Card/ParkingSummary.vue'),
},
{
name: 'ParkingBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Parking/Card/ParkingBasicData.vue'),
},
{
name: 'ParkingLog',
path: 'log',
meta: {
title: 'log',
icon: 'history',
},
component: () => import('src/pages/Parking/Card/ParkingLog.vue'),
},
],
},
],
};

View File

@ -11,7 +11,7 @@ export default {
component: RouterView,
redirect: { name: 'ShelvingMain' },
menus: {
main: ['ShelvingList'],
main: ['ShelvingList', 'ParkingList'],
card: ['ShelvingBasicData', 'ShelvingLog'],
},
children: [
@ -38,6 +38,21 @@ export default {
},
component: () => import('src/pages/Shelving/Card/ShelvingForm.vue'),
},
{
path: '/parking',
redirect: { name: 'ParkingList' },
children: [
{
path: 'list',
name: 'ParkingList',
meta: {
title: 'parkingList',
icon: 'view_list',
},
component: () => import('src/pages/Parking/ParkingList.vue'),
},
],
},
],
},
{

View File

@ -12,7 +12,14 @@ export default {
redirect: { name: 'WorkerMain' },
menus: {
main: ['WorkerList', 'WorkerDepartment'],
card: ['WorkerNotificationsManager', 'WorkerPda', 'WorkerLog'],
card: [
'WorkerBasicData',
'WorkerNotes',
'WorkerPda',
'WorkerNotificationsManager',
'WorkerPBX',
'WorkerLog',
],
departmentCard: ['BasicData'],
},
children: [
@ -66,6 +73,41 @@ export default {
},
component: () => import('src/pages/Worker/Card/WorkerSummary.vue'),
},
{
path: 'basic-data',
name: 'WorkerBasicData',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Worker/Card/WorkerBasicData.vue'),
},
{
path: 'notes',
name: 'NotesCard',
redirect: { name: 'WorkerNotes' },
children: [
{
path: '',
name: 'WorkerNotes',
meta: {
title: 'notes',
icon: 'vn:notes',
},
component: () =>
import('src/pages/Worker/Card/WorkerNotes.vue'),
},
],
},
{
name: 'WorkerPda',
path: 'pda',
meta: {
title: 'pda',
icon: 'phone_android',
},
component: () => import('src/pages/Worker/Card/WorkerPda.vue'),
},
{
name: 'WorkerNotificationsManager',
path: 'notifications',
@ -77,13 +119,13 @@ export default {
import('src/pages/Worker/Card/WorkerNotificationsManager.vue'),
},
{
name: 'WorkerPda',
path: 'pda',
path: 'pbx',
name: 'WorkerPBX',
meta: {
title: 'pda',
icon: 'phone_android',
title: 'pbx',
icon: 'vn:pbx',
},
component: () => import('src/pages/Worker/Card/WorkerPda.vue'),
component: () => import('src/pages/Worker/Card/WorkerPBX.vue'),
},
{
name: 'WorkerLog',

View File

@ -13,7 +13,8 @@ import department from './modules/department';
import shelving from 'src/router/modules/shelving';
import order from 'src/router/modules/order';
import entry from 'src/router/modules/entry';
import roadmap from "src/router/modules/roadmap";
import roadmap from 'src/router/modules/roadmap';
import parking from 'src/router/modules/parking';
const routes = [
{
@ -69,6 +70,7 @@ const routes = [
department,
roadmap,
entry,
parking,
{
path: '/:catchAll(.*)*',
name: 'NotFound',

View File

@ -0,0 +1,23 @@
/// <reference types="cypress" />
describe('ParkingBasicData', () => {
const codeInput = 'form .q-card .q-input input';
const sectorSelect = 'form .q-card .q-select input';
const sectorOpt = '.q-menu .q-item';
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/parking/1/basic-data`);
});
it('should edit the code and sector', () => {
cy.get(sectorSelect).type('Second');
cy.get(sectorOpt).click();
cy.get(codeInput).eq(0).clear();
cy.get(codeInput).eq(0).type(123);
cy.saveCard();
cy.get(sectorSelect).should('have.value', 'Second sector');
cy.get(codeInput).should('have.value', 123);
});
});

View File

@ -0,0 +1,30 @@
/// <reference types="cypress" />
describe('ParkingList', () => {
const firstCard = '.q-card:nth-child(1)';
const firstChipId =
':nth-child(1) > :nth-child(1) > .justify-between > .flex > .q-chip > .q-chip__content';
const firstDetailBtn =
':nth-child(1) > :nth-child(1) > .card-list-body > .actions > .q-btn';
const summaryHeader = '.summaryBody .header';
beforeEach(() => {
cy.login('developer');
cy.visit(`/#/parking/list`);
cy.closeSideMenu();
});
it('should redirect on clicking a parking', () => {
cy.get(firstChipId)
.invoke('text')
.then((content) => {
const id = content.substring(4);
cy.get(firstCard).click();
cy.url().should('include', `/parking/${id}/summary`);
});
});
it('should open the details', () => {
cy.get(firstDetailBtn).click();
cy.get(summaryHeader).contains('Basic data');
});
});

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" />
describe('Ticket descriptor', () => {
const toCloneOpt = '.q-list > :nth-child(5)';
const warehouseValue = '.summaryBody > :nth-child(2) > :nth-child(6) > .value > span';
const warehouseValue = ':nth-child(1) > :nth-child(6) > .value > span';
const summaryHeader = '.summaryHeader > div';
beforeEach(() => {

View File

@ -1,19 +1,42 @@
/// <reference types="cypress" />
describe('VnSearchBar', () => {
const employeeId = ' #1';
const salesPersonId = ' #18';
const idGap = '.q-item > .q-item__label';
const cardList = '.vn-card-list';
let url;
beforeEach(() => {
cy.login('developer');
cy.visit('/');
cy.visit('#/customer/list');
cy.url().then((currentUrl) => (url = currentUrl));
});
it('should redirect to new customer', () => {
cy.visit('#/customer/1112/basic-data')
cy.openLeftMenu();
cy.get('.q-item > .q-item__label').should('have.text',' #1112')
cy.closeLeftMenu();
it('should redirect to customer summary page', () => {
searchAndCheck('1', employeeId);
searchAndCheck('salesPerson', salesPersonId);
});
it('should stay on the list page if there are several results or none', () => {
cy.writeSearchbar('salesA{enter}');
checkCardListAndUrl(2);
cy.clearSearchbar();
cy.writeSearchbar('1{enter}');
cy.openLeftMenu();
cy.get('.q-item > .q-item__label').should('have.text',' #1')
cy.closeLeftMenu();
cy.writeSearchbar('0{enter}');
checkCardListAndUrl(0);
});
const searchAndCheck = (searchTerm, expectedText) => {
cy.clearSearchbar();
cy.writeSearchbar(`${searchTerm}{enter}`);
cy.get(idGap).should('have.text', expectedText);
};
const checkCardListAndUrl = (expectedLength) => {
cy.get(cardList).then(($cardList) => {
expect($cardList.find('.q-card').length).to.equal(expectedLength);
cy.url().then((currentUrl) => expect(currentUrl).to.equal(url));
});
};
});

View File

@ -52,16 +52,18 @@ Cypress.Commands.add('getValue', (selector) => {
}
// Si es un QSelect
if ($el.find('.q-select__dropdown-icon').length) {
return cy.get(
return cy
.get(
selector +
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input'
).invoke('val')
)
.invoke('val');
}
// Si es un QSelect
if ($el.find('span').length) {
return cy.get(
selector + ' span'
).then(($span) => { return $span[0].innerText })
return cy.get(selector + ' span').then(($span) => {
return $span[0].innerText;
});
}
// Puedes añadir un log o lanzar un error si el elemento no es reconocido
cy.log('Elemento no soportado');
@ -132,13 +134,13 @@ Cypress.Commands.add('validateRow', (rowSelector, expectedValues) => {
cy.get(rowSelector).within(() => {
for (const [index, value] of expectedValues.entries()) {
cy.log('CHECKING ', index, value);
if(value === undefined) continue
if (value === undefined) continue;
if (typeof value == 'boolean') {
const prefix = value ? '' : 'not.';
cy.getValue(`:nth-child(${index + 1})`).should(`${prefix}be.checked`);
continue;
}
cy.getValue(`:nth-child(${index + 1})`).should('equal', value)
cy.getValue(`:nth-child(${index + 1})`).should('equal', value);
}
});
});
@ -174,9 +176,9 @@ Cypress.Commands.add('openLeftMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
});
Cypress.Commands.add('closeLeftMenu', (element) => {
Cypress.Commands.add('closeSideMenu', (element) => {
if (element) cy.waitForElement(element);
cy.get('.fullscreen').click();
cy.get('.fullscreen.q-drawer__backdrop:not(.hidden)').click();
});
Cypress.Commands.add('clearSearchbar', (element) => {

View File

@ -1,11 +1,11 @@
import { vi, describe, expect, it, beforeAll, beforeEach, afterEach } from 'vitest';
import { createWrapper, axios } from 'app/test/vitest/helper';
import { vi, describe, expect, it, beforeAll, afterEach, beforeEach } from 'vitest';
import { createWrapper } from 'app/test/vitest/helper';
import VnSearchbar from 'components/ui/VnSearchbar.vue';
// Probar a importar como plugin vue-router en archivo helper
describe('VnSearchBar', () => {
let vm;
let wrapper;
let pushSpy;
beforeAll(() => {
wrapper = createWrapper(VnSearchbar, {
@ -16,7 +16,7 @@ describe('VnSearchBar', () => {
},
});
vm = wrapper.vm;
vm.route.matched = [
vm.router.currentRoute.value.matched = [
{
path: '/',
},
@ -30,24 +30,33 @@ describe('VnSearchBar', () => {
path: '/customer/:id/basic-data',
},
];
pushSpy = vi.spyOn(vm.router, 'push');
vi.spyOn(vm.arrayData, 'applyFilter');
});
afterEach(() => {
vi.clearAllMocks();
});
beforeEach(() => (vm.store.data = [{ id: 1112, name: 'Trash' }]));
afterEach(() => vi.clearAllMocks());
it('should be defined', async () => {
expect(vm.searchText).toBeDefined();
expect(vm.searchText).toEqual('');
});
it('should redirect', async () => {
vi.spyOn(vm.router,'push');
vm.searchText = '1';
it('should redirect to list page if there are several results', async () => {
vm.store.data.push({ id: 1, name: 'employee' });
await vm.search();
expect(vm.router.push).toHaveBeenCalledWith('/customer/1/basic-data');
vm.searchText = '1112';
expect(vm.searchText).toEqual('1112');
vi.spyOn(vm.router,'push');
expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/list' });
});
it('should redirect to list page if there is no results', async () => {
vm.store.data.pop();
await vm.search();
expect(vm.router.push).toHaveBeenCalledWith('/customer/1112/basic-data');
expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/list' });
});
it('should redirect to basic-data page if there is only one result', async () => {
await vm.search();
expect(pushSpy).toHaveBeenCalledWith({ path: '/customer/1112/basic-data' });
});
});